net.ctdp.rfdynhud.properties
Class FontProperty

java.lang.Object
  extended by net.ctdp.rfdynhud.properties.Property
      extended by net.ctdp.rfdynhud.properties.FontProperty

public class FontProperty
extends Property

The FontProperty serves for customizing a font value.

Author:
Marvin Froehlich (CTDP)

Field Summary
static StringMapping STANDARD_FONT
           
 
Constructor Summary
FontProperty(java.lang.String name, java.lang.String defaultValue)
           
FontProperty(java.lang.String name, java.lang.String defaultValue, boolean readonly)
           
FontProperty(java.lang.String name, java.lang.String nameForDisplay, java.lang.String defaultValue)
           
FontProperty(java.lang.String name, java.lang.String nameForDisplay, java.lang.String defaultValue, boolean readonly)
           
 
Method Summary
static java.lang.String getDefaultNamedFontValue(java.lang.String name)
           
 java.lang.String getDefaultValue()
          Gets the default (initial) value fo this property.
 java.awt.Font getFont()
          Gets the property's current value.
 java.lang.String getFontKey()
          Gets the property's current value.
 java.awt.FontMetrics getMetrics()
          Gets font metrics for the selected font.
 java.lang.String getValue()
          Gets the current value fo this property.
 boolean isAntiAliased()
          Is the currently selected font anti aliased?
 void loadValue(PropertyLoader loader, java.lang.String value)
          Loads the value from the configuration file.
protected  void onKeeperSet()
          
protected  void onValueChanged(java.lang.String oldValue, java.lang.String newValue)
          Invoked when the value has changed.
 void refresh()
          Must be called after font names have changed in the editor.
 boolean setFont(java.awt.Font font, boolean virtual, boolean antiAliased)
          Sets the property's current value.
 boolean setFont(java.lang.String fontKey)
          Sets the property's current value.
protected  boolean setFont(java.lang.String fontKey, boolean firstTime)
          Sets the property's current value.
 boolean setFont(java.lang.String fontName, int style, int size, boolean virtual, boolean antiAliased)
          Sets the property's current value.
 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, hasDefaultValue, isMatchingKey, isReadOnly, onButtonClicked, quoteValueInConfigurationFile, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STANDARD_FONT

public static final StringMapping STANDARD_FONT
Constructor Detail

FontProperty

public FontProperty(java.lang.String name,
                    java.lang.String nameForDisplay,
                    java.lang.String defaultValue,
                    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 -
readonly -

FontProperty

public FontProperty(java.lang.String name,
                    java.lang.String nameForDisplay,
                    java.lang.String defaultValue)
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

FontProperty

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

FontProperty

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

getDefaultValue

public java.lang.String getDefaultValue()
Gets the default (initial) value fo this property.

Specified by:
getDefaultValue in class Property
Returns:
the default value fo this property.

getDefaultNamedFontValue

public static java.lang.String getDefaultNamedFontValue(java.lang.String name)

onKeeperSet

protected void onKeeperSet()

Overrides:
onKeeperSet in class Property

onValueChanged

protected void onValueChanged(java.lang.String oldValue,
                              java.lang.String newValue)
Invoked when the value has changed.

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

refresh

public void refresh()
Must be called after font names have changed in the editor.


setFont

protected final boolean setFont(java.lang.String fontKey,
                                boolean firstTime)
Sets the property's current value.

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

setFont

public final boolean setFont(java.lang.String fontKey)
Sets the property's current value.

Parameters:
fontKey - the new value
Returns:
changed?

setFont

public final boolean setFont(java.awt.Font font,
                             boolean virtual,
                             boolean antiAliased)
Sets the property's current value.

Parameters:
font -
virtual -
antiAliased -
Returns:
changed?

setFont

public final boolean setFont(java.lang.String fontName,
                             int style,
                             int size,
                             boolean virtual,
                             boolean antiAliased)
Sets the property's current value.

Parameters:
fontName -
style -
size -
virtual -
antiAliased -
Returns:
changed?

getFontKey

public final java.lang.String getFontKey()
Gets the property's current value.

Returns:
the property's current value.

getFont

public final java.awt.Font getFont()
Gets the property's current value.

Returns:
the property's current value.

isAntiAliased

public final boolean isAntiAliased()
Is the currently selected font anti aliased?

Returns:
whether the currently selected font anti aliased?

getMetrics

public final java.awt.FontMetrics getMetrics()
Gets font metrics for the selected font.

Returns:
font metrics for the selected font.

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 java.lang.String 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