org.norvelle.textcite.model
Class BookOutlineItem

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

public class BookOutlineItem
extends AbstractCitationContainerTreeNode
implements ClipboardHostable

Represents an entry in the outline of the publication. Keeps track of the the Citations that are marked as falling under this outline item.

See Also:
Serialized Form

Nested Class Summary
static class BookOutlineItem.BookOutlineItemConverter
          BookOutlineItemConverter is an inner class used for serializing BookOutlineItem 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 BookOutlineItem()
          A parameterless constructor, so that we can recreate a serialized BookOutlineItem from XML.
  BookOutlineItem(java.lang.String n, BookOutlineItem parent, BookOutlineItem prevSibling, BookOutlineTree tree)
          The constructor calls the DefaultMutableTreeNode constructor, passing the name of the BookOutlineItem as the UserObject (which will also be displayed as the label).
  BookOutlineItem(java.lang.String n, BookOutlineItem parent, BookOutlineItem prevSibling, BookOutlineTree tree, boolean asFirst)
          The constructor calls the DefaultMutableTreeNode constructor, passing the name of the BookOutlineItem as the UserObject (which will also be displayed as the label)
  BookOutlineItem(java.lang.String n, BookOutlineItem parent, BookOutlineTree tree)
          The constructor calls the DefaultMutableTreeNode constructor, passing the name of the BookOutlineItem as the UserObject (which will also be displayed as the label).
 
Method Summary
 void addChildAfter(BookOutlineItem newItem, BookOutlineItem priorSibling)
          Adds the given new BookOutlineItem directly after the indicated sibling within the list of children Items
 void destroy()
          On destroying a BookOutlineItem, notify all associated Citations that they need to remove the BookOutlineItem from their CitationBookOutlineItemLists
 java.util.HashMap getCitations()
           
 int getId()
           
 java.lang.String getName()
           
 java.lang.String getOutlineNumber()
           
 BookOutlineTree getOutlineTree()
           
 java.lang.String getSortableOutlineNumber()
           
 void registerCitation(Citation citation)
          Mark a Citation object as belonging to this BookOutlineItem.
 void setName(java.lang.String n)
          Change the label of the BookOutlineItem.
 void setOutlineNumber(java.lang.String outlineNumber)
           
 void setSortableOutlineNumber(java.lang.String outlineNumber)
           
 java.lang.String toString()
           
 void unregisterCitation(Citation citation)
          Dissasociate a given Citation from this BookOutlineItem.
 
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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BookOutlineItem

public BookOutlineItem(java.lang.String n,
                       BookOutlineItem parent,
                       BookOutlineItem prevSibling,
                       BookOutlineTree tree,
                       boolean asFirst)
The constructor calls the DefaultMutableTreeNode constructor, passing the name of the BookOutlineItem as the UserObject (which will also be displayed as the label)

Parameters:
n - The name/label of the BookOutlineItem
parent - The BookOutlineItem that is parent to the new BookOutlineItem in the BookOutlineTree
prevSibling - The BookOutlineItem that the new item should be added *after*
tree - The BookOutlineTree that the new item should be added into.
asFirst - If true, add this new Item in as the first child in the array of parent's children

BookOutlineItem

public BookOutlineItem(java.lang.String n,
                       BookOutlineItem parent,
                       BookOutlineItem prevSibling,
                       BookOutlineTree tree)
The constructor calls the DefaultMutableTreeNode constructor, passing the name of the BookOutlineItem as the UserObject (which will also be displayed as the label). This constructor assumes that the new BookOutlineItem is to be added as after the indicated sibling.

Parameters:
n - The name/label of the BookOutlineItem
parent - The BookOutlineItem that is parent to the new BookOutlineItem in the BookOutlineTree
prevSibling - The BookOutlineItem that the new item should be added *after*
tree - The BookOutlineTree that the new item should be added into.

BookOutlineItem

public BookOutlineItem(java.lang.String n,
                       BookOutlineItem parent,
                       BookOutlineTree tree)
The constructor calls the DefaultMutableTreeNode constructor, passing the name of the BookOutlineItem as the UserObject (which will also be displayed as the label). This constructor assumes that the new BookOutlineItem is to be added as the last child in the parent's children.

Parameters:
n - The name/label of the BookOutlineItem
parent - The BookOutlineItem that is parent to the new BookOutlineItem in the BookOutlineTree
tree - The BookOutlineTree that the new item should be added into.

BookOutlineItem

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

Method Detail

registerCitation

public void registerCitation(Citation citation)
Mark a Citation object as belonging to this BookOutlineItem. The Citation itself handles associating a BookOutlineItem with itself, but the BookOutlineItem maintains a list of associated Citations in order to be able to produce a CitationFilter showing its Citations, or else export the Citations belonging to a certain position in the overall outline.

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 BookOutlineItem.

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

destroy

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

Specified by:
destroy in interface ClipboardHostable

addChildAfter

public void addChildAfter(BookOutlineItem newItem,
                          BookOutlineItem priorSibling)
Adds the given new BookOutlineItem directly after the indicated sibling within the list of children Items

Parameters:
newItem - The BookOutlineItem to be added
priorSibling - The sibling that the new item should be added after.

getName

public java.lang.String getName()

setName

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

Parameters:
n - The new name for the BookOutlineItem.

getSortableOutlineNumber

public java.lang.String getSortableOutlineNumber()
Returns:
Returns an outline number suitable for sorting on

setSortableOutlineNumber

public void setSortableOutlineNumber(java.lang.String outlineNumber)

getOutlineNumber

public java.lang.String getOutlineNumber()
Returns:
Returns the outline number.

setOutlineNumber

public void setOutlineNumber(java.lang.String outlineNumber)
Parameters:
outlineNumber - The new outline number of this item.

getOutlineTree

public BookOutlineTree getOutlineTree()
Returns:
Returns the tree which hosts this item.

getId

public int getId()

getCitations

public java.util.HashMap getCitations()

toString

public java.lang.String toString()
Overrides:
toString in class javax.swing.tree.DefaultMutableTreeNode