public class CPreferenceMenuPiece extends BaseMenuPiece
model
to show on the dialog can either be set
explicitly using setModel(PreferenceModel)
, or else will be read
from CControl.getPreferenceModel()
.setup(CControl)
to ensure that the
CControl
has a model.Constructor and Description |
---|
CPreferenceMenuPiece(CControl control)
Creates a new menu piece.
|
Modifier and Type | Method and Description |
---|---|
protected void |
action()
Opens a dialog with the current
PreferenceModel . |
void |
bind()
This method is called if there is a possibility for the user to see this menu.
|
PreferenceModel |
getModel()
Gets the model which was explicitly set.
|
void |
setModel(PreferenceModel model)
Explicitly sets the model which will be shown on the dialog.
|
static CPreferenceMenuPiece |
setup(CControl control)
Creates a new
CPreferenceMenuPiece . |
void |
unbind()
This method is called if the user has no longer any possibility to see this menu.
|
add, addSeparator, fill, getItem, getItemCount, insert, insertSeparator, remove, remove, removeAll
addListener, fireInsert, fireRemove, getMenu, getParent, isBound, items, removeListener, setParent
public CPreferenceMenuPiece(CControl control)
control
- the control for which this piece works, not null
public static CPreferenceMenuPiece setup(CControl control)
CPreferenceMenuPiece
. Reads the model of control
,
if control
has no model then a new PreferenceModel
will
be created and set.control
- the control whose model will be shownCControl.getPreferenceModel()
,
CControl.setPreferenceModel(PreferenceModel)
public void bind()
MenuPiece
bind
in class MenuPiece
MenuPiece.unbind()
public void unbind()
MenuPiece
unbind
in class MenuPiece
MenuPiece.bind()
public void setModel(PreferenceModel model)
null
is set, then this menu will try to show
CControl.getPreferenceModel()
.model
- the model to use or null
public PreferenceModel getModel()
null
setModel(PreferenceModel)
protected void action()
PreferenceModel
.