com.tensegrity.graph.layout
Class GraphLayoutService

java.lang.Object
  extended bycom.tensegrity.graph.layout.GraphLayoutService
All Implemented Interfaces:
LayoutProgress, LayoutService

public class GraphLayoutService
extends java.lang.Object
implements LayoutService, LayoutProgress

This class is an implementation of LayoutService.

Version:
$Id: GraphLayoutService.java,v 1.247 2006/05/10 20:03:07 SharokhKhani Exp $
Author:
SharokhKhani

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 astring.
 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

X_POSITION

public static final java.lang.String X_POSITION
Specifies the left position of the graph bounding box after arranging.

See Also:
Constant Field Values

Y_POSITION

public static final java.lang.String Y_POSITION
Specifies the top position of the graph bounding box after arranging.

See Also:
Constant Field Values

LAYOUT_EDGE_CONTEXT_AWARE

public static final 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.
Node: The according layouter recognizes the structure of the graphs which they have to be arranged, so they are normally able to route edges better than a universal default edge layouter.
The disadvantage of this proceedings is that the edges can be routed appropriately only if the graph is arranged as whole, i.e. arranging of nodes and edges on the same work process. As a result this proceeding is often not suitable if the user is allowed to move the nodes position.
Using of an universal 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.

See Also:
Constant Field Values

IGNORE_ISOLATED_NODES

public static final java.lang.String IGNORE_ISOLATED_NODES
Specifies whether the unconnected nodes are to be ignored.

See Also:
Constant Field Values

AUTO_EDGE_REASSIGNMENT

public static final java.lang.String AUTO_EDGE_REASSIGNMENT
Specifies whether the automatic port reassignment is active.

See Also:
Constant Field Values

AUTO_EDGE_REASSIGNMENT_DIRECTIONDEPENDENT

public static final java.lang.String AUTO_EDGE_REASSIGNMENT_DIRECTIONDEPENDENT
Specifies whether the according layouter are allowed to reassign ports to achieve an optimal routing of edges.

See Also:
Constant Field Values

LAYOUT_EDGE_ALWAYS_KEEP_EDGE_ROUTE

public static final 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.

See Also:
Constant Field Values

SERVICE_ATTRIBUTES

public static final java.lang.String SERVICE_ATTRIBUTES
XML tag for global properties.

See Also:
Constant Field Values

LAYOUT_CONTEXTS

public static final java.lang.String LAYOUT_CONTEXTS
XML tag for the layout contexts.

See Also:
Constant Field Values

BASE_LAYOUT_ENGINE

public static final java.lang.String BASE_LAYOUT_ENGINE
XML tag to for the base layouter.

See Also:
Constant Field Values

LAYOUT_ATTRIBUTES

public static final java.lang.String LAYOUT_ATTRIBUTES
XML tag for attributes.

See Also:
Constant Field Values

PREFERREDCOORDS

public static final java.lang.String PREFERREDCOORDS
preferred edge coordinates for this edge.

See Also:
Constant Field Values

border

public Boundary border
The border of the area that is to be considered. An edge layouter takes this into consideration and keeps edges inside this border

Constructor Detail

GraphLayoutService

public GraphLayoutService()
Constructs a new layout service instance with default settings.

Method Detail

registerLayoutEngine

public boolean registerLayoutEngine(NodeLayout newLyoutEngine)
Description copied from interface: LayoutService
This method may be used to add a new layouter into the layout pool. A layouter must implement the interface Layout.

Specified by:
registerLayoutEngine in interface LayoutService
Parameters:
newLyoutEngine - A new layouter.
Returns:
Returns true if the registering was successful.

registerLayoutEngine

public boolean registerLayoutEngine(EdgeLayout newLyoutEngine)
Description copied from interface: LayoutService
This method may be used to add a new edge layouter into the layout pool. An edge layouter must implement the interface EdgeLayout.

Specified by:
registerLayoutEngine in interface LayoutService
Parameters:
newLyoutEngine - A new edge layouter.
Returns:
Returns true if the registering was successful.
See Also:
LayoutService.registerLayoutEngine(EdgeLayout)

getNodeLayoutEngineList

public java.lang.String[] getNodeLayoutEngineList()
Description copied from interface: LayoutService
Returns an array of registered layouter.

Specified by:
getNodeLayoutEngineList in interface LayoutService
Returns:
a String array of registered layouter.

getEdgeLayoutEngineList

public java.lang.String[] getEdgeLayoutEngineList()
Description copied from interface: LayoutService
This method returns the list of registered edge layouter.

Specified by:
getEdgeLayoutEngineList in interface LayoutService
Returns:
Returns string array of registered edge layouter.

getLayoutContextList

public java.lang.String[] getLayoutContextList(java.lang.String layoutEngine)
Description copied from interface: LayoutService
This method returns array of layout-contexts that are associated with the specified basicLayoutEngine.

Specified by:
getLayoutContextList in interface LayoutService
Parameters:
layoutEngine - The basic Layout of which the derived layout contexts is requested.
Returns:
an array containing the derived layout contexts.

addLayoutContext

public boolean addLayoutContext(java.lang.String layoutName,
                                java.lang.String layoutContext)
Description copied from interface: LayoutService
Creates a new layout-context and add it into the pool of the layout-contexts. Note: The new layout-context must be unique. You can use LayoutService.isValidLayoutContext(String) to check whether the new name already exists.

Specified by:
addLayoutContext in interface LayoutService
Parameters:
layoutName - The name of basic NodeLayout or EdgeLayout.
layoutContext - The name for the new layout context
Returns:
Returns true if the function was successful or false if the name of the new layout context already exists or the specified basicEngine was not valid.
See Also:
LayoutService.registerLayoutEngine(NodeLayout)

isValidLayoutContext

public boolean isValidLayoutContext(java.lang.String layoutContext)
Description copied from interface: LayoutService
Verifies whether the specified layout-context is valid.

Specified by:
isValidLayoutContext in interface LayoutService
Parameters:
layoutContext - layout-context that is to be checked
Returns:
true if the specified layout-context is valid, otherwise false.

duplicateLayoutContext

public AttributeSet duplicateLayoutContext(java.lang.String templateLayoutContext,
                                           java.lang.String newLayoutContext)
Description copied from interface: LayoutService
Creates a copy from the layout-context specified by templateLayoutContext and adds it into the pool of .

Specified by:
duplicateLayoutContext in interface LayoutService
Parameters:
templateLayoutContext - The source layout-context
newLayoutContext - The name for the new copy of templateLayoutContext
Returns:
Returns the attribute set of the new layout-context

removeLayoutContext

public boolean removeLayoutContext(java.lang.String layoutContext)
Description copied from interface: LayoutService
Removes the specified layout-context

Specified by:
removeLayoutContext in interface LayoutService
Parameters:
layoutContext - The layout-contextto be removed
Returns:
Returns true if the function was successful.

getLayoutContextList

public java.lang.String[] getLayoutContextList()
Description copied from interface: LayoutService
This method returns the list of all defined node and edge layout-contexts.

Specified by:
getLayoutContextList in interface LayoutService
Returns:
a string array which contains a list of layout-contexts.

getNodeLayoutContextList

public java.lang.String[] getNodeLayoutContextList()
Description copied from interface: LayoutService
This method returns the list of all defined node layout-contexts.

Specified by:
getNodeLayoutContextList in interface LayoutService
Returns:
Returns a string array which contains a list of layout-contexts.

getEdgeLayoutContextList

public java.lang.String[] getEdgeLayoutContextList()
Description copied from interface: LayoutService
This method returns the list of all defined edge layout-contexts.

Specified by:
getEdgeLayoutContextList in interface LayoutService
Returns:
a String array which contains a list of layout-contexts.

getLayoutAttributeSet

public AttributeSet getLayoutAttributeSet(java.lang.String layoutContext)
Description copied from interface: LayoutService
Returns the attribute-set of the specified layout-context.

Specified by:
getLayoutAttributeSet in interface LayoutService
Parameters:
layoutContext - layout-context of which the attribute set is required.
Returns:
Returns the attribute-set of specified layout-context.
See Also:
LayoutService.setLayoutAttribute(String, String, Object), AttributeSet

setLayoutAttributeSet

public boolean setLayoutAttributeSet(java.lang.String layoutContext,
                                     AttributeSet attributeSet)
Description copied from interface: LayoutService
Returns the attribute-set of the layout context specified by layout-context. Note: the LayoutService 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.

Specified by:
setLayoutAttributeSet in interface LayoutService
Parameters:
layoutContext - layout-context of which the attribute set is to be set.
attributeSet - The new AttributeSet
Returns:
Returns true if the setting of attributes was successful.
See Also:
LayoutService.setLayoutAttribute(String, String, Object), AttributeSet

getNodeDefaultLayoutAttributes

public AttributeSet getNodeDefaultLayoutAttributes(java.lang.String layoutContext)
Description copied from interface: LayoutService
This method returns the default node attributes of specified layout-context. Note: The default node attributes are not to be confused with layout attributes which can set by LayoutService.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.

Specified by:
getNodeDefaultLayoutAttributes in interface LayoutService
Parameters:
layoutContext - specifies the target layout context.
Returns:
Returns the default AttributeSet. It may be null since some layouter does not offer special attributes for nodes.

getEdgeDefaultLayoutAttributes

public AttributeSet getEdgeDefaultLayoutAttributes(java.lang.String layoutContext)
Description copied from interface: LayoutService
This method returns the default edge attributes of specified layout-context. Note: The default edge attributes are not to be confused with layout attributes which can set by LayoutService.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.

Specified by:
getEdgeDefaultLayoutAttributes in interface LayoutService
Parameters:
layoutContext - specifies the target layout context
Returns:
the default AttributeSet. It may be null since some layouter does not offer special attributes for nodes.

error

public boolean error()
Description copied from interface: LayoutService
Returns true if an error has occurred; otherwise false. Use method LayoutService.getErrorMessage() to obtain a description text about the last occurred error.

Specified by:
error in interface LayoutService
Returns:
true if an error has occurred; otherwise false.

getErrorMessage

public java.lang.String getErrorMessage()
Description copied from interface: LayoutService
Returns the error-message if an error has occurred. You can use LayoutService.error() to find out whether an error has occurred.

Specified by:
getErrorMessage in interface LayoutService
Returns:
the error description

getLayoutReport

public AttributeSet getLayoutReport(java.lang.String layoutContext)
Description copied from interface: LayoutService
This method submits a report about the last layout process. It provides detail information accordingly. A report contains typically the calculation durations of different processing steps.

Specified by:
getLayoutReport in interface LayoutService
Parameters:
layoutContext - The layout-context of which the report is required.
Returns:
Returns an attribute-set which contains the report. or null, if no report is available
See Also:
AttributeSet

addProgressListener

public void addProgressListener(ProgressListener progresslistener)
Description copied from interface: LayoutService
Adds a progress-listener. The progress bar will update during the layout process.

Specified by:
addProgressListener in interface LayoutService
Parameters:
progresslistener - a ProgressListener

removeProgressListener

public void removeProgressListener(ProgressListener progresslistener)
Description copied from interface: LayoutService
Removes the specified Progress-listener.

Specified by:
removeProgressListener in interface LayoutService
Parameters:
progresslistener - the ProgressListener that is to be removed.

setDefaultLayoutContext

public boolean setDefaultLayoutContext(java.lang.String defaultLayoutContext)
Description copied from interface: LayoutService
Sets the default layout context of the edges. The default layout context will be used to arrange edges without a specified layout context. Note: The layout context of edges can be set using Layoutable.getLayoutContext().

Specified by:
setDefaultLayoutContext in interface LayoutService
Parameters:
defaultLayoutContext - The layout context which is to be used.
Returns:
Returns true if the layout context was valid.

layout

public boolean layout(java.util.List visualObjects,
                      java.lang.String nodeLayoutContext,
                      java.lang.String edgeLayoutContext)
Description copied from interface: LayoutService
Applies layout on the nodes and edges of viusalGraph. Note:: This method calls LayoutService.layoutEdges(List, String, String) internally.

Specified by:
layout in interface LayoutService
Parameters:
visualObjects - 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.
Returns:
Returns true if the function was successful; otherwise false, in which case the method LayoutService.getErrorMessage() could be used to obtain details about the error.

layout

public boolean layout(VisualGraphObjectContainer visualgraph,
                      java.lang.String nodeLayoutContext,
                      java.lang.String edgeLayoutContext)
Description copied from interface: LayoutService
Applies layout on the graph specified by viusalGraph. Note: This method calls LayoutService.layoutEdges(VisualGraphObjectContainer, String, String) internally.

Specified by:
layout in interface LayoutService
Parameters:
visualgraph - 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.
Returns:
Returns true if the function was successful; otherwise false, in which case the method LayoutService.getErrorMessage() could be used to obtain details about the error.

keepCurrentEdgesRoute

public void keepCurrentEdgesRoute(LayoutableEdge edge)
Description copied from interface: LayoutService
Call this method to keep the current edge's route.

Specified by:
keepCurrentEdgesRoute in interface LayoutService
Parameters:
edge - the edge of which the current route is to be considered.

internalRegisterEdge

public void internalRegisterEdge(VisualEdge vedge)
This method registered the given edge at the associated edge-layout to ensure its proper use. This method should not be called directly by the client but by the framework internally.

Parameters:
vedge - the edge of which the path is to be recovered.

internalLoadEdgePoints

public 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. This method should not be called directly by the client but by the framework internally.

Parameters:
vedge - the edge of which the path is to be recovered.

edgetypeToChar

public static final char edgetypeToChar(int edgetype)
For internal use only.
This helper method converts the given edge type constant into a character.

Parameters:
edgetype - the edge type constant to convert
Returns:
char the converted edge type

coordsToStr

public static final java.lang.String coordsToStr(Coordinate[] coords,
                                                 char type)
This helper method converts a coordinate array into astring. It is used for internal purpose.

Parameters:
coords - the coordinate array that should be converted.
type - specifies the type of the edge.
Returns:
String the converted string.

strToType

public static final char strToType(java.lang.String str)
This helper method parses an input string and returns the type of the stored data. It is used for internal purpose.

Parameters:
str - the data string.
Returns:
the type of the data.

strToCoords

public static final Coordinate[] strToCoords(java.lang.String str)
This helper method converts a given string into a Coordinate array. It is used for internal purpose.

Parameters:
str - the string that should be converted.
Returns:
the Coordinate array.

layoutEdges

public boolean layoutEdges(VisualGraphObjectContainer visualgraph,
                           java.lang.String edgelayoutContext,
                           java.lang.String nodelayoutContext)
Description copied from interface: LayoutService
Applies layout on the edges of the graph specified by viusalGraph.

Specified by:
layoutEdges in interface LayoutService
Parameters:
visualgraph - 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.
Returns:
Returns true if the function was successful; otherwise false, in which case the method LayoutService.getErrorMessage() could be used to obtain details about the error.

layoutEdges

public boolean layoutEdges(java.util.List visualObjects,
                           java.lang.String edgelayoutContext,
                           java.lang.String nodelayoutContext)
Description copied from interface: LayoutService
Applies layout on the edges of the graph specified by objectList

Specified by:
layoutEdges in interface LayoutService
Parameters:
visualObjects - The list of nodes and edges of the graph
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.
Returns:
Returns true if the function was successful; otherwise false, in which case the method LayoutService.getErrorMessage() could be used to obtain details about the error.

setPercentage

public void setPercentage(double value)
Description copied from interface: LayoutProgress
Sets the percentage value of current progress

Specified by:
setPercentage in interface LayoutProgress
Parameters:
value - The value of progress bar. It must be between 0.0 and 100.0

setLayoutAttribute

public boolean setLayoutAttribute(java.lang.String layoutContext,
                                  java.lang.String name,
                                  java.lang.Object value)
Description copied from interface: LayoutService
This method may be used to change the value of an attribute specified by layout-context and key.

Specified by:
setLayoutAttribute in interface LayoutService
Parameters:
layoutContext - 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
Returns:
Returns true if the setting of attributes was successful.
See Also:
LayoutService.setLayoutAttributeSet(String, AttributeSet)

getLayoutAttribute

public java.lang.Object getLayoutAttribute(java.lang.String layoutContext,
                                           java.lang.String key)
Description copied from interface: LayoutService
Obtains the value of the attribute specified by key and the layout-context.

Specified by:
getLayoutAttribute in interface LayoutService
Parameters:
layoutContext - The layout context of target layout
key - The name of the target attribute.
Returns:
Returns the value of the specified attribute.
See Also:
LayoutService.getLayoutAttributeSet(String)

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Description copied from interface: LayoutService
This method may be used to obtain a specified attribute of the LayoutService. 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);

Specified by:
getAttribute in interface LayoutService
Parameters:
name - The name of the target attribute.
Returns:
Returns the value of attribute specified by key.
See Also:
LayoutService.getAttribute(), AttributeSet

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Description copied from interface: LayoutService
This method may be used to modify a specified attribute of the LayoutService. 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);

Specified by:
setAttribute in interface LayoutService
Parameters:
name - The name of the attribute which is to be set.
value - The new value of the specified attribute.
See Also:
LayoutService.setAttribute(AttributeSet)

getAttribute

public AttributeSet getAttribute()
Description copied from interface: LayoutService
This method gets the attribute-set of LayoutService. Note: This Attributes are global and have an effect of all layout-context. To obtain the attributes of a layouter use LayoutService.getLayoutAttributeSet(String);

Specified by:
getAttribute in interface LayoutService
Returns:
Returns the AttributeSet of LayoutService
See Also:
LayoutService.getAttribute(String)

setAttribute

public void setAttribute(AttributeSet attributeSet)
Description copied from interface: LayoutService
This method may be used to set the attribute-set for this object. Note: This Attributes are global and have an effect of all layout-context. To obtain the attributes of a layouter use LayoutService.setLayoutAttributeSet(String, AttributeSet);

Specified by:
setAttribute in interface LayoutService
Parameters:
attributeSet - The AttributeSet that is to be used.
See Also:
LayoutService.setAttribute(String, Object)

init

public void init()
Description copied from interface: LayoutService
Initializes the internal state of the layout Service.

Specified by:
init in interface LayoutService

getConfiguration

public AttributeSet getConfiguration(java.lang.String[] listOfLayoutContexts)
Description copied from interface: LayoutService
This method returns an attribute-set which contains attributes of all layout contexts specified by listOfLayoutContexts. 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)
+----- ........

Specified by:
getConfiguration in interface LayoutService
Parameters:
listOfLayoutContexts - the list of the requested layout contexts, or null if the configuration of all registered layout contexts is required.
Returns:
the AttributeSet.
See Also:
LayoutService.setConfiguration(AttributeSet)

setConfiguration

public void setConfiguration(AttributeSet allAttributes)
Description copied from interface: LayoutService
This method uses the given AttributeSet 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.

Specified by:
setConfiguration in interface LayoutService
Parameters:
allAttributes - The attribute set that contains the global options and the attributes of each layout context.
See Also:
LayoutService.getConfiguration(String[])

mergeAttributes

public static boolean mergeAttributes(AttributeSet current,
                                      AttributeSet updated,
                                      boolean addMissing)
Updates the attribute values in the given 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.

Parameters:
current - The current AttributeSet
updated - The new attribute values to store in current
addMissing - true, to add attributes from updated when they are missing in current
Returns:
true, if the given AttributeSet current has been changed

updateLayoutAttributeSet

public void updateLayoutAttributeSet(java.lang.String layoutContext,
                                     AttributeSet layoutAttribute)
Description copied from interface: LayoutService
This method updates a specified attributes-set with the view of consistency.

A tree layouter for example may change the attribute layer distance to radius if the user changes the arrangement type from plan to radial.

Specified by:
updateLayoutAttributeSet in interface LayoutService
Parameters:
layoutContext - The according layout context
layoutAttribute - The attribute-Set which should be updated

onBeginLayout

public void onBeginLayout()
Description copied from interface: LayoutService
Informs the layout service that the layout of a nested graph is beginning.

Specified by:
onBeginLayout in interface LayoutService

onEndLayout

public void onEndLayout()
Description copied from interface: LayoutService
Informs the layout service that the layout of a nested graph is finished.

Specified by:
onEndLayout in interface LayoutService

getBaseLayoutEngine

public java.lang.String getBaseLayoutEngine(java.lang.String layoutContext)
Description copied from interface: LayoutService
This method returns the base layouter of an specified layout-contexts.

Specified by:
getBaseLayoutEngine in interface LayoutService
Parameters:
layoutContext - the layout context of which the base layouter is requested.
Returns:
the base layouter with which the specified layoutContext associates. The return value is null if the specified layoutContext is not valid.


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.