org.graffiti.attributes
Class BooleanAttribute

java.lang.Object
  extended by org.graffiti.attributes.AbstractAttribute
      extended by org.graffiti.attributes.BooleanAttribute
All Implemented Interfaces:
Attribute, DeepCopy, Displayable<Object>
Direct Known Subclasses:
SnapOnGridAttribute.SnapEnabledAttribute

public class BooleanAttribute
extends AbstractAttribute

Contains a boolean value.


Field Summary
 
Fields inherited from class org.graffiti.attributes.AbstractAttribute
id
 
Fields inherited from interface org.graffiti.attributes.Attribute
SEPARATOR
 
Constructor Summary
BooleanAttribute(String id)
          Constructs a new instance of a BooleanAttribute.
BooleanAttribute(String id, boolean value)
          Constructs a new instance of a BooleanAttribute with the given value.
BooleanAttribute(String id, Boolean value)
          Constructs a new instance of a BooleanAttribute with the given value.
 
Method Summary
 Object copy()
          Returns a deep copy of this instance.
protected  void doSetValue(Object o)
          Sets the value of the attribute.
 boolean getBoolean()
          Returns the value of this object.
 Object getValue()
          Returns the value of the attribute wrapped in an Boolean object.
 void setBoolean(boolean value)
          Sets the value of this object.
 void setDefaultValue()
          The attribute's value is set so that its getValue() method will not return null.
 String toXMLString()
          Returns a well-formed XML string representing the Displayable.
 
Methods inherited from class org.graffiti.attributes.AbstractAttribute
callPostAttributeAdded, callPostAttributeChanged, callPostAttributeRemoved, callPreAttributeAdded, callPreAttributeChanged, callPreAttributeRemoved, getAttributable, getDescription, getId, getName, getParent, getPath, getSpaces, getStandardXML, setDescription, setParent, setValue, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BooleanAttribute

public BooleanAttribute(String id)
Constructs a new instance of a BooleanAttribute.

Parameters:
id - the id of the attribute.

BooleanAttribute

public BooleanAttribute(String id,
                        boolean value)
Constructs a new instance of a BooleanAttribute with the given value.

Parameters:
id - the id of the attribute.
value - the value of the attribute.

BooleanAttribute

public BooleanAttribute(String id,
                        Boolean value)
Constructs a new instance of a BooleanAttribute with the given value.

Parameters:
id - the id of the attribute.
value - the value of the attribute.
Method Detail

setBoolean

public void setBoolean(boolean value)
Sets the value of this object.

Parameters:
value - the new value of this object.

getBoolean

public boolean getBoolean()
Returns the value of this object.

Returns:
the value of this object.

setDefaultValue

public void setDefaultValue()
Description copied from interface: Attribute
The attribute's value is set so that its getValue() method will not return null.

See Also:
Attribute.setDefaultValue()

getValue

public Object getValue()
Returns the value of the attribute wrapped in an Boolean object.

Returns:
the value of the attribute wrapped in an Boolean object.

copy

public Object copy()
Returns a deep copy of this instance. Parent won't be set because the context may be different.

Returns:
a deep copy of this instance.

doSetValue

protected void doSetValue(Object o)
                   throws IllegalArgumentException
Sets the value of the attribute. The ListenerManager is informed implicitly by the method setValue().

Specified by:
doSetValue in class AbstractAttribute
Parameters:
o - the new value of the attribute.
Throws:
IllegalArgumentException - if the parameter has not the appropriate class for this attribute.

toXMLString

public String toXMLString()
Description copied from interface: Displayable
Returns a well-formed XML string representing the Displayable. The Displayable should be reconstructable via this representation. Therefore it must at least include the type of Displayable (classname) and a representation of its value. PROBABLE FUTURE DESIGN: The Displayables themselves will provide a method to reconstruct their value from the XML representation they provided.

Specified by:
toXMLString in interface Displayable<Object>
Overrides:
toXMLString in class AbstractAttribute
Returns:
string holding an XML representation of this Displayable
See Also:
Displayable.toXMLString()


Generated at 2012-05-30 11:00:36 PM CEST