bibliothek.extension.gui.dock.preference.model
Class ButtonContentPreferenceModel

java.lang.Object
  extended by bibliothek.extension.gui.dock.preference.AbstractPreferenceModel
      extended by bibliothek.extension.gui.dock.preference.model.ButtonContentPreferenceModel
All Implemented Interfaces:
PreferenceModel

public class ButtonContentPreferenceModel
extends AbstractPreferenceModel

This PreferenceModel allows the user to set up a ButtonContent using the static conditions that are defined in ButtonContent.

Author:
Benjamin Sigg

Constructor Summary
ButtonContentPreferenceModel(DockController controller)
          Creates a new model
 
Method Summary
 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.
 
Methods inherited from class bibliothek.extension.gui.dock.preference.AbstractPreferenceModel
doOperation, firePreferenceAdded, firePreferenceChanged, firePreferenceRemoved, getController, getDescription, getOperations, hasListeners, isEnabled, isNatural, listeners, setValueNatural
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ButtonContentPreferenceModel

public ButtonContentPreferenceModel(DockController controller)
Creates a new model

Parameters:
controller - the controller in whose realm this model works
Method Detail

addPreferenceModelListener

public void addPreferenceModelListener(PreferenceModelListener listener)
Description copied from interface: PreferenceModel
Adds a listener to this model.

Specified by:
addPreferenceModelListener in interface PreferenceModel
Overrides:
addPreferenceModelListener in class AbstractPreferenceModel
Parameters:
listener - the new listener

removePreferenceModelListener

public void removePreferenceModelListener(PreferenceModelListener listener)
Description copied from interface: PreferenceModel
Removes a listener from this model.

Specified by:
removePreferenceModelListener in interface PreferenceModel
Overrides:
removePreferenceModelListener in class AbstractPreferenceModel
Parameters:
listener - the listener to remove.

write

public void write()
Description copied from interface: PreferenceModel
Writes the current preferences to the location where they are used.

Specified by:
write in interface PreferenceModel
Overrides:
write in class AbstractPreferenceModel

read

public void read()
Description copied from interface: PreferenceModel
Uses an unknown source to update this model and load all the preferences that are currently available. If the underlying resource cannot be read, or returns invalid data, then this model should not change its content.

Specified by:
read in interface PreferenceModel
Overrides:
read in class AbstractPreferenceModel

getContent

public ButtonContent getContent()
Gets the currently selected ButtonContent.

Returns:
the current content, not null

setContent

public void setContent(ButtonContent content)
Sets the property that should be shown.

Parameters:
content - the property, can be null

getLabel

public String getLabel(int index)
Description copied from interface: PreferenceModel
Gets a short label that can be presented to the user for the index'th object.

Parameters:
index - the number the preference
Returns:
a short human readable description

getPath

public Path getPath(int index)
Description copied from interface: PreferenceModel
Gets the unique identifier of the index'th preference of this model.

Parameters:
index - the index of the preference
Returns:
the unique path, compared to the other paths of this model

getSize

public int getSize()
Description copied from interface: PreferenceModel
Gets the number of preferences stored in this model.

Returns:
the number of preferences

getTypePath

public Path getTypePath(int index)
Description copied from interface: PreferenceModel
Tells what kind of type the 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.

Parameters:
index - the number of the value
Returns:
a unique path for the type of this value

getValue

public Object getValue(int index)
Description copied from interface: PreferenceModel
Gets the index'th preference. The type path determines how the value is to be presented on the screen.

Parameters:
index - the number of the preference
Returns:
the value or maybe null, has to be immutable

getValueInfo

public Object getValueInfo(int index)
Description copied from interface: PreferenceModel
Gets information about how the 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).

Parameters:
index - the index of the info
Returns:
the information or null if no information is available

setValue

public void setValue(int index,
                     Object value)
Description copied from interface: PreferenceModel
Sets the value of the index'th preference.

Parameters:
index - the number of the preference
value - the new value, may be null