prefuse.action.layout
Class GridLayout

java.lang.Object
  extended by prefuse.activity.Activity
      extended by prefuse.action.Action
          extended by prefuse.action.GroupAction
              extended by prefuse.action.layout.Layout
                  extended by prefuse.action.layout.GridLayout

public class GridLayout
extends Layout

Implements a uniform grid-based layout. This component can either use preset grid dimensions or analyze a grid-shaped graph to determine them automatically.

Author:
jeffrey heer

Field Summary
protected  boolean analyze
           
protected  int cols
           
protected  int rows
           
 
Fields inherited from class prefuse.action.layout.Layout
m_anchor, m_bounds, m_bpts, m_insets, m_margin, m_tmpa, 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
GridLayout(java.lang.String group)
          Create a new GridLayout without preset dimensions.
GridLayout(java.lang.String group, int nrows, int ncols)
          Create a new GridLayout using the specified grid dimensions.
 
Method Summary
static int[] analyzeGraphGrid(TupleSet ts)
          Analyzes a set of nodes to try and determine grid dimensions.
 int getNumCols()
          Get the number of grid columns.
 int getNumRows()
          Get the number of grid rows.
 void run(double frac)
          Runs this Action, triggering whatever processing this Action performs.
 void setNumCols(int cols)
          Set the number of grid columns.
 void setNumRows(int rows)
          Set the number of grid rows.
 
Methods inherited from class prefuse.action.layout.Layout
getLayoutAnchor, getLayoutBounds, setLayoutAnchor, setLayoutBounds, setMargin, setX, setY
 
Methods inherited from class prefuse.action.GroupAction
getGroup, 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

rows

protected int rows

cols

protected int cols

analyze

protected boolean analyze
Constructor Detail

GridLayout

public GridLayout(java.lang.String group)
Create a new GridLayout without preset dimensions. The layout will attempt to analyze an input graph to determine grid parameters.

Parameters:
group - the data group to layout. In this automatic grid analysis configuration, the group must resolve to a set of graph nodes.

GridLayout

public GridLayout(java.lang.String group,
                  int nrows,
                  int ncols)
Create a new GridLayout using the specified grid dimensions. If the input data has more elements than the grid dimensions can hold, the left over elements will not be visible.

Parameters:
group - the data group to layout
nrows - the number of rows of the grid
ncols - the number of columns of the grid
Method Detail

run

public void run(double frac)
Description copied from class: Action
Runs this Action, triggering whatever processing this Action performs. Subclass this method to create custom Actions.

Specified by:
run in class GroupAction
Parameters:
frac - the fraction of this Action's duration that has elapsed.
See Also:
Action.run(double)

analyzeGraphGrid

public static int[] analyzeGraphGrid(TupleSet ts)
Analyzes a set of nodes to try and determine grid dimensions. Currently looks for the edge count on a node to drop to 2 to determine the end of a row.

Parameters:
ts - TupleSet ts a set of nodes to analyze. Contained tuples must implement be Node instances.
Returns:
a two-element int array with the row and column lengths

getNumCols

public int getNumCols()
Get the number of grid columns.

Returns:
the number of grid columns

setNumCols

public void setNumCols(int cols)
Set the number of grid columns.

Parameters:
cols - the number of grid columns to use

getNumRows

public int getNumRows()
Get the number of grid rows.

Returns:
the number of grid rows

setNumRows

public void setNumRows(int rows)
Set the number of grid rows.

Parameters:
rows - the number of grid rows to use


Copyright © 2007 Regents of the University of California