org.annotation.wordfreak
Class DefaultAnnotationView

java.lang.Object
  extended byorg.annotation.wordfreak.AbstractAnnotationView
      extended byorg.annotation.wordfreak.DefaultAnnotationView
All Implemented Interfaces:
org.annotation.wordfreak.AnnotationTreeListener, AnnotationView, SortedAnnotationsSource, javax.swing.tree.TreeModel

public class DefaultAnnotationView
extends AbstractAnnotationView
implements SortedAnnotationsSource


Field Summary
 
Fields inherited from class org.annotation.wordfreak.AbstractAnnotationView
selectionMode, sort
 
Constructor Summary
DefaultAnnotationView(AnnotationTree t)
           
DefaultAnnotationView(AnnotationTree t, AnnotationFilter af)
           
DefaultAnnotationView(AnnotationTree t, AnnotationFilter af, AnnotationFilter baf)
           
DefaultAnnotationView(AnnotationTree t, AnnotationFilter af, AnnotationFilter baf, SortedAnnotations sa)
           
 
Method Summary
 void addTreeModelListener(javax.swing.event.TreeModelListener tml)
           
 int binarySearchAnnotation(Annotation a)
          Returns the index of the specified annotation in the list of annotations available for display.
 int binarySearchBase(Annotation a)
          Returns the index of the specified annotation in the list of annotations on which other annotaitons are based.
 void chainAnnotations(Annotation a, Annotation b)
          Creates a chain between the two specified annotations.
 void close()
          Does any clean up that needs to happen before the view goes away
 boolean containsAll(java.util.List list, java.lang.Object node)
          Checks whether each child of the specified node is contained in the specified list.
 Relation createRelation(java.lang.String type, java.lang.Object key, java.lang.String[] frame, Annotation[] annotations)
          Returns a new releation with the specified type, anchor key, frame, and annotations.
 void deepInsert(Annotation a)
          Inserts the specified annotation as deep as possible.
 Annotation deepInsert(java.lang.String type, int s, int e)
          Creates and inserts a new annotation specified type and span given by the specified start and end indices.
 javax.swing.event.TreeModelEvent doTreeNodesChanged(Annotation node, Annotation[] objects)
           
 javax.swing.event.TreeModelEvent doTreeNodesInserted(Annotation node, Annotation[] objects)
           
 javax.swing.event.TreeModelEvent doTreeNodesRemoved(Annotation node, Annotation[] objects)
           
 void filter(AnnotationFilter f)
          Applies the specified filter to this view.
 void fireTreeNodesChanged(Annotation node, Annotation[] objects)
          Used to notify listener that the nodes specificed as changelings have been changed and their parent is node is specified by parent.
 void fireTreeNodesInserted(Annotation parent, Annotation[] objects)
          Used to notify listener that the nodes specificed as insertions have been inserted under the specified parent.
 void fireTreeNodesMoved(Annotation[] children, Annotation oldParent, Annotation newParent)
          Used to notify listener that the nodes specificed as children have been moved from oldParent to newParent.
 void fireTreeNodesRemoved(Annotation node, Annotation[] objects)
          Used to notify listener that the nodes specificed as deletions have been deleted under the specified parent.
 void fireTreeStructureChanged(Annotation node)
          Used to notify listener that the structure under the specified node has changed substantually.
 Annotation getAnnotation(int i)
          Returns sorted annotation at index i.
 java.util.Iterator getAnnotationIterator()
          Returns Iterator for filtered/sorted annotations.
 int getAnnotationSize()
          Returns size of filtered/sorted annotations.
 Annotation getBase(int i)
          Returns the annotation at the specified index from the list of annotations which new annotation are based on.
 java.util.Iterator getBaseIterator()
          Returns an iterator over the list of annotations which new annotation are based on.
 int getBaseSize()
          Returns the number of annotation in the list of annotations which new annotation are based on.
 Annotation[] getChain(Annotation a)
          Returns the chains associated with the specified annotation.
 java.lang.Object getChild(java.lang.Object parent, int i)
           
 int getChildCount(java.lang.Object parent)
           
 java.lang.Object getContainingLeaf(int offset)
          Returns the leaf which contains the offset.
 Annotation getContainingNode(Span span)
          Returns the leaf which contains the offset.
 java.util.List getFilteredAnnotations()
          Returns a list of annotation which match the current filter criteria.
 int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
           
 java.util.List getLeavesInRange(int s, int e)
           
 java.lang.Object getNextLeaf(java.lang.Object node)
          Returns the susequent leaf node to the right of the specified node.
 java.lang.Object getParent(java.lang.Object node)
          Returns the parent of the specified node.
 javax.swing.tree.TreeNode[] getPath(java.lang.Object o)
          Returns an array of nodes between the specified node and the root.
 java.lang.Object getPreviousLeaf(java.lang.Object node)
          Returns the previous leaf node to the left of the specified node.
 Relation getRelation(java.lang.String type, Annotation a)
          Returns a relation which is of the specified type and has as its anchor the specified annotation.
 Relation[] getRelations(Annotation a)
          Returns all relations which contain the specified annotation.
 Relation[] getRelations(java.lang.String type)
          Returns all relations of the specified type.
 Relation[] getRelations(java.lang.String type, Annotation a)
          Returns all relation which are of the specified type and which contain the specified annotation.
 java.lang.Object getRoot()
           
 int getSize()
           
 SortedAnnotations getSortedAnnotations()
          Returns the object which manages sorted annotations.
 AnnotationSource getSource()
          Returns the source data associated with the file for this view.
 java.lang.String getText()
           
 Annotation getUnsortedAnnotation(int i)
          Returns filtered annotation at index i.
 AnnotationSelection getValidSelection(AnnotationSelection selectedAnnotations)
          Returns appropiate selection based on selection mode and attempted selection, null is returned if no selection is appropiate.
 Span getValidSelection(int start, int end)
          Returns appropiate selection based on selection mode and attempted selection, null is returned if no selection is appropiate.
 java.util.List getValidSelection(java.util.List selectedAnnotations)
           
 int indexOfAnnotation(Annotation a)
          Returns index of Annotation a in sorted annotations list if it is contained in the list; otherwise, (-(insertion point) - 1).
 int indexOfAnnotationOffset(int o)
          Returns index of sorted annotation which contains the offset o or the offset of the annotation which is closest.
 int indexOfBase(Annotation a)
          Returns index of Annotation a in base annotations list if it is contained in the list; otherwise, (-(insertion point) - 1).
 int indexOfBaseOffset(int o)
          Returns the index of an annotation in the list of annotations which new annotation are based on which contains the specified offset.
 int indexOfBaseOffset1(int o)
           
 int indexOfUnsortedAnnotation(Annotation a)
          Returns index of the annotation in the filtered annotations list if it is contained in the list; otherwise, (-(insertion point) - 1).
 void insert(Annotation a)
          Inserts the specified annotation into the view.
 Annotation insert(int s, int e)
          Creates and inserts a new annotation with the span specified by s and e.
 Annotation insert(int s, int e, Annotation parent)
          Returns an annotation with the specified start, end, and parent that has been inserted into the view.
 Annotation insert(java.lang.String type, Annotation s, Annotation e)
          Returns an annotation with the specified type, start, and end that has been inserted into the view.
 Annotation insert(java.lang.String type, int s, int e)
          Returns an annotation with the specified type, start, and end that has been inserted into the view.
 Annotation insert(java.lang.String type, int s, int e, Annotation parent)
          Returns an annotation with the specified type, start, end, and parent that has been inserted into the view.
 Annotation insertParent(Annotation child)
          Returns a new annotation which has the same span as the specified child annotation and is the parent of the specified child.
 Annotation insertParent(java.lang.String type, Annotation child)
          Returns a new annotation with the specified type which has the same span as the specified child annotation and is the parent of the specified child.
 Annotation insertZeroLengthAnnotationAfter(Annotation after)
          Returns a zero length annotation which is inserted after the specified annotation.
 Annotation insertZeroLengthAnnotationAfter(java.lang.String type, Annotation after)
          Returns a zero length annotation with the specified type which is inserted after the specified annotation.
 Annotation insertZeroLengthAnnotationBefore(Annotation before)
          Returns a zero length annotation which is inserted before the specified annotation.
 Annotation insertZeroLengthAnnotationBefore(java.lang.String type, Annotation before)
          Returns a zero length annotation of the specified type which is inserted before the specified annotation.
 boolean isLeaf(java.lang.Object node)
           
 boolean isTerminalSpan(int s, int e)
          Returns true if the span given by the specified start and end values can be inserted into this view as a leaf.
 void move(Annotation node, Annotation dest)
          Makes annotation parent the parent of annotaiton node.
 void put(int role, Annotation ann, Relation rel)
          Puts the specified annotation at the specified role index in the specified relation.
 void put(java.lang.String role, Annotation ann, Relation rel)
          Puts the specified annotation the specified relation with the specified role name.
 void remove(Annotation node)
          Removes an annotation from the view.
 void remove(Annotation node, boolean shrink)
          Removes an annotation from the view and shinks annotations which contained it based on teh specified shrink value.
 void remove(Annotation annotation, Relation relation)
          Removes the specified annotation from the specified relation or if the specified annotation is the anchor of the relation, removes the relation from this view.
 void remove(Relation relation)
          Removes the specified relation from this view.
 Annotation removeFromChain(Annotation a)
          Removes the specified annotation from a chain and returns another annotation from the modified chain if such an annotation exists.
 void removeTreeModelListener(javax.swing.event.TreeModelListener tml)
           
 void resetSelection()
          Resets the selection.
 void sort(java.util.Comparator c)
          Sorts the annotations in this view based on the specified comparison criteria.
 Annotation terminalInsert(java.lang.String type, int s, int e)
          Inserts a newly created annotation with the specified type and span in this tree and returns the newly created annotation.
 void update()
          Rebuilds the view based on the AnnotationTree.
 void update(Annotation a)
          Indicates that the specified annotation has been changed.
 void validate()
           
 void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
           
 
Methods inherited from class org.annotation.wordfreak.AbstractAnnotationView
getFirstLeaf, getLastLeaf, getSelectionMode, setSelectionMode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAnnotationView

public DefaultAnnotationView(AnnotationTree t)

DefaultAnnotationView

public DefaultAnnotationView(AnnotationTree t,
                             AnnotationFilter af)

DefaultAnnotationView

public DefaultAnnotationView(AnnotationTree t,
                             AnnotationFilter af,
                             AnnotationFilter baf)

DefaultAnnotationView

public DefaultAnnotationView(AnnotationTree t,
                             AnnotationFilter af,
                             AnnotationFilter baf,
                             SortedAnnotations sa)
Method Detail

close

public void close()
Description copied from interface: AnnotationView
Does any clean up that needs to happen before the view goes away

Specified by:
close in interface AnnotationView
Overrides:
close in class AbstractAnnotationView

getFilteredAnnotations

public java.util.List getFilteredAnnotations()
Description copied from interface: SortedAnnotationsSource
Returns a list of annotation which match the current filter criteria.

Specified by:
getFilteredAnnotations in interface SortedAnnotationsSource
Returns:
A list of annotation which match the current filter criteria.

sort

public void sort(java.util.Comparator c)
Description copied from interface: AnnotationView
Sorts the annotations in this view based on the specified comparison criteria.

Specified by:
sort in interface AnnotationView
Parameters:
c - The criteria on which the sort is based.

filter

public void filter(AnnotationFilter f)
Description copied from interface: AnnotationView
Applies the specified filter to this view.

Specified by:
filter in interface AnnotationView
Parameters:
f - The filter to be applied to this view.

validate

public void validate()

update

public void update()
Description copied from interface: AnnotationView
Rebuilds the view based on the AnnotationTree. This is called when major changes to the tree occur; such as after automatic annotation.

Specified by:
update in interface AnnotationView

getSize

public int getSize()

getSortedAnnotations

public SortedAnnotations getSortedAnnotations()
Description copied from interface: AnnotationView
Returns the object which manages sorted annotations.

Specified by:
getSortedAnnotations in interface AnnotationView
Overrides:
getSortedAnnotations in class AbstractAnnotationView

getBase

public Annotation getBase(int i)
Description copied from interface: AnnotationView
Returns the annotation at the specified index from the list of annotations which new annotation are based on.

Specified by:
getBase in interface AnnotationView
Parameters:
i - The index of the annotation to be returned.
Returns:
The annotation at the specified index from the list of annotations which new annotation are based on.

getBaseSize

public int getBaseSize()
Description copied from interface: AnnotationView
Returns the number of annotation in the list of annotations which new annotation are based on.

Specified by:
getBaseSize in interface AnnotationView
Returns:
The number of annotation in the list of annotations which new annotation are based on.

getBaseIterator

public java.util.Iterator getBaseIterator()
Description copied from interface: AnnotationView
Returns an iterator over the list of annotations which new annotation are based on.

Specified by:
getBaseIterator in interface AnnotationView
Returns:
An iterator over the list of annotations which new annotation are based on.

getAnnotation

public Annotation getAnnotation(int i)
Description copied from interface: AnnotationView
Returns sorted annotation at index i.

Specified by:
getAnnotation in interface AnnotationView
Parameters:
i - index
Returns:
sorted annotation at index i.

getUnsortedAnnotation

public Annotation getUnsortedAnnotation(int i)
Description copied from interface: AnnotationView
Returns filtered annotation at index i.

Specified by:
getUnsortedAnnotation in interface AnnotationView
Parameters:
i - index
Returns:
filtered annotation at index i.

getAnnotationSize

public int getAnnotationSize()
Description copied from interface: AnnotationView
Returns size of filtered/sorted annotations.

Specified by:
getAnnotationSize in interface AnnotationView
Returns:
returns size of filtered/sorted annotations.

getAnnotationIterator

public java.util.Iterator getAnnotationIterator()
Description copied from interface: AnnotationView
Returns Iterator for filtered/sorted annotations.

Specified by:
getAnnotationIterator in interface AnnotationView
Returns:
Iterator for filtered annotations.

indexOfAnnotation

public int indexOfAnnotation(Annotation a)
Description copied from interface: AnnotationView
Returns index of Annotation a in sorted annotations list if it is contained in the list; otherwise, (-(insertion point) - 1).

Specified by:
indexOfAnnotation in interface AnnotationView
Parameters:
a - Annotation.
Returns:
index of the Annotation a in sorted annotaitons list if it is contained in the list; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the filtered annotations list: the index of the first element greater than the key, or list.size(), if all elements in the list are less than the specified Annotation.

indexOfUnsortedAnnotation

public int indexOfUnsortedAnnotation(Annotation a)
Description copied from interface: AnnotationView
Returns index of the annotation in the filtered annotations list if it is contained in the list; otherwise, (-(insertion point) - 1).

Specified by:
indexOfUnsortedAnnotation in interface AnnotationView
Parameters:
a - Annotation.
Returns:
index of the Annotation a in the filtered annotaitons list if it is contained in the list; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the filtered annotations list: the index of the first element greater than the key, or list.size(), if all elements in the list are less than the specified Annotation.

indexOfBase

public int indexOfBase(Annotation a)
Description copied from interface: AnnotationView
Returns index of Annotation a in base annotations list if it is contained in the list; otherwise, (-(insertion point) - 1).

Specified by:
indexOfBase in interface AnnotationView
Parameters:
a - The annotation whose index is being searched for.
Returns:
index of the Annotation a in base annotaitons list if it is contained in the list; otherwise, (-(insertion point) - 1). The insertion point is defined as the point at which the key would be inserted into the base annotations list: the index of the first element greater than the key, or list.size(), if all elements in the list are less than the specified Annotation.

indexOfAnnotationOffset

public int indexOfAnnotationOffset(int o)
Description copied from interface: AnnotationView
Returns index of sorted annotation which contains the offset o or the offset of the annotation which is closest.

Specified by:
indexOfAnnotationOffset in interface AnnotationView
Parameters:
o - offset.
Returns:
index of sorted annotation which contains the offset o or the offset of the annotation which is closest.

indexOfBaseOffset1

public int indexOfBaseOffset1(int o)

indexOfBaseOffset

public int indexOfBaseOffset(int o)
Description copied from interface: AnnotationView
Returns the index of an annotation in the list of annotations which new annotation are based on which contains the specified offset.

Specified by:
indexOfBaseOffset in interface AnnotationView
Parameters:
o - The offset the base annotation at the returned index will contain.
Returns:
The index of an annotation in the list of annotations which new annotation are based on which contains the specified offset or (-(insertion point) - 1) of such an annotation if no such annotation exist.

getLeavesInRange

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

binarySearchAnnotation

public int binarySearchAnnotation(Annotation a)
Description copied from interface: AnnotationView
Returns the index of the specified annotation in the list of annotations available for display.

Specified by:
binarySearchAnnotation in interface AnnotationView
Parameters:
a - The annotation being searched for.
Returns:
the index of the specified annotation in the list of annotations available for display or (-(insertion point) - 1) of such an annotation if no such annotation exist..

binarySearchBase

public int binarySearchBase(Annotation a)
Description copied from interface: AnnotationView
Returns the index of the specified annotation in the list of annotations on which other annotaitons are based.

Specified by:
binarySearchBase in interface AnnotationView
Parameters:
a - The annotation being searched for.
Returns:
the index of the specified annotation in the list of annotations on which other annotations are based or (-(insertion point) - 1) of such an annotation if no such annotation exist..

getRoot

public java.lang.Object getRoot()
Specified by:
getRoot in interface javax.swing.tree.TreeModel

getChild

public java.lang.Object getChild(java.lang.Object parent,
                                 int i)
Specified by:
getChild in interface javax.swing.tree.TreeModel

getChildCount

public int getChildCount(java.lang.Object parent)
Specified by:
getChildCount in interface javax.swing.tree.TreeModel

containsAll

public boolean containsAll(java.util.List list,
                           java.lang.Object node)
Description copied from interface: AnnotationView
Checks whether each child of the specified node is contained in the specified list.

Specified by:
containsAll in interface AnnotationView
Parameters:
list - A list of children.
node - The node of a tree.
Returns:
true if each child of node is contained in the list, false otherwise.

getIndexOfChild

public int getIndexOfChild(java.lang.Object parent,
                           java.lang.Object child)
Specified by:
getIndexOfChild in interface javax.swing.tree.TreeModel

isLeaf

public boolean isLeaf(java.lang.Object node)
Specified by:
isLeaf in interface javax.swing.tree.TreeModel

getParent

public java.lang.Object getParent(java.lang.Object node)
Description copied from interface: AnnotationView
Returns the parent of the specified node.

Specified by:
getParent in interface AnnotationView
Overrides:
getParent in class AbstractAnnotationView

getPath

public javax.swing.tree.TreeNode[] getPath(java.lang.Object o)
Description copied from interface: AnnotationView
Returns an array of nodes between the specified node and the root.

Specified by:
getPath in interface AnnotationView
Parameters:
o - The node in the tree from which to start the part.
Returns:
An array of nodes between the specified node and the root.

getContainingLeaf

public java.lang.Object getContainingLeaf(int offset)
Returns the leaf which contains the offset.

Specified by:
getContainingLeaf in interface AnnotationView
Parameters:
offset - The offset.
Returns:
A leaf annotation whichi contains the offset or null if no such annotation exists.

getContainingNode

public Annotation getContainingNode(Span span)
Returns the leaf which contains the offset.

Parameters:
span - The span.
Returns:
the deepest annotation which contains the span

getText

public java.lang.String getText()

getNextLeaf

public java.lang.Object getNextLeaf(java.lang.Object node)
Description copied from interface: AnnotationView
Returns the susequent leaf node to the right of the specified node.

Specified by:
getNextLeaf in interface AnnotationView
Parameters:
node - An existing leaft node.
Returns:
The susequent leaf node to the right of the specified node or null if no such node exists.

getPreviousLeaf

public java.lang.Object getPreviousLeaf(java.lang.Object node)
Description copied from interface: AnnotationView
Returns the previous leaf node to the left of the specified node.

Specified by:
getPreviousLeaf in interface AnnotationView
Parameters:
node - An existing leaft node.
Returns:
The previous leaf node to the left of the specified node or null if no such node exists.

valueForPathChanged

public void valueForPathChanged(javax.swing.tree.TreePath path,
                                java.lang.Object newValue)
Specified by:
valueForPathChanged in interface javax.swing.tree.TreeModel

addTreeModelListener

public void addTreeModelListener(javax.swing.event.TreeModelListener tml)
Specified by:
addTreeModelListener in interface javax.swing.tree.TreeModel
Overrides:
addTreeModelListener in class AbstractAnnotationView

removeTreeModelListener

public void removeTreeModelListener(javax.swing.event.TreeModelListener tml)
Specified by:
removeTreeModelListener in interface javax.swing.tree.TreeModel
Overrides:
removeTreeModelListener in class AbstractAnnotationView

move

public void move(Annotation node,
                 Annotation dest)
Description copied from interface: AnnotationView
Makes annotation parent the parent of annotaiton node.

Specified by:
move in interface AnnotationView
Parameters:
node - The annotation being moved.
dest - The parent annotation.

remove

public void remove(Annotation node)
Description copied from interface: AnnotationView
Removes an annotation from the view.

Specified by:
remove in interface AnnotationView
Parameters:
node - The annotation to be removed.

remove

public void remove(Annotation node,
                   boolean shrink)
Description copied from interface: AnnotationView
Removes an annotation from the view and shinks annotations which contained it based on teh specified shrink value.

Specified by:
remove in interface AnnotationView
Parameters:
node - The node to be removed.
shrink - Whether nodes which contains the specifed annotation should be shunk.

insert

public Annotation insert(int s,
                         int e)
Description copied from interface: AnnotationView
Creates and inserts a new annotation with the span specified by s and e.

Specified by:
insert in interface AnnotationView
Parameters:
s - the start of the span for the annotation.
e - the end of the span for the annotation.

insert

public Annotation insert(int s,
                         int e,
                         Annotation parent)
Description copied from interface: AnnotationView
Returns an annotation with the specified start, end, and parent that has been inserted into the view.

Specified by:
insert in interface AnnotationView
Parameters:
s - The start value of the annotation's span.
e - The end value of the annotation's span.
parent - The parent of the annotation.
Returns:
An annotation with the specified start, end, and parent that has been inserted into the view.

insert

public Annotation insert(java.lang.String type,
                         int s,
                         int e)
Description copied from interface: AnnotationView
Returns an annotation with the specified type, start, and end that has been inserted into the view.

Specified by:
insert in interface AnnotationView
Parameters:
type - The type of the new annotation.
s - The start of the new annotation's span.
e - The end of the new annotation's span.
Returns:
An annotation with the specified type, start, end, and parent that has been inserted into the view.

insert

public Annotation insert(java.lang.String type,
                         int s,
                         int e,
                         Annotation parent)
Description copied from interface: AnnotationView
Returns an annotation with the specified type, start, end, and parent that has been inserted into the view.

Specified by:
insert in interface AnnotationView
Parameters:
type - The type of the new annotation.
s - The start of the new annotation's span.
e - The end of the new annotation's span.
parent - The parent of the new annotation.
Returns:
An annotation with the specified type, start, end, and parent that has been inserted into the view.

insert

public Annotation insert(java.lang.String type,
                         Annotation s,
                         Annotation e)
Description copied from interface: AnnotationView
Returns an annotation with the specified type, start, and end that has been inserted into the view.

Specified by:
insert in interface AnnotationView
Parameters:
type - The type of the new annotation.
s - The start annotation of the new annotation's span.
e - The end annotation of the new annotation's span.
Returns:
An annotation with the specified type, start, end, and parent that has been inserted into the view.

deepInsert

public Annotation deepInsert(java.lang.String type,
                             int s,
                             int e)
Description copied from interface: AnnotationView
Creates and inserts a new annotation specified type and span given by the specified start and end indices.

Specified by:
deepInsert in interface AnnotationView
Parameters:
type - The type of the annotation to be inserted.
s - the start of the span for the annotation.
e - the end of the span for the annotation.

deepInsert

public void deepInsert(Annotation a)
Description copied from interface: AnnotationView
Inserts the specified annotation as deep as possible.

Specified by:
deepInsert in interface AnnotationView
Parameters:
a - The annotation to insert.

isTerminalSpan

public boolean isTerminalSpan(int s,
                              int e)
Description copied from interface: AnnotationView
Returns true if the span given by the specified start and end values can be inserted into this view as a leaf.

Specified by:
isTerminalSpan in interface AnnotationView
Parameters:
s - The start value of the span.
e - The end value of the span.
Returns:
true if the span given by the specified start and end values does not intersect any existing nodes, false otherwise.

terminalInsert

public Annotation terminalInsert(java.lang.String type,
                                 int s,
                                 int e)
Description copied from interface: AnnotationView
Inserts a newly created annotation with the specified type and span in this tree and returns the newly created annotation.

Specified by:
terminalInsert in interface AnnotationView
Parameters:
type - The type of annotation to create.
s - The start of the span of the new annotation.
e - The end of the span of the new annotation.
Returns:
the newly ceated annotation or null if the annotation would intersect with an exiting annotation.

insert

public void insert(Annotation a)
Description copied from interface: AnnotationView
Inserts the specified annotation into the view.

Specified by:
insert in interface AnnotationView
Parameters:
a - The annotation to insert.

insertParent

public Annotation insertParent(Annotation child)
Description copied from interface: AnnotationView
Returns a new annotation which has the same span as the specified child annotation and is the parent of the specified child.

Specified by:
insertParent in interface AnnotationView
Parameters:
child - The annotation on which the new annotation is based.
Returns:
A new annotation which has the same span as the specified child annotation and is the parent of the specified child.

insertZeroLengthAnnotationBefore

public Annotation insertZeroLengthAnnotationBefore(Annotation before)
Description copied from interface: AnnotationView
Returns a zero length annotation which is inserted before the specified annotation.

Specified by:
insertZeroLengthAnnotationBefore in interface AnnotationView
Parameters:
before - The annotation which the the new annotaiton is before.
Returns:
A zero length annotation which is inserted before the specified annotation.

insertZeroLengthAnnotationAfter

public Annotation insertZeroLengthAnnotationAfter(Annotation after)
Description copied from interface: AnnotationView
Returns a zero length annotation which is inserted after the specified annotation.

Specified by:
insertZeroLengthAnnotationAfter in interface AnnotationView
Parameters:
after - The annotation which the the new annotaiton is after.
Returns:
A zero length annotation which is inserted after the specified annotation.

insertParent

public Annotation insertParent(java.lang.String type,
                               Annotation child)
Description copied from interface: AnnotationView
Returns a new annotation with the specified type which has the same span as the specified child annotation and is the parent of the specified child.

Specified by:
insertParent in interface AnnotationView
Parameters:
type - The type of the new annotation.
child - The annotation on which the new annotation is based.
Returns:
A new annotation which has the same span as the specified child annotation and is the parent of the specified child.

insertZeroLengthAnnotationBefore

public Annotation insertZeroLengthAnnotationBefore(java.lang.String type,
                                                   Annotation before)
Description copied from interface: AnnotationView
Returns a zero length annotation of the specified type which is inserted before the specified annotation.

Specified by:
insertZeroLengthAnnotationBefore in interface AnnotationView
Parameters:
type - The type of the new annotation.
before - The annotation which the the new annotaiton is before.
Returns:
A zero length annotation which is inserted before the specified annotation.

insertZeroLengthAnnotationAfter

public Annotation insertZeroLengthAnnotationAfter(java.lang.String type,
                                                  Annotation after)
Description copied from interface: AnnotationView
Returns a zero length annotation with the specified type which is inserted after the specified annotation.

Specified by:
insertZeroLengthAnnotationAfter in interface AnnotationView
Parameters:
type - The type of the new annotation.
after - The annotation which the the new annotaiton is after.
Returns:
A zero length annotation which is inserted after the specified annotation.

chainAnnotations

public void chainAnnotations(Annotation a,
                             Annotation b)
Description copied from interface: AnnotationView
Creates a chain between the two specified annotations.

Specified by:
chainAnnotations in interface AnnotationView
Parameters:
a - The first annotation in the chain.
b - The second annotation in the chain.

getChain

public Annotation[] getChain(Annotation a)
Description copied from interface: AnnotationView
Returns the chains associated with the specified annotation. Annotations can only be in one chain.

Specified by:
getChain in interface AnnotationView
Parameters:
a - An annotation in a chain.
Returns:
The chains associated with the specified annotation. The returned array can be empty.

removeFromChain

public Annotation removeFromChain(Annotation a)
Description copied from interface: AnnotationView
Removes the specified annotation from a chain and returns another annotation from the modified chain if such an annotation exists.

Specified by:
removeFromChain in interface AnnotationView
Parameters:
a - The annotation to be removed.
Returns:
A annotation from the modified chain or null if no such an annotation exists.

createRelation

public Relation createRelation(java.lang.String type,
                               java.lang.Object key,
                               java.lang.String[] frame,
                               Annotation[] annotations)
Description copied from interface: AnnotationView
Returns a new releation with the specified type, anchor key, frame, and annotations.

Specified by:
createRelation in interface AnnotationView
Parameters:
type - The type of the relations.
key - The anchor annotation of this relation.
frame - The names of the frame elements of the relation.
annotations - The annotation which occupy the frame elements.
Returns:
A new releation with the specified type, anchor key, frame, and annotations.

put

public void put(int role,
                Annotation ann,
                Relation rel)
Description copied from interface: AnnotationView
Puts the specified annotation at the specified role index in the specified relation.

Specified by:
put in interface AnnotationView
Parameters:
role - The position in the frame of the specified relation when the specified annotaiton will be placed.
ann - The annotation to be placed at the specified role Index in the specified relation.
rel - The annotation to be modified.

put

public void put(java.lang.String role,
                Annotation ann,
                Relation rel)
Description copied from interface: AnnotationView
Puts the specified annotation the specified relation with the specified role name. Role names can be duplicated and this will always add anothor element to the relations frame.

Specified by:
put in interface AnnotationView
Parameters:
role - The name of the role slot in the relation when the annotation will be placed.
ann - The annotation to put in the relation.
rel - The relation to be modified.

remove

public void remove(Relation relation)
Description copied from interface: AnnotationView
Removes the specified relation from this view.

Specified by:
remove in interface AnnotationView
Parameters:
relation - The relation to be removed.

remove

public void remove(Annotation annotation,
                   Relation relation)
Description copied from interface: AnnotationView
Removes the specified annotation from the specified relation or if the specified annotation is the anchor of the relation, removes the relation from this view.

Specified by:
remove in interface AnnotationView
Parameters:
annotation - The annotation to remove.
relation - The relation from which the spevified annotation is removed.

update

public void update(Annotation a)
Description copied from interface: AnnotationView
Indicates that the specified annotation has been changed.

Specified by:
update in interface AnnotationView
Specified by:
update in class AbstractAnnotationView

getRelations

public Relation[] getRelations(java.lang.String type)
Description copied from interface: AnnotationView
Returns all relations of the specified type.

Specified by:
getRelations in interface AnnotationView
Parameters:
type - The type of relations to be returned.
Returns:
An array of all relations of the specified type.

getRelations

public Relation[] getRelations(Annotation a)
Description copied from interface: AnnotationView
Returns all relations which contain the specified annotation.

Specified by:
getRelations in interface AnnotationView
Parameters:
a - The annotation which the returned relations contain.
Returns:
An array of all relations which contain the specified annotation.

getRelations

public Relation[] getRelations(java.lang.String type,
                               Annotation a)
Description copied from interface: AnnotationView
Returns all relation which are of the specified type and which contain the specified annotation.

Specified by:
getRelations in interface AnnotationView
Parameters:
type - The type of relations to be returned.
a - The annotation which the returned relations contain.
Returns:
An array of all relation which are of the specified type and which contain the specified relation.

getRelation

public Relation getRelation(java.lang.String type,
                            Annotation a)
Description copied from interface: AnnotationView
Returns a relation which is of the specified type and has as its anchor the specified annotation.

Specified by:
getRelation in interface AnnotationView
Parameters:
type - The type of relation to be returned.
a - The anchor of the relations to be returned.
Returns:
A relation which is of the specified type and has as its anchor the specified annotation or null if not such relation exists.

doTreeNodesInserted

public javax.swing.event.TreeModelEvent doTreeNodesInserted(Annotation node,
                                                            Annotation[] objects)

doTreeNodesRemoved

public javax.swing.event.TreeModelEvent doTreeNodesRemoved(Annotation node,
                                                           Annotation[] objects)

doTreeNodesChanged

public javax.swing.event.TreeModelEvent doTreeNodesChanged(Annotation node,
                                                           Annotation[] objects)

fireTreeNodesInserted

public void fireTreeNodesInserted(Annotation parent,
                                  Annotation[] objects)
Description copied from interface: org.annotation.wordfreak.AnnotationTreeListener
Used to notify listener that the nodes specificed as insertions have been inserted under the specified parent.

Specified by:
fireTreeNodesInserted in interface org.annotation.wordfreak.AnnotationTreeListener
Parameters:
parent - The parent of the nodes being inserted.
objects - The nodes that are being inserted.

fireTreeNodesRemoved

public void fireTreeNodesRemoved(Annotation node,
                                 Annotation[] objects)
Description copied from interface: org.annotation.wordfreak.AnnotationTreeListener
Used to notify listener that the nodes specificed as deletions have been deleted under the specified parent.

Specified by:
fireTreeNodesRemoved in interface org.annotation.wordfreak.AnnotationTreeListener
Parameters:
node - The parent of the nodes being deleted.
objects - The nodes that are being deleted.

fireTreeNodesMoved

public void fireTreeNodesMoved(Annotation[] children,
                               Annotation oldParent,
                               Annotation newParent)
Description copied from interface: org.annotation.wordfreak.AnnotationTreeListener
Used to notify listener that the nodes specificed as children have been moved from oldParent to newParent.

Specified by:
fireTreeNodesMoved in interface org.annotation.wordfreak.AnnotationTreeListener
Parameters:
children - The nodes being moved.
oldParent - The old parent of the moved nodes.
newParent - The new parent of the moved nodes.

fireTreeNodesChanged

public void fireTreeNodesChanged(Annotation node,
                                 Annotation[] objects)
Description copied from interface: org.annotation.wordfreak.AnnotationTreeListener
Used to notify listener that the nodes specificed as changelings have been changed and their parent is node is specified by parent.

Specified by:
fireTreeNodesChanged in interface org.annotation.wordfreak.AnnotationTreeListener
Parameters:
node -
objects -

fireTreeStructureChanged

public void fireTreeStructureChanged(Annotation node)
Description copied from interface: org.annotation.wordfreak.AnnotationTreeListener
Used to notify listener that the structure under the specified node has changed substantually.

Specified by:
fireTreeStructureChanged in interface org.annotation.wordfreak.AnnotationTreeListener
Parameters:
node - The specified node.

resetSelection

public void resetSelection()
Description copied from interface: AnnotationView
Resets the selection. This should be called before #getValidSelection when a new selection is made.

Specified by:
resetSelection in interface AnnotationView

getValidSelection

public Span getValidSelection(int start,
                              int end)
Description copied from interface: AnnotationView
Returns appropiate selection based on selection mode and attempted selection, null is returned if no selection is appropiate.

Specified by:
getValidSelection in interface AnnotationView
Returns:
span indicating appropiate selection.

getValidSelection

public AnnotationSelection getValidSelection(AnnotationSelection selectedAnnotations)
Description copied from interface: AnnotationView
Returns appropiate selection based on selection mode and attempted selection, null is returned if no selection is appropiate.

Specified by:
getValidSelection in interface AnnotationView
Returns:
span indicating appropiate selection.

getValidSelection

public java.util.List getValidSelection(java.util.List selectedAnnotations)

getSource

public AnnotationSource getSource()
Description copied from interface: AnnotationView
Returns the source data associated with the file for this view.

Specified by:
getSource in interface AnnotationView
Specified by:
getSource in class AbstractAnnotationView


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