bibliothek.gui.dock.station.stack.tab
Class TabComponentLayoutManager

java.lang.Object
  extended by bibliothek.gui.dock.station.stack.tab.TabComponentLayoutManager
All Implemented Interfaces:
LayoutManager

public class TabComponentLayoutManager
extends Object
implements LayoutManager

A LayoutManager that can be used by Components that show an OrientedLabel and a ButtonPanel.

Author:
Benjamin Sigg

Constructor Summary
TabComponentLayoutManager(OrientedLabel label, ButtonPanel panel, TabConfiguration configuration)
          Creates a new layout manager.
 
Method Summary
 void addLayoutComponent(String name, Component comp)
           
 Insets getActionInsets()
          Gets the empty space around the actions.
 ButtonPanel getActions()
          Gets the panels showing the actions
 TabConfiguration getConfiguration()
          Gets the current configuration of the tab
 int getFreeSpaceBetweenLabelAndActions()
          Gets the size of the gap between text/icon and actions.
 int getFreeSpaceToOpenSide()
          Gets the size of the open side.
 int getFreeSpaceToParallelBorder()
          Gets the size of the border at the side of the Dockable
 int getFreeSpaceToSideBorder()
          Gets the size of the free space between the borders that are on the same line as the text/icon and the actions.
 OrientedLabel getLabel()
          Gets the label showing icon and text
 Insets getLabelInsets()
          Gets the empty space around the label.
 TabPlacement getOrientation()
          Gets the current position of the tab in relation to the Dockables.
 void layoutContainer(Container parent)
           
 Dimension minimumLayoutSize(Container parent)
           
 Dimension preferredLayoutSize(Container parent)
           
 void removeLayoutComponent(Component comp)
           
 void setActionInsets(Insets actionInsets)
          Sets the empty space around the actions.
 void setConfiguration(TabConfiguration configuration)
          Changes the look and behavior of the tab.
 void setFreeSpaceBetweenLabelAndActions(int freeSpaceBetweenLabelAndActions)
          Sets the size of the gap that is between the label (icon and text) and the DockActions (if there are any).
 void setFreeSpaceToOpenSide(int freeSpaceToOpenSide)
          Sets the size of the free space between content and the open side.
 void setFreeSpaceToParallelBorder(int freeSpaceToParallelBorder)
          Sets the size of the free space between content and the border at the side of the Dockable.
 void setFreeSpaceToSideBorder(int freeSpaceToSideBorder)
          Sets the size of the free space between the borders that are on the same line as the text/icon and the actions.
 void setLabelInsets(Insets labelInsets)
          Sets the space that should be left empty around the label.
 void setOrientation(TabPlacement orientation)
           
protected  boolean shouldShowActions(Container parent)
          Using the current TabConfiguration, this method decides whether there is enough space to show the actions or not.
protected  boolean shouldShowIcon()
          Tells whether the icon should be shown for the current size of the label.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TabComponentLayoutManager

public TabComponentLayoutManager(OrientedLabel label,
                                 ButtonPanel panel,
                                 TabConfiguration configuration)
Creates a new layout manager.

Parameters:
label - the label shown on the tab
panel - the actions shown on the tab
configuration - the exact look and behavior of the tab
Method Detail

getActions

public ButtonPanel getActions()
Gets the panels showing the actions

Returns:
the actions, not null

getLabel

public OrientedLabel getLabel()
Gets the label showing icon and text

Returns:
the label, not null

getConfiguration

public TabConfiguration getConfiguration()
Gets the current configuration of the tab

Returns:
the configuration, not null

setConfiguration

public void setConfiguration(TabConfiguration configuration)
Changes the look and behavior of the tab.

Parameters:
configuration - the new configuration to use, not null

setFreeSpaceToOpenSide

public void setFreeSpaceToOpenSide(int freeSpaceToOpenSide)
Sets the size of the free space between content and the open side.

Parameters:
freeSpaceToOpenSide - the size

getFreeSpaceToOpenSide

public int getFreeSpaceToOpenSide()
Gets the size of the open side.

Returns:
the size
See Also:
setFreeSpaceToOpenSide(int)

setFreeSpaceBetweenLabelAndActions

public void setFreeSpaceBetweenLabelAndActions(int freeSpaceBetweenLabelAndActions)
Sets the size of the gap that is between the label (icon and text) and the DockActions (if there are any).

Parameters:
freeSpaceBetweenLabelAndActions - the size

getFreeSpaceBetweenLabelAndActions

public int getFreeSpaceBetweenLabelAndActions()
Gets the size of the gap between text/icon and actions.

Returns:
the size
See Also:
setFreeSpaceBetweenLabelAndActions(int)

setFreeSpaceToParallelBorder

public void setFreeSpaceToParallelBorder(int freeSpaceToParallelBorder)
Sets the size of the free space between content and the border at the side of the Dockable.

Parameters:
freeSpaceToParallelBorder - the size

getFreeSpaceToParallelBorder

public int getFreeSpaceToParallelBorder()
Gets the size of the border at the side of the Dockable

Returns:
the size
See Also:
setFreeSpaceToParallelBorder(int)

setFreeSpaceToSideBorder

public void setFreeSpaceToSideBorder(int freeSpaceToSideBorder)
Sets the size of the free space between the borders that are on the same line as the text/icon and the actions.

Parameters:
freeSpaceToSideBorder - the size

getFreeSpaceToSideBorder

public int getFreeSpaceToSideBorder()
Gets the size of the free space between the borders that are on the same line as the text/icon and the actions.

Returns:
the size
See Also:
setFreeSpaceToSideBorder(int)

setLabelInsets

public void setLabelInsets(Insets labelInsets)
Sets the space that should be left empty around the label.

Parameters:
labelInsets - the empty space, not null

getLabelInsets

public Insets getLabelInsets()
Gets the empty space around the label.

Returns:
the empty space

setActionInsets

public void setActionInsets(Insets actionInsets)
Sets the empty space around the actions.

Parameters:
actionInsets - the empty space, not null

getActionInsets

public Insets getActionInsets()
Gets the empty space around the actions.

Returns:
the empty space

setOrientation

public void setOrientation(TabPlacement orientation)

getOrientation

public TabPlacement getOrientation()
Gets the current position of the tab in relation to the Dockables.

Returns:
the location of the tab

addLayoutComponent

public void addLayoutComponent(String name,
                               Component comp)
Specified by:
addLayoutComponent in interface LayoutManager

preferredLayoutSize

public Dimension preferredLayoutSize(Container parent)
Specified by:
preferredLayoutSize in interface LayoutManager

minimumLayoutSize

public Dimension minimumLayoutSize(Container parent)
Specified by:
minimumLayoutSize in interface LayoutManager

layoutContainer

public void layoutContainer(Container parent)
Specified by:
layoutContainer in interface LayoutManager

shouldShowActions

protected boolean shouldShowActions(Container parent)
Using the current TabConfiguration, this method decides whether there is enough space to show the actions or not.

Parameters:
parent - the parent Container of the label and the actions
Returns:
wether the actions should be shown

shouldShowIcon

protected boolean shouldShowIcon()
Tells whether the icon should be shown for the current size of the label.

Returns:
whether to show the icon

removeLayoutComponent

public void removeLayoutComponent(Component comp)
Specified by:
removeLayoutComponent in interface LayoutManager