public interface PropertyInfo
Modifier and Type | Interface and Description |
---|---|
static class |
PropertyInfo.Edit
Describes conditions under which this property should be interactively
edited.
|
static class |
PropertyInfo.ExpandState |
Modifier and Type | Method and Description |
---|---|
Property |
createHandle(HasProperties host)
Creates a handle to the property for a specified host object.
|
java.util.List<java.lang.Class<?>> |
getAllowedTypes()
Returns a list of allowed classes that should be used for creating
instances of this property.
|
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.
|
boolean |
isSliderAllowed()
Returns
true if a slider is allowed to be used in
the interactive editing widget created for this property. |
java.lang.Object |
scanInstance(ReaderTokenizer rtok)
For a property whose class type implements
Scannable , attempts to
create and return a class instance based on input from a tokenizer. |
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.
|
boolean |
writeIfNonDefault(HasProperties host,
java.io.PrintWriter pw,
NumberFormat fmt,
java.lang.Object ref) |
void |
writeValue(java.lang.Object value,
java.io.PrintWriter pw,
NumberFormat fmt,
java.lang.Object ref)
Writes a value of the type associated with the property out to a
PrintWriter.
|
java.lang.String getName()
boolean isReadOnly()
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.boolean hasRestrictedRange()
Property.getRange()
method can be used to obtain a Range
object to
determine whether or not a particular value is legal.boolean getNullValueOK()
java.lang.String getDescription()
java.lang.String getPrintFormat()
java.lang.Class getValueClass()
java.lang.Class getHostClass()
boolean getAutoWrite()
PropertyList.writeProps
.PropertyInfo.Edit getEditing()
PropertyInfo.ExpandState getWidgetExpandState()
boolean isSliderAllowed()
true
if a slider is allowed to be used in
the interactive editing widget created for this property. In addition
to this, creation of sliders also require that the property have
a numeric value and a valid range.true
if a slider is allowed in the widgetjava.lang.Object getDefaultValue()
Property.VoidValue
if there is not default value.NumericInterval getDefaultNumericRange()
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.
void writeValue(java.lang.Object value, java.io.PrintWriter pw, NumberFormat fmt, java.lang.Object ref) throws java.io.IOException
value
- value to be writtenpw
- PrintWriter to which value is writtenfmt
- Numeric formatting information. This is only used when the value to be
written is itself Scannable
, in which case
it is passed to that value's write
method.ref
- Reference object. This is only used when the value to be
written is itself Scannable
, in which case
it is passed to that value's write
method.java.io.IOException
- if an I/O error occurred, or the value has a type which PropertyInfo does
not know aboutjava.lang.Object scanValue(ReaderTokenizer rtok) throws java.io.IOException
Since this method temporarily changes the accepted word characters
in order to read a class name, it should not be called if the next
available token might have been pushed back on the token stream using
pushBack()
.
rtok
- ReaderTokenizer supplying input tokens used to specify the property valuejava.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 aboutjava.lang.Object scanInstance(ReaderTokenizer rtok) throws java.io.IOException
Scannable
, attempts to
create and return a class instance based on input from a tokenizer.
"null"
, then no instance is created and null
is
returned. Otherwise, the word is assumed to be the name of a class for
which an instance is created and returned. The class must equal or be a
subclass of the property's value class.
Any returned value instance will need to subsequently scan itself from
the input stream using its scan
method. As
mentioned above, it is assumed the initial token required for this scan
is a '['
.
Since this method temporarily changes the accepted word characters
in order to read a class name, it should not be called if the next
available token might have been pushed back on the token stream using
pushBack()
.
rtok
- ReaderTokenizer supplying input tokensnull
if "null"
appears as the next token.java.io.IOException
- if no class is found for the class name specified in
the input stream, or the class is not equal to, or a subclass of,
the property's value class, or the class cannot be instantiated.Property createHandle(HasProperties host)
getHostClass
).java.lang.IllegalArgumentException
- if the host does not export the specified propertyboolean valueEqualsDefault(java.lang.Object value)
value
- value to check against the defaultboolean isInheritable()
inheritable
property.PropertyMode getDefaultMode()
int getDimension()
boolean isSharable()
java.util.List<java.lang.Class<?>> getAllowedTypes()
getValueClass()
. If there are no restrictions, this
method should return null
. At present, this method is intended as
a hint for use in widgets that manipulate the property value.boolean writeIfNonDefault(HasProperties host, java.io.PrintWriter pw, NumberFormat fmt, java.lang.Object ref) throws java.io.IOException
java.io.IOException