org.activemath.author.toc
Class ASyncTreeNodeDecorator

java.lang.Object
  extended by org.activemath.author.toc.ASyncTreeNodeDecorator
All Implemented Interfaces:
EventListener, TreeModelListener

public class ASyncTreeNodeDecorator
extends Object
implements TreeModelListener

This class implements a background engine that asynchronously fetches the decoration for the tree-nodes (currently title and type) and notifies the tree when the decoration is written to.


Field Summary
protected static boolean DEBUG
           
protected static org.apache.commons.logging.Log log
           
 
Constructor Summary
ASyncTreeNodeDecorator(TreeModel treeModel, MBaseRef mbaseRef)
          Starts operating and listens toe the tree-model events.
 
Method Summary
 void addNodeToDecorate(OJref refElt, TreePath path)
          To be called when needing to explicitly set the node to updated.
 void checkWholeTree()
           
 void treeNodesChanged(TreeModelEvent e)
          Calls #addNoteToDecorate for all nodes that are updated and that contain a null info.
 void treeNodesInserted(TreeModelEvent e)
          Calls #addNoteToDecorate for all nodes that are updated and that contain a null info.
 void treeNodesRemoved(TreeModelEvent e)
          Does nothing.
 void treeStructureChanged(TreeModelEvent e)
          Calls #addNoteToDecorate for all nodes children of the root change that contain a null info in their OJref.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log

DEBUG

protected static final boolean DEBUG
Constructor Detail

ASyncTreeNodeDecorator

public ASyncTreeNodeDecorator(TreeModel treeModel,
                              MBaseRef mbaseRef)
Starts operating and listens toe the tree-model events.

Parameters:
treeModel - The model to listen to events
mbaseRef - The mbase to extract information from
Method Detail

treeNodesChanged

public void treeNodesChanged(TreeModelEvent e)
Calls #addNoteToDecorate for all nodes that are updated and that contain a null info.

Specified by:
treeNodesChanged in interface TreeModelListener
Parameters:
e - The change-event from which all paths are extracted

treeNodesInserted

public void treeNodesInserted(TreeModelEvent e)
Calls #addNoteToDecorate for all nodes that are updated and that contain a null info.

Specified by:
treeNodesInserted in interface TreeModelListener
Parameters:
e - The change-event from which all paths are extracted

treeNodesRemoved

public void treeNodesRemoved(TreeModelEvent e)
Does nothing.

Specified by:
treeNodesRemoved in interface TreeModelListener
Parameters:
e - The change-event from which all paths are extracted

treeStructureChanged

public void treeStructureChanged(TreeModelEvent e)
Calls #addNoteToDecorate for all nodes children of the root change that contain a null info in their OJref.

Specified by:
treeStructureChanged in interface TreeModelListener
Parameters:
e - The change-event from which all paths are extracted

checkWholeTree

public void checkWholeTree()

addNodeToDecorate

public void addNodeToDecorate(OJref refElt,
                              TreePath path)
To be called when needing to explicitly set the node to updated. Should not be used in principle.

Parameters:
refElt - the user-object of the node from which to extract the ID and where the OJElement.setInfo(java.lang.Object) will be called setting as result a Hashtable with keys type (the result of MBaseRef.getTypeString(org.activemath.abstractcontent.MBaseID)) and titles for the result of MBaseRef.getTypeString(org.activemath.abstractcontent.MBaseID).
path - the path allowing us to build the events