edu.udo.cs.yale.gui.operatortree
Class OperatorTreeModel

java.lang.Object
  extended by edu.udo.cs.yale.gui.operatortree.OperatorTreeModel
All Implemented Interfaces:
javax.swing.tree.TreeModel

public class OperatorTreeModel
extends java.lang.Object
implements javax.swing.tree.TreeModel

A TreeModel hiding an operator (which itself already has a tree-like structure). Most of the method calls delegate to an operator. Events can be fired when operators are inserted or removed. Operator trees are the main experiment editor of the Yale GUI.

Version:
$Id: OperatorTreeModel.java,v 2.10 2006/03/27 13:21:58 ingomierswa Exp $
Author:
Ingo Mierswa, Simon Fischer

Field Summary
private  OperatorTree operatorTree
          The operator tree.
private  Operator root
          The root operator of the model (usually an experiment operator).
private  boolean showDisabledOperators
          Indicates if disabled operators should be shown by the model (default: true).
private  java.util.List<javax.swing.event.TreeModelListener> treeModelListeners
          The list of all tree model listeners.
 
Constructor Summary
OperatorTreeModel(Operator root, OperatorTree tree)
          Creates a new operator tree model.
 
Method Summary
 void addTreeModelListener(javax.swing.event.TreeModelListener l)
          Adds a tree model listener.
 void fireOperatorChanged(java.lang.Object source, javax.swing.tree.TreePath path)
          Must be used to indicate that an operator was changed in some way.
 void fireOperatorInserted(java.lang.Object source, javax.swing.tree.TreePath path, int index, Operator operator)
          Must be used to indicate that a new operator was added.
 void fireOperatorRemoved(java.lang.Object source, javax.swing.tree.TreePath path, int index, Operator operator)
          Must be used to indicate that an operator was removed.
 void fireOperatorRenamed(java.lang.Object source, javax.swing.tree.TreePath path)
          Must be used to indicate that an operator was renamed.
 void fireStructureChanged(java.lang.Object source, javax.swing.tree.TreePath path)
          Must be used to indicate that the tree structure has changed.
 java.lang.Object getChild(java.lang.Object parent, int index)
          Returns the child with the given index.
 int getChildCount(java.lang.Object parent)
          Returns the number of children operators.
 int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
          Returns the index of the child operator with respect to the given parent.
 java.lang.Object getRoot()
          Returns the root operator.
 boolean isLeaf(java.lang.Object node)
          Returns true if the operator is a leaf node, i.e. it does not have any children.
 void removeTreeModelListener(javax.swing.event.TreeModelListener l)
          Removes the tree model listener.
 void setShowDisabledOperators(boolean show)
          Sets the state of showing diabled operators.
 boolean showDisabledOperators()
          Indicates if disabled operators should be displayed by the tree.
 void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object node)
          Will be invoked after editing changes of nodes, i.e. after renaming.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

private Operator root
The root operator of the model (usually an experiment operator).


treeModelListeners

private java.util.List<javax.swing.event.TreeModelListener> treeModelListeners
The list of all tree model listeners.


operatorTree

private OperatorTree operatorTree
The operator tree.


showDisabledOperators

private boolean showDisabledOperators
Indicates if disabled operators should be shown by the model (default: true).

Constructor Detail

OperatorTreeModel

public OperatorTreeModel(Operator root,
                         OperatorTree tree)
Creates a new operator tree model.

Method Detail

showDisabledOperators

public boolean showDisabledOperators()
Indicates if disabled operators should be displayed by the tree.


setShowDisabledOperators

public void setShowDisabledOperators(boolean show)
Sets the state of showing diabled operators.


getRoot

public java.lang.Object getRoot()
Returns the root operator.

Specified by:
getRoot in interface javax.swing.tree.TreeModel


getChild

public java.lang.Object getChild(java.lang.Object parent,
                                 int index)
Returns the child with the given index. This method checks if disabled operators should be regarded or not.

Specified by:
getChild in interface javax.swing.tree.TreeModel


getChildCount

public int getChildCount(java.lang.Object parent)
Returns the number of children operators. This method checks if disabled operators should be regarded or not.

Specified by:
getChildCount in interface javax.swing.tree.TreeModel


getIndexOfChild

public int getIndexOfChild(java.lang.Object parent,
                           java.lang.Object child)
Returns the index of the child operator with respect to the given parent. This method checks if disabled operators should be regarded or not.

Specified by:
getIndexOfChild in interface javax.swing.tree.TreeModel


isLeaf

public boolean isLeaf(java.lang.Object node)
Returns true if the operator is a leaf node, i.e. it does not have any children.

Specified by:
isLeaf in interface javax.swing.tree.TreeModel


valueForPathChanged

public void valueForPathChanged(javax.swing.tree.TreePath path,
                                java.lang.Object node)
Will be invoked after editing changes of nodes, i.e. after renaming. This method also causes a refresh since the bounding box of the changed node would not be updated otherwise.

Specified by:
valueForPathChanged in interface javax.swing.tree.TreeModel


addTreeModelListener

public void addTreeModelListener(javax.swing.event.TreeModelListener l)
Adds a tree model listener.

Specified by:
addTreeModelListener in interface javax.swing.tree.TreeModel


removeTreeModelListener

public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
Removes the tree model listener.

Specified by:
removeTreeModelListener in interface javax.swing.tree.TreeModel


fireOperatorInserted

public void fireOperatorInserted(java.lang.Object source,
                                 javax.swing.tree.TreePath path,
                                 int index,
                                 Operator operator)
Must be used to indicate that a new operator was added. Notifies the listeners by invoking the method treeNodesInserted(...).


fireOperatorRemoved

public void fireOperatorRemoved(java.lang.Object source,
                                javax.swing.tree.TreePath path,
                                int index,
                                Operator operator)
Must be used to indicate that an operator was removed. Notifies the listeners by invoking the method treeNodesRemoved(...).


fireOperatorRenamed

public void fireOperatorRenamed(java.lang.Object source,
                                javax.swing.tree.TreePath path)
Must be used to indicate that an operator was renamed. Notifies the listeners by invoking the method treeNodesChanged(...).


fireOperatorChanged

public void fireOperatorChanged(java.lang.Object source,
                                javax.swing.tree.TreePath path)
Must be used to indicate that an operator was changed in some way. Notifies the listeners by invoking the method treeNodesChanged(...).


fireStructureChanged

public void fireStructureChanged(java.lang.Object source,
                                 javax.swing.tree.TreePath path)
Must be used to indicate that the tree structure has changed. Notifies the listeners by invoking the method treeStrucureChanged(...).



Copyright © 2001-2006