ilog.views.appframe.docview.project
Class IlvDefaultDataContainer

java.lang.Object
  extended by ilog.views.appframe.docview.project.IlvDefaultDataContainer
All Implemented Interfaces:
IlvDataContainer
Direct Known Subclasses:
IlvProjectDataContainer

public class IlvDefaultDataContainer
extends Object
implements IlvDataContainer

Default implementation of the IlvDataContainer interface.


Nested Class Summary
static class IlvDefaultDataContainer.AbstractNode
          An abstract implementation of the IlvDefaultDataContainer.Node interface to serve as a basis for implementing various kinds of nodes.
static interface IlvDefaultDataContainer.Node
          Defines nodes manipulated by an IlvDefaultDataContainer.
 
Field Summary
 
Fields inherited from interface ilog.views.appframe.docview.project.IlvDataContainer
NODE_TITLE_PROPERTY
 
Constructor Summary
IlvDefaultDataContainer()
          Constructs an empty IlvDefaultDataContainer.
 
Method Summary
 boolean acceptChild(Object parent, String category)
          Determines whether the specified parent node can have a child added with the specified category.
 void addDataContainerListener(DataContainerListener listener)
          Adds the specified data container listener for receiving data container events from this container.
 boolean canRemove(Object parent, Object node)
          Determines whether the specified node can be removed from this data container.
 void fireNodeAdditionEvent(Object parent, Object node, int index)
          Notifies all the listeners that have registered interest for notification of the data container changes that a node has been added to the data container.
 void fireNodeRemovalEvent(Object parent, Object node, int index)
          Notifies all the listeners that have registered interest for notification of the data container changes that a node has been removed from the data container.
 void firePropertyChangeEvent(Object parent, Object node, int index, String propertyName, Object oldValue, Object newValue)
          Notifies all the listeners that have registered interest for notification of the data container changes that the property of a node has been changed.
 String getCategory(Object node)
          Returns the category of the node.
 Object getChildAt(Object parent, int index)
          Returns the child node at the specified index in the child array of the parent node.
 int getChildCount(Object parent)
          Returns the number of children of the parent node.
 int getIndexOfChild(Object parent, Object child)
          Returns the index of the child node in the child array of the parent node.
 Object getNodeProperty(Object node, String propertyName)
          Returns the value of the node property with the specified propertyName.
 Object getParent(Object node)
          Returns the parent node of the specified node.
 String getTitle(Object node)
          Returns the title of the specified node.
 void insertNode(Object parent, Object node, int index)
          Inserts the specified node among the children of the specified parent node at a specified position.
 void removeDataContainerListener(DataContainerListener listener)
          Removes the specified data container listener, so that it no longer receives data container events from the data container.
 boolean removeNode(Object parent, Object node)
          Removes the specified node from the list of child nodes of the specified parent node.
 void setNodeProperty(Object node, String propertyName, Object value)
          Sets a new value to the property of the specified node with the specified propertyName.
 void setTitle(Object node, String title)
          Sets a title for the specified node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvDefaultDataContainer

public IlvDefaultDataContainer()
Constructs an empty IlvDefaultDataContainer.

Method Detail

getParent

public Object getParent(Object node)
Returns the parent node of the specified node.

Specified by:
getParent in interface IlvDataContainer
Parameters:
node - The node to retrieve the parent from.
Returns:
The parent node or null if the specified node is a root node.

getChildAt

public Object getChildAt(Object parent,
                         int index)
Returns the child node at the specified index in the child array of the parent node.

Specified by:
getChildAt in interface IlvDataContainer
Parameters:
parent - The parent node to add a child to.
index - The index of the node to return.
Returns:
The child node; if the parent is null, the root node at the specified index will be returned.
See Also:
getChildCount(java.lang.Object)

getChildCount

public int getChildCount(Object parent)
Returns the number of children of the parent node. If the parent is null, it will return the number of root nodes.

Specified by:
getChildCount in interface IlvDataContainer
See Also:
getChildAt(java.lang.Object, int)

getIndexOfChild

public int getIndexOfChild(Object parent,
                           Object child)
Returns the index of the child node in the child array of the parent node.

Specified by:
getIndexOfChild in interface IlvDataContainer
Parameters:
parent - The parent node.
child - The child node.
Returns:
The index of the child node.

getTitle

public String getTitle(Object node)
Returns the title of the specified node.

Specified by:
getTitle in interface IlvDataContainer
Parameters:
node - The node to get the title of.
Returns:
The value of the NODE_TITLE_PROPERTY of the specified node.
See Also:
setTitle(java.lang.Object, java.lang.String), getNodeProperty(java.lang.Object, java.lang.String)

setTitle

public void setTitle(Object node,
                     String title)
Sets a title for the specified node. The NODE_TITLE_PROPERTY of the node must be set to the specified title.

Specified by:
setTitle in interface IlvDataContainer
Parameters:
node - The node to set the title to.
title - The new title of the node.
See Also:
getTitle(java.lang.Object), setNodeProperty(java.lang.Object, java.lang.String, java.lang.Object)

getNodeProperty

public Object getNodeProperty(Object node,
                              String propertyName)
Returns the value of the node property with the specified propertyName.

Specified by:
getNodeProperty in interface IlvDataContainer
Parameters:
node - The node to get the property value from.
propertyName - The name of the property to return the value from.
Returns:
The node property.
See Also:
setNodeProperty(java.lang.Object, java.lang.String, java.lang.Object)

setNodeProperty

public void setNodeProperty(Object node,
                            String propertyName,
                            Object value)
Sets a new value to the property of the specified node with the specified propertyName. A NodePropertyChangeEvent is triggered to notify of this node property change.

Specified by:
setNodeProperty in interface IlvDataContainer
Parameters:
node - The node to change the property of.
propertyName - The name of the property to change the value of.
value - The new value of the property.
See Also:
getNodeProperty(java.lang.Object, java.lang.String)

getCategory

public String getCategory(Object node)
Returns the category of the node. Categories of nodes group nodes with the same logical type. For example, the same icons are used to represent nodes with the same category in an IlvExplorerView.

Specified by:
getCategory in interface IlvDataContainer
Parameters:
node - The node to get a category from.
Returns:
The category of the node.

insertNode

public void insertNode(Object parent,
                       Object node,
                       int index)
Inserts the specified node among the children of the specified parent node at a specified position.

Specified by:
insertNode in interface IlvDataContainer
Parameters:
parent - The node to insert a new child node into.
node - The new node to insert.
index - Specifies the position at which to insert the node. If equal to -1, the node will be added at the last position of the child array of the parent.
See Also:
removeNode(java.lang.Object, java.lang.Object)

removeNode

public boolean removeNode(Object parent,
                          Object node)
Removes the specified node from the list of child nodes of the specified parent node.

Specified by:
removeNode in interface IlvDataContainer
Parameters:
parent - The node to remove a child node from.
node - The node to remove.
Returns:
true if the node was previously added to the data container as a child of the parent; false otherwise.
See Also:
insertNode(java.lang.Object, java.lang.Object, int), canRemove(java.lang.Object, java.lang.Object)

acceptChild

public boolean acceptChild(Object parent,
                           String category)
Determines whether the specified parent node can have a child added with the specified category.

Specified by:
acceptChild in interface IlvDataContainer
Parameters:
parent - The parent node.
category - The category of nodes to add.
Returns:
true if the parent accepts a node with the specified category as a child; false otherwise.

canRemove

public boolean canRemove(Object parent,
                         Object node)
Determines whether the specified node can be removed from this data container.

Specified by:
canRemove in interface IlvDataContainer
Parameters:
parent - The parent node of the specified node or null.
node - The node to remove.
Returns:
true if the node can be removed; false otherwise.
See Also:
removeNode(java.lang.Object, java.lang.Object)

addDataContainerListener

public void addDataContainerListener(DataContainerListener listener)
Adds the specified data container listener for receiving data container events from this container.
If listener is null, no exception will be thrown and no action will be performed.

Specified by:
addDataContainerListener in interface IlvDataContainer
Parameters:
listener - The data container listener to add.
See Also:
removeDataContainerListener(ilog.views.appframe.docview.project.DataContainerListener)

removeDataContainerListener

public void removeDataContainerListener(DataContainerListener listener)
Removes the specified data container listener, so that it no longer receives data container events from the data container. If listener is null, no exception will be thrown and no action will be performed.

Specified by:
removeDataContainerListener in interface IlvDataContainer
Parameters:
listener - The data container listener to remove.
See Also:
addDataContainerListener(ilog.views.appframe.docview.project.DataContainerListener)

fireNodeAdditionEvent

public void fireNodeAdditionEvent(Object parent,
                                  Object node,
                                  int index)
Notifies all the listeners that have registered interest for notification of the data container changes that a node has been added to the data container.

Parameters:
parent - The parent node - can be null.
node - The node that was added.
index - The insertion index.

fireNodeRemovalEvent

public void fireNodeRemovalEvent(Object parent,
                                 Object node,
                                 int index)
Notifies all the listeners that have registered interest for notification of the data container changes that a node has been removed from the data container.

Parameters:
parent - The parent node - can be null.
node - The node that was removed.
index - The previous index of the node in the child array of the parent.

firePropertyChangeEvent

public void firePropertyChangeEvent(Object parent,
                                    Object node,
                                    int index,
                                    String propertyName,
                                    Object oldValue,
                                    Object newValue)
Notifies all the listeners that have registered interest for notification of the data container changes that the property of a node has been changed.

Parameters:
parent - The parent node - can be null.
node - The node with the property that has changed.
index - The position index of the node in the child array of the parent.
propertyName - The name of the property that was changed.
oldValue - The previous property value.
newValue - The new property value.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.