net.ctdp.rfdynhud.properties
Class Property

java.lang.Object
  extended by net.ctdp.rfdynhud.properties.Property
Direct Known Subclasses:
ArrayProperty, BackgroundProperty, BooleanProperty, BorderProperty, ColorProperty, EnumProperty, FilenameProperty, FloatProperty, FontProperty, IntProperty, ListProperty, PathnameProperty, PosSizeProperty, StringProperty, TimeProperty

public abstract class Property
extends java.lang.Object

The Property serves as a general data container and adapter. You can use it to put data into a GUI component and live update it.

Author:
Marvin Froehlich (CTDP)

Constructor Summary
  Property(java.lang.String name, boolean readonly, PropertyEditorType editorType)
           
  Property(java.lang.String name, boolean readonly, PropertyEditorType editorType, java.lang.String buttonText, java.lang.String buttonTooltip)
           
  Property(java.lang.String name, PropertyEditorType editorType)
           
  Property(java.lang.String name, java.lang.String nameForDisplay, boolean readonly, PropertyEditorType editorType)
           
protected Property(java.lang.String name, java.lang.String nameForDisplay, boolean readonly, PropertyEditorType editorType, java.lang.String buttonText, java.lang.String buttonTooltip)
           
  Property(java.lang.String name, java.lang.String nameForDisplay, PropertyEditorType editorType)
           
 
Method Summary
 java.lang.String getButtonText()
           
 java.lang.String getButtonTooltip()
           
 java.lang.String getDocumentationSource()
          Loads documentation for this Property from a "e;doc"e; folder under the keeper's package.
 PropertyEditorType getEditorType()
          Gets the proeprty editor type.
 PropertiesKeeper getKeeper()
          Gets the owner PropertiesKeeper.
 java.lang.String getName()
          Gets the property's technical name.
 java.lang.String getNameForDisplay()
          Gets the property's name for editor display.
abstract  java.lang.Object getValue()
          Gets the current value fo this property.
 java.lang.Object getValueForConfigurationFile()
          Gets the value prepared for the configuration file.
 boolean isMatchingKey(java.lang.String key)
          Checks whether the given key (from the configuration file) belongs to this Property.
 boolean isReadOnly()
          Is read only property?
abstract  void loadValue(PropertyLoader loader, java.lang.String value)
          Loads the value from the configuration file.
 void onButtonClicked(java.lang.Object button)
           
protected  void onKeeperSet()
           
 java.lang.Boolean quoteValueInConfigurationFile()
          Gets whether to quote this property's value in the config file (default is null, type dependent, numbers won't, others will).
abstract  void setValue(java.lang.Object value)
          Sets the new value for this property.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Property

protected Property(java.lang.String name,
                   java.lang.String nameForDisplay,
                   boolean readonly,
                   PropertyEditorType editorType,
                   java.lang.String buttonText,
                   java.lang.String buttonTooltip)
Parameters:
name - the property name
nameForDisplay - the name for editor display (null to use name)
readonly - read only property?
editorType - the property editor type
buttonText - the text for the button (may be null)
buttonTooltip - the tooltip for the button (ignored when button text is null)

Property

public Property(java.lang.String name,
                java.lang.String nameForDisplay,
                boolean readonly,
                PropertyEditorType editorType)
Parameters:
name - the technical name used internally. See getName().
nameForDisplay - the name displayed in the editor. See getNameForDisplay(). If null is passed, the value of the name parameter is used.
readonly - read only property?
editorType - the property editor type

Property

public Property(java.lang.String name,
                java.lang.String nameForDisplay,
                PropertyEditorType editorType)
Parameters:
name - the technical name used internally. See getName().
nameForDisplay - the name displayed in the editor. See getNameForDisplay(). If null is passed, the value of the name parameter is used.
editorType - the property editor type

Property

public Property(java.lang.String name,
                boolean readonly,
                PropertyEditorType editorType,
                java.lang.String buttonText,
                java.lang.String buttonTooltip)
Parameters:
name - the technical name used internally. See getName().
readonly - read only property?
editorType - the property editor type
buttonText - the text for the button (may be null)
buttonTooltip - the tooltip for the button (ignored when button text is null)

Property

public Property(java.lang.String name,
                boolean readonly,
                PropertyEditorType editorType)
Parameters:
name - the technical name used internally. See getName().
readonly - read only property?
editorType - the property editor type

Property

public Property(java.lang.String name,
                PropertyEditorType editorType)
Parameters:
name - the technical name used internally. See getName().
editorType - the property editor type
Method Detail

onKeeperSet

protected void onKeeperSet()

getKeeper

public final PropertiesKeeper getKeeper()
Gets the owner PropertiesKeeper.

Returns:
the owner PropertiesKeeper.

getName

public final java.lang.String getName()
Gets the property's technical name.

Returns:
the property's technical name.

getNameForDisplay

public java.lang.String getNameForDisplay()
Gets the property's name for editor display.

Returns:
the property's name for editor display.

isReadOnly

public final boolean isReadOnly()
Is read only property?

Returns:
whether this property is read only.

getEditorType

public final PropertyEditorType getEditorType()
Gets the proeprty editor type.

Returns:
the proeprty editor type.

getButtonText

public java.lang.String getButtonText()

getButtonTooltip

public java.lang.String getButtonTooltip()

setValue

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

Parameters:
value - the new value

getValue

public abstract java.lang.Object getValue()
Gets the current value fo this property.

Returns:
the current value fo this property.

onButtonClicked

public void onButtonClicked(java.lang.Object button)
Parameters:
button - the clicked button

quoteValueInConfigurationFile

public java.lang.Boolean quoteValueInConfigurationFile()
Gets whether to quote this property's value in the config file (default is null, type dependent, numbers won't, others will).

Returns:
whether to quote this property's value in the config file.

getValueForConfigurationFile

public java.lang.Object getValueForConfigurationFile()
Gets the value prepared for the configuration file. This can be a String or some other primitive value.

Returns:
the value prepared for the configuration file.

isMatchingKey

public boolean isMatchingKey(java.lang.String key)
Checks whether the given key (from the configuration file) belongs to this Property.

Parameters:
key - the probed property key
Returns:
whether the given key (from the configuration file) belongs to this Property.

loadValue

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

Parameters:
loader - the loader
value - the value to load

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

getDocumentationSource

public java.lang.String getDocumentationSource()
Loads documentation for this Property from a "e;doc"e; folder under the keeper's package.

Returns:
the documentation.