yfiles.client.tiles.HierarchyManager
Class HierarchyManager

This class adds support for nesting using group and folder nodes to a graph.

 
Constructor Summary
HierarchyManager(/*Graph*/ graph)
           This class adds support for nesting using group and folder nodes to a graph.
 
Method Summary
  closeGroup(/*String*/ groupNodeId)
          converts the group node with the given id into a folder node.
  createGroup(/*Object*/ args)
          returns a newly created group node according to the given arguments.
 Graph getGraph()
          returns the graph managed by this instance.
 String[] getNodes(/*Object*/ args)
          returns node ids according to the criteria defined in the arguments object.
 String getParent(/*String*/ nodeId)
          returns the id of the parent node of the node with the given id.
 String getVisibleGraphParent()
          returns the id of parent node for the currently visible graph or null.
 Boolean isFolderNode(/*String*/ nodeId)
          returns true, if the node with the given id is a folder node.
 Boolean isGroupNode(/*String*/ nodeId)
          returns true, if the node with the given id is a group node.
 Boolean isInStateLabelBox(/*String*/ nodeId, /*Number*/ x, /*Number*/ y)
          returns true, if (x,y) in world coordinates is inside the bounds of the state label of the group or folder node with the given id.
 Boolean isNormalNode(/*String*/ nodeId)
          returns true, if the node with the given id is neither a group nor a folder node.
  moveToParent(/*String[]*/ subNodeIds)
          Conveniance method that moves all given nodes a hierarchy level up, if possible.
  moveToSubgraph(/*String[]*/ subNodeIds, /*String?*/ parentNodeId)
          assigns the nodes with the given subNodeIds to the group node with the given parentNodeId.
  onCloseGroup(/*String*/ id, /*Object*/ newBounds)
          is called if a group node was successfully closed, i.e. converted to a folder node.
  onCloseGroupFailed(/*String*/ name, /*String*/ id)
          is called if closing a group node failed.
  onCreateGroup(/*String*/ id, /*Object*/ newBounds, /*String*/ name)
          is called, if a new group node was successfully created.
  onCreateGroupFailed(/*String*/ name)
          is called, if the creation of a new group node failed.
  onMoveToParent(/*String*/ parentNodeId, /*Object*/ newBounds, /*String[]*/ subNodeIds)
          is called if the nodes with the given ids were successfully moved to the parent graph of the current graph.
  onMoveToParentFailed(/*String*/ name, /*String[]*/ subNodeIds)
          is called if moving the nodes with the given ids to the parent graph of the current graph failed.
  onMoveToSubgraph(/*String*/ parentNodeId, /*Object*/ newBounds, /*String[]*/ subNodeIds)
          is called if the nodes with the given ids were successfully moved to the subgraph of the node with the given parentNodeId.
  onMoveToSubgraphFailed(/*String*/ name, /*String*/ parentNodeId, /*String[]*/ subNodeIds)
          is called if moving the nodes with the given ids to the subgraph of the node with the given parentNodeId failed.
  onNewHierarchyInfo(/*String*/ name)
          is called, if new info on the nesting structure of the graph is available.
  onOpenGroup(/*String*/ id, /*Object*/ newBounds)
          is called if a folder node was successfully opened, i.e. converted to a group node.
  onOpenGroupFailed(/*String*/ name, /*String*/ id)
          is called if opening a folder node failed.
  onSwitchToParent(/*String*/ id, /*Object*/ newBounds)
          is called if the graph was successfully switched to its parent graph.
  onSwitchToParentFailed(/*String*/ name)
          is called if switching the graph to its parent graph failed.
  onSwitchToSubgraph(/*String*/ id, /*Object*/ newBounds)
          is called if the graph was successfully switched to a subgraph.
  onSwitchToSubgraphFailed(/*String*/ name, /*String*/ id)
          is called if switching the graph to a subgraph failed.
  openGroup(/*String*/ groupNodeId)
          converts the folder node with the given id into a group node.
  refresh()
          refreshes the cached hierarchy information by means of a server call.
  switchToParent()
          returns to the parent of the current subgraph.
  switchToSubgraph(/*String?*/ parentNodeId)
          enters the subgraph (group or folder) of the node with the given id.
 
Constructor Detail

HierarchyManager

HierarchyManager(/*Graph*/ graph)
This class adds support for nesting using group and folder nodes to a graph.
Parameters:
graph - the graph to be used for grouping and folding
Method Detail

closeGroup

closeGroup(/*String*/ groupNodeId)
converts the group node with the given id into a folder node.

createGroup

createGroup(/*Object*/ args)
returns a newly created group node according to the given arguments. The following arguments are recognized.
x -> x coordinate of the center of the new node (in world coordinates, default 0)
y -> y coordinate of the center of the new node (in world coordinates, default 0)
closed -> if true, create a closed group node (folder),
if false create an open group node (default)
type -> name of the node realizer to use (String, optional)
subNodeIds -> the corresponding nodes become part of the new group (String[], optional)
parentNodeId -> id of the parent group or folder node for the new group node,
if null and no subnode ids are given use the currently visible subgraph,
if null and subnode ids are given, their nearest common ancestor becomes the parent
of the new group (String, optional)

getGraph

Graph getGraph()
returns the graph managed by this instance.

getNodes

String[] getNodes(/*Object*/ args)
returns node ids according to the criteria defined in the arguments object. Recognized keys in the given arguments object are the following.
excludeNormalNodes -> do not return normal nodes (default false)
excludeFolderNodes -> do not return folder nodes (default false)
excludeGroupNodes  -> do not return group nodes (default false)
onlyChildrenOf     -> only return children of the given node (String, optional)

getParent

String getParent(/*String*/ nodeId)
returns the id of the parent node of the node with the given id.

getVisibleGraphParent

String getVisibleGraphParent()
returns the id of parent node for the currently visible graph or null. null is returned, if the currently visible graph is the root graph.

isFolderNode

Boolean isFolderNode(/*String*/ nodeId)
returns true, if the node with the given id is a folder node.

isGroupNode

Boolean isGroupNode(/*String*/ nodeId)
returns true, if the node with the given id is a group node.

isInStateLabelBox

Boolean isInStateLabelBox(/*String*/ nodeId, /*Number*/ x, /*Number*/ y)
returns true, if (x,y) in world coordinates is inside the bounds of the state label of the group or folder node with the given id.

isNormalNode

Boolean isNormalNode(/*String*/ nodeId)
returns true, if the node with the given id is neither a group nor a folder node.

moveToParent

moveToParent(/*String[]*/ subNodeIds)
Conveniance method that moves all given nodes a hierarchy level up, if possible.

moveToSubgraph

moveToSubgraph(/*String[]*/ subNodeIds, /*String?*/ parentNodeId)
assigns the nodes with the given subNodeIds to the group node with the given parentNodeId. The group node can be either open or closed (folder). Invoking this method makes the group node the nearest common ancestor of the given nodes. The hierarchical structure of the given nodes will be kept by the operation, i.e if one of the given nodes is the parent of another given node then this relation will not be changed.

onCloseGroup

onCloseGroup(/*String*/ id, /*Object*/ newBounds)
is called if a group node was successfully closed, i.e. converted to a folder node.
Parameters:
id - id of the new folder node
newBounds - new bounds of the graph

onCloseGroupFailed

onCloseGroupFailed(/*String*/ name, /*String*/ id)
is called if closing a group node failed.
Parameters:
name - symbolic name of the graph
id - id the node, which was not closed

onCreateGroup

onCreateGroup(/*String*/ id, /*Object*/ newBounds, /*String*/ name)
is called, if a new group node was successfully created.
Parameters:
id - id of the new node
newBounds - new bounds of the graph
name - symbolic name of the graph

onCreateGroupFailed

onCreateGroupFailed(/*String*/ name)
is called, if the creation of a new group node failed.
Parameters:
name - symbolic name of the graph

onMoveToParent

onMoveToParent(/*String*/ parentNodeId, /*Object*/ newBounds, /*String[]*/ subNodeIds)
is called if the nodes with the given ids were successfully moved to the parent graph of the current graph.
Parameters:
parentNodeId - id of the parent node of the new graph, null for the root graph
newBounds - bounds of the parent graph
subNodeIds - ids of the nodes which were moved

onMoveToParentFailed

onMoveToParentFailed(/*String*/ name, /*String[]*/ subNodeIds)
is called if moving the nodes with the given ids to the parent graph of the current graph failed.
Parameters:
name - symbolic name of the graph
subNodeIds - ids of the nodes which were requested to be moved

onMoveToSubgraph

onMoveToSubgraph(/*String*/ parentNodeId, /*Object*/ newBounds, /*String[]*/ subNodeIds)
is called if the nodes with the given ids were successfully moved to the subgraph of the node with the given parentNodeId.
Parameters:
parentNodeId - id of the parent node of the new graph, null for the root graph
newBounds - bounds of the parent graph
subNodeIds - ids of the nodes which were moved

onMoveToSubgraphFailed

onMoveToSubgraphFailed(/*String*/ name, /*String*/ parentNodeId, /*String[]*/ subNodeIds)
is called if moving the nodes with the given ids to the subgraph of the node with the given parentNodeId failed.
Parameters:
name - symbolic name of the graph newBounds: bounds of the parent graph
subNodeIds - ids of the nodes which were requested to be moved

onNewHierarchyInfo

onNewHierarchyInfo(/*String*/ name)
is called, if new info on the nesting structure of the graph is available.
Parameters:
name - symbolic name of the graph

onOpenGroup

onOpenGroup(/*String*/ id, /*Object*/ newBounds)
is called if a folder node was successfully opened, i.e. converted to a group node.
Parameters:
id - id of the new group node
newBounds - new bounds of the graph

onOpenGroupFailed

onOpenGroupFailed(/*String*/ name, /*String*/ id)
is called if opening a folder node failed.
Parameters:
name - symbolic name of the graph
id - id the node, which was not opened

onSwitchToParent

onSwitchToParent(/*String*/ id, /*Object*/ newBounds)
is called if the graph was successfully switched to its parent graph.
Parameters:
id - id of the parent node of the new graph
newBounds - bounds of the parent graph

onSwitchToParentFailed

onSwitchToParentFailed(/*String*/ name)
is called if switching the graph to its parent graph failed.
Parameters:
name - symbolic name of the graph

onSwitchToSubgraph

onSwitchToSubgraph(/*String*/ id, /*Object*/ newBounds)
is called if the graph was successfully switched to a subgraph.
Parameters:
id - id of the parent node of the subgraph, null for the root graph
newBounds - bounds of the switched graph

onSwitchToSubgraphFailed

onSwitchToSubgraphFailed(/*String*/ name, /*String*/ id)
is called if switching the graph to a subgraph failed.
Parameters:
name - symbolic name of the graph
id - id the parent node of the subgraph, to which switching failed

openGroup

openGroup(/*String*/ groupNodeId)
converts the folder node with the given id into a group node.

refresh

refresh()
refreshes the cached hierarchy information by means of a server call.

switchToParent

switchToParent()
returns to the parent of the current subgraph. The view information of the graph is adapted and subsequent calls act on the paren graph (see switchToSubgraph).

switchToSubgraph

switchToSubgraph(/*String?*/ parentNodeId)
enters the subgraph (group or folder) of the node with the given id. The view information of the graph is adapted and subsequent calls act on the subgraph, e.g., createNode calls create nodes in the subgraph. If no
Parameters:
parentNodeId - is given, then the graph is switched to its top level. If the parent node is a group node, it is converted to a folder node, since yFiles only supports switching to the contents of a folder node or the root graph.

Copyright © 2006-2008 yWorks GmbH. All rights reserved.