Package bibliothek.gui.dock.common
Class CGrid
java.lang.Object
bibliothek.gui.dock.common.CGrid
A
Usage:
A
A client first fills a
If the
CGrid is a mechanism to layout a set of CDockable on
a SplitDockStation like the one used in the center of the
CContentArea or on the CWorkingArea. CGrids
also can register new CDockables to a CControl.Usage:
A
CGrid consists of a set of entries where each
entry consists of a set of CDockables and a rectangle
(position= x/y, size=width/height). The rectangle
tells where the CDockables and how big they are compared to the
other entries.A client first fills a
CGrid with such entries. Then the client calls
CGridArea.deploy(CGrid), CWorkingArea.deploy(CGrid) or
toTree(). This triggers the CGrid to convert its entries
into a tree of Dockables. This tree can then be given to a
SplitDockStation. The CGrid can be trashed after it created
the tree - changes to the grid will not be forwarded to the tree.If the
CGrid was created using the constructor CGrid(CControl),
then the method CControl.addDockable(SingleCDockable) or CControl.addDockable(MultipleCDockable)
is called for any new CDockable.- Author:
- Benjamin Sigg
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new set ofCDockables to this grid.voidaddHorizontalDivider(double x1, double x2, double y) Informs this grid about a horizontal divider that should be inserted into the layout.voidAdds some placeholders forMultipleCDockables to thisCGrid.voidaddPlaceholders(double x, double y, double width, double height, Path... placeholders) Adds some placeholders to thisCGrid.voidAdds some placeholders forSingleCDockables to thisCGrid.voidaddVerticalDivider(double x, double y1, double y2) Informs this grid about a vertical divider that should be inserted into the layout.voidMarksdockableas being selected in the stack that has the boundaries ofx, y, width, height.toTree()Creates and returns a tree which contains theCommonDockables of thisCGrid.
-
Constructor Details
-
CGrid
Deprecated.UseCGrid(CControl)with an argument ofnullinstead. This method may be removed in a future release.Creates a new grid. -
CGrid
Creates a new grid. IfCDockables is notnull, then newCDockables will be registered atcontrol. While a value ofnullis valid, for most clients a non-nullvalue will be the better choice. Please note that some methods will not work ifcontrolisnull.- Parameters:
control- the control where this grid should register newCDockables, should not benullfor most clients
-
-
Method Details
-
toTree
Creates and returns a tree which contains theCommonDockables of thisCGrid. The branches of the tree are put in a way, that the boundaries of theCommonDockables are respected as good as possible.- Returns:
- the contents of this grid as tree
-
add
Adds a new set ofCDockables to this grid. TheCDockables are also added to theCControlof thisCGrid.- Parameters:
x- the x-coordinate of the dockablesy- the y-coordinate of the dockableswidth- the width of the dockablesheight- the height of the dockablesdockables- a list ofSingleCDockables andMultipleCDockables.
-
addSingle
Adds some placeholders forSingleCDockables to thisCGrid. This method does not make any checks concerning the validity of the placeholders, the placeholders will however be checked once theCGridis deployed.
This method will assume that theCPlaceholderStrategyis installed and use the methodCPlaceholderStrategy.getSingleDockablePlaceholder(String)
Please note that placeholders are always placed after the real existingCDockables, if order is important then clients must use aCControlPerspectiveto create the layout. to convert the identifiers into placeholders.- Parameters:
x- the x-coordinate of the dockablesy- the y-coordinate of the dockableswidth- the width of the dockablesheight- the height of the dockablesidentifiers- the identifiers that would be returned bySingleCDockable.getUniqueId()- Throws:
IllegalStateException- if thisCGriddoes not have access to the aCControl
-
addMulti
Adds some placeholders forMultipleCDockables to thisCGrid. This method does not make any checks concerning the validity of the placeholders, the placeholders will however be checked once theCGridis deployed.
This method will assume that theCPlaceholderStrategyis installed and use the methodCPlaceholderStrategy.getMultipleDockablePlaceholder(String)to convert the identifiers into placeholders.
Please note that placeholders are always placed after the real existingCDockables, if order is important then clients must use aCControlPerspectiveto create the layout.- Parameters:
x- the x-coordinate of the dockablesy- the y-coordinate of the dockableswidth- the width of the dockablesheight- the height of the dockablesidentifiers- the identifiers that are used when callingCControl.addDockable(String, MultipleCDockable)- Throws:
IllegalStateException- if thisCGriddoes not have access to the aCControl
-
addPlaceholders
Adds some placeholders to thisCGrid. This method does not make any checks concerning the validity of the placeholders, the placeholders will however be checked once theCGridis deployed.
Please note that placeholders are always placed after the real existingCDockables, if order is important then clients must use aCControlPerspectiveto create the layout.- Parameters:
x- the x-coordinate of the dockablesy- the y-coordinate of the dockableswidth- the width of the dockablesheight- the height of the dockablesplaceholders- the list of new placeholders
-
select
Marksdockableas being selected in the stack that has the boundaries ofx, y, width, height.- Parameters:
x- the x coordinate of the stacky- the y coordinate of the stackwidth- the width of the stackheight- the height of the stackdockable- the element to select, notnull- Throws:
IllegalArgumentException- ifdockableis not registered at locationx/y/width/height
-
addHorizontalDivider
public void addHorizontalDivider(double x1, double x2, double y) Informs this grid about a horizontal divider that should be inserted into the layout. There are no guarantees that the divider really is inserted.- Parameters:
x1- the first x coordinate of the dividerx2- the second x coordinate of the dividery- the y coordinate of the divider
-
addVerticalDivider
public void addVerticalDivider(double x, double y1, double y2) Informs this grid about a vertical divider that should be inserted into the layout. There are no guarantees that the divider really is inserted.- Parameters:
x- the x coordinate of the dividery1- the first y coordinate of the dividery2- the second y coordinate of the divider
-
CGrid(CControl)with an argument ofnullinstead.