com.facetmap.simple
Class SimpleTaxonomy

java.lang.Object
  extended byjavax.swing.tree.DefaultTreeModel
      extended bycom.facetmap.simple.SimpleTaxonomy
All Implemented Interfaces:
Facet, java.io.Serializable, Taxonomy, javax.swing.tree.TreeModel

public class SimpleTaxonomy
extends javax.swing.tree.DefaultTreeModel
implements Taxonomy

There is a big problem with this class; namely, its Headings are stored in two different structures, neither of which is really definitive, and both of which are used. One of them (probably the Vector) must be eliminated soon.

See Also:
Serialized Form

Field Summary
protected  java.util.Vector index
           
protected  java.util.Hashtable nameMap
           
protected  java.lang.String stringId
           
protected  java.lang.String title
           
 
Fields inherited from class javax.swing.tree.DefaultTreeModel
asksAllowsChildren, listenerList, root
 
Constructor Summary
  SimpleTaxonomy(java.lang.String id, java.lang.String title, SimpleTaxHeading root)
           
protected SimpleTaxonomy(java.lang.String stringId, java.lang.String title, SimpleTaxHeading root, java.lang.String rootName)
           
  SimpleTaxonomy(java.lang.String id, java.lang.String title, java.lang.String rootHeadingTitle)
          Construct Taxonomy with a dummy root Heading -- not recommended.
 
Method Summary
 void appendHeadingInto(TaxonomicHeading child, TaxonomicHeading parent)
          Convenience method to insert a heading into a parent heading, in a position after all existing children.
 boolean containsHeading(java.lang.String name)
           
 TaxonomicHeading createTaxonomicHeading(java.lang.String id, java.lang.String title)
          Creates a new Heading suitable for adding to this Taxonomy.
 void doAddToFacetSpace()
          Contains any custom processing that must be done when this structure is added to a FacetSpace.
 Heading getHeading(java.lang.String name)
          Retrieves the Heading, with the specified ID, that is contained by this Facet.
 int getHeadingCount()
           
 java.lang.String getId()
          Unique identifier.
 Heading getRootHeading()
          A facet structure is rooted at the heading returned by this method.
 java.lang.String getStringId()
           
 TaxonomicHeading getTaxonomicHeading(java.lang.String name)
           
 java.lang.String getTitle()
          The descriptive name of this structure, for display to users.
 void insertHeadingInto(TaxonomicHeading child, TaxonomicHeading parent, int indexWithinParent)
          A special subclass method that accommodates the index.
protected  void setStringId(java.lang.String stringId)
           
 void setTitle(java.lang.String title)
           
 int size()
           
 
Methods inherited from class javax.swing.tree.DefaultTreeModel
addTreeModelListener, asksAllowsChildren, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getChild, getChildCount, getIndexOfChild, getListeners, getPathToRoot, getPathToRoot, getRoot, getTreeModelListeners, insertNodeInto, isLeaf, nodeChanged, nodesChanged, nodeStructureChanged, nodesWereInserted, nodesWereRemoved, reload, reload, removeNodeFromParent, removeTreeModelListener, setAsksAllowsChildren, setRoot, valueForPathChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

title

protected java.lang.String title

stringId

protected java.lang.String stringId

index

protected java.util.Vector index

nameMap

protected java.util.Hashtable nameMap
Constructor Detail

SimpleTaxonomy

public SimpleTaxonomy(java.lang.String id,
                      java.lang.String title,
                      java.lang.String rootHeadingTitle)
Construct Taxonomy with a dummy root Heading -- not recommended. Consumers have more control over the root Heading if they use one of the other constructors.


SimpleTaxonomy

public SimpleTaxonomy(java.lang.String id,
                      java.lang.String title,
                      SimpleTaxHeading root)

SimpleTaxonomy

protected SimpleTaxonomy(java.lang.String stringId,
                         java.lang.String title,
                         SimpleTaxHeading root,
                         java.lang.String rootName)
Method Detail

getHeadingCount

public int getHeadingCount()
Specified by:
getHeadingCount in interface Taxonomy

getId

public java.lang.String getId()
Description copied from interface: Facet
Unique identifier.

Specified by:
getId in interface Facet

createTaxonomicHeading

public TaxonomicHeading createTaxonomicHeading(java.lang.String id,
                                               java.lang.String title)
Description copied from interface: Taxonomy
Creates a new Heading suitable for adding to this Taxonomy.

Specified by:
createTaxonomicHeading in interface Taxonomy

getRootHeading

public Heading getRootHeading()
Description copied from interface: Facet
A facet structure is rooted at the heading returned by this method. The root is only necessary to provide a starting point for navigation through this structure; the root will be one of the headings in the default Selection, and it must have no backward for the purposes of Selection.getBackwardSelections(). In some subinterfaces, the root takes on a more familiar role, e.g. the root node of a Taxonomy.

Specified by:
getRootHeading in interface Facet
See Also:
Selection.getForwardSelections(int)

insertHeadingInto

public void insertHeadingInto(TaxonomicHeading child,
                              TaxonomicHeading parent,
                              int indexWithinParent)
                       throws java.lang.IllegalArgumentException
A special subclass method that accommodates the index. This is the preferred method for adding headings to taxonomies.

Specified by:
insertHeadingInto in interface Taxonomy
Throws:
java.lang.IllegalArgumentException - if you break the tree model

appendHeadingInto

public void appendHeadingInto(TaxonomicHeading child,
                              TaxonomicHeading parent)
                       throws java.lang.IllegalArgumentException
Convenience method to insert a heading into a parent heading, in a position after all existing children.

Specified by:
appendHeadingInto in interface Taxonomy
Throws:
java.lang.IllegalArgumentException

getHeading

public Heading getHeading(java.lang.String name)
                   throws UnknownReferenceException
Description copied from interface: Facet
Retrieves the Heading, with the specified ID, that is contained by this Facet. If the facet doesn't recognize the ID, it will throw UnknownReferenceException.

Specified by:
getHeading in interface Taxonomy
Throws:
UnknownReferenceException

getTaxonomicHeading

public TaxonomicHeading getTaxonomicHeading(java.lang.String name)
                                     throws UnknownReferenceException
Specified by:
getTaxonomicHeading in interface Taxonomy
Throws:
UnknownReferenceException

containsHeading

public boolean containsHeading(java.lang.String name)
Specified by:
containsHeading in interface Taxonomy

size

public int size()

setTitle

public void setTitle(java.lang.String title)
Specified by:
setTitle in interface Facet

getTitle

public java.lang.String getTitle()
Description copied from interface: Facet
The descriptive name of this structure, for display to users.

Specified by:
getTitle in interface Facet

setStringId

protected void setStringId(java.lang.String stringId)

getStringId

public java.lang.String getStringId()

doAddToFacetSpace

public void doAddToFacetSpace()
Description copied from interface: Facet
Contains any custom processing that must be done when this structure is added to a FacetSpace. This method should be called after the Facet is added to the FacetSpace.

Specified by:
doAddToFacetSpace in interface Facet