org.ceryle.graph
Class GraphSettings

java.lang.Object
  extended by org.ceryle.graph.GraphSettings

public class GraphSettings
extends Object

A structure encapsulating a set of graph settings, including zoom, rotation, locality, hyperbolic radius and distortion (fisheye effect), sequence, and the ID of the selected node. This is admittedly a bit imperfect since TouchGraph is by its nature dynamic, with the positioning of graph nodes set by graph tensioning, not absolute location.

For flexibility' sake, rather than set/get methods, the member variables are all public.

Since:
JDK1.3
Version:
$Id: GraphSettings.java,v 3.4 2007-06-15 12:09:23 altheim Exp $
Author:
Murray Altheim
See Also:
GraphLayoutPanel

Field Summary
 int m_fisheye
          The graph hyperbolic distortion (fisheye distortion) value.
 int m_locality
          The graph locality value.
 Point m_offset
          The horizontal and vertical offset from 0,0, expressed as a Point.
 int m_radius
          The graph hyperbolic radius (fisheye distortion) value.
 int m_rotation
          The graph rotation value.
 StackSet m_selected
          The set of the selected node IDs, empty if there is no selection.
 int m_sequence
          The graph sequence distortion value.
 int m_zoom
          The graph zoom value.
 int offsetLimit
          The horizontal and vertical offset limit on imported lens settings.
static int selectionLimit
          The maximum number of remembered graph nodes in a selection.
 
Constructor Summary
GraphSettings()
          Default constructor.
GraphSettings(GraphLayoutPanel glp)
          Constructor with a GraphLayoutPanel glp.
GraphSettings(String settings)
          Constructor with a settings String settings.
 
Method Summary
 void capture(GraphLayoutPanel glp)
          Captures the current settings of the provided GraphLayoutPanel glp.
 String getEncodedSettings()
          Returns a semicolon-delimited list of current lens settings stored within this GraphSettings.
static String getEncodedSettings(GraphLayoutPanel glp)
          Returns a semicolon-delimited list of current lens settings of the provided GraphLayoutPanel.
 void parseGraphSettings(String settings)
          Set the various lens settings according to a parse of the semicolon-delimited values in the String settings.
 boolean restore(GraphLayoutPanel glp)
          Restores the settings of the provided GraphLayoutPanel glp to those of this GraphSettings.
 String toString()
          Returns the String representation of this GraphSettings, ie., its label.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

selectionLimit

public static int selectionLimit
The maximum number of remembered graph nodes in a selection. The default is 10.


m_zoom

public int m_zoom
The graph zoom value.


m_rotation

public int m_rotation
The graph rotation value.


m_locality

public int m_locality
The graph locality value.


m_radius

public int m_radius
The graph hyperbolic radius (fisheye distortion) value.


m_fisheye

public int m_fisheye
The graph hyperbolic distortion (fisheye distortion) value.


m_sequence

public int m_sequence
The graph sequence distortion value.


m_offset

public Point m_offset
The horizontal and vertical offset from 0,0, expressed as a Point.


m_selected

public StackSet m_selected
The set of the selected node IDs, empty if there is no selection.


offsetLimit

public final int offsetLimit
The horizontal and vertical offset limit on imported lens settings.

See Also:
Constant Field Values
Constructor Detail

GraphSettings

public GraphSettings()
Default constructor.


GraphSettings

public GraphSettings(String settings)
              throws NumberFormatException
Constructor with a settings String settings.

Throws:
NumberFormatException - upon invalid syntax

GraphSettings

public GraphSettings(GraphLayoutPanel glp)
Constructor with a GraphLayoutPanel glp. With this constructor, the settings are captured upon instantiation.

Method Detail

capture

public void capture(GraphLayoutPanel glp)
Captures the current settings of the provided GraphLayoutPanel glp.


restore

public boolean restore(GraphLayoutPanel glp)
Restores the settings of the provided GraphLayoutPanel glp to those of this GraphSettings. Returns true if a node was selected via its ID.


parseGraphSettings

public void parseGraphSettings(String settings)
                        throws NumberFormatException
Set the various lens settings according to a parse of the semicolon-delimited values in the String settings. This clears any previous settings.

Throws:
NumberFormatException
See Also:
getEncodedSettings()

getEncodedSettings

public static String getEncodedSettings(GraphLayoutPanel glp)
Returns a semicolon-delimited list of current lens settings of the provided GraphLayoutPanel. These are encoded in the following order: E.g., "-8;180;4;20;53;0;-41,65". This produces the same encoded String as the non-static getEncodedSettings() when the GraphSettings have been set to a GraphLayoutPanel.


getEncodedSettings

public String getEncodedSettings()
Returns a semicolon-delimited list of current lens settings stored within this GraphSettings. These are returned in the following order: E.g., "-8;180;4;20;53;-41,65;Thing"


toString

public String toString()
Returns the String representation of this GraphSettings, ie., its label.

Overrides:
toString in class Object


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.