org.norvelle.textcite.model
Class Citation

java.lang.Object
  extended by org.norvelle.textcite.model.Citation

public class Citation
extends java.lang.Object


Nested Class Summary
static class Citation.CitationConverter
          CitationConverter is an inner class used for serializing Citation objects via XStream.
 
Field Summary
static int AUTHOR_COLUMN
           
static int BOOK_COLUMN
           
static int CATEGORY_COLUMN
           
static int NUM_COLUMNS
           
static int PAGEREF_COLUMN
           
static int SUMMARY_COLUMN
           
 
Constructor Summary
protected Citation()
          A parameterless constructor, so that we can recreate a serialized Citation from XML.
  Citation(Book book)
          The object constructor.
  Citation(Book book, java.lang.String text, java.lang.String summary, java.lang.String pageRef)
          The object constructor that also takes a text selection and a summary.
 
Method Summary
 int compareTo(java.lang.Object otherCitation, java.util.Vector comparators)
          Performs a comparison between this Citation and another one, based on a comparison of all of the fields indicated by the current comparators vector.
 void destroy()
          Unregister this Citation from all objects that reference it, and remove it from the master CitationCollection.
 void doUpgrade(double citebookVersion)
          When loading a Citebook of an older version, we may need to update the Citation objects that it contains.
 Book getBook()
           
 CitationCategoryCollection getCategories()
          Returns the list of Category objects associated with this Citation.
 java.lang.Object getColumnValue(int colnum)
          This method translates a numeric column number into a data field, and returns that field's value.
 java.lang.String getComment()
           
 int getId()
           
 BookOutlineItem getOutlineItem()
           
 java.lang.String getPageReference()
           
 java.lang.String getSummary()
           
 java.lang.String getText()
           
 java.lang.String getTranslation()
           
 boolean hasCommentary()
           
 boolean hasTranslation()
           
 boolean isOrphan()
           
 void registerCategory(Category cat)
          Add a Category to those listed as being associated with this Citation
 void setBook(Book book)
          The setter method for modifying the Book associated with this Citation.
 void setCategories(CitationCategoryCollection categoryList)
          Set the list of categories associated with this Citation.
 void setComment(java.lang.String comment)
           
 void setOutlineItem(BookOutlineItem outlineItem)
           
 void setPageReference(java.lang.String pageReference)
           
 void setSummary(java.lang.String summary)
           
 void setText(java.lang.String citationText)
          In order to make sure that the JTable gets updated correctly, we notify Listeners of the change to this Citation.
 void setTranslation(java.lang.String translation)
           
 void unregisterCategory(Category cat)
          Remove a given Category from those associated with this Citation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BOOK_COLUMN

public static final int BOOK_COLUMN
See Also:
Constant Field Values

AUTHOR_COLUMN

public static final int AUTHOR_COLUMN
See Also:
Constant Field Values

PAGEREF_COLUMN

public static final int PAGEREF_COLUMN
See Also:
Constant Field Values

SUMMARY_COLUMN

public static final int SUMMARY_COLUMN
See Also:
Constant Field Values

CATEGORY_COLUMN

public static final int CATEGORY_COLUMN
See Also:
Constant Field Values

NUM_COLUMNS

public static final int NUM_COLUMNS
See Also:
Constant Field Values
Constructor Detail

Citation

public Citation(Book book)
The object constructor. Automatically registers the new Citation with the Book that it is from.

Parameters:
book - The Book object that this Citation is associated with.

Citation

public Citation(Book book,
                java.lang.String text,
                java.lang.String summary,
                java.lang.String pageRef)
The object constructor that also takes a text selection and a summary.

Parameters:
book - The Book object that this Citation is associated with.
text - The text to be stored in this object.
summary - The summary text (no more than a single sentence) that capsulizes what the citation is about.

Citation

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

Method Detail

destroy

public void destroy()
Unregister this Citation from all objects that reference it, and remove it from the master CitationCollection. In particular, unregisters itself from the Book it is associated with, and unregisters itself from all Category objects. Sets the various private attributes to null.


unregisterCategory

public void unregisterCategory(Category cat)
Remove a given Category from those associated with this Citation.

Parameters:
cat - The Category to be removed

registerCategory

public void registerCategory(Category cat)
Add a Category to those listed as being associated with this Citation

Parameters:
cat - The Category to add.

getOutlineItem

public BookOutlineItem getOutlineItem()
Returns:
Returns the associated BookOutlineItem.

setOutlineItem

public void setOutlineItem(BookOutlineItem outlineItem)
Parameters:
outlineItem - The BookOutlineItem to associate with this Citation.

getSummary

public java.lang.String getSummary()

setSummary

public void setSummary(java.lang.String summary)

getComment

public java.lang.String getComment()

setComment

public void setComment(java.lang.String comment)

getTranslation

public java.lang.String getTranslation()

setTranslation

public void setTranslation(java.lang.String translation)

hasTranslation

public boolean hasTranslation()
Returns:
true if the translation attribute conntains text, otherwise false

hasCommentary

public boolean hasCommentary()
Returns:
true if the comment attribute contains text, otherwise false

getColumnValue

public java.lang.Object getColumnValue(int colnum)
This method translates a numeric column number into a data field, and returns that field's value.

Parameters:
colnum - The number of the column to be retrieved.
Returns:

setText

public void setText(java.lang.String citationText)
In order to make sure that the JTable gets updated correctly, we notify Listeners of the change to this Citation.

Parameters:
citationText - The new text to be assigned.

getText

public java.lang.String getText()

getPageReference

public java.lang.String getPageReference()

setPageReference

public void setPageReference(java.lang.String pageReference)

getCategories

public CitationCategoryCollection getCategories()
Returns the list of Category objects associated with this Citation.

Returns:
A CategoryList object containing the associated Category objects.

setCategories

public void setCategories(CitationCategoryCollection categoryList)
Set the list of categories associated with this Citation.

Parameters:
categoryList - The CitationCategoryCollection to be associated.

getId

public int getId()

getBook

public Book getBook()

setBook

public void setBook(Book book)
The setter method for modifying the Book associated with this Citation. Makes sure to unregister this Citation from the old book and register with the new Book.

Parameters:
book -

doUpgrade

public void doUpgrade(double citebookVersion)
When loading a Citebook of an older version, we may need to update the Citation objects that it contains. This routine performs the necessary upgrades, depending on the citebook version just loaded.

Parameters:
citebookVersion -

compareTo

public int compareTo(java.lang.Object otherCitation,
                     java.util.Vector comparators)
              throws java.lang.ClassCastException
Performs a comparison between this Citation and another one, based on a comparison of all of the fields indicated by the current comparators vector.

Parameters:
otherCitation - The Citation object that this Citation will be compared with
comparators - The Vector of Comparator object that will be used to provide a multi-field sort
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
java.lang.ClassCastException - if the otherCitation parameter is not a Citation

isOrphan

public boolean isOrphan()
Returns:
true if this citation is not owned by any valid Book