edu.northwestern.at.wordhoard.swing.annotations
Class AnnotationModel

java.lang.Object
  extended by edu.northwestern.at.wordhoard.swing.annotations.AnnotationModel

public class AnnotationModel
extends java.lang.Object

An annotation model.

Each annotation window has a model which maintains the following state information for the annotations in the window:

Window components register listeners on the model to listen for and react appropriately to changes in the annotation state.


Constructor Summary
AnnotationModel()
          Creates a new annotation model.
 
Method Summary
 void addListener(AnnotationListener listener)
          Adds a listener.
 void clear()
          Clears the annotations.
 Attachment[] getAnnotations()
          Gets the annotations.
 java.lang.String getExtraMessage()
          Gets the extra message.
 int getIndex()
          Gets the index of the current annotation.
 java.lang.String getNoAnnotationsMessage()
          Gets the no annotations message.
 int getNumAnnotations()
          Gets the number of annotations.
 boolean markersShown()
          Returns true if markers are shown.
 void next()
          Goes to to the next annotation.
 boolean panelShown()
          Returns true if the annotation panel is shown.
 void prev()
          Goes to the previous annotation.
 void removeListener(AnnotationListener listener)
          Removes a listener.
 void resetAnnotations()
          resets the annotations.
 void setAnnotations(Attachment[] annotations)
          Sets the annotations.
 void setExtraMessage(java.lang.String message)
          Sets the extra message.
 void setIndex(int index)
          Sets the index of the current annotation.
 void setNoAnnotationsMessage(java.lang.String message)
          Sets the no annotations message.
 void showMarkers(boolean show)
          Shows or hides annnotation markers.
 void showPanel(boolean show)
          Shows or hides the annotation panel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationModel

public AnnotationModel()
Creates a new annotation model.

Method Detail

markersShown

public boolean markersShown()
Returns true if markers are shown.

Returns:
True if markers shown.

showMarkers

public void showMarkers(boolean show)
                 throws PersistenceException
Shows or hides annnotation markers.

Parameters:
show - True to show markers, false to hide them.
Throws:
PersistenceException

panelShown

public boolean panelShown()
Returns true if the annotation panel is shown.

Returns:
True if the annotation panel is shown.

showPanel

public void showPanel(boolean show)
Shows or hides the annotation panel.

Parameters:
show - True to show the panel, false to hide it.

getAnnotations

public Attachment[] getAnnotations()
Gets the annotations.

Returns:
Array of annotations, or null.

setAnnotations

public void setAnnotations(Attachment[] annotations)
Sets the annotations.

Parameters:
annotations - Array of annotations, or null.

resetAnnotations

public void resetAnnotations()
resets the annotations.


getNumAnnotations

public int getNumAnnotations()
Gets the number of annotations.

Returns:
Number of annotations.

clear

public void clear()
Clears the annotations.


getIndex

public int getIndex()
Gets the index of the current annotation.

Returns:
Index of the current annotation.

setIndex

public void setIndex(int index)
Sets the index of the current annotation.

Parameters:
index - Index of the current annotation.

next

public void next()
Goes to to the next annotation.


prev

public void prev()
Goes to the previous annotation.


getNoAnnotationsMessage

public java.lang.String getNoAnnotationsMessage()
Gets the no annotations message.

Returns:
The no annotations message.

setNoAnnotationsMessage

public void setNoAnnotationsMessage(java.lang.String message)
Sets the no annotations message.

Parameters:
message - The no annotations message.

getExtraMessage

public java.lang.String getExtraMessage()
Gets the extra message.

Returns:
The extra message.

setExtraMessage

public void setExtraMessage(java.lang.String message)
Sets the extra message.

Parameters:
message - The extra message.

addListener

public void addListener(AnnotationListener listener)
Adds a listener.

Parameters:
listener - Annotation listener.

removeListener

public void removeListener(AnnotationListener listener)
Removes a listener.

Parameters:
listener - Annotation listener.