|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.gui.swing.customattribute.FormatAttribute
The FormatAttribute class represents an Attribute encapsulating
a Format instance. Use this Attribute implementation whenever you need Format
instances as Attribute.
| Field Summary | |
static int |
FONT
Identifier for the four available Format types. |
static java.lang.String |
FONT_GENERATOR
String identifier for the generators. |
static int |
MARKER
Identifier for the four available Format types. |
static java.lang.String |
MARKER_GENERATOR
String identifier for the generators. |
static int |
PAINT
Identifier for the four available Format types. |
static java.lang.String |
PAINT_GENERATOR
String identifier for the generators. |
static int |
STROKE
Identifier for the four available Format types. |
static java.lang.String |
STROKE_GENERATOR
String identifier for the generators. |
| Constructor Summary | |
FormatAttribute(int type)
Creates a new FormatAttribute based on the given type.
|
|
FormatAttribute(java.lang.String name,
int type)
Creates a new FormatAttribute based on the given type. |
|
| Method Summary | |
java.lang.Object |
clone()
Clones this attribute. |
java.lang.Object |
cloneValue()
Clones this attribute's value. |
Constraint |
getConstraint()
Returns the root of the constraint tree. |
CustomAttributeEditor |
getEditor()
Method getEditor returns an instance of a
CustomAttributeEditor which the
AttributeTree will use to allow users to edit this
attribute. |
static int |
getFormatType(Format format)
Utility method to dynamically identify the proper type identifier for a given Format instance. |
java.lang.String |
getGeneratorKey()
Returns a proper Generatorkey depending on the current value type. |
java.lang.String |
getName()
Returns the Attribute name. |
CustomAttributeRenderer |
getRenderer()
Returns an instance of a CustomAttributeRenderer which
the AttributeTree uses to render values of this
attribute. |
java.lang.String |
getStringRepresentation()
Returns a String representation for the value of this
attribute, which will be used to create an instance
of this attribute via the CustomAttributeGenerator. |
AttributeType |
getType()
Returns the current value's type. |
java.lang.Object |
getValue()
Returns the Attribute value. |
boolean |
isMutable()
Returns the mutable flag that indicates whether the attribute is mutable or immutable. |
java.lang.Object |
newValueInstance()
Creates a new instance of the value part of the CustomAttribute. |
void |
setConstraint(Constraint constraint)
Sets the root of the constraint tree. |
void |
setMutable(boolean mutable)
Sets the mutable flag that indicates whether the attribute is mutable or immutable. |
void |
setName(java.lang.String name)
Sets the name of this attribute. |
void |
setValue(java.lang.Object value)
Sets the Attribute value. |
boolean |
useDefaultEditor()
If the CustomAttribute does not implement its own editor, it
can use the default editors if the value is one of the recognized types
(e.g. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int PAINT
public static final int STROKE
public static final int FONT
public static final int MARKER
public static final java.lang.String PAINT_GENERATOR
public static final java.lang.String STROKE_GENERATOR
public static final java.lang.String FONT_GENERATOR
public static final java.lang.String MARKER_GENERATOR
| Constructor Detail |
public FormatAttribute(int type)
FormatAttribute based on the given type.
The name will be generated depending on the type.
type - identifier of the target format type.PAINT,
STROKE,
MARKER,
FONT
public FormatAttribute(java.lang.String name,
int type)
FormatAttribute based on the given type.
name - the name for this instancetype - identifier of the target format type.PAINT,
STROKE,
MARKER,
FONT| Method Detail |
public CustomAttributeEditor getEditor()
CustomAttributegetEditor returns an instance of a
CustomAttributeEditor which the
AttributeTree will use to allow users to edit this
attribute. The method returns null if no such editor exists
and the attribute is not editable or the default editor should be used.
getEditor in interface CustomAttributeCustomAttributeEditor for this attribute.public CustomAttributeRenderer getRenderer()
CustomAttributeCustomAttributeRenderer which
the AttributeTree uses to render values of this
attribute. The method returns null if no such renderer
exists and the default renderer should be used. A renderer is required
if the Attribute cannot be rendered by the
standard renderer of the Table.
getRenderer in interface CustomAttributeCustomAttributeRenderer for this attribute.public java.lang.String getStringRepresentation()
CustomAttributeString representation for the value of this
attribute, which will be used to create an instance
of this attribute via the CustomAttributeGenerator.
getStringRepresentation in interface CustomAttributeString representation of this attribute.public java.lang.Object newValueInstance()
CustomAttributeCustomAttribute. This is needed when instances of this
Attribute need to be added and an instance of the value part is required.
newValueInstance in interface CustomAttributeObject for the value part of this attribute.public java.lang.String getGeneratorKey()
getGeneratorKey in interface CustomAttributeString usable as a key for this attribute.CustomAttribute.getGeneratorKey()public AttributeType getType()
Attribute
getType in interface Attributepublic java.lang.String getName()
AttributeAttribute name.
getName in interface Attributepublic java.lang.Object getValue()
AttributeAttribute value.
getValue in interface Attribute
public void setValue(java.lang.Object value)
throws IllegalValueException,
ConstraintViolationException
AttributeAttribute value.
setValue in interface Attributevalue - the new value of the attribute.
IllegalValueException - if the attribute value is invalid.
ConstraintViolationException - thrown if the constraint of this
attribute does not permit setting the new value.public void setName(java.lang.String name)
CustomAttribute
setName in interface CustomAttributename - String for the new name.
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
AttributeString instances are immutable. The value of the attribute is
copied by means of the clone method of
Object.
clone in interface Attributejava.lang.CloneNotSupportedExceptionpublic boolean isMutable()
Attribute
isMutable in interface Attributetrue, if it is mutable; false, if
it is immutable.public void setMutable(boolean mutable)
Attribute
setMutable in interface Attributemutable - the new value of the mutable flag.public void setConstraint(Constraint constraint)
Restrictable
setConstraint in interface Restrictableconstraint - the root of the constraint treepublic Constraint getConstraint()
Restrictable
getConstraint in interface Restrictablepublic static int getFormatType(Format format)
format - the format instance you wish to receive the aprobriate type
identifier to.
public java.lang.Object cloneValue()
throws java.lang.CloneNotSupportedException
Attribute
cloneValue in interface Attributejava.lang.CloneNotSupportedException - may be thrown
if invoking this method on the value is not allowed or supported.public boolean useDefaultEditor()
CustomAttributeCustomAttribute does not implement its own editor, it
can use the default editors if the value is one of the recognized types
(e.g. String, Integer, etc.)
useDefaultEditor in interface CustomAttributeCustomAttribute.getEditor() returns null
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||