public class ButtonContentPreferenceModel extends AbstractPreferenceModel
PreferenceModel
allows the user to set up a ButtonContent
using the static
conditions that are defined in ButtonContent
.Constructor and Description |
---|
ButtonContentPreferenceModel(DockController controller)
Creates a new model
|
Modifier and Type | Method and Description |
---|---|
void |
addPreferenceModelListener(PreferenceModelListener listener)
Adds a listener to this model.
|
ButtonContent |
getContent()
Gets the currently selected
ButtonContent . |
String |
getLabel(int index)
Gets a short label that can be presented to the user for the
index 'th object. |
Path |
getPath(int index)
Gets the unique identifier of the
index 'th preference of
this model. |
int |
getSize()
Gets the number of preferences stored in this model.
|
Path |
getTypePath(int index)
Tells what kind of type the
index 'th value is. |
Object |
getValue(int index)
Gets the
index 'th preference. |
Object |
getValueInfo(int index)
Gets information about how the
index 'th value can
be modified. |
void |
read()
Uses an unknown source to update this model and load all the preferences
that are currently available.
|
void |
removePreferenceModelListener(PreferenceModelListener listener)
Removes a listener from this model.
|
void |
setContent(ButtonContent content)
Sets the property that should be shown.
|
void |
setValue(int index,
Object value)
Sets the value of the
index 'th preference. |
void |
write()
Writes the current preferences to the location where they are used.
|
doOperation, firePreferenceAdded, firePreferenceChanged, firePreferenceRemoved, getController, getDescription, getOperations, hasListeners, isEnabled, isNatural, listeners, setValueNatural
public ButtonContentPreferenceModel(DockController controller)
controller
- the controller in whose realm this model workspublic void addPreferenceModelListener(PreferenceModelListener listener)
PreferenceModel
addPreferenceModelListener
in interface PreferenceModel
addPreferenceModelListener
in class AbstractPreferenceModel
listener
- the new listenerpublic void removePreferenceModelListener(PreferenceModelListener listener)
PreferenceModel
removePreferenceModelListener
in interface PreferenceModel
removePreferenceModelListener
in class AbstractPreferenceModel
listener
- the listener to remove.public void write()
PreferenceModel
write
in interface PreferenceModel
write
in class AbstractPreferenceModel
public void read()
PreferenceModel
read
in interface PreferenceModel
read
in class AbstractPreferenceModel
public ButtonContent getContent()
ButtonContent
.null
public void setContent(ButtonContent content)
content
- the property, can be null
public String getLabel(int index)
PreferenceModel
index
'th object.index
- the number the preferencepublic Path getPath(int index)
PreferenceModel
index
'th preference of
this model.index
- the index of the preferencepublic int getSize()
PreferenceModel
public Path getTypePath(int index)
PreferenceModel
index
'th value is. The type
is represented as a path. Most times the path would equal the name of
some class. Note: there is a set of standard paths defined in Path
.index
- the number of the valuepublic Object getValue(int index)
PreferenceModel
index
'th preference. The type path
determines how the value is to be presented on the screen.index
- the number of the preferencenull
, has to be immutablepublic Object getValueInfo(int index)
PreferenceModel
index
'th value can
be modified. For an integer that might be its upper and lower boundaries.
The type of this objects depends on PreferenceModel.getTypePath(int)
.index
- the index of the infonull
if no information is
availablepublic void setValue(int index, Object value)
PreferenceModel
index
'th preference.index
- the number of the preferencevalue
- the new value, may be null