Class ForceDirectedLayoutWrapper
java.lang.Object
org.graffiti.plugin.algorithm.ThreadSafeAlgorithm
org.vanted.plugins.layout.multilevelframework.ForceDirectedLayoutWrapper
- All Implemented Interfaces:
Algorithm
public class ForceDirectedLayoutWrapper extends ThreadSafeAlgorithm
Wrapper class to enable usage of the PatternspringEmbedder (a.k.a. force-directed layout)
provided in the VANTED core as part of the Multilevel Framework.
This class provides two things:
- It waits for the layouting to finish before returning in the execute method (busy waiting). Otherwise, the multilevel framework would proceed to placing the next level with an unfinished layout as input.
- it makes all relevant Parameters of the available, some of which are not included in getParameters()/setParameters() in the original PatternspringEmbedder.
- See Also:
LayoutAlgorithmWrapper.layoutAlgWhitelist
-
Constructor Summary
Constructors Constructor Description ForceDirectedLayoutWrapper()
-
Method Summary
Modifier and Type Method Description void
attach(Graph g, Selection s)
Attaches the given graph to this algorithm.void
check()
Checks whether all preconditions of the current graph are satisfied.void
execute()
Executes the whole algorithm.void
executeThreadSafe(ThreadSafeOptions options)
ActionEvent
getActionEvent()
String
getCategory()
Returns the category an algorithm should assigned to.String
getDescription()
String
getMenuCategory()
Returns a path to a menu category.String
getName()
Returns the name (ID) of the algorithm.Parameter[]
getParameters()
Returns a list ofParameter
that are set for this algorithm.Set<Category>
getSetCategory()
Returns a set of categories to classify this algorithm .boolean
isLayoutAlgorithm()
A LayoutAlgorithm should return true.void
reset()
Resets the internal state of the algorithm.void
resetDataCache(ThreadSafeOptions options)
void
setActionEvent(ActionEvent a)
boolean
setControlInterface(ThreadSafeOptions options, JComponent jc)
DOCUMENT ME!void
setParameters(Parameter[] params)
Sets the parameters for this algorithm.Methods inherited from class org.graffiti.plugin.algorithm.ThreadSafeAlgorithm
getAcceleratorKeyStroke, mayWorkOnMultipleGraphs, showMenuIcon
-
Constructor Details
-
ForceDirectedLayoutWrapper
public ForceDirectedLayoutWrapper()
-
-
Method Details
-
getName
Description copied from interface:Algorithm
Returns the name (ID) of the algorithm.- Returns:
- DOCUMENT ME!
-
execute
public void execute()Description copied from interface:Algorithm
Executes the whole algorithm. -
getParameters
Description copied from interface:Algorithm
Returns a list ofParameter
that are set for this algorithm.- Returns:
- a collection of
Parameter
that are needed by theAlgorithm
.
-
setParameters
Description copied from interface:Algorithm
Sets the parameters for this algorithm. Must have the same types and order as the array returned bygetParameter
. -
attach
Description copied from interface:Algorithm
Attaches the given graph to this algorithm. A ttaches the given Selection information to the algorithm.- Parameters:
g
- the graph to attach.s
- the selection to attach.
-
check
Description copied from interface:Algorithm
Checks whether all preconditions of the current graph are satisfied.- Throws:
PreconditionException
- if the preconditions of the current graph are not satisfied.
-
reset
public void reset()Description copied from interface:Algorithm
Resets the internal state of the algorithm. -
getCategory
Description copied from interface:Algorithm
Returns the category an algorithm should assigned to. Return NULL if the algorithm should be sorted directly in the plugin menu.- Returns:
- The category an algorithm should assigned to.
-
getSetCategory
Description copied from interface:Algorithm
Returns a set of categories to classify this algorithm . e.g. return new HashSet(Arrays.asList( Category.GRAPH, Category.NODE )); is an algorithm, working on graphs and more specific on nodes - Returns:
- Set of Category Enums that classify this algorithm.
-
getMenuCategory
Description copied from interface:Algorithm
Returns a path to a menu category. This is s '.' separated string which reflects the position of this Algorithm in the Menu Hierarchy e.g. "Network.Layout" would put this algorithm in the menu 'Network' and its submenu 'Layout' If this menu is not existent it will be created If this method returns 'null' the algorithm will not appear in the menu- Returns:
-
isLayoutAlgorithm
public boolean isLayoutAlgorithm()Description copied from interface:Algorithm
A LayoutAlgorithm should return true. All other types of algorithms should return false.- Returns:
-
getDescription
-
getActionEvent
-
setActionEvent
-
setControlInterface
Description copied from class:ThreadSafeAlgorithm
DOCUMENT ME!- Specified by:
setControlInterface
in classThreadSafeAlgorithm
- Returns:
- true, if an GUI was set, false if no interface is needed
-
executeThreadSafe
- Specified by:
executeThreadSafe
in classThreadSafeAlgorithm
-
resetDataCache
- Specified by:
resetDataCache
in classThreadSafeAlgorithm
-