com.intel.gpe.client2.common.panels.tree
Class BaseNode

java.lang.Object
  extended by com.intel.gpe.client2.common.panels.tree.BaseNode
All Implemented Interfaces:
ObjectWithIcon, Node, java.lang.Comparable<Node>
Direct Known Subclasses:
GRIDNode, GRIDNode, LocalNode, RegistryNode, RegistryNode, RemoteFileNode, StorageNode, TargetSystemNode, TargetSystemNode

public abstract class BaseNode
extends java.lang.Object
implements Node, ObjectWithIcon, java.lang.Comparable<Node>

The base class for Grid Tree nodes.

Version:
$Id: BaseNode.java,v 1.5 2006/09/28 08:25:15 mlukichev Exp $
Author:
Alexander Lukichev

Field Summary
protected  java.util.List<ContentsChangeListener> contentsChangeListeners
           
protected  java.util.List<ChildrenChangeListener> listeners
           
protected  java.util.List<NodeChangeListener> nodeChangeListeners
           
 
Constructor Summary
BaseNode(GridTreeModel model, Node parent, AsyncClient asyncClient, MessageAdapter messageAdapter)
          Deprecated. 
BaseNode(GridTreeModel model, Node parent, AsyncClient asyncClient, MessageProvider messageProvider)
           
 
Method Summary
 void addChildrenChangeListener(ChildrenChangeListener l)
          Add the listener of changes in the list of the children
 void addContentsChangeListener(ContentsChangeListener listener)
           
 int compareTo(Node node)
           
 void executeRequest(Request request, com.intel.gpe.util.observer.IObserver observer)
           
 AsyncClient getAsyncClient()
           
 Node getChild(int i)
          Get the child specified with the index.
 int getChildCount()
          Get the number of children nodes.
 java.util.List<Node> getChildren()
          Get the currently cached list of the children.
 java.util.List getContents()
          Get the currently cached contents of the node.
 java.lang.String getIconPath()
           
 int getIndex(Node node)
          Get the index of the child.
 MessageAdapter getMessageAdapter()
          Deprecated. use getMessageProvider() instead
 MessageProvider getMessageProvider()
           
 GridTreeModel getModel()
          Get the tree model.
 java.lang.Object[] getPath()
          Get the path to the node.
 void notifyContentsChangeListener(java.util.List contents)
           
 void notifyNodeChanged()
          Send the notification to the listeners of the node state (not including the children change listeners)
 void refresh()
          Refresh the list of the children.
 void removeChildrenChangeListener(ChildrenChangeListener l)
          Remove the listener of changes in the list of the children
 void removeContentsChangeListener(ContentsChangeListener listener)
           
abstract  void requestChildren()
          Get the child nodes.
abstract  void requestContents()
          Get the contents of the node.
 void setChildren(java.util.List<Node> children)
          Set the child nodes.
 void setContents(java.util.List contents)
          Set the contents
 void setModel(GridTreeModel model)
           
 void showException(java.lang.String message, java.lang.Throwable e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.intel.gpe.client2.common.panels.tree.Node
isLeaf
 

Field Detail

listeners

protected java.util.List<ChildrenChangeListener> listeners

nodeChangeListeners

protected java.util.List<NodeChangeListener> nodeChangeListeners

contentsChangeListeners

protected java.util.List<ContentsChangeListener> contentsChangeListeners
Constructor Detail

BaseNode

@Deprecated
public BaseNode(GridTreeModel model,
                           Node parent,
                           AsyncClient asyncClient,
                           MessageAdapter messageAdapter)
Deprecated. 


BaseNode

public BaseNode(GridTreeModel model,
                Node parent,
                AsyncClient asyncClient,
                MessageProvider messageProvider)
Method Detail

notifyNodeChanged

public void notifyNodeChanged()
Send the notification to the listeners of the node state (not including the children change listeners)


requestChildren

public abstract void requestChildren()
Get the child nodes. This method is called whenever child nodes must be updated. The implementation should modify (if necessary) the child list with setChildren(List) method.


requestContents

public abstract void requestContents()
Get the contents of the node. This may be not children nodes but some other information.


refresh

public void refresh()
Refresh the list of the children. After the refresh is completed the listeners are invoked.


getChildren

public java.util.List<Node> getChildren()
Get the currently cached list of the children. If the list is null then a children request is started and an empty list is returned.

Returns:
the list of the children. May be empty (not null!) if no children cached.

getContents

public java.util.List getContents()
Get the currently cached contents of the node. If the contents list is null then the request of the contents is invoked.

Returns:
the contents

setChildren

public void setChildren(java.util.List<Node> children)
Set the child nodes.

Parameters:
children - new child node list

setContents

public void setContents(java.util.List contents)
Set the contents

Parameters:
contents - - the contents

addChildrenChangeListener

public void addChildrenChangeListener(ChildrenChangeListener l)
Add the listener of changes in the list of the children

Parameters:
l - - the listener

removeChildrenChangeListener

public void removeChildrenChangeListener(ChildrenChangeListener l)
Remove the listener of changes in the list of the children

Parameters:
l - - the listener

notifyContentsChangeListener

public void notifyContentsChangeListener(java.util.List contents)

addContentsChangeListener

public void addContentsChangeListener(ContentsChangeListener listener)

removeContentsChangeListener

public void removeContentsChangeListener(ContentsChangeListener listener)

getChildCount

public int getChildCount()
Description copied from interface: Node
Get the number of children nodes.

Specified by:
getChildCount in interface Node
Returns:
The number of children

getChild

public Node getChild(int i)
Description copied from interface: Node
Get the child specified with the index.

Specified by:
getChild in interface Node
Parameters:
i - The index of the child to get
Returns:
The child node

getPath

public java.lang.Object[] getPath()
Description copied from interface: Node
Get the path to the node.

Specified by:
getPath in interface Node
Returns:
the array representing the path to the node

getModel

public GridTreeModel getModel()
Get the tree model.

Returns:
the tree model

executeRequest

public void executeRequest(Request request,
                           com.intel.gpe.util.observer.IObserver observer)

getAsyncClient

public AsyncClient getAsyncClient()

showException

public void showException(java.lang.String message,
                          java.lang.Throwable e)

getMessageAdapter

@Deprecated
public MessageAdapter getMessageAdapter()
Deprecated. use getMessageProvider() instead

Returns:

getMessageProvider

public MessageProvider getMessageProvider()

setModel

public void setModel(GridTreeModel model)

getIconPath

public java.lang.String getIconPath()
Specified by:
getIconPath in interface ObjectWithIcon

getIndex

public int getIndex(Node node)
Description copied from interface: Node
Get the index of the child. If the specified node is not the child of this one then -1 is returned.

Specified by:
getIndex in interface Node
Parameters:
node - - the node
Returns:
the index of the node. -1 if the node is not contained in the receiver.

compareTo

public int compareTo(Node node)
Specified by:
compareTo in interface java.lang.Comparable<Node>


Copyright © 2008. All Rights Reserved.