|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openstreetmap.josm.tools.WindowGeometry
public class WindowGeometry
This is a helper class for persisting the geometry of a JOSM window to the preference store and for restoring it from the preference store.
Nested Class Summary | |
---|---|
static class |
WindowGeometry.WindowGeometryException
Exception thrown by the WindowGeometry class if something goes wrong |
Field Summary | |
---|---|
private java.awt.Dimension |
extent
the size |
private java.awt.Point |
topLeft
the top left point |
Constructor Summary | |
---|---|
WindowGeometry(java.awt.Point topLeft,
java.awt.Dimension extent)
|
|
WindowGeometry(java.awt.Rectangle rect)
|
|
WindowGeometry(java.lang.String preferenceKey)
Creates a window geometry from the values kept in the preference store under the key preferenceKey |
|
WindowGeometry(java.lang.String preferenceKey,
WindowGeometry defaultGeometry)
Creates a window geometry from the values kept in the preference store under the key preferenceKey . |
|
WindowGeometry(java.awt.Window window)
Creates a window geometry from the position and the size of a window. |
Method Summary | |
---|---|
void |
applySafe(java.awt.Window window)
Applies this geometry to a window. |
static WindowGeometry |
centerInWindow(java.awt.Component reference,
java.awt.Dimension extent)
Replies a window geometry object for a window with a specific size which is centered relative to the parent window of a reference component. |
static WindowGeometry |
centerOnScreen(java.awt.Dimension extent)
Replies a window geometry object for a window with a specific size which is centered on screen, where main window is |
static WindowGeometry |
centerOnScreen(java.awt.Dimension extent,
java.lang.String preferenceKey)
Replies a window geometry object for a window with a specific size which is centered on screen where the corresponding window is. |
static java.awt.Rectangle |
getFullScreenInfo()
Find the size of the full virtual screen. |
private java.awt.Rectangle |
getRectangle()
|
static java.awt.Rectangle |
getScreenInfo(java.lang.String preferenceKey)
Find the size and position of the screen for given coordinates. |
java.awt.Dimension |
getSize()
Replies the size spezified by the geometry |
java.awt.Point |
getTopLeft()
Replies the top left point for the geometry |
protected void |
initFromPreferences(java.lang.String preferenceKey)
|
protected void |
initFromWindowGeometry(WindowGeometry other)
|
static WindowGeometry |
mainWindow(java.lang.String preferenceKey,
java.lang.String arg,
boolean maximize)
|
protected int |
parseField(java.lang.String preferenceKey,
java.lang.String preferenceValue,
java.lang.String field)
|
void |
remember(java.lang.String preferenceKey)
Remembers a window geometry under a specific preference key |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.awt.Point topLeft
private java.awt.Dimension extent
Constructor Detail |
---|
public WindowGeometry(java.awt.Point topLeft, java.awt.Dimension extent)
topLeft
- the top left pointextent
- the extentpublic WindowGeometry(java.awt.Rectangle rect)
rect
- the positionpublic WindowGeometry(java.awt.Window window)
window
- the windowpublic WindowGeometry(java.lang.String preferenceKey) throws WindowGeometry.WindowGeometryException
preferenceKey
preferenceKey
- the preference key
WindowGeometry.WindowGeometryException
- thrown if no such key exist or if the preference value has
an illegal formatpublic WindowGeometry(java.lang.String preferenceKey, WindowGeometry defaultGeometry)
preferenceKey
. Falls back to the defaultGeometry
if
something goes wrong.
preferenceKey
- the preference keydefaultGeometry
- the default geometryMethod Detail |
---|
public static WindowGeometry centerOnScreen(java.awt.Dimension extent)
extent
- the size
public static WindowGeometry centerOnScreen(java.awt.Dimension extent, java.lang.String preferenceKey)
extent
- the sizepreferenceKey
- the key to get window size and position from, null value format
for whole virtual screen
public static WindowGeometry centerInWindow(java.awt.Component reference, java.awt.Dimension extent)
reference
- the reference component.extent
- the size
protected int parseField(java.lang.String preferenceKey, java.lang.String preferenceValue, java.lang.String field) throws WindowGeometry.WindowGeometryException
WindowGeometry.WindowGeometryException
protected void initFromPreferences(java.lang.String preferenceKey) throws WindowGeometry.WindowGeometryException
WindowGeometry.WindowGeometryException
protected void initFromWindowGeometry(WindowGeometry other)
public static WindowGeometry mainWindow(java.lang.String preferenceKey, java.lang.String arg, boolean maximize)
public void remember(java.lang.String preferenceKey)
preferenceKey
- the preference keypublic java.awt.Point getTopLeft()
public java.awt.Dimension getSize()
private java.awt.Rectangle getRectangle()
public void applySafe(java.awt.Window window)
window
- the windowpublic static java.awt.Rectangle getScreenInfo(java.lang.String preferenceKey)
preferenceKey
- the key to get size and position frompublic static java.awt.Rectangle getFullScreenInfo()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |