MetaDone
metadone.client.grasyla2.visuallibrary.GraphVizLayout Class Reference
Inheritance diagram for metadone.client.grasyla2.visuallibrary.GraphVizLayout:
Collaboration diagram for metadone.client.grasyla2.visuallibrary.GraphVizLayout:

List of all members.

Classes

class  DelayLayout

Public Types

enum  RankDir { TB, LR, BT, RL }

Public Member Functions

final GrasylaScene getScene ()
boolean isRecursive ()
void setRecursive (boolean recursive)
RankDir getRankDir ()
void setRankDir (RankDir rankDir)
final void invokeLayoutImmediately (Widget widget)
abstract boolean shouldLayoutWidget (Widget w)

Static Public Attributes

static final Dependency NO_LAYOUT_DEPENDENCY

Protected Member Functions

 GraphVizLayout (GrasylaScene scene)
final void performLayout ()
final void performLayoutWithDelay (final Widget widget, final Set< Widget > waitFor)
boolean ignoreChild (Widget ch)
void performLayout (Widget widget) throws DelayLayout
void removeLinearParts (List< Point > list)
double getAngleThreshold ()
int getDistanceThreshold ()
abstract Collection< Pair
< Widget, Widget > > 
getEdges (Collection< Widget > widgets)
Rectangle getSize (Widget w)
void updatePosition (Widget widget, Point location)
boolean clearControlPoints (Widget widget)
void updateControlPoints (Widget source, Widget target, List< Point > controlPoints)

Private Member Functions

Set< Widget > performLayoutRec (Widget widget)
byte[] buildGraph (List< Widget > children, Map< Widget, Integer > positions) throws IOException

Static Private Member Functions

static Point getPoint (String pos) throws IllegalArgumentException

Private Attributes

final GraphViz graphviz
GrasylaScene scene
boolean recursive
RankDir rankDir
WeakHashMap< Widget, Object > inQueue = new WeakHashMap<Widget, Object>()

Static Private Attributes

static final Logger logger = Logger.getLogger(GraphVizLayout.class)
static final float PIXELS_PER_INCH = 72

Detailed Description

A layout algorithm delegating the computations to graphviz.

Author:
kma

Member Enumeration Documentation

The rankdir from graphviz.

Enumerator:
TB 
LR 
BT 
RL 

Constructor & Destructor Documentation

metadone.client.grasyla2.visuallibrary.GraphVizLayout.GraphVizLayout ( GrasylaScene  scene) [protected]

Member Function Documentation

boolean metadone.client.grasyla2.visuallibrary.GraphVizLayout.clearControlPoints ( Widget  widget) [protected]

Removes all the control points.

Parameters:
widgetThe widget being laid out
Returns:
true iff updating the control points for the widget is supported

Reimplemented in metadone.client.grasyla2.visuallibrary.GrasylaScene.MyGraphVizLayout.

Referenced by metadone.client.grasyla2.visuallibrary.GraphVizLayout.performLayout().

double metadone.client.grasyla2.visuallibrary.GraphVizLayout.getAngleThreshold ( ) [protected]

The angle threshold for filtering.

Returns:
The treshold in radians

Referenced by metadone.client.grasyla2.visuallibrary.GraphVizLayout.removeLinearParts().

int metadone.client.grasyla2.visuallibrary.GraphVizLayout.getDistanceThreshold ( ) [protected]

The minimal distance threshold for filtering.

Returns:
The minimal distance

Referenced by metadone.client.grasyla2.visuallibrary.GraphVizLayout.removeLinearParts().

abstract Collection<Pair<Widget, Widget> > metadone.client.grasyla2.visuallibrary.GraphVizLayout.getEdges ( Collection< Widget >  widgets) [protected, pure virtual]

Gets the edges for a collection of widgets.

Parameters:
widgetsThe widgets
Returns:
All the edges between the widgets

Implemented in metadone.client.grasyla2.visuallibrary.GrasylaScene.MyGraphVizLayout.

Referenced by metadone.client.grasyla2.visuallibrary.GraphVizLayout.buildGraph(), and metadone.client.grasyla2.visuallibrary.GraphVizLayout.performLayout().

static Point metadone.client.grasyla2.visuallibrary.GraphVizLayout.getPoint ( String  pos) throws IllegalArgumentException [static, private]
RankDir metadone.client.grasyla2.visuallibrary.GraphVizLayout.getRankDir ( )

Gets the direction of the layout.

Returns:
The direction

References metadone.client.grasyla2.visuallibrary.GraphVizLayout.rankDir.

Rectangle metadone.client.grasyla2.visuallibrary.GraphVizLayout.getSize ( Widget  w) [protected]

Gets the size of a widget.

Parameters:
wThe widget
Returns:
The bounds of the widget

Referenced by metadone.client.grasyla2.visuallibrary.GraphVizLayout.buildGraph(), and metadone.client.grasyla2.visuallibrary.GraphVizLayout.performLayout().

boolean metadone.client.grasyla2.visuallibrary.GraphVizLayout.ignoreChild ( Widget  ch) [protected]

Called to check if the widget should be laid out as a node.

Parameters:
chThe widget the check
Returns:
true if the ch should be ignored as a node

Reimplemented in metadone.client.grasyla2.visuallibrary.GrasylaScene.MyGraphVizLayout.

References metadone.client.grasyla2.visuallibrary.GraphVizLayout.NO_LAYOUT_DEPENDENCY.

Referenced by metadone.client.grasyla2.visuallibrary.GraphVizLayout.buildGraph().

final void metadone.client.grasyla2.visuallibrary.GraphVizLayout.invokeLayoutImmediately ( Widget  widget)
boolean metadone.client.grasyla2.visuallibrary.GraphVizLayout.isRecursive ( )

Indicates whether the layout is recursive.

Returns:
Whether the layout is recursive

References metadone.client.grasyla2.visuallibrary.GraphVizLayout.recursive.

Referenced by metadone.client.grasyla2.visuallibrary.GraphVizLayout.performLayoutRec().

final void metadone.client.grasyla2.visuallibrary.GraphVizLayout.performLayoutWithDelay ( final Widget  widget,
final Set< Widget >  waitFor 
) [protected]

Performs a layout with a delay for taking care of animations and such.

Parameters:
widgetThe widget
waitForThe set of dependent widgets that must be laid out before the current one

References metadone.client.grasyla2.visuallibrary.GraphVizLayout.inQueue, and metadone.client.grasyla2.visuallibrary.GraphVizLayout.performLayout().

Referenced by metadone.client.grasyla2.visuallibrary.GraphVizLayout.performLayoutRec().

void metadone.client.grasyla2.visuallibrary.GraphVizLayout.removeLinearParts ( List< Point >  list) [protected]

Removes linear parts from a list of points.

This is used to filter the set of control points returned by graphviz which is quite large.

Parameters:
listThe list of points to filter
See also:
getAngleThreshold()
getDistanceThreshold()

References metadone.client.grasyla2.visuallibrary.GraphVizLayout.getAngleThreshold(), and metadone.client.grasyla2.visuallibrary.GraphVizLayout.getDistanceThreshold().

Referenced by metadone.client.grasyla2.visuallibrary.GraphVizLayout.performLayout(), and metadone.client.grasyla2.visuallibrary.GrasylaScene.MyGraphVizLayout.updateControlPoints().

void metadone.client.grasyla2.visuallibrary.GraphVizLayout.setRankDir ( RankDir  rankDir)

Sets the direction of the layout.

Parameters:
rankDirThe new direction

References metadone.client.grasyla2.visuallibrary.GraphVizLayout.rankDir.

void metadone.client.grasyla2.visuallibrary.GraphVizLayout.setRecursive ( boolean  recursive)
abstract boolean metadone.client.grasyla2.visuallibrary.GraphVizLayout.shouldLayoutWidget ( Widget  w) [pure virtual]

Checks whether a widget children should be laid out.

Parameters:
wThe widget to check
Returns:
true if the children should be laid out

Implemented in metadone.client.grasyla2.visuallibrary.GrasylaScene.MyGraphVizLayout.

Referenced by metadone.client.grasyla2.visuallibrary.GraphEngine.findLayoutWidget(), and metadone.client.grasyla2.visuallibrary.GraphVizLayout.performLayoutRec().

void metadone.client.grasyla2.visuallibrary.GraphVizLayout.updateControlPoints ( Widget  source,
Widget  target,
List< Point >  controlPoints 
) [protected]

Updates the control points for an edge.

The default implementation just logs a failure trace.

Parameters:
sourceThe source widget
targetThe target widget
controlPointsThe control points

Reimplemented in metadone.client.grasyla2.visuallibrary.GrasylaScene.MyGraphVizLayout.

References metadone.client.grasyla2.visuallibrary.GraphVizLayout.logger.

Referenced by metadone.client.grasyla2.visuallibrary.GraphVizLayout.performLayout().

void metadone.client.grasyla2.visuallibrary.GraphVizLayout.updatePosition ( Widget  widget,
Point  location 
) [protected]

Updates the position of a widget after the algorithm has found a position.

Parameters:
widgetThe widget
locationThe found location

Reimplemented in metadone.client.grasyla2.visuallibrary.GrasylaScene.MyGraphVizLayout.

Referenced by metadone.client.grasyla2.visuallibrary.GraphVizLayout.performLayout().


Member Data Documentation

Initial value:
 new Dependency() {
        @Override
        public void revalidateDependency() {
            
        }
    }

A dependency to add to a widget to ignore it in the layout algorithm.

Referenced by metadone.client.grasyla2.visuallibrary.GrasylaScene.MakeFreeWidget.clear(), metadone.client.grasyla2.visuallibrary.GraphVizLayout.ignoreChild(), and metadone.client.grasyla2.visuallibrary.GrasylaScene.MakeFreeWidget.update().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations