com.tensegrity.graph.rule
Class GraphRule

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

public final class GraphRule
extends com.tensegrity.graph.rule.AbstractRule
implements Rule, java.io.Serializable

Class GraphRule implements the rule template for VisualGraph objects. Such a rule contains a set of attributes whose combined values define the runtime behavior of those VisualGraphs which are associated with the rule.

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

The autospace-mode attribute specifies whether or how to displace VisualNodes when they are added to a VisualGraph so that overlap is avoided.
The following constants are supported:

ValueDescription
AUTOSPACEMODE_NONE The autospace-mode is disabled.
AUTOSPACEMODE_HORIZONTAL The VisualNodes are displaced to the left or to the right in order to avoid overlapping.
AUTOSPACEMODE_VERTICAL The VisualNodes are displaced to the top or to the bottom in order to avoid overlapping.
This attribute is used with user interaction only.

The methods provided by the GraphRule to support the autospace-mode attribute are listed below:

The accept-loose-objects attribute refers to VisualNodes as objects and it specifies whether the VisualGraph, this rule is assigned to, accepts loose VisualNode objects inside of it. Loose VisualNode objects are those with an indegree and an outdegree of zero.
In the case that a VisualNode is added and it is a loose one but crosses a VisualEdge with enabled edge-insert-mode, the VisualNode is not considered as a loose VisualNode.
This attribute is not only used with user interaction but also for API calls.

The methods provided by the GraphRule to support the accept-loose-objects attribute are listed below:

The edge-split-tolerance attribute specifies the maximum distance of a VisualNode to a VisualEdge to let the VisualNode split the VisualEdge.
This attribute is used with user interaction only.

The methods provided by the GraphRule to support the edge-split-tolerance attribute are listed below:

The edge-insert-single-position attribute specifies whether a multi selection of VisualNodes split a VisualEdge at a certain position (e.g. the mouse cursor position) or of they split those VisualEdges they might geometrically overlay.

The methods provided by the GraphRule to support the edge-insert-single-position attribute are listed below:

The node-drop-handler attribute specifies the name of the VisualNodeDropHandler instance to invoke when a VisualNode is dropped on/added to the VisualGraph this rule is assigned to.
This attribute is used with user interaction only.
For further information about node-drop-handlers please see the documentation of VisualNodeDropHandler

Version:
$Id: GraphRule.java,v 1.33 2006/03/02 10:43:59 BurkhardWick Exp $
Author:
Stepan Rutz
See Also:
RuleRegistry, Serialized Form

Field Summary
static int AUTOSPACEMODE_HORIZONTAL
          Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead
static java.lang.String AUTOSPACEMODE_HORIZONTAL_DESCRIPTION
          Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead
static int AUTOSPACEMODE_NONE
          Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead
static java.lang.String AUTOSPACEMODE_NONE_DESCRIPTION
          Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead
static int AUTOSPACEMODE_VERTICAL
          Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead
static java.lang.String AUTOSPACEMODE_VERTICAL_DESCRIPTION
          Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead
 
Constructor Summary
GraphRule(GraphRule rule)
          Copy-Constructs a new graph rule.
GraphRule(java.lang.String name)
          Constructs a new graph rule.
 
Method Summary
static java.lang.String autospaceMode2String(int autospacemode)
          Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead
 Rule deepCopy()
          Returns a deepCopy of this rule.
 boolean equals(java.lang.Object obj)
           
 int getAutoSpaceMode()
          Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead
 java.lang.String getDescription()
          Returns a description of this rule.
 java.lang.String getDropHandlerName()
          Returns the name that identifies the VisualNodeDropHandler for this GraphRule.
 int getEdgeSplitTolerance()
          Returns the current tolerance for edge-splitting.
 java.util.Set getLegalCrossVisualSubgraphEdgeSplits()
          Returns a set of rule names that identify VisualSubgraph objects that should allow cross subgraph edgesplits.
 java.lang.String getLegalCrossVisualSubgraphEdgeSplitsAsString()
          Returns the is-legal-subgraph list concatenated into a single string where tokens are delimited by a colon.
 java.lang.String getName()
          Returns the name of the rule.
 int hashCode()
           
 boolean isAcceptLooseObjects()
          Returns the accept-loose-objects flag for this GraphRule.
 boolean isEdgeInsertSinglePosition()
          Returns the edge single position flag for this GraphRule.
 void setAcceptLooseObjects(boolean acceptlooseobjects)
          Sets the accept-loose-objects flag for this GraphRule.
 void setAutoSpaceMode(int autospacemode)
          Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead
 void setDropHandlerName(java.lang.String drophandlername)
          Sets the name that identifies the VisualNodeDropHandler for this GraphRule.
 void setEdgeInsertSinglePosition(boolean edgeinsertsingleposition)
          Sets the edge single position flag for this GraphRule.
 void setEdgeSplitTolerance(int edgeSplitTolerance)
          Sets the tolerance for edge-splitting.
 void setLegalCrossVisualSubgraphEdgeSplits(java.util.Collection legalSubgraphRules)
          Sets the is-legal-subgraph rule names (as Strings) for this GraphRule.
static int string2autospaceMode(java.lang.String description)
          Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead
 java.lang.String toString()
          Return a string representation of this rule.
 
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

AUTOSPACEMODE_NONE

public static final int AUTOSPACEMODE_NONE
Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead

the valid autospace modes.

See Also:
Constant Field Values

AUTOSPACEMODE_HORIZONTAL

public static final int AUTOSPACEMODE_HORIZONTAL
Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead

the valid autospace modes.

See Also:
Constant Field Values

AUTOSPACEMODE_VERTICAL

public static final int AUTOSPACEMODE_VERTICAL
Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead

the valid autospace modes.

See Also:
Constant Field Values

AUTOSPACEMODE_NONE_DESCRIPTION

public static final java.lang.String AUTOSPACEMODE_NONE_DESCRIPTION
Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead

descriptive strings for the available autospace modes.

See Also:
Constant Field Values

AUTOSPACEMODE_HORIZONTAL_DESCRIPTION

public static final java.lang.String AUTOSPACEMODE_HORIZONTAL_DESCRIPTION
Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead

descriptive strings for the available autospace modes.

See Also:
Constant Field Values

AUTOSPACEMODE_VERTICAL_DESCRIPTION

public static final java.lang.String AUTOSPACEMODE_VERTICAL_DESCRIPTION
Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead

descriptive strings for the available autospace modes.

See Also:
Constant Field Values
Constructor Detail

GraphRule

public GraphRule(java.lang.String name)
Constructs a new graph rule.

The default settings of the properties are as follows:

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

GraphRule

public GraphRule(GraphRule rule)
Copy-Constructs a new graph rule.

The reference of for the enclosing RuleRegistry is set to null in the new instance.

Parameters:
rule - the GaphRule instance to copy from
Method Detail

getAutoSpaceMode

public int getAutoSpaceMode()
Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead

Gets the autospace mode for this GraphRule.

Returns:
the autospace mode for this graphrule. Must be one of the AUTOSPACE_* fields defined in this class.

Find more information in the class documentation


setAutoSpaceMode

public void setAutoSpaceMode(int autospacemode)
Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead

Sets the autospace mode for this GraphRule.

Parameters:
autospacemode - the autospace mode to set. Must be one of the AUTOSPACE_* fields defined in this class.
Throws:
InvalidArgumentException - thrown if the value is not one of the pre-defined autospace constants.

Find more information in the class documentation


isAcceptLooseObjects

public boolean isAcceptLooseObjects()
Returns the accept-loose-objects flag for this GraphRule.

Returns:
the accept-loose-objects flag for this graphrule.

Find more information in the class documentation


setAcceptLooseObjects

public void setAcceptLooseObjects(boolean acceptlooseobjects)
Sets the accept-loose-objects flag for this GraphRule.

Parameters:
acceptlooseobjects - the accept-loose-objects flag for this graphrule.

Find more information in the class documentation


getEdgeSplitTolerance

public int getEdgeSplitTolerance()
Returns the current tolerance for edge-splitting.

Returns:
the tolerance for edge-splitting.

Find more information in the class documentation


setEdgeSplitTolerance

public void setEdgeSplitTolerance(int edgeSplitTolerance)
Sets the tolerance for edge-splitting.

Parameters:
edgeSplitTolerance - the tolerance to use for edge-splitting.

Find more information in the class documentation


isEdgeInsertSinglePosition

public boolean isEdgeInsertSinglePosition()
Returns the edge single position flag for this GraphRule.

Returns:
the edge single position flag for this graphrule.

Find more information in the class documentation


setEdgeInsertSinglePosition

public void setEdgeInsertSinglePosition(boolean edgeinsertsingleposition)
Sets the edge single position flag for this GraphRule.

Parameters:
edgeinsertsingleposition - the edge single position flag for this graphrule.

Find more information in the class documentation


getDropHandlerName

public java.lang.String getDropHandlerName()
Returns the name that identifies the VisualNodeDropHandler for this GraphRule.

Returns:
the name that identities the VisualNodeDropHandler for this GraphRule.

Find more information in the class documentation


setDropHandlerName

public void setDropHandlerName(java.lang.String drophandlername)
Sets the name that identifies the VisualNodeDropHandler for this GraphRule.

Parameters:
drophandlername - the name that identities the VisualNodeDropHandler for this GraphRule.

Find more information in the class documentation


getLegalCrossVisualSubgraphEdgeSplits

public java.util.Set getLegalCrossVisualSubgraphEdgeSplits()
Returns a set of rule names that identify VisualSubgraph objects that should allow cross subgraph edgesplits.

Returns:
a set of rules that identify legal visualsubgraphs for edge-splitting.

Find more information in the class documentation


getLegalCrossVisualSubgraphEdgeSplitsAsString

public java.lang.String getLegalCrossVisualSubgraphEdgeSplitsAsString()
Returns the is-legal-subgraph list concatenated into a single string where tokens are delimited by a colon.

Returns:
the is-legal-subgraph list concatenated into a single string.

Find more information in the class documentation


setLegalCrossVisualSubgraphEdgeSplits

public void setLegalCrossVisualSubgraphEdgeSplits(java.util.Collection legalSubgraphRules)
Sets the is-legal-subgraph rule names (as Strings) for this GraphRule.

Parameters:
legalSubgraphRules - collection of names of legal rules.
Returns:
true if the node can be legally placed in the given subgraph (identified by its rule).

Find more information in the class documentation


getDescription

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

Specified by:
getDescription in interface Rule
Returns:
a 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.

toString

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

Returns:
string representation of this rule.

equals

public boolean equals(java.lang.Object obj)

hashCode

public int hashCode()

autospaceMode2String

public static final java.lang.String autospaceMode2String(int autospacemode)
Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead

Returns a descriptive string for the given autospace-mode.

Parameters:
autospacemode - the autospace-mode to look up.
Returns:
description for the given autospace-mode.

string2autospaceMode

public static final int string2autospaceMode(java.lang.String description)
Deprecated. use VisualGraphViewInteractionConfiguration displace modes instead

Returns the autospace-mode for the given descriptive string.

Parameters:
description - the string describing the autospace-mode.
Returns:
the autospace-mode that was parsed.

getName

public java.lang.String getName()
Returns the name of the rule.

Specified by:
getName in interface Rule
Returns:
the name of the rule.


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