org.annotation.wordfreak.scheme
Class AnnotationScheme

java.lang.Object
  extended byorg.annotation.wordfreak.scheme.AnnotationScheme
All Implemented Interfaces:
AnnotatedFileListener, ChooserListener, java.util.EventListener, Plugin, javax.swing.event.TreeModelListener, UndoListener, ViewerListener, WordFreakKeyboardFocusManager.HotKeyListener
Direct Known Subclasses:
DerivativeAnnotationScheme, DocumentAnnotationScheme, GenericAnnotationScheme, ParagraphAnnotationScheme, POSAnnotationScheme, SentenceAnnotationScheme, TextCorrectionAnnotationScheme, TokenAnnotationScheme

public abstract class AnnotationScheme
extends java.lang.Object
implements Plugin, AnnotatedFileListener, ViewerListener, UndoListener, javax.swing.event.TreeModelListener, WordFreakKeyboardFocusManager.HotKeyListener

Annotation schemes define different types of annotation. This is primarily done by specifying which types of annotations the scheme deals handles by overriding handlesAnnotation and the labels assigned to those types of annotation by overriding initOutcomes. For annoations which are based on oher annotations the building blocks can be specified by overriding handlesBaseAnnotation. A specific interface for entering the annotations can be built by overriding createChooser.


Nested Class Summary
 class AnnotationScheme.POSFeature
           
 
Field Summary
protected static int _ADD
           
protected static int _MOVE
           
protected static int _RELOAD
           
protected static int _REMOVE
           
protected static int _UPDATE
           
static int ANNOTATE
          global constant for setting the mouse to ANNOTATE mode
protected  AnnotationFilter annotationFilter
          Filter which determines what subset of the annotations this scheme cares about.
protected  Annotator annotator
          Current annotator for sorting outcomes if this is supported.
protected  java.lang.String annotatorName
          Username of the person doing the annotation
protected  boolean canCreateAnnotations
          Determines whether the scheme can create new annotations, or simply add properties to existing annotations.
protected  Chooser chooser
           
protected  int chooserWidth
          the number of buttons per row that will be passed to the outcomes chooser component
static java.lang.String COADJUST
           
static java.lang.String COADJUSTLEFT
           
static java.lang.String COADJUSTRIGHT
           
protected  java.lang.String[] codes
          Parallel array to outcomes which designate the types an annotation can be marked with when outcomes is used for display purposes only
protected  java.util.List coloredWords
          A list of the annotations that have been colorized
protected  java.awt.Color[] colors
           
protected  java.util.Map colorTable
          Provides a mapping between annotation types and colors for color viewing of annotations.
static java.lang.String COMMENT
           
protected  java.util.Map config
           
protected  boolean configLoaded
           
protected  boolean confineToBase
           
protected  AnnotationFile currentFile
          Stores the last AnnotatedFile which was sent to the AnnotationListeners.
static java.lang.String DEFAULT_ACTION
          Navigation Messages
protected  java.lang.String defaultType
          Default type for new annotations.
static java.lang.String END
           
protected  java.util.List files
          List of AnnotatedFiles that are currently being modified by this scheme.
protected  int findIndex
           
static java.lang.String FLATLEFT
           
static java.lang.String FLATNEXT
           
static java.lang.String FLATPREV
           
static java.lang.String FLATRIGHT
           
protected  java.util.Map groups
          A mapping from group labels to the outcomes in those groups.
static java.lang.String GROWLEFT
           
static java.lang.String GROWRIGHT
           
protected  GuiListener guiListener
           
static java.lang.String HOME
           
protected  javax.swing.Icon[] icons
           
protected  int index
          Index of annotation currently under examination.
static java.lang.String INSERT
           
static int JUMP
          global constant for setting trhe mouse to JUMP mode
static java.awt.ComponentOrientation L2R
           
static java.lang.String LEFT
           
protected  java.util.List listeners
           
protected  SchemeNavigator navigator
           
static java.lang.String NEXT
           
static java.lang.String NEXTCHUNK
           
static java.lang.String NORM
           
protected  boolean one2one
          When true designates that the scheme should create an annotation automatically for each base annotation unless that annoation already exists.
protected  java.lang.String one2oneFeature
          Specifies a feature that an automatically created annotation should have.
protected  java.lang.String one2oneValue
          Specifies the value of a the feature, one2oneFeature that an automatically created annotation should have.
protected  java.awt.ComponentOrientation orientation
           
static java.lang.String OUTCOME_CODES
           
static java.lang.String OUTCOME_COLORS
           
static java.lang.String OUTCOME_NAMES
           
protected  java.lang.String[] outcomes
          Set of types that an annotation can mark be marked with in this scheme.
static java.lang.String PREV
           
static java.lang.String PREVCHUNK
           
static java.awt.ComponentOrientation R2L
           
static java.lang.String REMOVE
           
static java.lang.String RIGHT
           
protected  AnnotationSelection selectedAnnotations
          List of all selected annotations for this scheme.
protected  int selEnd
          Index of the annotation at the beginning of the selection
protected  int selStart
          Index of the annotation at the beginning of the selection
static java.lang.String SHRINKLEFT
           
static java.lang.String SHRINKRIGHT
           
protected  SortCriteria sortCriteria
           
protected  SortedAnnotations sorted
           
protected  int sortedIndex
          Position of last examined annotation when a sorting scheme of than the default is used.
static java.lang.String SPLIT
           
protected  Annotation splita
           
protected  Annotation splitb
           
protected  java.lang.String type
          The string parameter passed to the scheme constructor.
protected  java.util.Map typeMap
          provides a mapping between outcomes and the annotation types which those
protected  java.lang.String typeName
          Indicates which feature of the annotation should be used as the primary type.
protected  java.util.Map types
           
protected  boolean update
           
static java.lang.String UPDATE
           
protected  AnnotationView view
          Current view for this annotation scheme.
protected  java.util.List views
          List of AnnotatedViewss that are currently being used by this scheme.
 
Constructor Summary
AnnotationScheme(java.lang.String type)
           
AnnotationScheme(java.lang.String type, Chooser c)
           
 
Method Summary
 void addAnnotationSchemeListener(AnnotationSchemeListener listener)
          Registers the specified listener for annotation scheme callbacks.
 boolean adjudicationMatch(Annotation a, Annotation b)
           
 boolean adjudicationMatch(Annotation a, java.lang.Object ao, Annotation b, java.lang.Object bo)
           
 void annotatedFile(AnnotationFile f)
          Selects annotations from f that this scheme can modify.
protected  Annotation annotationFromMouse(int start, int end)
           
protected  Annotation annotationFromMouse(int start, int end, java.lang.String type)
          Creates a new annotation based on the offsets start and end and updates the schemes data stuctures.
protected  void buildSwatches()
           
 void closeAnnotatedFile(AnnotationFile f)
          Removes annotations in f from the set of possible annotations.
 void colorize()
           
protected  void createChooser()
          Instantiates a new chooser if one does not already exist and registers the chooser for scheme events and the scheme for chooser events.
protected  AnnotationView createView(AnnotationFile af)
           
 void dispose()
           
 void down()
          Specifies the the current annotation should be changed to an appropiate child annotation.
 void end()
           
 void filter()
          Filters the set of possible annotations to include only those which match the annotationFilter.
 void findExpression(java.lang.String e, int dir)
           
 void findExpressionAgain(java.lang.String e, int dir)
           
 void flatNext()
           
 void flatPrev()
           
 java.lang.Object getAdjudicationData(Annotation a)
           
 Annotation getAnnotation()
           
 Annotation getAnnotation(int i)
           
 AnnotationFilter getAnnotationFilter()
           
protected  void getAnnotationsFromFile(AnnotationFile f)
          Creates data structures needed by the scheme to induce the set of all possible annotations.
 java.util.List getAnnotationsFromOffsets(int s, int e)
           
 int getAnnotationSize()
           
 Chooser getChooser()
           
 java.util.Map getColorScheme()
           
 boolean getConfineToBase()
           
 Annotation getCurrentAnnotation()
           
 java.lang.String getDefaultType()
           
static java.lang.String[] getNames()
          Returns the list of Strings that can be passed to the contsructor to specify which scheme behavior to use.
 java.lang.String getPropertyName()
          Returns the name of the property used to compare annotations
protected  SelectionMode getSelectionMode()
           
protected  int getSortedIndex()
           
 java.lang.String[] getValuesForFeature(java.lang.String f)
          Returns the set of valid values for the specified feature.
 boolean handlesAnnotation(Annotation a)
           
 boolean handlesBaseAnnotation(Annotation a)
           
 boolean handlesRelation(Relation r)
           
protected  void hilightChunk(int s, int e)
           
 void home()
           
 void hotKeyPressed(java.lang.String name)
          Indicates that the hot key with the specified name has been pressed.
 int indexOfAnnotation(Annotation a)
           
protected abstract  void initOutcomes()
          Initalizes the set of outcomes that this scheme can assign an annotation.
 boolean isOutcome(java.lang.String choice)
           
 void jumpToMark()
          Selects the Annotation marked by setMark
 boolean linkAnnotation(Annotation source, Annotation target, int modifiers)
          Requests that the specified source annotation be linked to the specified target annotation given the modifiers.
 boolean moveAnnotation(Annotation child, Annotation newParent, Annotation oldParent)
          Requests that the specified child annotation be moved form the specified old parent to the specified new parent.
 void next()
          Advances scheme to the next annotation.
 void nextFile()
          Specifies that the current annotation should be set to an annotation the next file.
 void nextOutcome()
          Specifies that the type feature of the current annotation should be updated to the next appropiate value.
protected  void notifyListeners(int op, Annotation ann)
           
protected  void notifyListeners(int op, Annotation ann, Annotation p)
           
 int offsetToIndex(int offset)
           
 void prev()
          Advances scheme to the previous annotation.
 void prevFile()
          Specifies that the current annotation should be set to an annotation the previous file.
 void prevOutcome()
          Specifies that the type feature of the current annotation should be updated to the previous appropiate value.
protected  void process(Annotation a)
           
 void redoPerformed()
           
 void reload()
          Reloads each of the open files.
 void reloadFiles(java.lang.String encoding)
          Requests that all loaded files be reloaded using the specified encoding or the default encoding is the specified encoding is null.
 void removeAllAnnotationSchemeListeners()
           
protected  void removeAnnotation(Annotation a)
           
protected  void removeAnnotation(Annotation a, boolean shrink)
           
 void removeAnnotationSchemeListener(AnnotationSchemeListener listener)
          Unregisters the specified listener from the annotation scheme callbacks.
 void selectCurrentAnnotation()
          Requests that the current annotation be selected.
 void set(java.lang.String choice)
          Performs appropiate action based on user selection choice.
 void set(java.lang.String choice, int modifiers)
          Specifies that the specified choice has been selected with the specified modifier.
 void set(java.lang.String choice, int modifiers, boolean jump)
          Specifies that the specified choice has been selected with the specified modifier and that the next annotation should be shown.
 void set(java.lang.String choice, int modifiers, boolean jump, Annotation selectedAnnotation)
          Specifies that the specified choice has been selected with the specified modifier and the specified selected Annotation and that the next annotation should be shown.
 void setAnnotatedFile(AnnotationFile af)
           
 void setAnnotation(Annotation a)
          Specifies the the annotation specified should be the current annotation.
 void setAnnotationFilter(AnnotationFilter af)
          Designates the filter that will be applied whenever the filter method is called.
 void setAnnotationView(AnnotationView v)
           
 void setAnnotator(Annotator a)
          Sets the current annotator to allow outcomes to be sorted.
 void setAnnotatorName(java.lang.String ann)
          Designates the annotator who will be making the annotations.
 void setChooser(Chooser c)
           
 void setChunkNavigation(boolean b)
           
 void setConfig(java.util.Map cfg)
          Assigns the configuration specific properties of this scheme.
 void setConfineToBase(boolean c)
           
 void setFeature(Annotation ann, java.lang.String feature, java.lang.String value)
          Sets the annotation's feature to the specified value.
 void setGuiListener(GuiListener gl)
          Designates a listener for adding gui objects to the display.
 void setJumpAfterAnnotation(boolean j)
           
 void setMark()
          Stores the AnnotatedFile and character offset of the current Annotation in static variables so that other schemes can select the same one.
 void setNavigator(SchemeNavigator n)
           
 void setOneToOne(boolean o, java.lang.String d)
          Specifies that this should create an annotation of type d for every annotation that this scheme handles.
 void setOneToOne(boolean o, java.lang.String f, java.lang.String v)
           
 void setOrientation(java.awt.ComponentOrientation o)
           
 void setSelection(AnnotationSelection anns)
          Requests that the specified annotation selection should be set as the current selection.
 void setSelection(AnnotationSelection anns, boolean validate)
          Requests that the specified annotation selection should be set as the current selection and adjusted if the specified validate condition is true.
 void setSelectionEnd(int offset)
          Specifies that a selection is being made which ends at the specified offset.
protected  void setSelectionMode(SelectionMode sm)
           
 void setSelectionStart(int offset)
          Specifies that a selection is being made which starts at the specified offset.
 void setSelEnd(int offset, boolean validate)
           
protected  void setSortedIndex(int si)
           
 void setSortScheme(SortCriteria sortCriteria)
          Notifies this scheme to use the specified sorting criteria.
protected  void setTypeName(java.lang.String t)
          Sets the primary type used in this scheme to an annotation's feature t.
 void trackAnnotation(Annotation a)
           
 void treeNodesChanged(javax.swing.event.TreeModelEvent e)
           
 void treeNodesInserted(javax.swing.event.TreeModelEvent e)
           
 void treeNodesRemoved(javax.swing.event.TreeModelEvent e)
           
 void treeStructureChanged(javax.swing.event.TreeModelEvent e)
           
 void undoPerformed()
           
 void up()
          Specifies the the current annotation should be changed to an appropiate parent annotation.
protected  void updateOutcomes(Annotation a)
          Changes the possible outcomes or their order as appropiate.
 void viewCreated()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

view

protected AnnotationView view
Current view for this annotation scheme. This is changed whenever the currently displayed file changes.


annotator

protected Annotator annotator
Current annotator for sorting outcomes if this is supported.


configLoaded

protected boolean configLoaded

config

protected java.util.Map config

types

protected java.util.Map types

navigator

protected SchemeNavigator navigator

selectedAnnotations

protected AnnotationSelection selectedAnnotations
List of all selected annotations for this scheme.


index

protected int index
Index of annotation currently under examination.


sortedIndex

protected int sortedIndex
Position of last examined annotation when a sorting scheme of than the default is used.


selStart

protected int selStart
Index of the annotation at the beginning of the selection


selEnd

protected int selEnd
Index of the annotation at the beginning of the selection


defaultType

protected java.lang.String defaultType
Default type for new annotations.


one2one

protected boolean one2one
When true designates that the scheme should create an annotation automatically for each base annotation unless that annoation already exists.


one2oneFeature

protected java.lang.String one2oneFeature
Specifies a feature that an automatically created annotation should have.


one2oneValue

protected java.lang.String one2oneValue
Specifies the value of a the feature, one2oneFeature that an automatically created annotation should have.


canCreateAnnotations

protected boolean canCreateAnnotations
Determines whether the scheme can create new annotations, or simply add properties to existing annotations.


files

protected java.util.List files
List of AnnotatedFiles that are currently being modified by this scheme.


views

protected java.util.List views
List of AnnotatedViewss that are currently being used by this scheme.


annotationFilter

protected AnnotationFilter annotationFilter
Filter which determines what subset of the annotations this scheme cares about.


colorTable

protected java.util.Map colorTable
Provides a mapping between annotation types and colors for color viewing of annotations.


currentFile

protected AnnotationFile currentFile
Stores the last AnnotatedFile which was sent to the AnnotationListeners.


coloredWords

protected java.util.List coloredWords
A list of the annotations that have been colorized


_ADD

protected static final int _ADD
See Also:
Constant Field Values

_REMOVE

protected static final int _REMOVE
See Also:
Constant Field Values

_RELOAD

protected static final int _RELOAD
See Also:
Constant Field Values

_UPDATE

protected static final int _UPDATE
See Also:
Constant Field Values

_MOVE

protected static final int _MOVE
See Also:
Constant Field Values

typeMap

protected java.util.Map typeMap
provides a mapping between outcomes and the annotation types which those


chooserWidth

protected int chooserWidth
the number of buttons per row that will be passed to the outcomes chooser component


orientation

protected java.awt.ComponentOrientation orientation

findIndex

protected int findIndex

L2R

public static final java.awt.ComponentOrientation L2R

R2L

public static final java.awt.ComponentOrientation R2L

JUMP

public static final int JUMP
global constant for setting trhe mouse to JUMP mode

See Also:
Constant Field Values

ANNOTATE

public static final int ANNOTATE
global constant for setting the mouse to ANNOTATE mode

See Also:
Constant Field Values

DEFAULT_ACTION

public static final java.lang.String DEFAULT_ACTION
Navigation Messages

See Also:
Constant Field Values

NORM

public static final java.lang.String NORM
See Also:
Constant Field Values

HOME

public static final java.lang.String HOME
See Also:
Constant Field Values

END

public static final java.lang.String END
See Also:
Constant Field Values

LEFT

public static final java.lang.String LEFT
See Also:
Constant Field Values

RIGHT

public static final java.lang.String RIGHT
See Also:
Constant Field Values

NEXT

public static final java.lang.String NEXT
See Also:
Constant Field Values

PREV

public static final java.lang.String PREV
See Also:
Constant Field Values

FLATLEFT

public static final java.lang.String FLATLEFT
See Also:
Constant Field Values

FLATRIGHT

public static final java.lang.String FLATRIGHT
See Also:
Constant Field Values

FLATNEXT

public static final java.lang.String FLATNEXT
See Also:
Constant Field Values

FLATPREV

public static final java.lang.String FLATPREV
See Also:
Constant Field Values

INSERT

public static final java.lang.String INSERT
See Also:
Constant Field Values

REMOVE

public static final java.lang.String REMOVE
See Also:
Constant Field Values

UPDATE

public static final java.lang.String UPDATE
See Also:
Constant Field Values

GROWLEFT

public static final java.lang.String GROWLEFT
See Also:
Constant Field Values

GROWRIGHT

public static final java.lang.String GROWRIGHT
See Also:
Constant Field Values

SHRINKLEFT

public static final java.lang.String SHRINKLEFT
See Also:
Constant Field Values

SHRINKRIGHT

public static final java.lang.String SHRINKRIGHT
See Also:
Constant Field Values

COMMENT

public static final java.lang.String COMMENT
See Also:
Constant Field Values

NEXTCHUNK

public static final java.lang.String NEXTCHUNK
See Also:
Constant Field Values

PREVCHUNK

public static final java.lang.String PREVCHUNK
See Also:
Constant Field Values

COADJUSTLEFT

public static final java.lang.String COADJUSTLEFT
See Also:
Constant Field Values

COADJUSTRIGHT

public static final java.lang.String COADJUSTRIGHT
See Also:
Constant Field Values

SPLIT

public static final java.lang.String SPLIT
See Also:
Constant Field Values

COADJUST

public static final java.lang.String COADJUST
See Also:
Constant Field Values

OUTCOME_NAMES

public static final java.lang.String OUTCOME_NAMES
See Also:
Constant Field Values

OUTCOME_CODES

public static final java.lang.String OUTCOME_CODES
See Also:
Constant Field Values

OUTCOME_COLORS

public static final java.lang.String OUTCOME_COLORS
See Also:
Constant Field Values

confineToBase

protected boolean confineToBase

listeners

protected java.util.List listeners

sortCriteria

protected SortCriteria sortCriteria

guiListener

protected GuiListener guiListener

annotatorName

protected java.lang.String annotatorName
Username of the person doing the annotation


update

protected boolean update

outcomes

protected java.lang.String[] outcomes
Set of types that an annotation can mark be marked with in this scheme.


groups

protected java.util.Map groups
A mapping from group labels to the outcomes in those groups.


codes

protected java.lang.String[] codes
Parallel array to outcomes which designate the types an annotation can be marked with when outcomes is used for display purposes only


colors

protected java.awt.Color[] colors

icons

protected javax.swing.Icon[] icons

chooser

protected Chooser chooser

type

protected java.lang.String type
The string parameter passed to the scheme constructor.


sorted

protected SortedAnnotations sorted

typeName

protected java.lang.String typeName
Indicates which feature of the annotation should be used as the primary type. This determines how sorting of annotations is performed and is set to Annotation.TYPE by default.


splita

protected Annotation splita

splitb

protected Annotation splitb
Constructor Detail

AnnotationScheme

public AnnotationScheme(java.lang.String type)

AnnotationScheme

public AnnotationScheme(java.lang.String type,
                        Chooser c)
Method Detail

setJumpAfterAnnotation

public void setJumpAfterAnnotation(boolean j)

hotKeyPressed

public void hotKeyPressed(java.lang.String name)
Description copied from interface: WordFreakKeyboardFocusManager.HotKeyListener
Indicates that the hot key with the specified name has been pressed.

Specified by:
hotKeyPressed in interface WordFreakKeyboardFocusManager.HotKeyListener
Parameters:
name - The name of the hot key.

setChunkNavigation

public void setChunkNavigation(boolean b)

setConfig

public void setConfig(java.util.Map cfg)
Assigns the configuration specific properties of this scheme.

Parameters:
cfg - a mapping between configuration parameters and their values.

setNavigator

public void setNavigator(SchemeNavigator n)

setOrientation

public void setOrientation(java.awt.ComponentOrientation o)

setTypeName

protected void setTypeName(java.lang.String t)
Sets the primary type used in this scheme to an annotation's feature t.

Parameters:
t - the name of the feature to be used as the primary type.

setOneToOne

public void setOneToOne(boolean o,
                        java.lang.String d)
Specifies that this should create an annotation of type d for every annotation that this scheme handles.

Parameters:
o - true if annotations should be created.
d - the type of annotation to create.

setOneToOne

public void setOneToOne(boolean o,
                        java.lang.String f,
                        java.lang.String v)

setConfineToBase

public void setConfineToBase(boolean c)

getConfineToBase

public boolean getConfineToBase()

annotatedFile

public void annotatedFile(AnnotationFile f)
Selects annotations from f that this scheme can modify.

Specified by:
annotatedFile in interface AnnotatedFileListener
Parameters:
f - The file which was opened.

getNames

public static java.lang.String[] getNames()
Returns the list of Strings that can be passed to the contsructor to specify which scheme behavior to use.


getPropertyName

public java.lang.String getPropertyName()
Returns the name of the property used to compare annotations


createView

protected AnnotationView createView(AnnotationFile af)

viewCreated

public void viewCreated()

getAnnotationsFromFile

protected void getAnnotationsFromFile(AnnotationFile f)
Creates data structures needed by the scheme to induce the set of all possible annotations. This minimaly includes populating List annotations and List allAnnotaitons


trackAnnotation

public void trackAnnotation(Annotation a)

handlesAnnotation

public boolean handlesAnnotation(Annotation a)

handlesBaseAnnotation

public boolean handlesBaseAnnotation(Annotation a)

handlesRelation

public boolean handlesRelation(Relation r)

getAdjudicationData

public java.lang.Object getAdjudicationData(Annotation a)

adjudicationMatch

public boolean adjudicationMatch(Annotation a,
                                 Annotation b)

adjudicationMatch

public boolean adjudicationMatch(Annotation a,
                                 java.lang.Object ao,
                                 Annotation b,
                                 java.lang.Object bo)

setMark

public void setMark()
Stores the AnnotatedFile and character offset of the current Annotation in static variables so that other schemes can select the same one.


jumpToMark

public void jumpToMark()
Selects the Annotation marked by setMark


getSortedIndex

protected int getSortedIndex()

setSortedIndex

protected void setSortedIndex(int si)

setAnnotatedFile

public void setAnnotatedFile(AnnotationFile af)

setAnnotationView

public void setAnnotationView(AnnotationView v)

getAnnotationSize

public int getAnnotationSize()

indexOfAnnotation

public int indexOfAnnotation(Annotation a)

getAnnotation

public Annotation getAnnotation()

getAnnotation

public Annotation getAnnotation(int i)

setAnnotation

public void setAnnotation(Annotation a)
Description copied from interface: ChooserListener
Specifies the the annotation specified should be the current annotation.

Specified by:
setAnnotation in interface ChooserListener
Parameters:
a - the annotation which should become the current annotation.

selectCurrentAnnotation

public void selectCurrentAnnotation()
Description copied from interface: ViewerListener
Requests that the current annotation be selected.

Specified by:
selectCurrentAnnotation in interface ViewerListener

getCurrentAnnotation

public Annotation getCurrentAnnotation()

setSelection

public void setSelection(AnnotationSelection anns)
Description copied from interface: ViewerListener
Requests that the specified annotation selection should be set as the current selection. The selection will be adjusted to ensure that only a valid selection is made.

Specified by:
setSelection in interface ViewerListener
Parameters:
anns - The annotations to be selected.

setSelection

public void setSelection(AnnotationSelection anns,
                         boolean validate)
Description copied from interface: ViewerListener
Requests that the specified annotation selection should be set as the current selection and adjusted if the specified validate condition is true.

Specified by:
setSelection in interface ViewerListener
Parameters:
anns - The annotations to be selected.
validate - Whether the annotaitons should be adjusted to be a valid selection.

setSelectionStart

public void setSelectionStart(int offset)
Description copied from interface: ViewerListener
Specifies that a selection is being made which starts at the specified offset.

Specified by:
setSelectionStart in interface ViewerListener
Parameters:
offset - The start of the selection.

setSelectionEnd

public void setSelectionEnd(int offset)
Description copied from interface: ViewerListener
Specifies that a selection is being made which ends at the specified offset. This method is continually called as a selection is being extended.

Specified by:
setSelectionEnd in interface ViewerListener
Parameters:
offset - The end of the selection.

setSelEnd

public void setSelEnd(int offset,
                      boolean validate)

linkAnnotation

public boolean linkAnnotation(Annotation source,
                              Annotation target,
                              int modifiers)
Description copied from interface: ViewerListener
Requests that the specified source annotation be linked to the specified target annotation given the modifiers. This behavior can be used for arbitray actions in viewers which involve two annotations. Currently it is used for annotating traces in ConstituentAnnotaitonScheme.

Specified by:
linkAnnotation in interface ViewerListener
Parameters:
source - The source annotation.
target - The target annotation.
modifiers - The modifiers selected when this action was taken.
Returns:
true if the operation wsa successful, false otherwise.

moveAnnotation

public boolean moveAnnotation(Annotation child,
                              Annotation newParent,
                              Annotation oldParent)
Description copied from interface: ViewerListener
Requests that the specified child annotation be moved form the specified old parent to the specified new parent.

Specified by:
moveAnnotation in interface ViewerListener
Parameters:
child - The annotation to be moved.
newParent - The parent under which the specified child should be placed.
oldParent - The previous parent.
Returns:
true if the move was successful, false otherwise.

getAnnotationsFromOffsets

public java.util.List getAnnotationsFromOffsets(int s,
                                                int e)

reloadFiles

public void reloadFiles(java.lang.String encoding)
Description copied from interface: ViewerListener
Requests that all loaded files be reloaded using the specified encoding or the default encoding is the specified encoding is null.

Specified by:
reloadFiles in interface ViewerListener
Parameters:
encoding - The encoding which should be used to reload the files.

offsetToIndex

public int offsetToIndex(int offset)

notifyListeners

protected void notifyListeners(int op,
                               Annotation ann)

notifyListeners

protected void notifyListeners(int op,
                               Annotation ann,
                               Annotation p)

annotationFromMouse

protected Annotation annotationFromMouse(int start,
                                         int end)

annotationFromMouse

protected Annotation annotationFromMouse(int start,
                                         int end,
                                         java.lang.String type)
Creates a new annotation based on the offsets start and end and updates the schemes data stuctures. This method should be overridden by any scheme that wishes to use a MouseModeChooser for annotation.


setAnnotationFilter

public void setAnnotationFilter(AnnotationFilter af)
Designates the filter that will be applied whenever the filter method is called.


getAnnotationFilter

public AnnotationFilter getAnnotationFilter()

closeAnnotatedFile

public void closeAnnotatedFile(AnnotationFile f)
Removes annotations in f from the set of possible annotations.

Specified by:
closeAnnotatedFile in interface AnnotatedFileListener
Parameters:
f - The file which was closed.

up

public void up()
Description copied from interface: ChooserListener
Specifies the the current annotation should be changed to an appropiate parent annotation.

Specified by:
up in interface ChooserListener

down

public void down()
Description copied from interface: ChooserListener
Specifies the the current annotation should be changed to an appropiate child annotation.

Specified by:
down in interface ChooserListener

next

public void next()
Advances scheme to the next annotation.

Specified by:
next in interface ChooserListener

prev

public void prev()
Advances scheme to the previous annotation.

Specified by:
prev in interface ChooserListener

home

public void home()

end

public void end()

flatNext

public void flatNext()

flatPrev

public void flatPrev()

nextFile

public void nextFile()
Description copied from interface: ChooserListener
Specifies that the current annotation should be set to an annotation the next file.

Specified by:
nextFile in interface ChooserListener

prevFile

public void prevFile()
Description copied from interface: ChooserListener
Specifies that the current annotation should be set to an annotation the previous file.

Specified by:
prevFile in interface ChooserListener

nextOutcome

public void nextOutcome()
Description copied from interface: ChooserListener
Specifies that the type feature of the current annotation should be updated to the next appropiate value.

Specified by:
nextOutcome in interface ChooserListener

prevOutcome

public void prevOutcome()
Description copied from interface: ChooserListener
Specifies that the type feature of the current annotation should be updated to the previous appropiate value.

Specified by:
prevOutcome in interface ChooserListener

updateOutcomes

protected void updateOutcomes(Annotation a)
Changes the possible outcomes or their order as appropiate.


process

protected void process(Annotation a)

getDefaultType

public java.lang.String getDefaultType()

buildSwatches

protected void buildSwatches()

hilightChunk

protected void hilightChunk(int s,
                            int e)

colorize

public void colorize()

reload

public void reload()
Reloads each of the open files. This typically occurs after an automatic annotator has tagged a file and the annotator needs to be updated with the new annotations.


filter

public void filter()
Filters the set of possible annotations to include only those which match the annotationFilter. This can cause the set of annotations to grow or shrink.


isOutcome

public boolean isOutcome(java.lang.String choice)

set

public final void set(java.lang.String choice)
Performs appropiate action based on user selection choice.

Specified by:
set in interface ChooserListener
Parameters:
choice - The choice which has been selected.

set

public final void set(java.lang.String choice,
                      int modifiers)
Description copied from interface: ChooserListener
Specifies that the specified choice has been selected with the specified modifier.

Specified by:
set in interface ChooserListener
Parameters:
choice - The choice which has been selected.
modifiers - The modifiers selection when that choice was made.

set

public void set(java.lang.String choice,
                int modifiers,
                boolean jump)
Description copied from interface: ChooserListener
Specifies that the specified choice has been selected with the specified modifier and that the next annotation should be shown.

Specified by:
set in interface ChooserListener
Parameters:
choice - The choice which has been selected.
modifiers - The modifiers selection when that choice was made.
jump - Specifies whether the next annotation should be immediately shown.

set

public void set(java.lang.String choice,
                int modifiers,
                boolean jump,
                Annotation selectedAnnotation)
Description copied from interface: ChooserListener
Specifies that the specified choice has been selected with the specified modifier and the specified selected Annotation and that the next annotation should be shown.

Specified by:
set in interface ChooserListener
Parameters:
choice - The choice which has been selected.
modifiers - The modifiers selection when that choice was made.
jump - Specifies whether the next annotation should be immediately shown.
selectedAnnotation - An annotation whose selection is related to the specified choice.

removeAnnotation

protected void removeAnnotation(Annotation a)

removeAnnotation

protected void removeAnnotation(Annotation a,
                                boolean shrink)

createChooser

protected void createChooser()
Instantiates a new chooser if one does not already exist and registers the chooser for scheme events and the scheme for chooser events.


initOutcomes

protected abstract void initOutcomes()
Initalizes the set of outcomes that this scheme can assign an annotation.


removeAllAnnotationSchemeListeners

public void removeAllAnnotationSchemeListeners()

addAnnotationSchemeListener

public void addAnnotationSchemeListener(AnnotationSchemeListener listener)
Registers the specified listener for annotation scheme callbacks.

Parameters:
listener - The object that will recieve the callbacks.

removeAnnotationSchemeListener

public void removeAnnotationSchemeListener(AnnotationSchemeListener listener)
Unregisters the specified listener from the annotation scheme callbacks.

Parameters:
listener - The object which will no longer recieve annotation scheme callbacks.

setAnnotator

public void setAnnotator(Annotator a)
Sets the current annotator to allow outcomes to be sorted.


setAnnotatorName

public void setAnnotatorName(java.lang.String ann)
Designates the annotator who will be making the annotations.


setChooser

public void setChooser(Chooser c)

getChooser

public Chooser getChooser()

getValuesForFeature

public java.lang.String[] getValuesForFeature(java.lang.String f)
Description copied from interface: ViewerListener
Returns the set of valid values for the specified feature. Typically this is only valid for the type feature.

Specified by:
getValuesForFeature in interface ViewerListener
Parameters:
f - The feature whose value are being requested.
Returns:
An array containing the valid values for the specified feature or null if the specified feature does not have a fixed set of values.

setGuiListener

public void setGuiListener(GuiListener gl)
Designates a listener for adding gui objects to the display.


setSortScheme

public void setSortScheme(SortCriteria sortCriteria)
Notifies this scheme to use the specified sorting criteria.

Parameters:
sortCriteria - The basis on which the annotation sort should be done.

getColorScheme

public java.util.Map getColorScheme()

dispose

public void dispose()

getSelectionMode

protected SelectionMode getSelectionMode()

setSelectionMode

protected void setSelectionMode(SelectionMode sm)

setFeature

public void setFeature(Annotation ann,
                       java.lang.String feature,
                       java.lang.String value)
Sets the annotation's feature to the specified value.

Parameters:
ann - The annotation whose feature is being changed.
feature - The name of the feature to be set.
value - The value for the feature.

undoPerformed

public void undoPerformed()
Specified by:
undoPerformed in interface UndoListener

redoPerformed

public void redoPerformed()
Specified by:
redoPerformed in interface UndoListener

findExpression

public void findExpression(java.lang.String e,
                           int dir)

findExpressionAgain

public void findExpressionAgain(java.lang.String e,
                                int dir)

treeNodesChanged

public void treeNodesChanged(javax.swing.event.TreeModelEvent e)
Specified by:
treeNodesChanged in interface javax.swing.event.TreeModelListener

treeNodesInserted

public void treeNodesInserted(javax.swing.event.TreeModelEvent e)
Specified by:
treeNodesInserted in interface javax.swing.event.TreeModelListener

treeNodesRemoved

public void treeNodesRemoved(javax.swing.event.TreeModelEvent e)
Specified by:
treeNodesRemoved in interface javax.swing.event.TreeModelListener

treeStructureChanged

public void treeStructureChanged(javax.swing.event.TreeModelEvent e)
Specified by:
treeStructureChanged in interface javax.swing.event.TreeModelListener


Copyright © 2004 Thomas Morton and Jeremy LaCivita. All Rights Reserved.