bibliothek.gui.dock.facile.menu
Class ThemeMenuPiece

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.ThemeMenuPiece
Direct Known Subclasses:
CThemeMenuPiece

public class ThemeMenuPiece
extends BaseMenuPiece

A MenuPiece that can change the DockTheme.

Author:
Benjamin Sigg

Constructor Summary
ThemeMenuPiece(DockController controller, boolean defaultThemes)
          Creates a new piece
 
Method Summary
 void add(ThemeFactory factory)
          Adds an item for factory.
 DockController getController()
          Gets the controller whose theme might be changed by this piece.
 ThemeFactory getFactory(int index)
          Gets the index'th factory.
 int getFactoryCount()
          Gets the number of factories that can be selected by the user.
 ThemeFactory getSelected()
          Gets the factory which is currently selected.
 int indexOf(ThemeFactory factory)
          Gets the index of factory.
 void remove(ThemeFactory factory)
          Removes the item of factory.
 void setController(DockController controller)
          Sets the controller whose theme might be changed by this piece.
 void setSelected(ThemeFactory factory)
          Selects the item which represents factory and changes the DockTheme when necessary.
 
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, items, removeListener, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThemeMenuPiece

public ThemeMenuPiece(DockController controller,
                      boolean defaultThemes)
Creates a new piece

Parameters:
controller - the controller whose theme might be changed, can be null
defaultThemes - whether the piece should be filled up with the factories that can be obtained through the DockUI
Method Detail

getController

public DockController getController()
Gets the controller whose theme might be changed by this piece.

Returns:
the controller

setController

public void setController(DockController controller)
Sets the controller whose theme might be changed by this piece. The theme of the controller is changed if there is a selection on this piece.

Parameters:
controller - the new controller, can be null

add

public void add(ThemeFactory factory)
Adds an item for factory.

Parameters:
factory - the factory to be made available

remove

public void remove(ThemeFactory factory)
Removes the item of factory. Please note that the DockTheme created by factory might still be in use.

Parameters:
factory - the factory to remove

setSelected

public void setSelected(ThemeFactory factory)
Selects the item which represents factory and changes the DockTheme when necessary.

Parameters:
factory - the factory to select

getSelected

public ThemeFactory getSelected()
Gets the factory which is currently selected.

Returns:
the factory or null if nothing is selected

getFactoryCount

public int getFactoryCount()
Gets the number of factories that can be selected by the user.

Returns:
the number of factories

getFactory

public ThemeFactory getFactory(int index)
Gets the index'th factory.

Parameters:
index - the index of the factory
Returns:
the factory

indexOf

public int indexOf(ThemeFactory factory)
Gets the index of factory.

Parameters:
factory - the factory to search
Returns:
the index or -1