deegree 2.3 (2010/04/09 10:10 build-4-official)

org.deegree.portal.context
Class Node

java.lang.Object
  extended by org.deegree.portal.context.Node

public class Node
extends Object

encapsulates about a node described/contained by a Web Map Context

Since:
2.0
Version:
$Revision: 18195 $, 1.0. $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
Author:
Linda Vels, last edited by: $Author: mschneider $

Field Summary
(package private)  List<Node[]> tree
           
 
Constructor Summary
Node(int id, Node parent, String title, boolean selectable, boolean collapsed)
          Creates a new ContextNode object.
 
Method Summary
 void appendNode(Node childNode)
          adds a new child node to the node
 Node[][] getFlatTree()
           
 int getId()
          The id of the selected node.
 int getIndex(int nodeID)
          returns the index of the child node
 int getMaxNodeId()
          return the maximum id of all nodes
 Node getNode(int nodeId)
          Returns a childnode of the selected node by id
 Node getNode(int nodeId, Node[] nodes)
           
 Node[] getNodes()
          The childnodes of the selected node in the tree
 Node getParent()
           
 String getTitle()
          The title of the selected node.
 void insertNode(Node childNode, int index)
          insert a new child node at given position
 boolean isCollapsed()
          The status of the node (collapsed or not (expanded)).
 boolean isSelectable()
          The selectable status of the node.
 void moveNode(int nodeId, Boolean up)
          moves a node within the tree up or down
 boolean removeNode(int nodeID)
          removes a node
 void setCollapsed(boolean collapsed)
           
 void setId(int id)
           
 void setNodes(Node[] nodes)
           
 void setParent(Node parent)
           
 void setSelectable(boolean selectable)
           
 void setTitle(String title)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tree

List<Node[]> tree
Constructor Detail

Node

public Node(int id,
            Node parent,
            String title,
            boolean selectable,
            boolean collapsed)
     throws ContextException
Creates a new ContextNode object.

Parameters:
id - id of the selected node
parent -
title - title of the selected node
selectable -
collapsed - defines if the node is collapsed in the legend viewer
Throws:
ContextException
Method Detail

getNodes

public Node[] getNodes()
The childnodes of the selected node in the tree

Returns:
all nodes

getNode

public Node getNode(int nodeId)
Returns a childnode of the selected node by id

Parameters:
nodeId - to retrieve
Returns:
node by id or null if not found

getNode

public Node getNode(int nodeId,
                    Node[] nodes)
Parameters:
nodeId -
nodes -
Returns:
node by id from a list

getMaxNodeId

public int getMaxNodeId()
return the maximum id of all nodes

Returns:
maximum id of all nodes

setParent

public void setParent(Node parent)
Parameters:
parent -

getParent

public Node getParent()
Returns:
parent node

getId

public int getId()
The id of the selected node.

Returns:
id

getTitle

public String getTitle()
The title of the selected node.

Returns:
title

isCollapsed

public boolean isCollapsed()
The status of the node (collapsed or not (expanded)).

Returns:
true if node is collapsed

isSelectable

public boolean isSelectable()
The selectable status of the node.

Returns:
true if node is selectable

setNodes

public void setNodes(Node[] nodes)
Parameters:
nodes -

setSelectable

public void setSelectable(boolean selectable)
Parameters:
selectable -

setCollapsed

public void setCollapsed(boolean collapsed)
Parameters:
collapsed -

setId

public void setId(int id)
Parameters:
id -

setTitle

public void setTitle(String title)
              throws ContextException
Parameters:
title -
Throws:
ContextException

getFlatTree

public Node[][] getFlatTree()
Returns:
flat tree as node matrix

moveNode

public void moveNode(int nodeId,
                     Boolean up)
moves a node within the tree up or down

Parameters:
nodeId -
up -

appendNode

public void appendNode(Node childNode)
adds a new child node to the node

Parameters:
childNode -

insertNode

public void insertNode(Node childNode,
                       int index)
insert a new child node at given position

Parameters:
childNode - the new child node
index - the position of the new child node (0=first node)
Throws:
IndexOutOfBoundsException

removeNode

public boolean removeNode(int nodeID)
removes a node

Parameters:
nodeID - the id of the node
Returns:
true if node is removed

getIndex

public int getIndex(int nodeID)
returns the index of the child node

Parameters:
nodeID - the node id to look for
Returns:
index of the child node, -1 if node is not found

deegree 2.3 (2010/04/09 10:10 build-4-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org