bibliothek.gui.dock.station.toolbar.group
Class ToolbarGroupSpanStrategy<P extends bibliothek.gui.dock.station.support.PlaceholderListItem<bibliothek.gui.Dockable>>

java.lang.Object
  extended by bibliothek.gui.dock.station.toolbar.group.ToolbarGroupSpanStrategy<P>

public abstract class ToolbarGroupSpanStrategy<P extends bibliothek.gui.dock.station.support.PlaceholderListItem<bibliothek.gui.Dockable>>
extends Object

This class keeps track of the currently used Spans of a ToolbarGroupDockStation. To be exact: the class offers a Span for each gap between columns or lines, and is able to update the size of the spans when knowing the current drag and drop operation.

Author:
Benjamin Sigg

Constructor Summary
ToolbarGroupSpanStrategy(DockablePlaceholderToolbarGrid<P> grid, ToolbarGroupDockStation station)
          Creates a new strategy
 
Method Summary
 int getColumn(int index)
          Gets the size of the gap left of the column index.
 int getLine(int column, int index)
          Gets the size of the gap top of the cell index of column.
protected abstract  void handleResized()
          Called if the size of a Span changed and the station must be resized.
 void mutate(int column)
          Mutates the Spans to present an insertion into column column.
 void mutate(int column, int line)
          Mutates the Spans to present an insertation into column at line.
 void reset(boolean force)
          Tests which columns and cells currently exist, and may create or delete Span if necessary.
 void setController(bibliothek.gui.DockController controller)
          Sets the DockController in whose realm this strategy works, allows to access the current SpanFactory.
 void setDividers(ToolbarGroupDividerStrategy dividers)
          Sets the strategy for painting between the Dockables.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ToolbarGroupSpanStrategy

public ToolbarGroupSpanStrategy(DockablePlaceholderToolbarGrid<P> grid,
                                ToolbarGroupDockStation station)
Creates a new strategy

Parameters:
grid - all the columns and theirs cells
station - the station that is using this strategy
Method Detail

setDividers

public void setDividers(ToolbarGroupDividerStrategy dividers)
Sets the strategy for painting between the Dockables. The strategy is required to find the minimum size of all gaps.

Parameters:
dividers - the new strategy, can be null

handleResized

protected abstract void handleResized()
Called if the size of a Span changed and the station must be resized.


setController

public void setController(bibliothek.gui.DockController controller)
Sets the DockController in whose realm this strategy works, allows to access the current SpanFactory.

Parameters:
controller - the new controller, can be null

reset

public void reset(boolean force)
Tests which columns and cells currently exist, and may create or delete Span if necessary.

Parameters:
force - if true, then the Spans get recreated even if the number of columns and lines did not change

getColumn

public int getColumn(int index)
Gets the size of the gap left of the column index. If there are n columns, index=n will return the size of the right most gap.

Parameters:
index - the index of a column
Returns:
the size of the gap

getLine

public int getLine(int column,
                   int index)
Gets the size of the gap top of the cell index of column. If there are n cells, then index=n will return the size of the bottom most gap.

Parameters:
column - the column in which to search
index - the index of the cell
Returns:
the size of the gap

mutate

public void mutate(int column)
Mutates the Spans to present an insertion into column column.

Parameters:
column - the column where an item is inserted

mutate

public void mutate(int column,
                   int line)
Mutates the Spans to present an insertation into column at line.

Parameters:
column - the column where the insertion is happening
line - the line into which an item is inserted