Package bibliothek.gui.dock.common.menu
Class CPreferenceMenuPiece
java.lang.Object
bibliothek.gui.dock.support.menu.MenuPiece
bibliothek.gui.dock.support.menu.BaseMenuPiece
bibliothek.gui.dock.common.menu.CPreferenceMenuPiece
A menu piece that shows an entry for opening the preferences-dialog. The
Note: clients can use
model to show on the dialog can either be set
explicitly using setModel(PreferenceModel), or else will be read
from CControl.getPreferenceModel().Note: clients can use
setup(CControl) to ensure that the
CControl has a model.- Author:
- Benjamin Sigg
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaction()Opens a dialog with the currentPreferenceModel.voidbind()This method is called if there is a possibility for the user to see this menu.getModel()Gets the model which was explicitly set.voidsetModel(PreferenceModel model) Explicitly sets the model which will be shown on the dialog.static CPreferenceMenuPieceCreates a newCPreferenceMenuPiece.voidunbind()This method is called if the user has no longer any possibility to see this menu.Methods inherited from class bibliothek.gui.dock.support.menu.BaseMenuPiece
add, addSeparator, fill, getItem, getItemCount, insert, insertSeparator, remove, remove, removeAllMethods inherited from class bibliothek.gui.dock.support.menu.MenuPiece
addListener, fireInsert, fireRemove, getMenu, getParent, isBound, items, removeListener, setParent
-
Constructor Details
-
CPreferenceMenuPiece
Creates a new menu piece.- Parameters:
control- the control for which this piece works, notnull
-
-
Method Details
-
setup
Creates a newCPreferenceMenuPiece. Reads the model ofcontrol, ifcontrolhas no model then a newPreferenceModelwill be created and set.- Parameters:
control- the control whose model will be shown- Returns:
- a new menu piece
- See Also:
-
bind
public void bind()Description copied from class:MenuPieceThis 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. -
unbind
public void unbind()Description copied from class:MenuPieceThis 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. -
setModel
Explicitly sets the model which will be shown on the dialog. Ifnullis set, then this menu will try to showCControl.getPreferenceModel().- Parameters:
model- the model to use ornull
-
getModel
Gets the model which was explicitly set.- Returns:
- the model or
null - See Also:
-
action
protected void action()Opens a dialog with the currentPreferenceModel.
-