Package bibliothek.gui.dock.common
Class CLocation
java.lang.Object
bibliothek.gui.dock.common.CLocation
- Direct Known Subclasses:
AbstractStackholdingLocation,CBaseLocation,CExtendedModeLocation,CFlapLocation,CSplitLocation
A class describing the current location of a
Some warnings:
CDockable. CLocations
are combined, and a whole path of CLocations describes an actual location.
Some warnings:
- A
CLocationis 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 aCLocation. For this reason clients are strongly encouraged not to storeCLocations in any kind of collection for later use. - There is no code available for storing
CLocationpersistently. This is deliberate, asCLocations are only good for a momentary snapshot of the location. The framework itself provides facilities to persistently store the location of aDockablefor a long time. You may have a look atCControl.writeXML(java.io.File)andCControl.setMissingStrategy(MissingCDockableStrategy). - While
CLocationandDockablePropertyboth store the location ofCDockableor aDockable, they are not exactly the same thing. ACLocationexpresses the current location of aCDockableindependent from thedockableitself. ADockablePropertyhowever may also store information that is specific to aDockable, namely the placeholder. This means that while everyCLocationcan be converted to aDockableProperty, not everyDockablePropertycan be converted to aCLocationwithout 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 CLocations are to be considered equal if findRoot(), findMode() and
findProperty() return the same value.- Author:
- Benjamin Sigg
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract CLocationaside()Deprecated.static CBaseLocationbase()Creates a new location that tells all children to use the default center.static CBaseLocationbase(CContentArea center) Creates a new location that tells all children to use a station defined oncenter.booleanexpandProperty(DockableProperty property, CLocationExpandStrategy strategy) Tries to create a location that resemblesproperty.final CLocationexpandProperty(DockController controller, DockableProperty property) Tries to create a location that resemblesproperty.static CExternalizedLocationexternal(int x, int y, int width, int height) Creates a new location representing the externalized mode.abstract ExtendedModefindMode()Gets the mode this location represents.Gets a path describing this location in terms of the DockingFrames.abstract DockablePropertyfindProperty(DockableProperty successor) Gets a path describing this location in terms of the DockingFrames.abstract StringfindRoot()Gets the name of the station this location belongs to.abstract CLocationGets the parent location of this location.inthashCode()static CMaximizedLocationCreates a location representing the maximized mode.static CMaximalExternalizedLocationmaximized(int x, int y, int width, int height) Creates a location representing an element that is externalized and maximized.static CMaximizedLocationmaximized(CContentArea area) Creates a location representing the maximized mode onarea.static CMaximizedLocationCreates a location representing the maximized mode onarea.static CMinimizeAreaLocationminimized(CMinimizeArea area) Creates a new location representing a minimize area.static CFlapIndexLocationminimized(CMinimizeArea area, int index) Creates a new location representing a minimize area.static CGridAreaLocationnormalized(CGridArea area) Creates a new location representing a grid area.static CWorkingAreaLocationworking(CWorkingArea area) Creates a new location representing the givenCWorkingArea.
-
Constructor Details
-
CLocation
public CLocation()
-
-
Method Details
-
base
Creates a new location that tells all children to use a station defined oncenter.- Parameters:
center- the base of all new locations, can benull- Returns:
- the representation of
center
-
base
Creates a new location that tells all children to use the default center.- Returns:
- the new base
-
working
Creates a new location representing the givenCWorkingArea.- Parameters:
area- an area- Returns:
- the representation of
area
-
minimized
Creates a new location representing a minimize area.- Parameters:
area- the area to which the location refers- Returns:
- the new location
-
minimized
Creates a new location representing a minimize area.- Parameters:
area- the area to which the location refersindex- the exact location onarea- Returns:
- the new location
-
normalized
Creates a new location representing a grid area.- Parameters:
area- the area that is represented- Returns:
- the new location
-
external
Creates a new location representing the externalized mode.- Parameters:
x- the x-coordinate in pixelsy- the y-coordinate in pixelswidth- the width in pixelsheight- the height in pixels- Returns:
- the new location
-
maximized
Creates a location representing the maximized mode.- Returns:
- the maximized mode
-
maximized
Creates a location representing the maximized mode onarea. It is the clients responsibility to ensure thatareaactually allows maximization.- Parameters:
area- the area on which an element will be maximized- Returns:
- the new maximization location
-
maximized
Creates a location representing the maximized mode onarea. It is the clients responsibility to ensure thatareaactually allows maximization.- Parameters:
area- the area on which an element will be maximized- Returns:
- the new maximization location
-
maximized
Creates a location representing an element that is externalized and maximized. The coordinates are used once theCDockableis no longer maximized.- Parameters:
x- the x-coordinate in pixelsy- the y-coordinate in pixelswidth- the width in pixelsheight- the height in pixels- Returns:
- the new location
-
getParent
Gets the parent location of this location. Some root-locations may never have a parent.- Returns:
- the parent location, can be
null
-
findRoot
Gets the name of the station this location belongs to. This can be the id of anyCStation.- Returns:
- the name of the station or
nullif this location does not have enough information to find the root
-
findMode
Gets the mode this location represents.- Returns:
- the mode or
null
-
findProperty
Gets a path describing this location in terms of the DockingFrames. The method is ignoring any children of this location.- Returns:
- the path to this location or
null
-
findProperty
Gets a path describing this location in terms of the DockingFrames.- Parameters:
successor- the path of the elements above this location ornull- Returns:
- the path to this location or
null, can also besuccessor
-
expandProperty
Tries to create a location that resemblesproperty.- Parameters:
controller- the controller in whose realm this method is called, may be used to load extensionsproperty- some location- Returns:
- a location whose
findProperty()would createpropertyagain, ornullin case thatpropertycan't be used
-
expandProperty
Tries to create a location that resemblesproperty.- Parameters:
property- some locationstrategy- a strategy helping to convert the properties- Returns:
- a location whose
findProperty()would createpropertyagain, ornullin case thatpropertycan't be used
-
aside
Deprecated.Clients should make use ofCDockable.setLocationsAside(CDockable)andCDockable.setLocationsAsideFocused(), because these methods can directly modifyDockStations and insert placeholders when necessary.Returns aCLocationthat describes the location of an element that should be inserted next to this location.- Returns:
- the new location
-
equals
-
hashCode
public int hashCode()
-
CDockable.setLocationsAside(CDockable)andCDockable.setLocationsAsideFocused(), because these methods can directly modifyDockStations and insert placeholders when necessary.