org.annotation.wordfreak
Class UnmarkedTextAnnotationView

java.lang.Object
  extended byorg.annotation.wordfreak.AbstractAnnotationView
      extended byorg.annotation.wordfreak.UnmarkedTextAnnotationView
All Implemented Interfaces:
org.annotation.wordfreak.AnnotationTreeListener, AnnotationView, java.util.EventListener, javax.swing.tree.TreeModel, javax.swing.event.TreeModelListener, TreeTableModel

public class UnmarkedTextAnnotationView
extends AbstractAnnotationView
implements javax.swing.event.TreeModelListener, TreeTableModel

A wrapper class for AnnotationViews which inserts nodes for any source text which is not part of an annotation in the view. This is used by the TreeViewer to render the annotations in the view.

Author:
Jeremy Lacivita, Tom Morton

Field Summary
 
Fields inherited from class org.annotation.wordfreak.AbstractAnnotationView
selectionMode, sort, treeDataListeners
 
Constructor Summary
UnmarkedTextAnnotationView(AnnotationView v)
           
 
Method Summary
 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.
 boolean containsAll(java.util.List l, java.lang.Object n)
          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.
 void filter(AnnotationFilter f)
          Applies the specified filter to this view.
 void fireTreeNodesChanged(Annotation parent, Annotation[] changelings)
          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[] insertions)
          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 parent, Annotation[] deletions)
          Used to notify listener that the nodes specificed as deletions have been deleted under the specified parent.
 void fireTreeStructureChanged(Annotation a)
          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.Class getColumnClass(int col)
          Returns the type for column number column.
 int getColumnCount()
          Returns the number ofs availible column.
 java.lang.String getColumnName(int col)
          Returns the name for column number column.
 java.lang.Object getContainingLeaf(int offset)
          Returns the leaf node which contains the specified offset.
 int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
           
 java.lang.Object getNextLeaf(java.lang.Object node)
          Returns the susequent leaf node to the right 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()
           
 AnnotationSource getSource()
          Returns the source data associated with the file for this view.
 Annotation getUnsortedAnnotation(int i)
          Returns filtered annotation at index i.
 AnnotationSelection getValidSelection(AnnotationSelection s)
          Returns appropiate selection based on selection mode and attempted selection, null is returned if no selection is appropiate.
 Span getValidSelection(int s, int e)
          Returns appropiate selection based on selection mode and attempted selection, null is returned if no selection is appropiate.
 java.lang.Object getValueAt(java.lang.Object node, int column)
          Returns the value to be displayed for node node, at column number column.
 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 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 isCellEditable(java.lang.Object node, int column)
          Indicates whether the the value for node node, at column number column is editable.
 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 resetSelection()
          Resets the selection.
 void setValueAt(java.lang.Object aValue, java.lang.Object node, int column)
          Sets the value for node node, at column number column.
 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 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 update()
          Rebuilds the view based on the AnnotationTree.
 void update(Annotation a)
          Indicates that the specified annotation has been changed.
 void updateTree(javax.swing.tree.TreeNode root)
           
 void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
           
 
Methods inherited from class org.annotation.wordfreak.AbstractAnnotationView
addTreeModelListener, close, getFirstLeaf, getLastLeaf, getParent, getSelectionMode, getSortedAnnotations, removeTreeModelListener, setSelectionMode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.tree.TreeModel
addTreeModelListener, removeTreeModelListener
 

Constructor Detail

UnmarkedTextAnnotationView

public UnmarkedTextAnnotationView(AnnotationView v)
Method Detail

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

updateTree

public void updateTree(javax.swing.tree.TreeNode root)

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.

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.

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

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

valueForPathChanged

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

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.

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.

getContainingLeaf

public java.lang.Object getContainingLeaf(int offset)
Description copied from interface: AnnotationView
Returns the leaf node which contains the specified offset.

Specified by:
getContainingLeaf in interface AnnotationView
Parameters:
offset - The offset that the returned leaf should contain.
Returns:
The leaf node which contains the specified offset or null if no such leaf exists.

containsAll

public boolean containsAll(java.util.List l,
                           java.lang.Object n)
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:
l - A list of children.
n - The node of a tree.
Returns:
true if each child of node is contained in the list, false otherwise.

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.

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,
                         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.

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.

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.

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.

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.

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.

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.

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.

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..

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 AnnotationSelection getValidSelection(AnnotationSelection s)
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 Span getValidSelection(int s,
                              int e)
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.

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

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.

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

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.

treeStructureChanged

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

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.

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.

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.

fireTreeNodesChanged

public void fireTreeNodesChanged(Annotation parent,
                                 Annotation[] changelings)
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:
parent -
changelings -

fireTreeNodesInserted

public void fireTreeNodesInserted(Annotation parent,
                                  Annotation[] insertions)
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.
insertions - The nodes that are being inserted.

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.

fireTreeNodesRemoved

public void fireTreeNodesRemoved(Annotation parent,
                                 Annotation[] deletions)
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:
parent - The parent of the nodes being deleted.
deletions - The nodes that are being deleted.

fireTreeStructureChanged

public void fireTreeStructureChanged(Annotation a)
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:
a - The specified node.

getColumnCount

public int getColumnCount()
Description copied from interface: TreeTableModel
Returns the number ofs availible column.

Specified by:
getColumnCount in interface TreeTableModel

getColumnName

public java.lang.String getColumnName(int col)
Description copied from interface: TreeTableModel
Returns the name for column number column.

Specified by:
getColumnName in interface TreeTableModel

getColumnClass

public java.lang.Class getColumnClass(int col)
Description copied from interface: TreeTableModel
Returns the type for column number column.

Specified by:
getColumnClass in interface TreeTableModel

getValueAt

public java.lang.Object getValueAt(java.lang.Object node,
                                   int column)
Description copied from interface: TreeTableModel
Returns the value to be displayed for node node, at column number column.

Specified by:
getValueAt in interface TreeTableModel

isCellEditable

public boolean isCellEditable(java.lang.Object node,
                              int column)
Description copied from interface: TreeTableModel
Indicates whether the the value for node node, at column number column is editable.

Specified by:
isCellEditable in interface TreeTableModel

setValueAt

public void setValueAt(java.lang.Object aValue,
                       java.lang.Object node,
                       int column)
Description copied from interface: TreeTableModel
Sets the value for node node, at column number column.

Specified by:
setValueAt in interface TreeTableModel


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