bibliothek.gui.dock.support.menu
Class BaseMenuPiece

java.lang.Object
  extended by bibliothek.gui.dock.support.menu.MenuPiece
      extended by bibliothek.gui.dock.support.menu.BaseMenuPiece
Direct Known Subclasses:
CloseableDockableMenuPiece, CPreferenceMenuPiece, FreeMenuPiece, FrontendSettingsList, LookAndFeelMenuPiece, PreferenceMenuPiece, ThemeMenuPiece

public class BaseMenuPiece
extends MenuPiece

A very simple piece, subclasses can add or remove items from this piece at any time.

Author:
Benjamin Sigg

Constructor Summary
BaseMenuPiece()
           
 
Method Summary
protected  void add(Component item)
          Adds item at the end of this piece.
protected  void addSeparator()
          Adds a separator at the end of this piece.
 void fill(List<Component> items)
          Inserts all items of this piece into items.
protected  Component getItem(int index)
          Gets the index'th item of this piece.
 int getItemCount()
          Gets the number of items this MenuPiece added to its menu.
protected  void insert(int index, Component item)
          Inserts a new item into the menu.
protected  void insertSeparator(int index)
          Inserts a separator into this piece.
protected  void remove(Component item)
          Removes item from the menu.
protected  void remove(int index)
          Removes the index'th item of this piece.
protected  void removeAll()
          Removes all items of this piece.
 
Methods inherited from class bibliothek.gui.dock.support.menu.MenuPiece
addListener, fireInsert, fireRemove, getMenu, getParent, items, removeListener, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseMenuPiece

public BaseMenuPiece()
Method Detail

fill

public void fill(List<Component> items)
Description copied from class: MenuPiece
Inserts all items of this piece into items.

Specified by:
fill in class MenuPiece
Parameters:
items - the list which has to be filled in the same order as the items will appear on the menu

getItemCount

public int getItemCount()
Description copied from class: MenuPiece
Gets the number of items this MenuPiece added to its menu.

Specified by:
getItemCount in class MenuPiece
Returns:
the number of items

getItem

protected Component getItem(int index)
Gets the index'th item of this piece.

Parameters:
index - the location of the item
Returns:
the item

addSeparator

protected void addSeparator()
Adds a separator at the end of this piece.


insertSeparator

protected void insertSeparator(int index)
Inserts a separator into this piece.

Parameters:
index - the location of the separator

insert

protected void insert(int index,
                      Component item)
Inserts a new item into the menu.

Parameters:
index - the location of the new item, measured in the coordinate space of this piece.
item - the new item.

add

protected void add(Component item)
Adds item at the end of this piece.

Parameters:
item - the item to add.

remove

protected void remove(Component item)
Removes item from the menu.

Parameters:
item - the item to remove

remove

protected void remove(int index)
Removes the index'th item of this piece.

Parameters:
index - the location of the item to remove.

removeAll

protected void removeAll()
Removes all items of this piece.