org.graffiti.graphics.grid
Class SnapOnGridAttribute

java.lang.Object
  extended by org.graffiti.attributes.AbstractAttribute
      extended by org.graffiti.attributes.AbstractCollectionAttribute
          extended by org.graffiti.attributes.LinkedHashMapAttribute
              extended by org.graffiti.graphics.grid.SnapOnGridAttribute
All Implemented Interfaces:
Attribute, CollectionAttribute, SortedCollectionAttribute, DeepCopy, Displayable<Object>

public final class SnapOnGridAttribute
extends LinkedHashMapAttribute

Attribute representing the snap behavior of a grid.

Version:
$Revision$ $Date$
Author:
Kathrin Hanauer, Andreas Gleißner

Nested Class Summary
 class SnapOnGridAttribute.SnapEnabledAttribute
          Attribute representing if the snap behavior of a grid is enabled.
 class SnapOnGridAttribute.ToleranceAttribute
          Attribute representing the snap tolerance of a grid.
 
Field Summary
static String ENABLED
          Id of the contained SnapOnGridAttribute.SnapEnabledAttribute.
static String SNAP_BENDS
          Id of the contained SnapBendsAttribute.
static String TOLERANCE
          Id of the contained SnapOnGridAttribute.ToleranceAttribute.
 
Fields inherited from class org.graffiti.attributes.AbstractCollectionAttribute
attributes
 
Fields inherited from class org.graffiti.attributes.AbstractAttribute
id
 
Fields inherited from interface org.graffiti.attributes.Attribute
SEPARATOR
 
Constructor Summary
protected SnapOnGridAttribute(GridAttribute gridAttribute)
          Constructs a SnapOnGridAttribute with the specified parent.
 
Method Summary
protected  void applyOnGrid()
          Sets the snap behavior of the grid represented by the parent attribute to the value of this attribute.
 SnapOnGridAttribute copy()
          Copies this CollectionAttribute and returns the copy.
 double getTolerance()
          Returns the snap tolerance of the grid.
 boolean isEnabled()
          Returns if the snap behavior of the grid is enabled.
 boolean isSnapBends()
          Returns if the snap behavior of the grid is enabled for bends.
 void setEnabled(boolean value)
          Sets if the snap behavior of the grid is enabled.
protected  void setFromGrid(Grid grid)
          Sets the value of this attribute to the snap behavior of the specified grid.
 void setParent(CollectionAttribute parent)
          Sets the attribute's parent.
 void setSnapBends(boolean value)
          Sets if the snap behavior of the grid is enabled for bends.
 void setTolerance(double value)
          Sets the snap tolerance of the grid.
 
Methods inherited from class org.graffiti.attributes.LinkedHashMapAttribute
doSetValue, getCollection, setCollection, setDefaultValue, toXMLString
 
Methods inherited from class org.graffiti.attributes.AbstractCollectionAttribute
add, add, containsAttribute, getAttributable, getAttribute, getValue, isEmpty, remove, remove, setAttributable, toString
 
Methods inherited from class org.graffiti.attributes.AbstractAttribute
callPostAttributeAdded, callPostAttributeChanged, callPostAttributeRemoved, callPreAttributeAdded, callPreAttributeChanged, callPreAttributeRemoved, getDescription, getId, getName, getParent, getPath, getSpaces, getStandardXML, setDescription, setValue, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.graffiti.attributes.CollectionAttribute
add, add, containsAttribute, getAttribute, isEmpty, remove, remove, setAttributable
 
Methods inherited from interface org.graffiti.attributes.Attribute
getAttributable, getId, getParent, getPath, getValue, setValue, toString
 
Methods inherited from interface org.graffiti.plugin.Displayable
getDescription, getName, setDescription
 

Field Detail

ENABLED

public static final String ENABLED
Id of the contained SnapOnGridAttribute.SnapEnabledAttribute.

See Also:
Constant Field Values

TOLERANCE

public static final String TOLERANCE
Id of the contained SnapOnGridAttribute.ToleranceAttribute.

See Also:
Constant Field Values

SNAP_BENDS

public static final String SNAP_BENDS
Id of the contained SnapBendsAttribute.

See Also:
Constant Field Values
Constructor Detail

SnapOnGridAttribute

protected SnapOnGridAttribute(GridAttribute gridAttribute)
Constructs a SnapOnGridAttribute with the specified parent.

Parameters:
gridAttribute - the parent of the constructed attribute.
Method Detail

isEnabled

public boolean isEnabled()
Returns if the snap behavior of the grid is enabled.

Returns:
if the snap behavior of the grid is enabled.

setEnabled

public void setEnabled(boolean value)
Sets if the snap behavior of the grid is enabled.

Parameters:
value - denotes if the snap behavior of the grid is enabled.

getTolerance

public double getTolerance()
Returns the snap tolerance of the grid.

Returns:
the snap tolerance of the grid.

setTolerance

public void setTolerance(double value)
Sets the snap tolerance of the grid.

Parameters:
value - denotes the snap tolerance of the grid.

isSnapBends

public boolean isSnapBends()
Returns if the snap behavior of the grid is enabled for bends.

Returns:
if the snap behavior of the grid is enabled for bends.

setSnapBends

public void setSnapBends(boolean value)
Sets if the snap behavior of the grid is enabled for bends.

Parameters:
value - denotes if the snap behavior of the grid is enabled for bends.

copy

public SnapOnGridAttribute copy()
Copies this CollectionAttribute and returns the copy. All sub-attributes will be copied, too, i.e. a deep-copy is returned.

Specified by:
copy in interface DeepCopy
Overrides:
copy in class LinkedHashMapAttribute
Returns:
a copy of the CollectionAttribute.

setParent

public void setParent(CollectionAttribute parent)
               throws FieldAlreadySetException
Sets the attribute's parent.

Implementation Notes: This method should only be called once and only by an addAttribute() method! The ListenerManager is already informed by the calling addAttribute method that the Attribute is now added to the hierarchy. Therefore no event is generated by this method.

Specified by:
setParent in interface Attribute
Overrides:
setParent in class AbstractAttribute
Parameters:
parent - the new parent of the Attribute.
Throws:
FieldAlreadySetException - DOCUMENT ME!

applyOnGrid

protected void applyOnGrid()
Sets the snap behavior of the grid represented by the parent attribute to the value of this attribute.


setFromGrid

protected void setFromGrid(Grid grid)
Sets the value of this attribute to the snap behavior of the specified grid.

Parameters:
grid - the grid whose snap behavior is to be copied.


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