|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.graph.layout.GraphLayoutService
This class is an implementation of LayoutService.
| Field Summary | |
static java.lang.String |
AUTO_EDGE_REASSIGNMENT
Specifies whether the automatic port reassignment is active. |
static java.lang.String |
AUTO_EDGE_REASSIGNMENT_DIRECTIONDEPENDENT
Specifies whether the according layouter are allowed to reassign ports to achieve an optimal routing of edges. |
static java.lang.String |
BASE_LAYOUT_ENGINE
XML tag to for the base layouter. |
Boundary |
border
The border of the area that is to be considered. |
static java.lang.String |
IGNORE_ISOLATED_NODES
Specifies whether the unconnected nodes are to be ignored. |
static java.lang.String |
LAYOUT_ATTRIBUTES
XML tag for attributes. |
static java.lang.String |
LAYOUT_CONTEXTS
XML tag for the layout contexts. |
static java.lang.String |
LAYOUT_EDGE_ALWAYS_KEEP_EDGE_ROUTE
Specifies whether the edge path set by a node layout is to be taken into consideration. |
static java.lang.String |
LAYOUT_EDGE_CONTEXT_AWARE
Specifies whether the edges are to be routed by the same layouter which arranges nodes, or by the default edge layouter.
|
static java.lang.String |
PREFERREDCOORDS
preferred edge coordinates for this edge. |
static java.lang.String |
SERVICE_ATTRIBUTES
XML tag for global properties. |
static java.lang.String |
X_POSITION
Specifies the left position of the graph bounding box after arranging. |
static java.lang.String |
Y_POSITION
Specifies the top position of the graph bounding box after arranging. |
| Constructor Summary | |
GraphLayoutService()
Constructs a new layout service instance with default settings. |
|
| Method Summary | |
boolean |
addLayoutContext(java.lang.String layoutName,
java.lang.String layoutContext)
Creates a new layout-context and add it into the pool of the layout-contexts. |
void |
addProgressListener(ProgressListener progresslistener)
Adds a progress-listener. |
static java.lang.String |
coordsToStr(Coordinate[] coords,
char type)
This helper method converts a coordinate array into a string.
|
AttributeSet |
duplicateLayoutContext(java.lang.String templateLayoutContext,
java.lang.String newLayoutContext)
Creates a copy from the layout-context specified by templateLayoutContext and adds it into the pool of . |
static char |
edgetypeToChar(int edgetype)
For internal use only. |
boolean |
error()
Returns true if an error has occurred; otherwise false.
|
AttributeSet |
getAttribute()
This method gets the attribute-set of LayoutService.
|
java.lang.Object |
getAttribute(java.lang.String name)
This method may be used to obtain a specified attribute of the LayoutService.
|
java.lang.String |
getBaseLayoutEngine(java.lang.String layoutContext)
This method returns the base layouter of an specified layout-contexts. |
AttributeSet |
getConfiguration(java.lang.String[] listOfLayoutContexts)
This method returns an attribute-set which contains attributes of all layout contexts specified by listOfLayoutContexts.
|
AttributeSet |
getEdgeDefaultLayoutAttributes(java.lang.String layoutContext)
This method returns the default edge attributes of specified layout-context. |
java.lang.String[] |
getEdgeLayoutContextList()
This method returns the list of all defined edge layout-contexts. |
java.lang.String[] |
getEdgeLayoutEngineList()
This method returns the list of registered edge layouter. |
java.lang.String |
getErrorMessage()
Returns the error-message if an error has occurred. |
java.lang.Object |
getLayoutAttribute(java.lang.String layoutContext,
java.lang.String key)
Obtains the value of the attribute specified by key and the layout-context. |
AttributeSet |
getLayoutAttributeSet(java.lang.String layoutContext)
Returns the attribute-set of the specified layout-context. |
java.lang.String[] |
getLayoutContextList()
This method returns the list of all defined node and edge layout-contexts. |
java.lang.String[] |
getLayoutContextList(java.lang.String layoutEngine)
This method returns array of layout-contexts that are associated with the specified basicLayoutEngine. |
AttributeSet |
getLayoutReport(java.lang.String layoutContext)
This method submits a report about the last layout process. |
AttributeSet |
getNodeDefaultLayoutAttributes(java.lang.String layoutContext)
This method returns the default node attributes of specified layout-context. |
java.lang.String[] |
getNodeLayoutContextList()
This method returns the list of all defined node layout-contexts. |
java.lang.String[] |
getNodeLayoutEngineList()
Returns an array of registered layouter. |
void |
init()
Initializes the internal state of the layout Service. |
void |
internalLoadEdgePoints(VisualEdge vedge)
This method reads the preferred edge coordinates for recovering the preferred edge path. the original coordinates are stored in the layout-attributes of the edges. |
void |
internalRegisterEdge(VisualEdge vedge)
This method registered the given edge at the associated edge-layout to ensure its proper use. |
boolean |
isValidLayoutContext(java.lang.String layoutContext)
Verifies whether the specified layout-context is valid. |
void |
keepCurrentEdgesRoute(LayoutableEdge edge)
Call this method to keep the current edge's route. |
boolean |
layout(java.util.List visualObjects,
java.lang.String nodeLayoutContext,
java.lang.String edgeLayoutContext)
Applies layout on the nodes and edges of viusalGraph.
|
boolean |
layout(VisualGraphObjectContainer visualgraph,
java.lang.String nodeLayoutContext,
java.lang.String edgeLayoutContext)
Applies layout on the graph specified by viusalGraph.
|
boolean |
layoutEdges(java.util.List visualObjects,
java.lang.String edgelayoutContext,
java.lang.String nodelayoutContext)
Applies layout on the edges of the graph specified by objectList |
boolean |
layoutEdges(VisualGraphObjectContainer visualgraph,
java.lang.String edgelayoutContext,
java.lang.String nodelayoutContext)
Applies layout on the edges of the graph specified by viusalGraph. |
static boolean |
mergeAttributes(AttributeSet current,
AttributeSet updated,
boolean addMissing)
Updates the attribute values in the given AttributeSet
current with the values in updated. |
void |
onBeginLayout()
Informs the layout service that the layout of a nested graph is beginning. |
void |
onEndLayout()
Informs the layout service that the layout of a nested graph is finished. |
boolean |
registerLayoutEngine(EdgeLayout newLyoutEngine)
This method may be used to add a new edge layouter into the layout pool. |
boolean |
registerLayoutEngine(NodeLayout newLyoutEngine)
This method may be used to add a new layouter into the layout pool. |
boolean |
removeLayoutContext(java.lang.String layoutContext)
Removes the specified layout-context |
void |
removeProgressListener(ProgressListener progresslistener)
Removes the specified Progress-listener. |
void |
setAttribute(AttributeSet attributeSet)
This method may be used to set the attribute-set for this object. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
This method may be used to modify a specified attribute of the LayoutService.
|
void |
setConfiguration(AttributeSet allAttributes)
This method uses the given AttributeSet to configure the
layout contexts and the LayouService itself.
|
boolean |
setDefaultLayoutContext(java.lang.String defaultLayoutContext)
Sets the default layout context of the edges. |
boolean |
setLayoutAttribute(java.lang.String layoutContext,
java.lang.String name,
java.lang.Object value)
This method may be used to change the value of an attribute
specified by layout-context and key. |
boolean |
setLayoutAttributeSet(java.lang.String layoutContext,
AttributeSet attributeSet)
Returns the attribute-set of the layout context specified by layout-context. |
void |
setPercentage(double value)
Sets the percentage value of current progress |
static Coordinate[] |
strToCoords(java.lang.String str)
This helper method converts a given string into a Coordinate
array. |
static char |
strToType(java.lang.String str)
This helper method parses an input string and returns
the type of the stored data. |
void |
updateLayoutAttributeSet(java.lang.String layoutContext,
AttributeSet layoutAttribute)
This method updates a specified attributes-set with the view of consistency. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String X_POSITION
public static final java.lang.String Y_POSITION
public static final java.lang.String LAYOUT_EDGE_CONTEXT_AWARE
default edge layouter.
default edge layouter.default edge layouter ensures a uniform routing
of edges and is suitable for user interactions but it does not consider
the structure of the graphs, and the chosen routes are not always optimal.
public static final java.lang.String IGNORE_ISOLATED_NODES
public static final java.lang.String AUTO_EDGE_REASSIGNMENT
public static final java.lang.String AUTO_EDGE_REASSIGNMENT_DIRECTIONDEPENDENT
public static final java.lang.String LAYOUT_EDGE_ALWAYS_KEEP_EDGE_ROUTE
public static final java.lang.String SERVICE_ATTRIBUTES
public static final java.lang.String LAYOUT_CONTEXTS
public static final java.lang.String BASE_LAYOUT_ENGINE
public static final java.lang.String LAYOUT_ATTRIBUTES
public static final java.lang.String PREFERREDCOORDS
public Boundary border
edge layouter
takes this into consideration and keeps edges inside this border
| Constructor Detail |
public GraphLayoutService()
| Method Detail |
public boolean registerLayoutEngine(NodeLayout newLyoutEngine)
LayoutServiceLayout.
registerLayoutEngine in interface LayoutServicenewLyoutEngine - A new layouter.
public boolean registerLayoutEngine(EdgeLayout newLyoutEngine)
LayoutServiceEdgeLayout.
registerLayoutEngine in interface LayoutServicenewLyoutEngine - A new edge layouter.
LayoutService.registerLayoutEngine(EdgeLayout)public java.lang.String[] getNodeLayoutEngineList()
LayoutService
getNodeLayoutEngineList in interface LayoutServiceString array of registered layouter.public java.lang.String[] getEdgeLayoutEngineList()
LayoutService
getEdgeLayoutEngineList in interface LayoutServicepublic java.lang.String[] getLayoutContextList(java.lang.String layoutEngine)
LayoutServicebasicLayoutEngine.
getLayoutContextList in interface LayoutServicelayoutEngine - The basic Layout of which the derived
layout contexts is requested.
public boolean addLayoutContext(java.lang.String layoutName,
java.lang.String layoutContext)
LayoutServiceLayoutService.isValidLayoutContext(String) to check whether
the new name already exists.
addLayoutContext in interface LayoutServicelayoutName - The name of basic NodeLayout or
EdgeLayout.layoutContext - The name for the new layout context
LayoutService.registerLayoutEngine(NodeLayout)public boolean isValidLayoutContext(java.lang.String layoutContext)
LayoutService
isValidLayoutContext in interface LayoutServicelayoutContext - layout-context that is to be checked
true if the specified layout-context is valid,
otherwise false.
public AttributeSet duplicateLayoutContext(java.lang.String templateLayoutContext,
java.lang.String newLayoutContext)
LayoutServicetemplateLayoutContext and adds it into the pool of .
duplicateLayoutContext in interface LayoutServicetemplateLayoutContext - The source layout-contextnewLayoutContext - The name for the new copy of templateLayoutContext
public boolean removeLayoutContext(java.lang.String layoutContext)
LayoutService
removeLayoutContext in interface LayoutServicelayoutContext - The layout-contextto be removed
public java.lang.String[] getLayoutContextList()
LayoutService
getLayoutContextList in interface LayoutServicepublic java.lang.String[] getNodeLayoutContextList()
LayoutService
getNodeLayoutContextList in interface LayoutServicepublic java.lang.String[] getEdgeLayoutContextList()
LayoutService
getEdgeLayoutContextList in interface LayoutServiceString array which contains a list of layout-contexts.public AttributeSet getLayoutAttributeSet(java.lang.String layoutContext)
LayoutService
getLayoutAttributeSet in interface LayoutServicelayoutContext - layout-context of which the attribute
set is required.
LayoutService.setLayoutAttribute(String, String, Object),
AttributeSet
public boolean setLayoutAttributeSet(java.lang.String layoutContext,
AttributeSet attributeSet)
LayoutServiceLayoutService ensures that the modified
AttributeSet will updated by corresponding layouter.
A layouter may change the attribute set if necessarily.
A tree layouter for example may change the attribute
layer distance to radius if the user changes
the arrangement type from plan to radial.
setLayoutAttributeSet in interface LayoutServicelayoutContext - layout-context of which the attribute set
is to be set.attributeSet - The new AttributeSet
LayoutService.setLayoutAttribute(String, String, Object),
AttributeSetpublic AttributeSet getNodeDefaultLayoutAttributes(java.lang.String layoutContext)
LayoutServiceLayoutService.setLayoutAttribute(String, String, Object)
and LayoutService.setLayoutAttributeSet(String, AttributeSet).
The layout-attributes configure the layout as a whole. But some
layouter also accept configuration of nodes to allow
different treatment.
getNodeDefaultLayoutAttributes in interface LayoutServicelayoutContext - specifies the target layout context.
AttributeSet.
It may be null since some layouter does not offer
special attributes for nodes.public AttributeSet getEdgeDefaultLayoutAttributes(java.lang.String layoutContext)
LayoutServiceLayoutService.setLayoutAttribute(String, String, Object)
and LayoutService.setLayoutAttributeSet(String, AttributeSet).
The layout-attributes configure the layout as a whole. But some
layouter also accept configuration of edges to allow
different treatment.
getEdgeDefaultLayoutAttributes in interface LayoutServicelayoutContext - specifies the target layout context
AttributeSet. It may be
null since some layouter does not offer special
attributes for nodes.public boolean error()
LayoutServicetrue if an error has occurred; otherwise false.
Use method LayoutService.getErrorMessage() to obtain
a description text about the last occurred error.
error in interface LayoutServicetrue if an error has occurred; otherwise false.public java.lang.String getErrorMessage()
LayoutServiceLayoutService.error() to find out whether
an error has occurred.
getErrorMessage in interface LayoutServicepublic AttributeSet getLayoutReport(java.lang.String layoutContext)
LayoutService
getLayoutReport in interface LayoutServicelayoutContext - The layout-context of which the report is required.
AttributeSetpublic void addProgressListener(ProgressListener progresslistener)
LayoutService
addProgressListener in interface LayoutServiceprogresslistener - a ProgressListenerpublic void removeProgressListener(ProgressListener progresslistener)
LayoutService
removeProgressListener in interface LayoutServiceprogresslistener - the ProgressListener that is
to be removed.public boolean setDefaultLayoutContext(java.lang.String defaultLayoutContext)
LayoutServiceLayoutable.getLayoutContext().
setDefaultLayoutContext in interface LayoutServicedefaultLayoutContext - The layout context which is to be used.
public boolean layout(java.util.List visualObjects,
java.lang.String nodeLayoutContext,
java.lang.String edgeLayoutContext)
LayoutServiceviusalGraph.
Note:: This method calls LayoutService.layoutEdges(List, String, String)
internally.
layout in interface LayoutServicevisualObjects - The list of VisualNode
and VisualEdge that should be arranged.nodeLayoutContext - The node layout-context that should be used.edgeLayoutContext - The edge layout-context that should be used.
LayoutService.getErrorMessage()
could be used to obtain details about the error.
public boolean layout(VisualGraphObjectContainer visualgraph,
java.lang.String nodeLayoutContext,
java.lang.String edgeLayoutContext)
LayoutServiceviusalGraph.
Note: This method calls LayoutService.layoutEdges(VisualGraphObjectContainer, String, String)
internally.
layout in interface LayoutServicevisualgraph - The VisualGraph that should be arranged.nodeLayoutContext - The layout-context that should be used to layout nodes.edgeLayoutContext - The layout-context that should be used to layout edges.
LayoutService.getErrorMessage()
could be used to obtain details about the error.public void keepCurrentEdgesRoute(LayoutableEdge edge)
LayoutService
keepCurrentEdgesRoute in interface LayoutServiceedge - the edge of which the current route is to be considered.public void internalRegisterEdge(VisualEdge vedge)
vedge - the edge of which the path is to be recovered.public void internalLoadEdgePoints(VisualEdge vedge)
vedge - the edge of which the path is to be recovered.public static final char edgetypeToChar(int edgetype)
edgetype - the edge type constant to convert
public static final java.lang.String coordsToStr(Coordinate[] coords,
char type)
string.
It is used for internal purpose.
coords - the coordinate array that should be converted.type - specifies the type of the edge.
public static final char strToType(java.lang.String str)
string and returns
the type of the stored data. It is used for internal purpose.
str - the data string.
public static final Coordinate[] strToCoords(java.lang.String str)
string into a Coordinate
array. It is used for internal purpose.
str - the string that should be converted.
Coordinate array.
public boolean layoutEdges(VisualGraphObjectContainer visualgraph,
java.lang.String edgelayoutContext,
java.lang.String nodelayoutContext)
LayoutServiceviusalGraph.
layoutEdges in interface LayoutServicevisualgraph - The VisualGraph of which the edges should be arranged.edgelayoutContext - The layout-context that should be used to arrange edge of the graph.nodelayoutContext - The layout-context that should be used to arrange nodes of the graph.
The layout-context must associate with a Edge layouter.
LayoutService.getErrorMessage()
could be used to obtain details about the error.
public boolean layoutEdges(java.util.List visualObjects,
java.lang.String edgelayoutContext,
java.lang.String nodelayoutContext)
LayoutService
layoutEdges in interface LayoutServicevisualObjects - The list of nodes and edges of the graphedgelayoutContext - The layout-context that should be used to arrange edge of the graph.nodelayoutContext - The layout-context that should be used to arrange nodes of the graph.
LayoutService.getErrorMessage()
could be used to obtain details about the error.public void setPercentage(double value)
LayoutProgress
setPercentage in interface LayoutProgressvalue - The value of progress bar. It
must be between 0.0 and 100.0
public boolean setLayoutAttribute(java.lang.String layoutContext,
java.lang.String name,
java.lang.Object value)
LayoutServicevalue of an attribute
specified by layout-context and key.
setLayoutAttribute in interface LayoutServicelayoutContext - The layout context which attribute is to
be changed.name - The name of attribute which is to be set.value - The new value of the attribute specified by key
LayoutService.setLayoutAttributeSet(String, AttributeSet)
public java.lang.Object getLayoutAttribute(java.lang.String layoutContext,
java.lang.String key)
LayoutServicekey and the layout-context.
getLayoutAttribute in interface LayoutServicelayoutContext - The layout context of target layoutkey - The name of the target attribute.
LayoutService.getLayoutAttributeSet(String)public java.lang.Object getAttribute(java.lang.String name)
LayoutServiceLayoutService.
Note: This Attributes are global and have an effect of all
layout-context. To obtain the attributes of a layout instance, use
LayoutService.getLayoutAttribute(String, String);
getAttribute in interface LayoutServicename - The name of the target attribute.
key.LayoutService.getAttribute(),
AttributeSet
public void setAttribute(java.lang.String name,
java.lang.Object value)
LayoutServiceLayoutService.
Note: This Attributes are global and have an effect of all
layout-context. To set change the attributes of a layouter
use LayoutService.setLayoutAttribute(String, String, Object);
setAttribute in interface LayoutServicename - The name of the attribute which is to be set.value - The new value of the specified attribute.LayoutService.setAttribute(AttributeSet)public AttributeSet getAttribute()
LayoutServiceLayoutService.
Note: This Attributes are global and have an effect of all
layout-context. To obtain the attributes of a layouter use
LayoutService.getLayoutAttributeSet(String);
getAttribute in interface LayoutServiceAttributeSet of LayoutServiceLayoutService.getAttribute(String)public void setAttribute(AttributeSet attributeSet)
LayoutServiceAttributes are global and have an effect of all
layout-context. To obtain the attributes of a layouter use
LayoutService.setLayoutAttributeSet(String, AttributeSet);
setAttribute in interface LayoutServiceattributeSet - The AttributeSet that is to be used.LayoutService.setAttribute(String, Object)public void init()
LayoutService
init in interface LayoutServicepublic AttributeSet getConfiguration(java.lang.String[] listOfLayoutContexts)
LayoutServicelistOfLayoutContexts.
It may be used to obtain attributes of a set of layout contexts with
the view of saving of the current state of the layout contexts and the
LayoutService.
The Atribute tree has following structure:
LayoutConfiguration (Attr)
+--- Global attributes (Attr)
|
+---- Layout Contexts (Attr)
|
+---- Context
| |--- Base Layouter (string)
| |--- Attributes (Attr)
+----- Context
| |--- Base Layouter (string)
| |--- Attributes (Attr)
+----- ........
getConfiguration in interface LayoutServicelistOfLayoutContexts - the list of the requested layout contexts, or
null if the configuration of all registered layout contexts is required.
AttributeSet.LayoutService.setConfiguration(AttributeSet)public void setConfiguration(AttributeSet allAttributes)
LayoutServiceAttributeSet to configure the
layout contexts and the LayouService itself.
Note: The LayoutService creates a new layout-context
automatically if a layout-context was saved but not existing
at the loading time.
setConfiguration in interface LayoutServiceallAttributes - The attribute set that contains the global options
and the attributes of each layout context.LayoutService.getConfiguration(String[])
public static boolean mergeAttributes(AttributeSet current,
AttributeSet updated,
boolean addMissing)
AttributeSet
current with the values in updated. Both sets must have
the same hierarchical structure, but in the AttributeSet
updated some (or all) attributes can be omitted.
This method will recurse into nested AttributeSets.
current - The current AttributeSetupdated - The new attribute values to store in currentaddMissing - true, to add attributes from updated when they
are missing in current
AttributeSet
current has been changed
public void updateLayoutAttributeSet(java.lang.String layoutContext,
AttributeSet layoutAttribute)
LayoutService
A tree layouter for example may change the attribute
layer distance to radius if the user changes
the arrangement type from plan to radial.
updateLayoutAttributeSet in interface LayoutServicelayoutContext - The according layout contextlayoutAttribute - The attribute-Set which should be updatedpublic void onBeginLayout()
LayoutService
onBeginLayout in interface LayoutServicepublic void onEndLayout()
LayoutService
onEndLayout in interface LayoutServicepublic java.lang.String getBaseLayoutEngine(java.lang.String layoutContext)
LayoutService
getBaseLayoutEngine in interface LayoutServicelayoutContext - the layout context of which the base layouter is requested.
base layouter with which the specified
layoutContext associates. The return value is null if the specified
layoutContext is not valid.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||