org.norvelle.textcite.model
Class Category

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

public class Category
extends AbstractCitationContainerTreeNode
implements ClipboardHostable

Represents a subject category that can be associated with a citation. Stored in hierarchical form in the CategoryTree

See Also:
Serialized Form

Nested Class Summary
static class Category.CategoryConverter
          CategoryConverter is an inner class used for serializing Category objects via XStream.
 
Field Summary
 
Fields inherited from class org.norvelle.textcite.model.AbstractCitationContainerTreeNode
citationIds, citations
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
protected Category()
          A parameterless constructor, so that we can recreate a serialized Category from XML.
  Category(java.lang.String n)
          This constructor is the same as the two-parameter one, simply supplying null as the parent Category, so that the new Category will be added to the root of the tree
  Category(java.lang.String n, Category parent)
          The constructor calls the DefaultMutableTreeNode constructor, passing the name of the Category as the UserObject (which will also be displayed as the label)
 
Method Summary
 void destroy()
          On destroying a Category, notify all associated Citations that they need to remove the Category from their CitationCategoryLists
 java.util.HashMap getCitations()
           
 int getId()
           
 java.lang.String getName()
           
 void registerCitation(Citation citation)
          Mark a Citation object as belong to this Category.
 void setName(java.lang.String n)
          Change the label of the category.
 void unregisterCitation(Citation citation)
          Dissasociate a given Citation from this Category.
 
Methods inherited from class org.norvelle.textcite.model.AbstractCitationContainerTreeNode
restoreCitationReferences, saveCitationReferences
 
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
 

Constructor Detail

Category

public Category(java.lang.String n,
                Category parent)
The constructor calls the DefaultMutableTreeNode constructor, passing the name of the Category as the UserObject (which will also be displayed as the label)

Parameters:
n - The name/label of the Category
parent - The Category that is parent to the new Category in the CategoryTree

Category

public Category(java.lang.String n)
This constructor is the same as the two-parameter one, simply supplying null as the parent Category, so that the new Category will be added to the root of the tree

Parameters:
n - The name of the new Category

Category

protected Category()
A parameterless constructor, so that we can recreate a serialized Category from XML. Visible only to the inner classes and derived classes.

Method Detail

registerCitation

public void registerCitation(Citation citation)
Mark a Citation object as belong to this Category.

Specified by:
registerCitation in class AbstractCitationContainerTreeNode
Parameters:
citation - The Citation object to be added

unregisterCitation

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

Specified by:
unregisterCitation in class AbstractCitationContainerTreeNode
Parameters:
citation - The Citation to be eliminated from the Category.

destroy

public void destroy()
On destroying a Category, notify all associated Citations that they need to remove the Category from their CitationCategoryLists

Specified by:
destroy in interface ClipboardHostable

getName

public java.lang.String getName()

setName

public void setName(java.lang.String n)
Change the label of the category. This has to signal the TreeModel that the node has changed.

Parameters:
n - The new name for the Category.

getId

public int getId()

getCitations

public java.util.HashMap getCitations()