org.eodisp.ui.sm.models
Class SmExpTreeModel

java.lang.Object
  extended by javax.swing.tree.DefaultTreeModel
      extended by org.eodisp.ui.sm.models.SmExpTreeModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.tree.TreeModel, EodispModel

public class SmExpTreeModel
extends javax.swing.tree.DefaultTreeModel
implements EodispModel

Version:
$Id:$
Author:
eglimi
See Also:
Serialized Form

Field Summary
(package private) static org.apache.log4j.Logger logger
          Log4J logger for this class
 
Fields inherited from class javax.swing.tree.DefaultTreeModel
asksAllowsChildren, root
 
Constructor Summary
SmExpTreeModel()
          The filter used to show only the content we want
 
Method Summary
 void addExperimentTreeListenerListener(ExperimentTreeModelListener listener)
           
 void doSave()
          Executes the save command in the model.
 void doUpdate()
           Instructs the model to do an update of its data.
 java.lang.Object getChild(java.lang.Object parent, int index)
          
 int getChildCount(java.lang.Object parent)
          
 ExperimentTreeModelListener[] getExperimentTreeListener()
           
 int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
          
 java.lang.Object getRoot()
           
 boolean hasChanges()
          Returns a value stating whether the model has some changes since the last change.
 boolean isLeaf(java.lang.Object node)
          
 void redo()
          This re-performs the last command executed by the model.
 void removeExperimentTreeListener(ExperimentTreeModelListener listener)
           
 void undo()
          This makes and undo of the last command executed by the model.
 void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
          Handle the value change.
 
Methods inherited from class javax.swing.tree.DefaultTreeModel
addTreeModelListener, asksAllowsChildren, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getListeners, getPathToRoot, getPathToRoot, getTreeModelListeners, insertNodeInto, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, reload, reload, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, setRoot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static org.apache.log4j.Logger logger
Log4J logger for this class

Constructor Detail

SmExpTreeModel

public SmExpTreeModel()
The filter used to show only the content we want

Method Detail

valueForPathChanged

public void valueForPathChanged(javax.swing.tree.TreePath path,
                                java.lang.Object newValue)
Handle the value change. This means that the string representation for the given node has changed. This in turn should set the name of the object.

Specified by:
valueForPathChanged in interface javax.swing.tree.TreeModel
Overrides:
valueForPathChanged in class javax.swing.tree.DefaultTreeModel

doSave

public void doSave()
            throws java.io.IOException
Description copied from interface: EodispModel
Executes the save command in the model. This saves the changes since the last save persistently.

Specified by:
doSave in interface EodispModel
Throws:
java.io.IOException - thrown when the data could not be saved persistently. This should lead to a visual indication to the user.

doUpdate

public void doUpdate()

Instructs the model to do an update of its data. Many EodispModels are just intermediated models for view components and do not hold the actual data. The actual data is usually retrieved and maintained by a persistency framework. Thus, if the real data has been changed, a model can be informed of this updated and it can be instructed to reload the data.

This should in most cases lead to an update of the visual component representing the data as well.

Note that updating the tree model is especially expensive, since the whole tree will be rebuilt.

Specified by:
doUpdate in interface EodispModel

hasChanges

public boolean hasChanges()
Description copied from interface: EodispModel
Returns a value stating whether the model has some changes since the last change.

Specified by:
hasChanges in interface EodispModel
Returns:
True if the model has changes since the last change or false, if there are no changes.

redo

public void redo()
Description copied from interface: EodispModel
This re-performs the last command executed by the model. How a redo is implemented depends on the model. This operation might not be available on all models. Models not supporting redo should ignore such a request.

Specified by:
redo in interface EodispModel

undo

public void undo()
Description copied from interface: EodispModel
This makes and undo of the last command executed by the model. How an undo is implemented depends on the model. This operation might not be available on all models. Models not supporting undo should ignore such a request.

Specified by:
undo in interface EodispModel

getRoot

public java.lang.Object getRoot()
Specified by:
getRoot in interface javax.swing.tree.TreeModel
Overrides:
getRoot in class javax.swing.tree.DefaultTreeModel

getChild

public java.lang.Object getChild(java.lang.Object parent,
                                 int index)

Specified by:
getChild in interface javax.swing.tree.TreeModel
Overrides:
getChild in class javax.swing.tree.DefaultTreeModel

getChildCount

public int getChildCount(java.lang.Object parent)

Specified by:
getChildCount in interface javax.swing.tree.TreeModel
Overrides:
getChildCount in class javax.swing.tree.DefaultTreeModel

isLeaf

public boolean isLeaf(java.lang.Object node)

Specified by:
isLeaf in interface javax.swing.tree.TreeModel
Overrides:
isLeaf in class javax.swing.tree.DefaultTreeModel

getIndexOfChild

public int getIndexOfChild(java.lang.Object parent,
                           java.lang.Object child)

Specified by:
getIndexOfChild in interface javax.swing.tree.TreeModel
Overrides:
getIndexOfChild in class javax.swing.tree.DefaultTreeModel

addExperimentTreeListenerListener

public void addExperimentTreeListenerListener(ExperimentTreeModelListener listener)

removeExperimentTreeListener

public void removeExperimentTreeListener(ExperimentTreeModelListener listener)

getExperimentTreeListener

public ExperimentTreeModelListener[] getExperimentTreeListener()