maspack.properties
Interface PropertyInfo

All Known Implementing Classes:
PropertyDesc

public interface PropertyInfo

Provides property information that is static with respect to a property's exporting class.


Nested Class Summary
static class PropertyInfo.Edit
          Describes conditions under which this property should be interactively edited.
static class PropertyInfo.ExpandState
           
 
Method Summary
 Property createHandle(HasProperties host)
          Creates a handle to the property for a specified host object.
 boolean getAutoWrite()
          Returns true if auto-writing is enabled for this property.
 PropertyMode getDefaultMode()
          Returns the default inheritance mode for the property.
 NumericInterval getDefaultNumericRange()
          Returns a default numeric range for this property, if any.
 java.lang.Object getDefaultValue()
          Returns the default value for the property, or Property.VoidValue if there is not default value.
 java.lang.String getDescription()
          Returns a text description of the property.
 int getDimension()
          Returns the numeric dimension of this property, or -1 if the property is not numeric or does not have a fixed dimension.
 PropertyInfo.Edit getEditing()
          Returns information describing the conditions under which this property should be interactively edited.
 java.lang.Class getHostClass()
          Returns the host class of the property.
 java.lang.String getName()
          Returns the name of the property.
 boolean getNullValueOK()
          Returns true if the property value may be null.
 java.lang.String getPrintFormat()
          Returns a format string used to convert numeric components of the property's value into text.
 java.lang.Class getValueClass()
          Returns the class type for the property's value.
 PropertyInfo.ExpandState getWidgetExpandState()
           
 boolean hasRestrictedRange()
          Returns true if the property has a restricted value range.
 boolean isInheritable()
          Returns true if the property is a inheritable property.
 boolean isReadOnly()
          Returns true if the property is read-only.
 boolean isSharable()
          Returns true if the value of this property is sharable among several hosts.
 java.lang.Object scanValue(ReaderTokenizer rtok)
          Scans a value of the type associated with the property from a ReaderTokenizer.
 boolean valueEqualsDefault(java.lang.Object value)
          Returns true if a specified value equals the default value of the property.
 void writeValue(java.lang.Object value, java.io.PrintWriter pw, NumberFormat fmt)
          Writes a value of the type associated with the property out to a PrintWriter.
 

Method Detail

getName

java.lang.String getName()
Returns the name of the property.

Returns:
property name

isReadOnly

boolean isReadOnly()
Returns true if the property is read-only. A property is read-only if it's value cannot be set using the the Property.set method. getAutoWrite should return false for read-only properties, since it makes no sense to try to save such properties in persistent storage.

Returns:
true if the property is read-only

hasRestrictedRange

boolean hasRestrictedRange()
Returns true if the property has a restricted value range. If the property has a restricted range, the Property.getRange() method can be used to obtain a Range object to determine whether or not a particular value is legal.

Returns:
true if the property has a restricted value range

getNullValueOK

boolean getNullValueOK()
Returns true if the property value may be null.

Returns:
true if the property value may be null

getDescription

java.lang.String getDescription()
Returns a text description of the property. This can be used for generating documentation, GUI tool tips, etc.

Returns:
text description of the property

getPrintFormat

java.lang.String getPrintFormat()
Returns a format string used to convert numeric components of the property's value into text. This string may be null if there is no numeric data associated with the property.

Returns:
numeric format string

getValueClass

java.lang.Class getValueClass()
Returns the class type for the property's value.

Returns:
property value class type

getHostClass

java.lang.Class getHostClass()
Returns the host class of the property.

Returns:
host class of the property

getAutoWrite

boolean getAutoWrite()
Returns true if auto-writing is enabled for this property. Auto-writing means that the property and it's value should be written out by the method PropertyList.writeProps.

Returns:
true if auto-writing is enabled for this property

getEditing

PropertyInfo.Edit getEditing()
Returns information describing the conditions under which this property should be interactively edited.

Returns:
conditions for interactive editing.

getWidgetExpandState

PropertyInfo.ExpandState getWidgetExpandState()

getDefaultValue

java.lang.Object getDefaultValue()
Returns the default value for the property, or Property.VoidValue if there is not default value.

Returns:
property's default value

getDefaultNumericRange

NumericInterval getDefaultNumericRange()
Returns a default numeric range for this property, if any. If there is no default numeric range, null is returned.

If a getRangeMethod is not defined for the property, and the property has a numeric type, then the default numeric range is returned by the property's getRange method. The default numeric range is also used to determine bounds on slider widgets for manipulating the property's value, in case the upper or lower limits returned by the getRange method are unbounded.

Returns:
default numeric range for this property

writeValue

void writeValue(java.lang.Object value,
                java.io.PrintWriter pw,
                NumberFormat fmt)
                throws java.io.IOException
Writes a value of the type associated with the property out to a PrintWriter.

Parameters:
value - value to be written
pw - PrintWriter to which value is written
fmt - Numeric formatting information. This is only used when the value to be writtem is itself Scannable, in which case it is passed to that value's write method.
Throws:
java.io.IOException - if an I/O error occurred, or the value has a type which PropertyInfo does not know about

scanValue

java.lang.Object scanValue(ReaderTokenizer rtok)
                           throws java.io.IOException
Scans a value of the type associated with the property from a ReaderTokenizer.

Parameters:
rtok - ReaderTokenizer supplying input tokens used to specify the property value
Throws:
java.io.IOException - if the input is not in the correct format, an I/O error occurred, or the value has a type which PropertyInfo does not know about

createHandle

Property createHandle(HasProperties host)
Creates a handle to the property for a specified host object. The host must export the property (i.e., it must be an instance of the class returned by getHostClass).

Returns:
property handle
Throws:
java.lang.IllegalArgumentException - if the host does not export the specified property

valueEqualsDefault

boolean valueEqualsDefault(java.lang.Object value)
Returns true if a specified value equals the default value of the property.

Parameters:
value - value to check against the default
Returns:
true if the value equals the default value

isInheritable

boolean isInheritable()
Returns true if the property is a inheritable property.


getDefaultMode

PropertyMode getDefaultMode()
Returns the default inheritance mode for the property. If the property is not inheritable, then this method should return PropertyMode.Explicit.

Returns:
default inheritance mode

getDimension

int getDimension()
Returns the numeric dimension of this property, or -1 if the property is not numeric or does not have a fixed dimension.


isSharable

boolean isSharable()
Returns true if the value of this property is sharable among several hosts. This implies that the host does not maintain an internal copy of the value. Changes to the value itself may therefore effect several hosts.

Returns:
true if the property value can be shared by several hosts