org.norvelle.textcite.model
Class AbstractCitationContainerTreeNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by org.norvelle.textcite.model.AbstractCitationContainerTreeNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode
Direct Known Subclasses:
BookOutlineItem, Category

public abstract class AbstractCitationContainerTreeNode
extends javax.swing.tree.DefaultMutableTreeNode

AbstractCitationContainerTreeNode: A TreeNode implementation that contains methods for handling collections of Citations.

Author:
Erik Norvelle
See Also:
Serialized Form

Field Summary
protected  java.util.Vector citationIds
          This Vector contains only the IDs of the Citations, not the references to the objects.
protected  java.util.HashMap citations
          This HashMap contains the Citations which reference this CitationContainer.
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
protected AbstractCitationContainerTreeNode()
           
protected AbstractCitationContainerTreeNode(java.lang.String name)
           
 
Method Summary
abstract  void registerCitation(Citation citation)
          Mark a Citation object as belonging to this AbstractCitationContainerTreeNode.
 void restoreCitationReferences()
          This method restores the citations HashMap, filling it with references to the Citations indicated in the citationIds Vector.
 void saveCitationReferences()
          This method saves the currently references Citations in the citationIds Vector, by id, as the name suggests, so that this Vector can be serialized without serializing the Citations themselves (which get serialized at a later stage)
abstract  void unregisterCitation(Citation citation)
          Dissasociate a given Citation from this AbstractCitationContainerTreeNode.
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

citations

protected java.util.HashMap citations
This HashMap contains the Citations which reference this CitationContainer. If a Citation changes authorship, or is deleted, it should use the unregisterCitation() method to clear its reference from the HashMap


citationIds

protected java.util.Vector citationIds
This Vector contains only the IDs of the Citations, not the references to the objects. It is used to delay serialization of the Citations themselves, when serializing objects that maintain lists of Citations objects

Constructor Detail

AbstractCitationContainerTreeNode

protected AbstractCitationContainerTreeNode()

AbstractCitationContainerTreeNode

protected AbstractCitationContainerTreeNode(java.lang.String name)
Method Detail

registerCitation

public abstract void registerCitation(Citation citation)
Mark a Citation object as belonging to this AbstractCitationContainerTreeNode.

Parameters:
citation - The Citation object to be added

unregisterCitation

public abstract void unregisterCitation(Citation citation)
Dissasociate a given Citation from this AbstractCitationContainerTreeNode.

Parameters:
citation - The Citation to be eliminated.

saveCitationReferences

public void saveCitationReferences()
This method saves the currently references Citations in the citationIds Vector, by id, as the name suggests, so that this Vector can be serialized without serializing the Citations themselves (which get serialized at a later stage)


restoreCitationReferences

public void restoreCitationReferences()
This method restores the citations HashMap, filling it with references to the Citations indicated in the citationIds Vector.