Package adams.gui.goe
Class FlowHelper
- java.lang.Object
-
- adams.gui.goe.FlowHelper
-
public class FlowHelper extends Object
A helper class for flow-related queries.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description FlowHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<Node>
findCallableActorsHandler(Node parent)
Locates all nodes representingActorReferenceHandler
actors.static List<Node>
findCallableActorsHandler(Node parent, Class[] restrict)
Locates all nodes representingActorReferenceHandler
actors.static List<Node>
findCallableActorsHandler(Container cont)
Locates all nodes representingActorReferenceHandler
actors.protected static List<Node>
findNodes(Node parent, boolean up, HashSet<Class> restrict, Class type)
Locates all nodes representing the specified type of actors.static List<Node>
findNodes(Node parent, Class type)
Locates all nodes representing the specified type of actors.static List<Node>
findNodes(Node parent, Class[] restrict, Class type)
Locates all nodes representing the specified type of actors.static List<Node>
findNodes(Container cont, Class type)
Locates all nodes representing the specified type of actors.protected static boolean
findNodesMatch(Class type, HashSet<Class> restrict, Actor actor)
Checks whether the actor is a match for the type/restrictions.static List<Node>
findTopCallableActors(Node parent)
Locates all top nodes representing CallableActors actors.static List<Node>
findTopCallableActors(Container cont)
Locates all top nodes representing CallableActors actors.static List<Node>
findTopNodes(Node parent, Class type)
Locates all top nodes representing the specified type.static List<Node>
findTopNodes(Container cont, Class type)
Locates all top nodes representing CallableActors actors.static AbstractDatabaseConnection
getDatabaseConnection(Node parent, Class actorCls, AbstractDatabaseConnection defDbCon)
Returns the database connection that needs to be used in the GOE.protected static AbstractDatabaseConnection
getDatabaseConnection(Node parent, Class actorCls, AbstractDatabaseConnection defDbCon, boolean up)
Returns the database connection that needs to be used in the GOE.static AbstractDatabaseConnection
getDatabaseConnection(Container cont, Class actorCls, AbstractDatabaseConnection defDbCon)
Returns the database connection that needs to be used in the GOE.static Node
getEditedNode(Container cont)
Returns the node that is currently being edited.static Node
getEditedParent(Container cont)
Returns the parent of the node that is currently being edited or the node below a node is added.static Tree
getTree(Container cont)
Tries to obtain the current flow editor tree.static boolean
isFlowEdited(Container cont)
Checks whether a flow is currently being edited (in the flow editor).protected static boolean
isRestricted(Class actor, HashSet<Class> restrict)
Checks whether the actor is listed in the restricted classes (specific class or superclass/interface).
-
-
-
Method Detail
-
getTree
public static Tree getTree(Container cont)
Tries to obtain the current flow editor tree.- Parameters:
cont
- the container to start the search from- Returns:
- the tree, null if none found
-
isFlowEdited
public static boolean isFlowEdited(Container cont)
Checks whether a flow is currently being edited (in the flow editor).- Parameters:
cont
- the container to start the search from- Returns:
- true if a flow is being edited
-
getEditedParent
public static Node getEditedParent(Container cont)
Returns the parent of the node that is currently being edited or the node below a node is added.- Parameters:
cont
- the container to start the search from- Returns:
- the parent node, null if none being edited
-
getEditedNode
public static Node getEditedNode(Container cont)
Returns the node that is currently being edited.- Parameters:
cont
- the container to start the search from- Returns:
- the node, null if none being edited
-
getDatabaseConnection
public static AbstractDatabaseConnection getDatabaseConnection(Container cont, Class actorCls, AbstractDatabaseConnection defDbCon)
Returns the database connection that needs to be used in the GOE.- Parameters:
cont
- the container to start the search fromactorCls
- the database connection actor class to look fordefDbCon
- the default database connection if none found in tree- Returns:
- the database connection to be used
-
getDatabaseConnection
public static AbstractDatabaseConnection getDatabaseConnection(Node parent, Class actorCls, AbstractDatabaseConnection defDbCon)
Returns the database connection that needs to be used in the GOE.- Parameters:
parent
- the node to start the search fromactorCls
- the database connection actor class to look fordefDbCon
- the default database connection if none found in tree- Returns:
- the database connection to be used
-
getDatabaseConnection
protected static AbstractDatabaseConnection getDatabaseConnection(Node parent, Class actorCls, AbstractDatabaseConnection defDbCon, boolean up)
Returns the database connection that needs to be used in the GOE.- Parameters:
parent
- the node to start the search fromactorCls
- the database connection actor class to look fordefDbCon
- the default database connection if none found in treeup
- whether to go up in the actor tree- Returns:
- the database connection to be used
-
isRestricted
protected static boolean isRestricted(Class actor, HashSet<Class> restrict)
Checks whether the actor is listed in the restricted classes (specific class or superclass/interface).- Parameters:
actor
- the class to checkrestrict
- the restrictions if any- Returns:
- true if restricted
-
findCallableActorsHandler
public static List<Node> findCallableActorsHandler(Container cont)
Locates all nodes representingActorReferenceHandler
actors.- Parameters:
cont
- the container to start the search from- Returns:
- the nodes with
ActorReferenceHandler
found
-
findCallableActorsHandler
public static List<Node> findCallableActorsHandler(Node parent)
Locates all nodes representingActorReferenceHandler
actors.- Parameters:
parent
- the parent node- Returns:
- the nodes with
ActorReferenceHandler
found
-
findCallableActorsHandler
public static List<Node> findCallableActorsHandler(Node parent, Class[] restrict)
Locates all nodes representingActorReferenceHandler
actors.- Parameters:
parent
- the parent noderestrict
- the classes to restrict the results to- Returns:
- the nodes with
ActorReferenceHandler
found
-
findTopCallableActors
public static List<Node> findTopCallableActors(Container cont)
Locates all top nodes representing CallableActors actors.- Parameters:
cont
- the container to get the root node from- Returns:
- the nodes with CallableActors found
-
findTopCallableActors
public static List<Node> findTopCallableActors(Node parent)
Locates all top nodes representing CallableActors actors.- Parameters:
parent
- the parent node- Returns:
- the nodes with CallableActors found
-
findNodes
public static List<Node> findNodes(Container cont, Class type)
Locates all nodes representing the specified type of actors.- Parameters:
cont
- the container to start the search fromtype
- the type of actors to find- Returns:
- the nodes found
-
findNodes
public static List<Node> findNodes(Node parent, Class type)
Locates all nodes representing the specified type of actors.- Parameters:
parent
- the parent nodetype
- the type of actors to find- Returns:
- the nodes found
-
findNodes
public static List<Node> findNodes(Node parent, Class[] restrict, Class type)
Locates all nodes representing the specified type of actors.- Parameters:
parent
- the parent noderestrict
- the classes to restrict the results to- Returns:
- the nodes found
-
findNodesMatch
protected static boolean findNodesMatch(Class type, HashSet<Class> restrict, Actor actor)
Checks whether the actor is a match for the type/restrictions.- Parameters:
type
- the type the actor has to berestrict
- whether to restrict the classesactor
- the actor to check- Returns:
- true if a match
- See Also:
findNodes(Node, boolean, HashSet, Class)
-
findNodes
protected static List<Node> findNodes(Node parent, boolean up, HashSet<Class> restrict, Class type)
Locates all nodes representing the specified type of actors.- Parameters:
parent
- the parent nodeup
- whether to go up in the actor treerestrict
- the classes to restrict the results to, null if no restrictions- Returns:
- the nodes found
-
findTopNodes
public static List<Node> findTopNodes(Container cont, Class type)
Locates all top nodes representing CallableActors actors.- Parameters:
cont
- the container to get the root node fromtype
- the type of actor to locate- Returns:
- the nodes with CallableActors found
-
-