yfiles.client.tiles.HierarchyManager
Class HierarchyManager

Manages hierarchic graphs.

 
Constructor Summary
HierarchyManager(/*Graph*/ graph)
           This class adds support for nesting using group and folder nodes to a graph.
 
Method Summary
  closeGroup(/*String*/ groupNodeId, /*anything*/ customData)
          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, /*anything*/ customData)
          Conveniance method that moves all given nodes a hierarchy level up, if possible.
  moveToSubgraph(/*String[]*/ subNodeIds, /*String*/ parentNodeId, /*anything*/ customData)
          assigns the nodes with the given subNodeIds to the group node with the given parentNodeId.
  openGroup(/*String*/ groupNodeId, /*anything*/ customData)
          converts the folder node with the given id into a group node.
  refresh()
          refreshes the cached hierarchy information by means of a server call.
  setData(/*Object*/ hierarchyData)
          set the hierarchy data.
  switchToParent(/*anything*/ customData)
          returns to the parent of the current subgraph.
  switchToSubgraph(/*String*/ parentNodeId, /*anything*/ customData)
          enters the subgraph (group or folder) of the node with the given id.
 
Event Summary
  onCloseGroup(/*String*/ id, /*Object*/ newBounds, /*anything*/ customData)
          is called if a group node was successfully closed, i.e. converted to a folder node.
  onCloseGroupFailed(/*String*/ name, /*String*/ id, /*anything*/ customData)
          is called if closing a group node failed.
  onCreateGroup(/*String*/ id, /*Object*/ newBounds, /*String*/ name, /*anything*/ customData)
          is called, if a new group node was successfully created.
  onCreateGroupFailed(/*String*/ name, /*anything*/ customData)
          is called, if the creation of a new group node failed.
  onMoveToParent(/*String*/ parentNodeId, /*Object*/ newBounds, /*String[]*/ subNodeIds, /*anything*/ customData)
          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, /*anything*/ customData)
          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, /*anything*/ customData)
          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, /*anything*/ customData)
          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, /*anything*/ customData)
          is called if a folder node was successfully opened, i.e. converted to a group node.
  onOpenGroupFailed(/*String*/ name, /*String*/ id, /*anything*/ customData)
          is called if opening a folder node failed.
  onSwitchToParent(/*String*/ id, /*Object*/ newBounds, /*anything*/ customData)
          is called if the graph was successfully switched to its parent graph.
  onSwitchToParentFailed(/*String*/ name, /*anything*/ customData)
          is called if switching the graph to its parent graph failed.
  onSwitchToSubgraph(/*String*/ id, /*Object*/ newBounds, /*anything*/ customData)
          is called if the graph was successfully switched to a subgraph.
  onSwitchToSubgraphFailed(/*String*/ name, /*String*/ id, /*anything*/ customData)
          is called if switching the graph to a subgraph failed.
 
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, /*anything*/ customData)
converts the group node with the given id into a folder node.
The optional customData parameter is not sent to the server, but passed to the callback for the success or failure case.
Parameters:
groupNodeId - The id of the group node that should be converted into a folder node.
customData - Any data that should be passed forward to the onCloseGroup and onCloseGroupFailed callbacks.

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)
	customData -> optional parameter which is not sent to the server, but passed to the
	callback for the success or failure case.
	
Parameters:
args - An object that has any of the described properties.

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)
	
Parameters:
args - An object that defines any of the described properties.

getParent

String getParent(/*String*/ nodeId)
returns the id of the parent node of the node with the given id.
Parameters:
nodeId - The id of the node that should be tested.

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.
Parameters:
nodeId - The id of the node that should be tested.

isGroupNode

Boolean isGroupNode(/*String*/ nodeId)
returns true, if the node with the given id is a group node.
Parameters:
nodeId - The id of the node that should be tested.

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.
Parameters:
nodeId - The id of the node that owns the state label.
x - The x coordinate that should be contained in the state label box.
y - The y coordinate that should be contained in the state label box.

isNormalNode

Boolean isNormalNode(/*String*/ nodeId)
returns true, if the node with the given id is neither a group nor a folder node.
Parameters:
nodeId - The id of the node that should be tested.

moveToParent

moveToParent(/*String[]*/ subNodeIds, /*anything*/ customData)
Conveniance method that moves all given nodes a hierarchy level up, if possible.
The optional customData parameter is not sent to the server, but passed to the callback for the success or failure case.
Parameters:
subNodeIds - The ids of the nodes that should be assigned to the parent of their group.
customData - Any data that should be passed forward to the onMoveToParent and onMoveToParentFailed callbacks.

moveToSubgraph

moveToSubgraph(/*String[]*/ subNodeIds, /*String*/ parentNodeId, /*anything*/ customData)
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. The optional customData parameter is not sent to the server, but passed to the callback for the success or failure case.
Parameters:
subNodeIds - The ids of the nodes that should be assigned to the specified parentNodeId.
parentNodeId - The id of the group node that the nodes specified in the subNodeIds should be assigned to.
customData - Any data that should be passed forward to the onMoveToSubgraph and onMoveToSubgraphFailed callbacks.

openGroup

openGroup(/*String*/ groupNodeId, /*anything*/ customData)
converts the folder node with the given id into a group node.
The optional customData parameter is not sent to the server, but passed to the callback for the success or failure case.
Parameters:
groupNodeId - The id of the folder node that should be converted into a group node.
customData - Any data that should be passed forward to the onOpenGroup and onOpenGroupFailed callbacks.

refresh

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

setData

setData(/*Object*/ hierarchyData)
set the hierarchy data.
If the hierarchy data needs to be updated, this can be done by calling refresh, which fetches the data from the server. If the hierarchy data is already present on the client it can be set using this function without calling the server.
Parameters:
hierarchyData - the hierarchy data as an object in the format which is also returned by the server

switchToParent

switchToParent(/*anything*/ customData)
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). The optional customData parameter is not sent to the server, but passed to the callback for the success or failure case.
Parameters:
customData - Any data that should be passed forward to the onSwitchToParent and onSwitchToParentFailed callbacks.

switchToSubgraph

switchToSubgraph(/*String*/ parentNodeId, /*anything*/ customData)
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 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. The optional customData parameter is not sent to the server, but passed to the callback for the success or failure case.
Parameters:
parentNodeId - The id of the group or folder node that should be entered.
customData - Any data that should be passed forward to the onSwitchToSubgraph and onSwitchToSubgraphFailed callbacks.
Event Detail

onCloseGroup

onCloseGroup(/*String*/ id, /*Object*/ newBounds, /*anything*/ customData)
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
customData - custom data from the request

onCloseGroupFailed

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

onCreateGroup

onCreateGroup(/*String*/ id, /*Object*/ newBounds, /*String*/ name, /*anything*/ customData)
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
customData - custom data from the request

onCreateGroupFailed

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

onMoveToParent

onMoveToParent(/*String*/ parentNodeId, /*Object*/ newBounds, /*String[]*/ subNodeIds, /*anything*/ customData)
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
customData - custom data from the request

onMoveToParentFailed

onMoveToParentFailed(/*String*/ name, /*String[]*/ subNodeIds, /*anything*/ customData)
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
customData - custom data from the request

onMoveToSubgraph

onMoveToSubgraph(/*String*/ parentNodeId, /*Object*/ newBounds, /*String[]*/ subNodeIds, /*anything*/ customData)
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
customData - custom data from the request

onMoveToSubgraphFailed

onMoveToSubgraphFailed(/*String*/ name, /*String*/ parentNodeId, /*String[]*/ subNodeIds, /*anything*/ customData)
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
parentNodeId - id of the parent node of the requested subgraph, null for the root graph newBounds: bounds of the parent graph
subNodeIds - ids of the nodes which were requested to be moved
customData - custom data from the request

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, /*anything*/ customData)
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
customData - custom data from the request

onOpenGroupFailed

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

onSwitchToParent

onSwitchToParent(/*String*/ id, /*Object*/ newBounds, /*anything*/ customData)
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
customData - custom data from the request

onSwitchToParentFailed

onSwitchToParentFailed(/*String*/ name, /*anything*/ customData)
is called if switching the graph to its parent graph failed.
Parameters:
name - symbolic name of the graph
customData - custom data from the request

onSwitchToSubgraph

onSwitchToSubgraph(/*String*/ id, /*Object*/ newBounds, /*anything*/ customData)
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
customData - custom data from the request

onSwitchToSubgraphFailed

onSwitchToSubgraphFailed(/*String*/ name, /*String*/ id, /*anything*/ customData)
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
customData - custom data from the request

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