public abstract class CLocation extends Object
CDockable
. CLocation
s
are combined, and a whole path of CLocation
s describes an actual location.
CLocation
is a very short living object: it does not have any ties to the
actual layout of the application. Meaning that any change in the layout may invalidate a CLocation
. For
this reason clients are strongly encouraged not to store CLocation
s in any kind of collection for later use.CLocation
persistently. This is deliberate, as CLocation
s
are only good for a momentary snapshot of the location. The framework itself provides facilities to persistently store
the location of a Dockable
for a long time. You may have a look at CControl.writeXML(java.io.File)
and
CControl.setMissingStrategy(MissingCDockableStrategy)
.CLocation
and DockableProperty
both store the location of CDockable
or
a Dockable
, they are not exactly the same thing. A CLocation
expresses the current location of a
CDockable
independent from the dockable
itself. A DockableProperty
however may also
store information that is specific to a Dockable
, namely the placeholder. This means that while every
CLocation
can be converted to a DockableProperty
, not every DockableProperty
can be
converted to a CLocation
without loosing some information.// an externalized element CLocation location = CLocation.external( 20, 20, 400, 300 ); // a minimized element at the left side of the default panel CLocation location = CLocation.base().minimalWest(); // an element in the lower right corner on a stack (tapped pane): CLocation location = CLocation.base().normalSouth( 0.5 ).east( 0.5 ).stack( 2 ); // an element in the middle on a specific CContentArea CContentArea area = ... CLocation location = CLocation.base( area ).normalRectangle( 0.25, 0.25, 0.5, 0.5 );Two
CLocation
s are to be considered equal if findRoot()
, findMode()
and
findProperty()
return the same value.Type | Property and Description |
---|---|
DockableProperty |
find
Gets a path describing this location in terms of the
DockingFrames.
|
Constructor and Description |
---|
CLocation() |
Modifier and Type | Method and Description |
---|---|
abstract CLocation |
aside()
Deprecated.
Clients should make use of
CDockable.setLocationsAside(CDockable) and
CDockable.setLocationsAsideFocused() , because these methods can directly modify DockStation s
and insert placeholders when necessary. |
static CBaseLocation |
base()
Creates a new location that tells all children to use the default
center.
|
static CBaseLocation |
base(CContentArea center)
Creates a new location that tells all children to use a station
defined on
center . |
boolean |
equals(Object obj) |
CLocation |
expandProperty(DockableProperty property,
CLocationExpandStrategy strategy)
Tries to create a location that resembles
property . |
CLocation |
expandProperty(DockController controller,
DockableProperty property)
Tries to create a location that resembles
property . |
static CExternalizedLocation |
external(int x,
int y,
int width,
int height)
Creates a new location representing the externalized mode.
|
abstract ExtendedMode |
findMode()
Gets the mode this location represents.
|
DockableProperty |
findProperty()
Gets a path describing this location in terms of the
DockingFrames.
|
abstract DockableProperty |
findProperty(DockableProperty successor)
Gets a path describing this location in terms of the
DockingFrames.
|
abstract String |
findRoot()
Gets the name of the station this location belongs to.
|
abstract CLocation |
getParent()
Gets the parent location of this location.
|
int |
hashCode() |
static CMaximizedLocation |
maximized()
Creates a location representing the maximized mode.
|
static CMaximizedLocation |
maximized(CContentArea area)
Creates a location representing the maximized mode on
area . |
static CMaximizedLocation |
maximized(CGridArea area)
Creates a location representing the maximized mode on
area . |
static CMaximalExternalizedLocation |
maximized(int x,
int y,
int width,
int height)
Creates a location representing an element that is externalized and maximized.
|
static CMinimizeAreaLocation |
minimized(CMinimizeArea area)
Creates a new location representing a minimize area.
|
static CFlapIndexLocation |
minimized(CMinimizeArea area,
int index)
Creates a new location representing a minimize area.
|
static CGridAreaLocation |
normalized(CGridArea area)
Creates a new location representing a grid area.
|
static CWorkingAreaLocation |
working(CWorkingArea area)
Creates a new location representing the given
CWorkingArea . |
public DockableProperty findProperty
public static CBaseLocation base(CContentArea center)
center
.center
- the base of all new locations, can be null
center
public static CBaseLocation base()
public static CWorkingAreaLocation working(CWorkingArea area)
CWorkingArea
.area
- an areaarea
public static CMinimizeAreaLocation minimized(CMinimizeArea area)
area
- the area to which the location referspublic static CFlapIndexLocation minimized(CMinimizeArea area, int index)
area
- the area to which the location refersindex
- the exact location on area
public static CGridAreaLocation normalized(CGridArea area)
area
- the area that is representedpublic static CExternalizedLocation external(int x, int y, int width, int height)
x
- the x-coordinate in pixelsy
- the y-coordinate in pixelswidth
- the width in pixelsheight
- the height in pixelspublic static CMaximizedLocation maximized()
public static CMaximizedLocation maximized(CGridArea area)
area
. It is the clients
responsibility to ensure that area
actually allows maximization.area
- the area on which an element will be maximizedpublic static CMaximizedLocation maximized(CContentArea area)
area
. It is the clients
responsibility to ensure that area
actually allows maximization.area
- the area on which an element will be maximizedpublic static CMaximalExternalizedLocation maximized(int x, int y, int width, int height)
CDockable
is no longer maximized.x
- the x-coordinate in pixelsy
- the y-coordinate in pixelswidth
- the width in pixelsheight
- the height in pixelspublic abstract CLocation getParent()
null
public abstract String findRoot()
CStation
.null
if this location
does not have enough information to find the rootpublic abstract ExtendedMode findMode()
null
public DockableProperty findProperty()
public abstract DockableProperty findProperty(DockableProperty successor)
successor
- the path of the elements above this location or null
null
, can also be successor
public final CLocation expandProperty(DockController controller, DockableProperty property)
property
.controller
- the controller in whose realm this method is called, may be used to load
extensionsproperty
- some locationfindProperty()
would create
property
again, or null
in case that property
can't be usedpublic CLocation expandProperty(DockableProperty property, CLocationExpandStrategy strategy)
property
.property
- some locationstrategy
- a strategy helping to convert the propertiesfindProperty()
would create
property
again, or null
in case that property
can't be used@Deprecated public abstract CLocation aside()
CDockable.setLocationsAside(CDockable)
and
CDockable.setLocationsAsideFocused()
, because these methods can directly modify DockStation
s
and insert placeholders when necessary.CLocation
that describes the location of an element
that should be inserted next to this location.