|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbibliothek.gui.dock.station.toolbar.layout.ToolbarGridLayoutManager<P>
public abstract class ToolbarGridLayoutManager<P extends bibliothek.gui.dock.station.support.PlaceholderListItem<bibliothek.gui.Dockable>>
This LayoutManager2
orders a set of Component
s in columns. To
decide which component belongs to which column, the contents of a
DockablePlaceholderToolbarGrid
are used.
Nested Class Summary | |
---|---|
protected class |
ToolbarGridLayoutManager.Wrapper
A wrapper around one Component , caches minimal, maximal or
preferred size. |
Constructor Summary | |
---|---|
ToolbarGridLayoutManager(Container parent,
Orientation orientation,
DockablePlaceholderToolbarGrid<P> grid,
ToolbarGroupDockStation station)
Creates a new layout manager. |
Method Summary | |
---|---|
void |
addLayoutComponent(Component comp,
Object constraints)
|
void |
addLayoutComponent(String name,
Component comp)
|
Rectangle |
getBounds(int column)
Gets the boundaries of the column at index column . |
Rectangle |
getBounds(int column,
int line)
Calculates the current boundaries of the cell at column/line
. |
int |
getColumnAt(int location)
Tells which column covers the coordinate location . |
Rectangle |
getGapBounds(int column,
boolean includeScrollBars)
Gets the boundaries of the gab between the column column-1
and column . |
Rectangle |
getGapBounds(int column,
int line)
Gets the size of a gap between two rows. |
int |
getInsertionLineAt(int column,
int location)
Tells where to insert an item during a drag and drop operation, if the mouse is hovering over the column column . |
float |
getLayoutAlignmentX(Container target)
|
float |
getLayoutAlignmentY(Container target)
|
Rectangle |
getScreenBounds(int column)
|
Rectangle |
getScreenBounds(int column,
int line)
|
protected abstract Component |
getScrollbar(int column)
Gets the scrollbars that are currently shown for column . |
protected abstract int |
getScrollbarValue(int column,
int required,
int available)
Gets the current position of the scrollbar for column , this method is at the same time
used to inform the scrollbar about the required and available size. |
void |
invalidateLayout(Container target)
|
boolean |
isColumnAt(int location)
Tells whether there is a column covering location . |
protected ToolbarGridLayoutManager.Wrapper[][] |
layout()
Gets an array of columns, where each column is an array of Component s. |
protected void |
layout(Container parent,
ToolbarGridLayoutManager.Wrapper[][] components,
Dimension required,
Dimension available,
bibliothek.gui.dock.station.toolbar.layout.ToolbarGridLayoutManager.Size size)
Layouts components such that they fit into
available . |
void |
layoutContainer(Container parent)
|
Dimension |
maximumLayoutSize(Container parent)
|
Dimension |
minimumLayoutSize(Container parent)
|
void |
mutate()
Closes all gaps for inserting items. |
void |
mutate(int column)
Opens a gap for inserting an item into column . |
void |
mutate(int column,
int line)
Opens a gap for inserting an item into column at line . |
Dimension |
preferredLayoutSize(Container parent)
|
void |
removeLayoutComponent(Component comp)
|
void |
setController(bibliothek.gui.DockController controller)
Sets the DockController in whose realm this manager works. |
void |
setDividerStrategy(ToolbarGroupDividerStrategy dividers)
Sets the strategy responsible for painting a border between the Dockable s. |
protected abstract void |
setShowScrollbar(int column,
boolean show)
Enables or disables a scrollbar for a column. |
protected abstract Component |
toComponent(P item)
Converts item into a Component , this
LayoutManager will then set the location and size of the
resulting component. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ToolbarGridLayoutManager(Container parent, Orientation orientation, DockablePlaceholderToolbarGrid<P> grid, ToolbarGroupDockStation station)
parent
- the Container
which is going to use this LayoutManager
orientation
- the orientation, must not be null
grid
- the list of items to lay out, must not be null
station
- the station using this layout managerMethod Detail |
---|
public void setController(bibliothek.gui.DockController controller)
DockController
in whose realm this manager works. Allows this manager access to properties
like the SpanFactory
.
controller
- the controller or null
public void setDividerStrategy(ToolbarGroupDividerStrategy dividers)
Dockable
s. The strategy is
required to find the minimum size of the gaps between the items.
dividers
- the new strategy, can be null
public void mutate()
public void mutate(int column)
column
.
column
- the column where an item is insertedpublic void mutate(int column, int line)
column
at line
.
column
- the column into which an item is insertedline
- the location of the new itemprotected abstract Component toComponent(P item)
item
into a Component
, this
LayoutManager
will then set the location and size of the
resulting component.
item
- the item to convert
Component
whose position and size will be setprotected abstract void setShowScrollbar(int column, boolean show)
column
- the column whose settings are updatedshow
- whether to show scrollbars or notprotected abstract int getScrollbarValue(int column, int required, int available)
column
, this method is at the same time
used to inform the scrollbar about the required and available size.
required
- the amount of pixels required to show the columnavailable
- the amount of pixels actually available for showing the column
0
and required - available
protected abstract Component getScrollbar(int column)
column
.
column
- the column whose scrollbars are requested
null
if not presentprotected ToolbarGridLayoutManager.Wrapper[][] layout()
Component
s.
public void addLayoutComponent(String name, Component comp)
addLayoutComponent
in interface LayoutManager
public void removeLayoutComponent(Component comp)
removeLayoutComponent
in interface LayoutManager
public void addLayoutComponent(Component comp, Object constraints)
addLayoutComponent
in interface LayoutManager2
public int getColumnAt(int location)
location
. If the location is between columns, then the
result can be either of these columns.
location
- a point on the axis that is orthogonal to the orientation of the columns
location
or -1 if out of boundsisColumnAt(int)
public boolean isColumnAt(int location)
location
.
location
- a point on the axis that is orthogonal to the orientation of the columns
location
getColumnAt(int)
public int getInsertionLineAt(int column, int location)
column
.
column
- the column over which the mouse is hovering, must be an existing columnlocation
- a point on the axis that is parallel to the orientation of the columns
public Dimension maximumLayoutSize(Container parent)
maximumLayoutSize
in interface LayoutManager2
public Dimension preferredLayoutSize(Container parent)
preferredLayoutSize
in interface LayoutManager
public Dimension minimumLayoutSize(Container parent)
minimumLayoutSize
in interface LayoutManager
public void layoutContainer(Container parent)
layoutContainer
in interface LayoutManager
protected void layout(Container parent, ToolbarGridLayoutManager.Wrapper[][] components, Dimension required, Dimension available, bibliothek.gui.dock.station.toolbar.layout.ToolbarGridLayoutManager.Size size)
components
such that they fit into
available
.
parent
- the Container
whose layout is upatedcomponents
- the components to layoutrequired
- the size required for the optimal layoutavailable
- the size that is actually availablesize
- which Dimension
to get for layouting the componentspublic float getLayoutAlignmentX(Container target)
getLayoutAlignmentX
in interface LayoutManager2
public float getLayoutAlignmentY(Container target)
getLayoutAlignmentY
in interface LayoutManager2
public void invalidateLayout(Container target)
invalidateLayout
in interface LayoutManager2
public Rectangle getBounds(int column, int line)
column/line
.
column
- the column in which to search the cellline
- the row in column
IllegalArgumentException
- if there is no cell at column/line
public Rectangle getScreenBounds(int column, int line)
public Rectangle getBounds(int column)
column
. This
method returns the union of the boundaries of all cells, meaning if there
are gaps between the cells they are included in the boundaries. But
excess space around the cells (e.g. because other columns are bigger) is
ignored by this method.
column
- the column whose boundaries are searched
null
if the column
column
does not have any cells. This however is a
special case that should not appear in a live application and
indicates a bigger issue.
IllegalArgumentException
- if column
is out of boundspublic Rectangle getScreenBounds(int column)
public Rectangle getGapBounds(int column, boolean includeScrollBars)
column-1
and column
. This is the gap of column
to its
left or top neighbor. The gap may have a width or height of
0
, meaning the gap is not visible to the user. If
column
is 0
, then the gap to the left or top
end of the Container
using this LayoutManager
is
returned. If column
is equal to the total number of columns,
the gap to the right or bottom end of the Container
is returned.Container
.
column
- the column whose left gap is searchedincludeScrollBars
- if true
, then the scrollbars are part of the gap as well
null
if one columns has no cells. This
however is a case that should not appear in a live client and
that indicates a bigger issue.
IllegalArgumentException
- if column
is out of boundspublic Rectangle getGapBounds(int column, int line)
column
- the column in which the rows areline
- the row into which an item is inserted
line-1
and line
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |