com.tensegrity.graph.rule
Class EdgeRule

java.lang.Object
  extended bycom.tensegrity.graph.rule.AbstractRule
      extended bycom.tensegrity.graph.rule.AbstractGraphObjectRule
          extended bycom.tensegrity.graph.rule.EdgeRule
All Implemented Interfaces:
GraphObjectRule, Rule, java.io.Serializable

public class EdgeRule
extends AbstractGraphObjectRule
implements java.io.Serializable

Class EdgeRule implements the rule template for VisualEdge objects. Such a rule contains a set of attributes whose combined values, including those defined in GraphObjectRule, define the runtime behavior of those visual edges which are associated with the rule.

The attributes supported by the EdgeRule are listed below. You can find detailed information about each attribute afterwards.

The detachable-source attribute specifies whether the source end of a VisualEdge can be detached.
It specifies the detachable source state of the VisualEdge for user interaction only.
The methods provided by the EdgeRule to support the detachable-source attribute are listed below:

The detachable-target attribute specifies whether the target end of a VisualEdge can be detached.
It specifies the detachable target state of the VisualEdge for user interaction only.
The methods provided by the EdgeRule to support the detachable-target attribute are listed below:

The edge-insert-mode attribute refers to the edge-split operation.
The following String values are supported:

ValueDescription
edge insert disabled The edge-split operation is disabled when the attributes value is set to 'edge insert disabled'.
edge insert exact position When the attributes value is set to 'edge insert exact position' the VisualNode dropped onto the VisualEdge splits the VisualEdge exactly the position where it has been dropped.
edge insert automatic center When the attributes value is set to 'edge insert automatic center' the VisualNode dropped onto the VisualEdge splits the VisualEdge at its center position.
This attribute is used only with user interaction.
The methods provided by the EdgeRule to support the edge-insert-mode attribute are listed below:

The snap-to-port-distance attribute specifies the distance which is used to let the source end or the target end of a VisualEdge automatically snap to a VisualPort when either the source end, the target end or the whole VisualEdge is moved around.
A value less than zero it is automatically converted to zero.
This attribute is used only with user interaction.
The methods provided by the EdgeRule to support the edge-insert-mode attribute are listed below:

Version:
$Id: EdgeRule.java,v 1.27 2005/09/29 13:45:56 MichaelKegel Exp $
Author:
Stepan Rutz
See Also:
RuleRegistry, Serialized Form

Field Summary
static int EDGEINSERTMODE_AUTOCENTER
          edge-insert-mode constants
static int EDGEINSERTMODE_DISABLED
          edge-insert-mode constants
static int EDGEINSERTMODE_EXACT
          edge-insert-mode constants
 
Constructor Summary
EdgeRule(EdgeRule rule)
          Copy constructor for an edge rule.
EdgeRule(java.lang.String name)
          Constructs a new edge rule.
 
Method Summary
 Rule deepCopy()
          Returns a deepCopy of this rule.
static java.lang.String edgeinsertMode2String(int edgeinsertmode)
          Returns a descriptive string for the given edge insert mode.
 boolean equals(java.lang.Object obj)
           
 java.lang.String getDescription()
          Return a string description of this rule.
 int getEdgeInsertMode()
          Returns the edge insert mode for this edge rule.
 int getSnapToPortDistance()
          Returns the snap to port distance for this edge rule.
 int hashCode()
           
 boolean isDetachableSource()
          Returns the detachableSource flag for this rule.
 boolean isDetachableTarget()
          Returns the detachableTarget flag for this rule.
 void setDetachableSource(boolean detachableSource)
          Sets the detachableSource flag for this rule.
 void setDetachableTarget(boolean detachableTarget)
          Sets the detachableTarget flag for this rule.
 void setEdgeInsertMode(int edgeinsertmode)
          Sets the edge insert mode for this edge rule.
 void setSnapToPortDistance(int snapToPortDistance)
          Sets the snap to port distance for this edge rule.
 java.lang.String toString()
          Return a string representation of this rule.
 
Methods inherited from class com.tensegrity.graph.rule.AbstractGraphObjectRule
getName, isCopyable, isCutable, isDeletable, isMovable, isResizable, isSelectable, setCopyable, setCutable, setDeletable, setMovable, setResizable, setSelectable
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.tensegrity.graph.rule.Rule
getName
 

Field Detail

EDGEINSERTMODE_DISABLED

public static final int EDGEINSERTMODE_DISABLED
edge-insert-mode constants

See Also:
Constant Field Values

EDGEINSERTMODE_EXACT

public static final int EDGEINSERTMODE_EXACT
edge-insert-mode constants

See Also:
Constant Field Values

EDGEINSERTMODE_AUTOCENTER

public static final int EDGEINSERTMODE_AUTOCENTER
edge-insert-mode constants

See Also:
Constant Field Values
Constructor Detail

EdgeRule

public EdgeRule(java.lang.String name)
Constructs a new edge rule.

The properties are initialized with the following defaults:

Parameters:
name - name of the rule, must not be null.

EdgeRule

public EdgeRule(EdgeRule rule)
Copy constructor for an edge rule.

The reference to the parent RuleRegistry is set to null in the copy.

Parameters:
rule - the source rule to copy from.
Method Detail

edgeinsertMode2String

public static final java.lang.String edgeinsertMode2String(int edgeinsertmode)
Returns a descriptive string for the given edge insert mode.

Parameters:
edgeinsertmode - the edge-insert-mode to look up.
Returns:
description for the given edge-insert-mode.

isDetachableSource

public boolean isDetachableSource()
Returns the detachableSource flag for this rule.

Returns:
true if detaching is allowed, otherwise false.

Find more information in the class documentation


setDetachableSource

public void setDetachableSource(boolean detachableSource)
Sets the detachableSource flag for this rule.

Parameters:
detachableSource - true if detaching is allowed, otherwise false.

Find more information in the class documentation


isDetachableTarget

public boolean isDetachableTarget()
Returns the detachableTarget flag for this rule.

Returns:
true if detaching is allowed, otherwise false.

Find more information in the class documentation


setDetachableTarget

public void setDetachableTarget(boolean detachableTarget)
Sets the detachableTarget flag for this rule.

Parameters:
detachableTarget - true if detaching is allowed, otherwise false.

Find more information in the class documentation


setEdgeInsertMode

public void setEdgeInsertMode(int edgeinsertmode)
Sets the edge insert mode for this edge rule.

Parameters:
edgeinsertmode - one of the EDGEINSERT_MODE flags from this class.
Throws:
InvalidArgumentException - thrown if the edge insert mode is not one of the valid constants defined in this class.

Find more information in the class documentation


getEdgeInsertMode

public int getEdgeInsertMode()
Returns the edge insert mode for this edge rule.

Returns:
one of the EDGEINSERT_MODE flags from this class.

Find more information in the class documentation


setSnapToPortDistance

public void setSnapToPortDistance(int snapToPortDistance)
Sets the snap to port distance for this edge rule. If the argument is less than zero it is automatically set to zero silently.

Parameters:
snapToPortDistance - the distance when the edge snaps to the closest port.

Find more information in the class documentation


getSnapToPortDistance

public int getSnapToPortDistance()
Returns the snap to port distance for this edge rule.

Returns:
the snap to port distance for this edge rule.

Find more information in the class documentation


toString

public java.lang.String toString()
Return a string representation of this rule.

Overrides:
toString in class AbstractGraphObjectRule
Returns:
string representation of this rule.

getDescription

public java.lang.String getDescription()
Return a string description of this rule.

Specified by:
getDescription in interface Rule
Returns:
string description of this rule.

deepCopy

public Rule deepCopy()
Returns a deepCopy of this rule.

Specified by:
deepCopy in interface Rule
Returns:
a deepCopy of this rule.

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class AbstractGraphObjectRule

hashCode

public int hashCode()
Overrides:
hashCode in class AbstractGraphObjectRule


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.