prefuse.action.layout
Class Layout

java.lang.Object
  extended by prefuse.activity.Activity
      extended by prefuse.action.Action
          extended by prefuse.action.GroupAction
              extended by prefuse.action.layout.Layout
Direct Known Subclasses:
AxisLabelLayout, AxisLayout, CircleLayout, CollapsedStackLayout, CollapsedSubtreeLayout, Distortion, ForceDirectedLayout, FruchtermanReingoldLayout, GridLayout, RandomLayout, SpecifiedLayout, StackedAreaChart, TreeLayout

public abstract class Layout
extends GroupAction

Abstract base class providing convenience methods for layout algorithms.

Author:
jeffrey heer

Field Summary
protected  java.awt.geom.Point2D m_anchor
          The explicitly set anchor point at which the layout can be centered or rooted.
protected  java.awt.geom.Rectangle2D m_bounds
          The explicitly set layout bounds.
protected  double[] m_bpts
           
protected  java.awt.Insets m_insets
           
protected  boolean m_margin
           
protected  java.awt.geom.Point2D m_tmpa
           
protected  java.awt.geom.Rectangle2D m_tmpb
           
 
Fields inherited from class prefuse.action.GroupAction
m_group
 
Fields inherited from class prefuse.action.Action
m_vis
 
Fields inherited from class prefuse.activity.Activity
DEFAULT_STEP_TIME, INFINITY
 
Constructor Summary
Layout()
          Create a new Layout.
Layout(java.lang.String group)
          Create a new Layout.
Layout(java.lang.String group, long duration)
           
 
Method Summary
 java.awt.geom.Point2D getLayoutAnchor()
          Return the layout anchor at which to center or root the layout.
 java.awt.geom.Rectangle2D getLayoutBounds()
          Returns the bounds in which the layout should be computed.
 void setLayoutAnchor(java.awt.geom.Point2D a)
          Explicitly set the layout anchor point.
 void setLayoutBounds(java.awt.geom.Rectangle2D b)
          Explicitly set the layout bounds.
 void setMargin(int top, int left, int bottom, int right)
          Set the margins the layout should observe within its layout bounds.
 void setX(VisualItem item, VisualItem referrer, double x)
          Convenience method for setting an x-coordinate.
 void setY(VisualItem item, VisualItem referrer, double y)
          Convenience method for setting an y-coordinate.
 
Methods inherited from class prefuse.action.GroupAction
getGroup, run, setGroup
 
Methods inherited from class prefuse.action.Action
getVisualization, run, setVisualization
 
Methods inherited from class prefuse.activity.Activity
addActivityListener, alwaysRunAfter, cancel, fireActivityCancelled, fireActivityFinished, fireActivityScheduled, fireActivityStarted, fireActivityStepped, getDuration, getNextTime, getPace, getPacingFunction, getStartTime, getStepTime, getStopTime, isEnabled, isRunning, isScheduled, removeActivityListener, run, runAfter, runAt, setDuration, setEnabled, setPacingFunction, setStartTime, setStepTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_bounds

protected java.awt.geom.Rectangle2D m_bounds
The explicitly set layout bounds. May be null.


m_anchor

protected java.awt.geom.Point2D m_anchor
The explicitly set anchor point at which the layout can be centered or rooted. May be null.


m_margin

protected boolean m_margin

m_insets

protected java.awt.Insets m_insets

m_bpts

protected double[] m_bpts

m_tmpb

protected java.awt.geom.Rectangle2D m_tmpb

m_tmpa

protected java.awt.geom.Point2D m_tmpa
Constructor Detail

Layout

public Layout()
Create a new Layout.


Layout

public Layout(java.lang.String group)
Create a new Layout.

Parameters:
group - the data group to layout.

Layout

public Layout(java.lang.String group,
              long duration)
Method Detail

setMargin

public void setMargin(int top,
                      int left,
                      int bottom,
                      int right)
Set the margins the layout should observe within its layout bounds.

Parameters:
top - the top margin, in pixels
left - the left margin, in pixels
bottom - the bottom margin, in pixels
right - the right margin, in pixels

getLayoutBounds

public java.awt.geom.Rectangle2D getLayoutBounds()
Returns the bounds in which the layout should be computed. If the bounds have been explicitly set, that value is used. Otherwise, an attempt is made to compute the bounds based upon the display region of the first display found in this action's associated Visualization.

Returns:
the layout bounds within which to constain the layout.

setLayoutBounds

public void setLayoutBounds(java.awt.geom.Rectangle2D b)
Explicitly set the layout bounds. A reference to the input rectangle instance is maintained, not a copy, and so any subsequent changes to the rectangle object will also change the layout bounds.

Parameters:
b - a rectangle specifying the layout bounds. A reference to this same instance is kept.

getLayoutAnchor

public java.awt.geom.Point2D getLayoutAnchor()
Return the layout anchor at which to center or root the layout. How this point is used (if it is used at all) is dependent on the particular Layout implementation. If no anchor point has been explicitly set, the center coordinate for the first display found in this action's associated Visualization is used, if available.

Returns:
the layout anchor point.

setLayoutAnchor

public void setLayoutAnchor(java.awt.geom.Point2D a)
Explicitly set the layout anchor point. The provided object will be used directly (rather than copying its values), so subsequent changes to that point object will change the layout anchor.

Parameters:
a - the layout anchor point to use

setX

public void setX(VisualItem item,
                 VisualItem referrer,
                 double x)
Convenience method for setting an x-coordinate. The start value of the x-coordinate will be set to the current value, and the current and end values will be set to the provided x-coordinate. If the current value is not a number (NaN), the x-coordinate of the provided referrer item (if non null) will be used to set the start coordinate.

Parameters:
item - the item to set
referrer - the referrer item to use for the start location if the current valu eis not a number (NaN)
x - the x-coordinate value to set. This will be set for both the current and end values.
See Also:
PrefuseLib.setX(VisualItem, VisualItem, double)

setY

public void setY(VisualItem item,
                 VisualItem referrer,
                 double y)
Convenience method for setting an y-coordinate. The start value of the y-coordinate will be set to the current value, and the current and end values will be set to the provided y-coordinate. If the current value is not a number (NaN), the y-coordinate of the provided referrer item (if non null) will be used to set the start coordinate.

Parameters:
item - the item to set
referrer - the referrer item to use for the start location if the current valu eis not a number (NaN)
y - the y-coordinate value to set. This will be set for both the current and end values.
See Also:
PrefuseLib.setY(VisualItem, VisualItem, double)


Copyright © 2007 Regents of the University of California