org.norvelle.textcite.model
Class CitationCategoryCollection

java.lang.Object
  extended by org.norvelle.textcite.model.CitationCategoryCollection
All Implemented Interfaces:
ListModelAdaptee

public class CitationCategoryCollection
extends java.lang.Object
implements ListModelAdaptee

Holds the CitationCategory objects currently associated with a given Citation. Descended from ListModelAdaptee so that it can serve directly as the Model for the JList GUI object on the Citation edit form.


Nested Class Summary
static class CitationCategoryCollection.CitationCategoryCollectionConverter
          CitationCategoryCollectionConverter is an inner class used for serializing CitationCategoryCollection objects via XStream.
 
Constructor Summary
CitationCategoryCollection()
          This constructor is used by collect a set of categories, without necessarily associating them with a Citation
CitationCategoryCollection(Citation parent)
          The constructor associates the new CitationCategoryCollection with the parent citation.
 
Method Summary
 void addAdapter(ListModelChangeListener adapter)
           
 void clear()
           
 java.util.Iterator<Category> getCategoryIterator()
           
 java.lang.Object getElementAt(int i)
           
 int getPosInList(java.lang.Object item)
           
 int getSize()
           
 void recreateAdapterCollection()
          After loading a new file, the AdapterCollection (which is marked as transient) will not be recreated during the deserialization process.
 void registerCategory(Category category)
          Add a CitationCategory to the list of categories associated with the parent Citation.
 void removeAdapter(ListModelChangeListener adapter)
           
 void setParent(Citation parent)
          Associate this CategoryList with a Citation.
 java.lang.String toString()
          Produce a String value for this CategoryList by concatenating the category names with commas.
 void unregisterCategory(Category category)
          Unlink a given category from those associated with the parent Citation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CitationCategoryCollection

public CitationCategoryCollection(Citation parent)
The constructor associates the new CitationCategoryCollection with the parent citation.

Parameters:
parent -

CitationCategoryCollection

public CitationCategoryCollection()
This constructor is used by collect a set of categories, without necessarily associating them with a Citation

Method Detail

registerCategory

public void registerCategory(Category category)
Add a CitationCategory to the list of categories associated with the parent Citation. Also makes sure that the Category is informed of the new Citation that has been added to it.


unregisterCategory

public void unregisterCategory(Category category)
Unlink a given category from those associated with the parent Citation. We remove the Category from the CitationCategoryCollection, and we also remove the Citation from those associated with the Category itself.

Parameters:
category - The Category object that is to be dissociated.

toString

public java.lang.String toString()
Produce a String value for this CategoryList by concatenating the category names with commas.

Overrides:
toString in class java.lang.Object

getSize

public int getSize()
Specified by:
getSize in interface ListModelAdaptee

getElementAt

public java.lang.Object getElementAt(int i)
Specified by:
getElementAt in interface ListModelAdaptee

getPosInList

public int getPosInList(java.lang.Object item)
Specified by:
getPosInList in interface ListModelAdaptee

getCategoryIterator

public java.util.Iterator<Category> getCategoryIterator()

clear

public void clear()

setParent

public void setParent(Citation parent)
Associate this CategoryList with a Citation. We need to tell the Citation to associate each listed Category with itself.


addAdapter

public void addAdapter(ListModelChangeListener adapter)
Specified by:
addAdapter in interface ListModelAdaptee

removeAdapter

public void removeAdapter(ListModelChangeListener adapter)
Specified by:
removeAdapter in interface ListModelAdaptee

recreateAdapterCollection

public void recreateAdapterCollection()
After loading a new file, the AdapterCollection (which is marked as transient) will not be recreated during the deserialization process. This procedure needs to be called to recreate an emtpy AdapterCollection.

Specified by:
recreateAdapterCollection in interface ListModelAdaptee