net.ctdp.rfdynhud.properties
Class ListProperty<E,L extends java.util.Collection<E>>

java.lang.Object
  extended by net.ctdp.rfdynhud.properties.Property
      extended by net.ctdp.rfdynhud.properties.ListProperty<E,L>
Type Parameters:
E - the list element type
L - the list type

public class ListProperty<E,L extends java.util.Collection<E>>
extends Property

The ListProperty serves for customizing a value from a list.

Author:
Marvin Froehlich (CTDP)

Constructor Summary
ListProperty(java.lang.String name, E defaultValue, L list)
           
ListProperty(java.lang.String name, E defaultValue, L list, boolean readonly)
           
ListProperty(java.lang.String name, java.lang.String nameForDisplay, E defaultValue, L list)
           
ListProperty(java.lang.String name, java.lang.String nameForDisplay, E defaultValue, L list, boolean readonly)
           
ListProperty(java.lang.String name, java.lang.String nameForDisplay, E defaultValue, L list, boolean readonly, java.lang.String buttonText)
           
 
Method Summary
 java.lang.String getButton2Text()
           
 java.lang.String getButton2Tooltip()
           
 L getList()
          Gets the data list.
 E getSelectedValue()
          Gets the currently selected element.
 E getValue()
          Gets the current value fo this property.
 void loadValue(PropertyLoader loader, java.lang.String value)
          Loads the value from the configuration file.
protected  void onKeeperSet()
          
protected  void onValueChanged(E oldValue, E newValue)
          Invoked when the value has changed.
 boolean setSelectedValue(E value)
          Sets the new selected value for this property.
protected  boolean setSelectedValue(E value, boolean firstTime)
          Sets the new selected value for this property.
 void setValue(java.lang.Object value)
          Sets the new value for this property.
 
Methods inherited from class net.ctdp.rfdynhud.properties.Property
getButtonText, getButtonTooltip, getDocumentationSource, getEditorType, getKeeper, getName, getNameForDisplay, getValueForConfigurationFile, isMatchingKey, isReadOnly, onButtonClicked, quoteValueInConfigurationFile, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ListProperty

public ListProperty(java.lang.String name,
                    java.lang.String nameForDisplay,
                    E defaultValue,
                    L list,
                    boolean readonly,
                    java.lang.String buttonText)
Parameters:
name - the technical name used internally. See Property.getName().
nameForDisplay - the name displayed in the editor. See Property.getNameForDisplay(). If null is passed, the value of the name parameter is used.
defaultValue - the default value
list - the data list
readonly - read only property?
buttonText - the text for the displayed button in the editor

ListProperty

public ListProperty(java.lang.String name,
                    java.lang.String nameForDisplay,
                    E defaultValue,
                    L list,
                    boolean readonly)
Parameters:
name - the technical name used internally. See Property.getName().
nameForDisplay - the name displayed in the editor. See Property.getNameForDisplay(). If null is passed, the value of the name parameter is used.
defaultValue - the default value
list - the data list
readonly - read only property?

ListProperty

public ListProperty(java.lang.String name,
                    java.lang.String nameForDisplay,
                    E defaultValue,
                    L list)
Parameters:
name - the technical name used internally. See Property.getName().
nameForDisplay - the name displayed in the editor. See Property.getNameForDisplay(). If null is passed, the value of the name parameter is used.
defaultValue - the default value
list - the data list

ListProperty

public ListProperty(java.lang.String name,
                    E defaultValue,
                    L list,
                    boolean readonly)
Parameters:
name - the technical name used internally. See Property.getName(). 'nameForDisplay' is set to the same value.
defaultValue - the default value
list - the data list
readonly - read only property?

ListProperty

public ListProperty(java.lang.String name,
                    E defaultValue,
                    L list)
Parameters:
name - the technical name used internally. See Property.getName(). 'nameForDisplay' is set to the same value.
defaultValue - the default value
list - the data list
Method Detail

getList

public final L getList()
Gets the data list.

Returns:
the data list.

onKeeperSet

protected void onKeeperSet()

Overrides:
onKeeperSet in class Property

onValueChanged

protected void onValueChanged(E oldValue,
                              E newValue)
Invoked when the value has changed.

Parameters:
oldValue - the old value
newValue - the new value

setSelectedValue

protected final boolean setSelectedValue(E value,
                                         boolean firstTime)
Sets the new selected value for this property.

Parameters:
value - the new value
firstTime -
Returns:
changed?

setSelectedValue

public final boolean setSelectedValue(E value)
Sets the new selected value for this property.

Parameters:
value - the new value
Returns:
changed?

getSelectedValue

public final E getSelectedValue()
Gets the currently selected element.

Returns:
the currently selected element.

setValue

public void setValue(java.lang.Object value)
Sets the new value for this property.

Specified by:
setValue in class Property
Parameters:
value - the new value

getValue

public E getValue()
Gets the current value fo this property.

Specified by:
getValue in class Property
Returns:
the current value fo this property.

loadValue

public void loadValue(PropertyLoader loader,
                      java.lang.String value)
Loads the value from the configuration file.

Specified by:
loadValue in class Property
Parameters:
loader - the loader
value - the value to load

getButton2Text

public java.lang.String getButton2Text()

getButton2Tooltip

public java.lang.String getButton2Tooltip()