bibliothek.gui.dock.common.menu
Class SingleCDockableListMenuPiece

java.lang.Object
  extended by bibliothek.gui.dock.support.menu.MenuPiece
      extended by bibliothek.gui.dock.support.menu.BaseMenuPiece
          extended by bibliothek.gui.dock.facile.menu.CloseableDockableMenuPiece
              extended by bibliothek.gui.dock.common.menu.SingleCDockableListMenuPiece

public class SingleCDockableListMenuPiece
extends CloseableDockableMenuPiece

A piece of a menu that adds an item for each closeable CDockable that can be found in a CControl. The user can show or hide CDockables by clicking onto these items.
Please note: this menu shows only CDockables that really do exist, if a dockable is loaded lazy, then this menu does not show the element!

Author:
Benjamin Sigg

Nested Class Summary
 
Nested classes/interfaces inherited from class bibliothek.gui.dock.facile.menu.CloseableDockableMenuPiece
CloseableDockableMenuPiece.Item
 
Constructor Summary
SingleCDockableListMenuPiece(CControl control)
          Creates a new piece.
 
Method Summary
 void bind()
          This method is called if there is a possibility for the user to see this menu.
protected  void hide(Dockable dockable)
          Ensures that dockable is not visible.
protected  boolean include(Dockable dockable)
          Tells whether an item should be inserted into the menu for the given dockable or not.
 void setControl(CControl control)
          Exchanges the CControl whose CDockables are observed by this piece.
 void setFrontend(DockFrontend frontend)
          Sets the frontend which will be observed by this piece.
protected  void show(Dockable dockable)
          Ensures that dockable is visible.
 void unbind()
          This method is called if the user has no longer any possibility to see this menu.
 
Methods inherited from class bibliothek.gui.dock.facile.menu.CloseableDockableMenuPiece
check, create, getFrontend, getOrder, insert, reorder, setOrder
 
Methods inherited from class bibliothek.gui.dock.support.menu.BaseMenuPiece
add, addSeparator, fill, getItem, getItemCount, insert, insertSeparator, remove, remove, removeAll
 
Methods inherited from class bibliothek.gui.dock.support.menu.MenuPiece
addListener, fireInsert, fireRemove, getMenu, getParent, isBound, items, removeListener, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleCDockableListMenuPiece

public SingleCDockableListMenuPiece(CControl control)
Creates a new piece.

Parameters:
control - the control to observe for new Dockables, can be null.
Method Detail

setControl

public void setControl(CControl control)
Exchanges the CControl whose CDockables are observed by this piece.

Parameters:
control - the new control to observe, can be null

bind

public void bind()
Description copied from class: MenuPiece
This method is called if there is a possibility for the user to see this menu. The menu should register listeners, update its text etc. to be ready for that event. This method must never be called twice in a row.

Overrides:
bind in class CloseableDockableMenuPiece
See Also:
MenuPiece.unbind()

unbind

public void unbind()
Description copied from class: MenuPiece
This method is called if the user has no longer any possibility to see this menu. The menu should unregister its listeners. This method must never be called twice in a row.

Overrides:
unbind in class CloseableDockableMenuPiece
See Also:
MenuPiece.bind()

setFrontend

public void setFrontend(DockFrontend frontend)
Description copied from class: CloseableDockableMenuPiece
Sets the frontend which will be observed by this piece. Every Dockable that is registered at the frontend will get an item in the menu of this piece.

Overrides:
setFrontend in class CloseableDockableMenuPiece
Parameters:
frontend - the list of Dockables, can be null

show

protected void show(Dockable dockable)
Description copied from class: CloseableDockableMenuPiece
Ensures that dockable is visible.

Overrides:
show in class CloseableDockableMenuPiece
Parameters:
dockable - the element to show

hide

protected void hide(Dockable dockable)
Description copied from class: CloseableDockableMenuPiece
Ensures that dockable is not visible.

Overrides:
hide in class CloseableDockableMenuPiece
Parameters:
dockable - the element to hide

include

protected boolean include(Dockable dockable)
Description copied from class: CloseableDockableMenuPiece
Tells whether an item should be inserted into the menu for the given dockable or not.

Overrides:
include in class CloseableDockableMenuPiece
Parameters:
dockable - the element to check
Returns:
true if there should be an item added to the menu