bibliothek.gui.dock.station.stack.menu
Class ButtonCombinedMenu<B extends Component>

java.lang.Object
  extended by bibliothek.gui.dock.station.stack.tab.AbstractTabPaneComponent
      extended by bibliothek.gui.dock.station.stack.menu.AbstractCombinedMenu
          extended by bibliothek.gui.dock.station.stack.menu.ButtonCombinedMenu<B>
Type Parameters:
B - the button created and used by this menu
All Implemented Interfaces:
CombinedMenu, TabMenu, TabPaneComponent
Direct Known Subclasses:
BubbleTabMenu, EclipseMenu, FlatMenu

public abstract class ButtonCombinedMenu<B extends Component>
extends AbstractCombinedMenu

A CombinedMenu intended to be subclasses. Subclasses build a simple Component which serves as some kind of button, and allow this menu to set the icon, text, etc.. through a BasicButtonModel.

Author:
Benjamin Sigg

Constructor Summary
ButtonCombinedMenu(TabPane pane, CombinedHandler<? super AbstractCombinedMenu> handler)
          Creates a new menu.
 
Method Summary
protected  void backgroundChanged(BackgroundPaint paint)
          Called if the background algorithm has been exchanged.
protected abstract  B createButton(BasicTrigger trigger)
          Creates a new button for this menu.
protected  Component createComponent()
          Creates the button which will always be visible.
protected  void ensureComponent()
          Ensures that AbstractCombinedMenu.createComponent() is called and its result stored.
 B getButton()
          Gets the button that was created by createButton(BasicTrigger).
protected abstract  BasicButtonModel getModel(B button)
          Gets a BasicButtonModel which is used to interact with button, this method may be called many times for the same button.
protected  void selected(Dockable dockable)
          Called if this menu was open, an element was selected and the menu closed.
 void setController(DockController controller)
          Sets the controller in whose realm this menu is used.
 
Methods inherited from class bibliothek.gui.dock.station.stack.menu.AbstractCombinedMenu
addTabMenuListener, closed, getBackground, getComponent, getController, getDockable, getDockableCount, getDockables, getZOrder, insert, isPaneVisible, open, remove, removeTabMenuListener, setEnabled, setIcon, setPaneVisible, setText, setTooltip, setZOrder, tabMenuListeners
 
Methods inherited from class bibliothek.gui.dock.station.stack.tab.AbstractTabPaneComponent
getBounds, getMaximumSize, getMinimumSize, getOrientation, getOverlap, getPreferredSize, getTabParent, setBounds, setOrientation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface bibliothek.gui.dock.station.stack.tab.TabPaneComponent
getBounds, getMaximumSize, getMinimumSize, getOverlap, getPreferredSize, getTabParent, setBounds, setOrientation
 

Constructor Detail

ButtonCombinedMenu

public ButtonCombinedMenu(TabPane pane,
                          CombinedHandler<? super AbstractCombinedMenu> handler)
Creates a new menu.

Parameters:
pane - the owner of this menu
handler - handler for making this menu visible or invisible and change the z order
Method Detail

setController

public void setController(DockController controller)
Description copied from interface: CombinedMenu
Sets the controller in whose realm this menu is used.

Specified by:
setController in interface CombinedMenu
Overrides:
setController in class AbstractCombinedMenu
Parameters:
controller - the realm

backgroundChanged

protected void backgroundChanged(BackgroundPaint paint)
Description copied from class: AbstractCombinedMenu
Called if the background algorithm has been exchanged.

Overrides:
backgroundChanged in class AbstractCombinedMenu
Parameters:
paint - the new background algorithm, can be null

createComponent

protected Component createComponent()
Description copied from class: AbstractCombinedMenu
Creates the button which will always be visible. The user needs to click onto that button in order to show the content of this menu. This method will be called only once and not from a constructor of AbstractCombinedMenu.

Specified by:
createComponent in class AbstractCombinedMenu
Returns:
the new button

getButton

public B getButton()
Gets the button that was created by createButton(BasicTrigger).

Returns:
the button, may be null

createButton

protected abstract B createButton(BasicTrigger trigger)
Creates a new button for this menu. There are no limitations of what a button really is, as long as it is a Component.

Parameters:
trigger - a trigger to call AbstractCombinedMenu.open(), can be ignored.
Returns:
the newly created button

getModel

protected abstract BasicButtonModel getModel(B button)
Gets a BasicButtonModel which is used to interact with button, this method may be called many times for the same button.

Parameters:
button - the button whose model is requested
Returns:
the model, not null

ensureComponent

protected void ensureComponent()
Description copied from class: AbstractCombinedMenu
Ensures that AbstractCombinedMenu.createComponent() is called and its result stored.

Overrides:
ensureComponent in class AbstractCombinedMenu

selected

protected void selected(Dockable dockable)
Description copied from class: AbstractCombinedMenu
Called if this menu was open, an element was selected and the menu closed.

Specified by:
selected in class AbstractCombinedMenu
Parameters:
dockable - the selected element