bibliothek.gui.dock.station.stack.tab.layouting
Class LineTabsLayoutBlock

java.lang.Object
  extended by bibliothek.gui.dock.station.stack.tab.layouting.AbstractTabsLayoutBlock
      extended by bibliothek.gui.dock.station.stack.tab.layouting.LineTabsLayoutBlock
All Implemented Interfaces:
LayoutBlock, TabsLayoutBlock

public class LineTabsLayoutBlock
extends AbstractTabsLayoutBlock

This TabsLayoutBlock orders its tabs in a line.

Author:
Benjamin Sigg

Nested Class Summary
 class LineTabsLayoutBlock.LineSize
          Size information about a line on a LineTabsLayoutBlock.
protected  class LineTabsLayoutBlock.SizeCollector
          Used to calculate the minimum and preferred size of a set of Tabs.
protected  class LineTabsLayoutBlock.ZOrder
          Calculates the z-order of various components requiring only a subset of all comparisons
 
Nested classes/interfaces inherited from class bibliothek.gui.dock.station.stack.tab.layouting.AbstractTabsLayoutBlock
AbstractTabsLayoutBlock.TabsSize
 
Constructor Summary
LineTabsLayoutBlock()
           
 
Method Summary
protected  void checkSelection()
          Creates the tab that should be selected and adds it at an appropriate location.
 void doLayout()
          Updates the layout of this block.
protected  Tab[] getCurrentTabs()
          Gets all the tabs that are currently shown, ordered by z.
 int getIndexOfTabAt(Point mouseLocation)
          Searches the index of the tab beneath mouseLocation.
 LineTabsLayoutBlock.LineSize[] getSizes()
          Creates a map of all sizes for which this block knows how to make an optimal layout.
 Tab[] getTabs(Size size)
          Gets all the tabs that would be shown if size would be applied.
 int getTabsCount(Size size)
          Tells how many tabs could be shown if size would be applied.
 boolean isAllTabs(Size size)
          Tells whether this block would be able to show all tabs if size would be applied.
 boolean isSameSize()
          If set, then all tabs have the same height (width) if laid out horizontal (vertical).
 void setSameSize(boolean sameSize)
          If set, then all tabs have the same height (width) if laid out horizontal (vertical).
 
Methods inherited from class bibliothek.gui.dock.station.stack.tab.layouting.AbstractTabsLayoutBlock
addTab, checkExistence, getBounds, getDockableTabMap, getOrientation, getOriginalTabLocations, getPane, getSelectedTab, getTabs, getTabsCount, getTabsOrderedByImportance, indexOfTab, insertTab, insertTab, isVisible, removeAllTabs, removeTab, removeTab, setBounds, setLayout, setOrientation, setPane
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineTabsLayoutBlock

public LineTabsLayoutBlock()
Method Detail

isSameSize

public boolean isSameSize()
If set, then all tabs have the same height (width) if laid out horizontal (vertical).

Returns:
true if all tabs have the same size

setSameSize

public void setSameSize(boolean sameSize)
If set, then all tabs have the same height (width) if laid out horizontal (vertical).

Parameters:
sameSize - whether all tabs should have the same height.

isAllTabs

public boolean isAllTabs(Size size)
Description copied from interface: TabsLayoutBlock
Tells whether this block would be able to show all tabs if size would be applied.

Parameters:
size - the size that might be applied
Returns:
true if all tabs could be shown

getTabs

public Tab[] getTabs(Size size)
Description copied from interface: TabsLayoutBlock
Gets all the tabs that would be shown if size would be applied.

Parameters:
size - the size that might be applied
Returns:
the tabs that would be shown

getTabsCount

public int getTabsCount(Size size)
Description copied from interface: TabsLayoutBlock
Tells how many tabs could be shown if size would be applied.

Parameters:
size - the size that might be applied
Returns:
the number of tabs that could be shown

checkSelection

protected void checkSelection()
Creates the tab that should be selected and adds it at an appropriate location. Note that the additional tab might lead to a situation where there is not enough space. If a selected tab already exists then this method does nothing.


getSizes

public LineTabsLayoutBlock.LineSize[] getSizes()
Description copied from interface: LayoutBlock
Creates a map of all sizes for which this block knows how to make an optimal layout. If for example this block consists of 12 buttons, then different sizes might lead to a row of 12 blocks, to 2 rows of 6 blocks, to 3 rows of 4 blocks, etc...

Returns:
the map of sizes, may be empty or null

getIndexOfTabAt

public int getIndexOfTabAt(Point mouseLocation)
Description copied from interface: TabsLayoutBlock
Searches the index of the tab beneath mouseLocation.

Parameters:
mouseLocation - the location of the mouse
Returns:
the index of the tab beneath mouseLocation or -1

getCurrentTabs

protected Tab[] getCurrentTabs()
Gets all the tabs that are currently shown, ordered by z.

Returns:
the currently shown tabs

doLayout

public void doLayout()
Description copied from class: AbstractTabsLayoutBlock
Updates the layout of this block. The layout includes the location and size of all the Tabs managed by this block. This method must not add or remove tabs from the block.

Specified by:
doLayout in class AbstractTabsLayoutBlock