prefuse.visual.sort
Class TreeDepthItemSorter

java.lang.Object
  extended by prefuse.visual.sort.ItemSorter
      extended by prefuse.visual.sort.TreeDepthItemSorter
All Implemented Interfaces:
java.util.Comparator

public class TreeDepthItemSorter
extends ItemSorter

ItemSorter that sorts items by tree depths. By default items deeper in the tree are given lower scores, so that parent nodes are drawn on top of child nodes. This ordering can be reversed using the appropriate constructor arguments.

Author:
jeffrey heer

Field Summary
protected static int AGGREGATE
           
protected static int DECORATOR
           
protected static int EDGE
           
protected static int ITEM
           
protected static int NODE
           
 
Constructor Summary
TreeDepthItemSorter()
          Create a new TreeDepthItemSorter that orders nodes such that parents are placed above their children.
TreeDepthItemSorter(boolean childrenAbove)
          Create a new TreeDepthItemSorter with the given sort ordering by depth.
 
Method Summary
 int score(VisualItem item)
          Score items similarly to ItemSorter, but additionally ranks items based on their tree depth.
 
Methods inherited from class prefuse.visual.sort.ItemSorter
compare, compare
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

AGGREGATE

protected static final int AGGREGATE
See Also:
Constant Field Values

EDGE

protected static final int EDGE
See Also:
Constant Field Values

ITEM

protected static final int ITEM
See Also:
Constant Field Values

NODE

protected static final int NODE
See Also:
Constant Field Values

DECORATOR

protected static final int DECORATOR
See Also:
Constant Field Values
Constructor Detail

TreeDepthItemSorter

public TreeDepthItemSorter()
Create a new TreeDepthItemSorter that orders nodes such that parents are placed above their children.


TreeDepthItemSorter

public TreeDepthItemSorter(boolean childrenAbove)
Create a new TreeDepthItemSorter with the given sort ordering by depth.

Parameters:
childrenAbove - true if children should be ordered above their parents, false if parents should be ordered above their children.
Method Detail

score

public int score(VisualItem item)
Score items similarly to ItemSorter, but additionally ranks items based on their tree depth.

Overrides:
score in class ItemSorter
Parameters:
item - the VisualItem to provide an ordering score
Returns:
the ordering score
See Also:
ItemSorter.score(prefuse.visual.VisualItem)


Copyright © 2007 Regents of the University of California