@ClientOnly public class PlaceholderGrouping extends Object implements DockableGrouping
Dockable is about to be moved to a new position, then this DockableGrouping searches for
a unique identifier, called a "placeholder", which indicates where the Dockable should be placed.placeholder is placed at the location of the Dockable, for which
hierarchyChanged(Dockable) was called last. Basically the placeholder always follows the last Dockable
that was moved around.ExtendedMode there is no more than one placeholder set. Meaning
there is only one location marked for each mode.CControlPerspective, and methods like
CGridPerspective.gridPlaceholder,
to set the initial location of the placeholder.| Constructor and Description |
|---|
PlaceholderGrouping(CControl control,
Path placeholder)
Creates a new grouping.
|
| Modifier and Type | Method and Description |
|---|---|
protected Location |
findLocationFor(Dockable dockable,
CLocationMode mode)
Searches a location for
dockable. |
protected Location |
findLocationFor(Dockable dockable,
CLocationMode mode,
Location validatedHistory)
Called by
getValidatedLocation(Dockable, CLocationMode, Location), this method tries to find a location on the
root station designated by validatedHistory. |
void |
focusGained(Dockable dockable)
Called after
dockable has gained the focus. |
ExtendedMode |
getInitialMode(Dockable dockable)
Tries to find out how to display
dockable initially. |
protected Path |
getLastPlaceholder()
Placeholder that marks the last position where this
PlaceholderGrouping did store something. |
protected DockableProperty |
getLocation(DockStation root)
Searches the ideal location on
root that matches the placeholder. |
Path |
getPlaceholder()
Gets the placeholder that is searched by this
PlaceholderGrouping, and that is placed wherever
a Dockable is moved when hierarchyChanged(Dockable) was called. |
Location |
getStoredLocation(Dockable dockable,
CLocationMode mode,
Location history)
Called right after an old location of
dockable for mode was read. |
Location |
getValidatedLocation(Dockable dockable,
CLocationMode mode,
Location validatedHistory)
Called right before
dockable is moved to a new location. |
void |
hierarchyChanged(Dockable dockable)
Always called after
dockable has changed its location. |
protected void |
markLocation(Dockable dockable)
Makes sure that the placeholder marks the current location of
dockable. |
void |
removePlaceholderEverywhere()
Removes the
last placeholder everywhere. |
public PlaceholderGrouping(CControl control, Path placeholder)
control - The realm in which this object acts, used to access things like the root DockStationsplaceholder - a unique identifier with which the location of a group of Dockables is markedpublic Path getPlaceholder()
PlaceholderGrouping, and that is placed wherever
a Dockable is moved when hierarchyChanged(Dockable) was called.nullprotected Path getLastPlaceholder()
PlaceholderGrouping did store something. The default implementation
always returns placeholder + "last", but subclasses may change the behavior.public Location getStoredLocation(Dockable dockable, CLocationMode mode, Location history)
DockableGroupingdockable for mode was read. The method
may change the location of dockable by returning a new Location object.DockableGrouping.getValidatedLocation(Dockable, CLocationMode, Location) will be called
before dockable actually is moved to a new location.getStoredLocation in interface DockableGroupingdockable - the dockable whose location is about to be changedmode - the target mode for dockablehistory - the old location of dockable, may be nullhistory, or a newly created location. Also null is valid result.
This method is allowed to return an invalid location, invalid locations however will be replaced with valid location.public Location getValidatedLocation(Dockable dockable, CLocationMode mode, Location validatedHistory)
DockableGroupingdockable is moved to a new location.getValidatedLocation in interface DockableGroupingdockable - the Dockable whose location is about to be changedmode - the target mode for dockablevalidatedHistory - a validated location. This may be the result of DockableGrouping.getStoredLocation(Dockable, CLocationMode, Location)
if that result already was a valid location, or it may be a new location, may be nullvalidatedHistory, or a newly created location. Also null is a valid result.
This method should return only valid locations, invalid locations will lead the framework to place the dockable at some
default locationpublic ExtendedMode getInitialMode(Dockable dockable)
DockableGroupingdockable initially.getInitialMode in interface DockableGroupingdockable - an invisible dockable that is about to be made visible, and that does not have a location defined.dockable, or nullprotected Location findLocationFor(Dockable dockable, CLocationMode mode)
dockable.dockable - the element whose new location is searchedmode - the target mode of dockablenull if no location can be calculatedprotected Location findLocationFor(Dockable dockable, CLocationMode mode, Location validatedHistory)
getValidatedLocation(Dockable, CLocationMode, Location), this method tries to find a location on the
root station designated by validatedHistory.dockable - the element whose new location is searchedmode - the target mode of dockablevalidatedHistory - the location where the unmodified algorithm would place dockablevalidatedHistory, or validatedHistory. Should not return null.protected DockableProperty getLocation(DockStation root)
root that matches the placeholder.root - the station on which to search the placeholderthe placeholder, or null if the placeholder was not foundpublic void hierarchyChanged(Dockable dockable)
DockableGroupingdockable has changed its location. This method will be called for any Dockable that
changed its location, even if DockableGrouping.getStoredLocation(Dockable, CLocationMode, Location) or DockableGrouping.getValidatedLocation(Dockable, CLocationMode, Location)
was never called.DockHierarchyListener would have been added to dockablehierarchyChanged in interface DockableGroupingdockable - a Dockable that has a new placepublic void focusGained(Dockable dockable)
DockableGroupingdockable has gained the focus.focusGained in interface DockableGroupingdockable - the element that just gained the focusprotected void markLocation(Dockable dockable)
dockable.dockable - defines the location to markpublic void removePlaceholderEverywhere()
last placeholder everywhere.Copyright © 2018. All rights reserved.