y.layout
Class LabelLayoutTranslator

java.lang.Object
  |
  +--y.layout.LabelLayoutTranslator
All Implemented Interfaces:
Layouter, LayoutStage

public class LabelLayoutTranslator
extends Object
implements LayoutStage

Layout stage that automatically translates label layout information provided by the standard label layout classes EdgeLabelLayout and NodeLabelLayout to layout data of type LabelLayoutData that is accessible by the keys defined in class LabelLayoutKeys.

One can use this layout stage as label layouter of a label aware layouter like HierarchicLayouter. This can be done by assigning the stage by an appropriate call to setLabelLayouter.

Note that care must be taken on the choice of label model that is used by the classes EdgeLabelLayout and NodeLabelLayout. The calculated label positions must be consistent with the label positions allowed by the label model. The best label layout results are achived by choosing FreeEdgeLabelModel for edge layouts and FreeNodeLabelModel for node layouts.


Field Summary
 
Fields inherited from interface y.layout.Layouter
EDGE_ID_DPKEY, NODE_ID_DPKEY, SELECTED_EDGES, SELECTED_NODES
 
Constructor Summary
LabelLayoutTranslator()
          Creates a new instance of LabelLayoutTranslator.
 
Method Summary
 boolean canLayout(LayoutGraph graph)
          The returned result gets calculated by the core layouter.
 void doLayout(LayoutGraph graph)
          Before invoking the core layouter this stage translates traditional label layout information to data provider based label layout data.
 Layouter getCoreLayouter()
          Returns the core layouter.
 void setCoreLayouter(Layouter core)
          Sets the core layouter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LabelLayoutTranslator

public LabelLayoutTranslator()
Creates a new instance of LabelLayoutTranslator. Initially no core layouter will be bound to this layout stage.

Method Detail

setCoreLayouter

public void setCoreLayouter(Layouter core)
Description copied from interface: LayoutStage
Sets the core layouter.

Specified by:
setCoreLayouter in interface LayoutStage

getCoreLayouter

public Layouter getCoreLayouter()
Description copied from interface: LayoutStage
Returns the core layouter.

Specified by:
getCoreLayouter in interface LayoutStage

doLayout

public void doLayout(LayoutGraph graph)
Before invoking the core layouter this stage translates traditional label layout information to data provider based label layout data. Afterwards the calculated layout data will be written back to the original label layout.

Specified by:
doLayout in interface Layouter

canLayout

public boolean canLayout(LayoutGraph graph)
The returned result gets calculated by the core layouter.

Specified by:
canLayout in interface Layouter

© Copyright 2000-2003,
yWorks GmbH.
All rights reserved.

2003