public class DimensionService extends SimpleModificationTracker implements PersistentStateComponent<Element>
EVER_CHANGED, NEVER_CHANGED
Constructor and Description |
---|
DimensionService() |
Modifier and Type | Method and Description |
---|---|
static DimensionService |
getInstance() |
java.awt.Point |
getLocation(java.lang.String key) |
java.awt.Point |
getLocation(java.lang.String key,
Project project) |
java.awt.Dimension |
getSize(java.lang.String key) |
java.awt.Dimension |
getSize(java.lang.String key,
Project project) |
Element |
getState() |
void |
loadState(Element element)
This method is called when new component state is loaded.
|
void |
setLocation(java.lang.String key,
java.awt.Point point)
Store specified
point under the key . |
void |
setLocation(java.lang.String key,
java.awt.Point point,
Project project) |
void |
setSize(java.lang.String key,
java.awt.Dimension size)
Store specified
size under the key . |
void |
setSize(java.lang.String key,
java.awt.Dimension size,
Project project) |
getModificationCount, incModificationCount
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initializeComponent, noStateLoaded
public static DimensionService getInstance()
public java.awt.Point getLocation(java.lang.String key)
key
- a String key to perform a query for.key
. The method returns
null
if there is no stored value under the key
. If point
is outside of current screen bounds then the method returns null
. It
properly works in multi-monitor configuration.java.lang.IllegalArgumentException
- if key
is null
.public java.awt.Point getLocation(java.lang.String key, Project project)
public void setLocation(java.lang.String key, java.awt.Point point)
point
under the key
. If point
is
null
then the value stored under key
will be removed.key
- a String key to store location for.point
- location to save.java.lang.IllegalArgumentException
- if key
is null
.public void setLocation(java.lang.String key, java.awt.Point point, Project project)
public java.awt.Dimension getSize(java.lang.String key)
key
- a String key to perform a query for.key
. The method returns
null
if there is no stored value under the key
.java.lang.IllegalArgumentException
- if key
is null
.public java.awt.Dimension getSize(java.lang.String key, Project project)
public void setSize(java.lang.String key, java.awt.Dimension size)
size
under the key
. If size
is
null
then the value stored under key
will be removed.key
- a String key to to save size for.size
- a Size to save.java.lang.IllegalArgumentException
- if key
is null
.public void setSize(java.lang.String key, java.awt.Dimension size, Project project)
public Element getState()
getState
in interface PersistentStateComponent<Element>
null
value indicates
that the returned state won't be stored, as a result previously stored state will be used.XmlSerializer
public void loadState(Element element)
PersistentStateComponent
State object should be used directly, defensive copying is not required.
loadState
in interface PersistentStateComponent<Element>
element
- loaded component stateXmlSerializerUtil.copyBean(Object, Object)