|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
The NodeLayout interface specifies the contract for classes
responsible for laying out both node and edge elements of a graph. Client
code may selectively add only those nodes and edges that should be positioned
by the layout algorithm. The additional minor responsibilities include
layout duration estimation, layout progress notification as well as two
methods which can be implemented to efficiently allocate memory.
An implementation class should perform its layout using a layout algorithm that arranges nodes and edges according to some conceptual arrangement model.
The Layout classes may be used individually or by a
LayoutController. To ensure that a Layout is always
used properly, the following process flow is stipulated:
Layout.init()Layout.getLayoutAttributesTemplate()Layout.useAttribute(AttributeSet)beforeAddNodeHandler(int) addNode(LayoutableNode) beforeAddEdgeHandler(int) addEdge(LayoutableEdge) isGraphSuitable() getEstimatedArrangingTime() Layout.beforeLayoutHandler() layout(int, int, boolean) Layout.afterLayoutHandler()
________________________________________
| + getLayoutAttributesTemplate |
|________________________________________|
| _____________________________________|
| | # init |
| |_____________________________________|
| | # beforeAddNodeHandler |
| |_____________________________________|
| | _________________________________|
| | | + addNode |
| | |_________________________________|
| |_____________________________________|
| | # beforeAddEdgeHandler |
| |_____________________________________|
| | _________________________________|
| | | + addEdge |
| | |_________________________________|
| |_____________________________________|
| | __________________________________|
| | | + useAttribute |
| | |__________________________________|
| | |\ + isGraphSuitable? __..' |
| | | \ __..-' |
| | | \ __..-' |
| | |NO \ __..--' YES |
| | |____\__'__________________________|
| | | |+ getEstimatedArrangingTime |
| | | |____________________________|
| | | | _________________________|
| | | | | # beforeLayoutHandler |
| | | | | # layout |
| | | | | # afterLayoutHandler |
| | | | |_________________________|
| | | | | + getReport() |
| | | | |_________________________|
| | | |____________________________|
| | |__________________________________|
| |_____________________________________|
|________________________________________|
| Field Summary | |
static int |
DIRECTION_BOTTOM_TO_TOP
constant that tells about the direction of a node layout |
static int |
DIRECTION_LEFT_TO_RIGHT
constant that tells about the direction of a node layout |
static int |
DIRECTION_RIGHT_TO_LEFT
constant that tells about the direction of a node layout |
static int |
DIRECTION_TOP_TO_BOTTOM
constant that tells about the direction of a node layout |
static int |
DIRECTION_UNDEFINED
constant that tells about the direction of a node layout |
| Method Summary | |
boolean |
addEdge(LayoutableEdge edge)
This method adds an edge to the layout. |
boolean |
addNode(LayoutableNode node)
This method adds nodes into the layout classes. |
void |
beforeAddEdgeHandler(int edgeCount)
This method must be called before inserting edges. |
void |
beforeAddNodeHandler(int nodeCount)
This method will be triggered before inserting nodes. |
int |
getDirection()
Returns a constant that represents the direction of the NodeLayout implementation. |
AttributeSet |
getEdgeAttributesTemplate()
Returns the attribute set of edges which is initialized with default values. |
long |
getEstimatedArrangingTime()
Returns an estimate time for arranging of a given graph. |
AttributeSet |
getNodeAttributesTemplate()
Returns the attribute set of nodes which is initialized with default values. |
int |
getPreferEdgeType(AttributeSet usingAttributes)
This method allows a layout classes to inform the caller about it preferred edge type. |
boolean |
isGraphSuitable()
This method checks whether the layout is able to arrange the visual elements it contains. |
boolean |
layout(int left,
int top,
boolean reassignPorts)
Performs the layout process. |
void |
setProgressBar(LayoutProgress progressBar)
This method might be use to set a progress bar. |
| Methods inherited from interface com.tensegrity.graph.layout.Layout |
afterLayoutHandler, beforeLayoutHandler, error, getErrorMessage, getLayoutAttributesTemplate, getName, getReport, init, updateAttributeSet, useAttribute |
| Field Detail |
public static final int DIRECTION_UNDEFINED
public static final int DIRECTION_TOP_TO_BOTTOM
public static final int DIRECTION_LEFT_TO_RIGHT
public static final int DIRECTION_BOTTOM_TO_TOP
public static final int DIRECTION_RIGHT_TO_LEFT
| Method Detail |
public int getDirection()
NodeLayout implementation. Valid values are defined through
the 'direction' constants from this interface.
NodeLayoutpublic void beforeAddNodeHandler(int nodeCount)
nodeCount - The number of nodes that will be added.public boolean addNode(LayoutableNode node)
node - the node that is to be added.
Layout.getErrorMessage()
may be used to get details information.beforeAddNodeHandler(int)public void beforeAddEdgeHandler(int edgeCount)
edgeCount may be used for internal preparing
like memory allocation.
edgeCount - he number of edges that will be added.public boolean addEdge(LayoutableEdge edge)
edge - The edge that is to be added.
Layout.getErrorMessage()
may be used to get details information.beforeAddEdgeHandler(int)public boolean isGraphSuitable()
public boolean layout(int left,
int top,
boolean reassignPorts)
left - The left position of the graph bounding box after arranging.top - The top position of the graph bounding box after arranging.reassignPorts - Specifies whether the layout is allowed
to reassign ports or not.
beforeAddEdgeHandler(int)public AttributeSet getNodeAttributesTemplate()
AttributeSet
for nodes if any; otherwise null.AttributeSetpublic AttributeSet getEdgeAttributesTemplate()
AttributeSet
for nodes if any; otherwise null.public long getEstimatedArrangingTime()
public void setProgressBar(LayoutProgress progressBar)
progressBar - The progress bar that is to be updated.public int getPreferEdgeType(AttributeSet usingAttributes)
usingAttributes - the configuration that should being used.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||