gate.gui.docview
Class AnnotationListView

java.lang.Object
  extended by gate.util.AbstractFeatureBearer
      extended by gate.creole.AbstractResource
          extended by gate.gui.docview.AbstractDocumentView
              extended by gate.gui.docview.AnnotationListView
All Implemented Interfaces:
AnnotationListener, ActionsPublisher, AnnotationEditorOwner, AnnotationList, DocumentView, Resource, FeatureBearer, NameBearer, VisualResource, Serializable, EventListener

public class AnnotationListView
extends AbstractDocumentView
implements AnnotationListener, AnnotationList, AnnotationEditorOwner

A tabular view for a list of annotations. Used as part of the document viewer to display all the annotation currently highlighted.

See Also:
Serialized Form

Nested Class Summary
protected  class AnnotationListView.DeleteAction
           
protected  class AnnotationListView.EditAnnotationAction
           
 
Field Summary
protected  List<AnnotationData> annDataList
          Stores the AnnotationData objects representing the annotations displayed by this view.
protected  Map<String,AnnotationVisualResource> editorsCache
          A map that stores instantiated annotations editors in order to avoid the delay of building them at each request;
protected  JTextField filterTextField
           
protected  boolean localSelectionUpdating
          Flag used to mark the fact that the table selection is currently being updated, to synchronise it with the global selection.
protected  JPanel mainPanel
           
protected  JScrollPane scroller
           
protected  JLabel statusLabel
           
protected  XJTable table
           
protected  gate.gui.docview.AnnotationListView.AnnotationTableModel tableModel
           
protected  TextualDocumentView textView
           
 
Fields inherited from class gate.gui.docview.AbstractDocumentView
active, document, guiInitialised, handle, owner
 
Fields inherited from class gate.creole.AbstractResource
name
 
Fields inherited from class gate.util.AbstractFeatureBearer
features
 
Fields inherited from interface gate.gui.docview.DocumentView
CENTRAL, HORIZONTAL, VERTICAL
 
Constructor Summary
AnnotationListView()
           
 
Method Summary
 AnnotationDataImpl addAnnotation(Annotation ann, AnnotationSet set)
          Adds an annotation to be displayed in the list.
 List<AnnotationData> addAnnotations(List<Annotation> annotations, AnnotationSet set)
          Adds a batch of annotations in one go.
 void annotationChanged(Annotation ann, AnnotationSet set, String oldType)
          Called by the annotation editor when an annotation has been changed.
 void annotationUpdated(AnnotationEvent e)
          Called when an Annotation has been updated
 void cleanup()
          releases the memory allocated to this resource
 List<AnnotationData> getAllAnnotations()
          Returns the tags for all the annotations currently displayed
 AnnotationData getAnnotationAtRow(int row)
          (non-Javadoc)
 List<Action> getGenericEditorActions(AnnotationSet set, Annotation annotation)
           
 Component getGUI()
          Returns the actual UI component this view represents.
 Annotation getNextAnnotation()
          Called by the editor for obtaining the next annotation to be edited.
 Annotation getPreviousAnnotation()
          Called by the editor for obtaining the previous annotation to be edited.
 int getRowForAnnotation(AnnotationData data)
          Returns the display row for a given annotation.
 ListSelectionModel getSelectionModel()
          Obtains the selection model used by this list view.
 List<Action> getSpecificEditorActions(AnnotationSet set, Annotation annotation)
           
 JTextComponent getTextComponent()
          Gets the UI component used to display the document text.
 int getType()
          Returns the type of this view.
protected  void initGUI()
          Implementers should override this method and use it for populating the GUI.
protected  void initListeners()
           
protected  void registerHooks()
          This method will be called whenever the view becomes active.
 void removeAnnotation(AnnotationData tag)
           
 void removeAnnotations(Collection<AnnotationData> tags)
           
 void selectAnnotation(AnnotationData data)
          Called by the editor when a new annotation needs to be selected.
 void selectAnnotationForTag(Object tag)
          Selects the annotation for the given tag.
 void setSelectedAnnotations(List<AnnotationData> selectedAnnots)
          Some document views can use the concept of selected annotations.
protected  void unregisterHooks()
          This method will be called whenever this view becomes inactive.
 
Methods inherited from class gate.gui.docview.AbstractDocumentView
getActions, getDocument, getHandle, getOwner, isActive, setActive, setHandle, setOwner, setTarget
 
Methods inherited from class gate.creole.AbstractResource
checkParameterValues, getBeanInfo, getInitParameterValues, getInitParameterValues, getName, getParameterValue, getParameterValue, getParameterValues, init, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners
 
Methods inherited from class gate.util.AbstractFeatureBearer
getFeatures, setFeatures
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gate.gui.docview.DocumentView
isActive, setActive, setOwner
 
Methods inherited from interface gate.gui.ActionsPublisher
getActions
 
Methods inherited from interface gate.VisualResource
setHandle, setTarget
 
Methods inherited from interface gate.Resource
getParameterValue, init, setParameterValue, setParameterValues
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures, setFeatures
 
Methods inherited from interface gate.util.NameBearer
getName, setName
 
Methods inherited from interface gate.gui.annedit.AnnotationEditorOwner
getDocument
 

Field Detail

table

protected XJTable table

tableModel

protected gate.gui.docview.AnnotationListView.AnnotationTableModel tableModel

scroller

protected JScrollPane scroller

annDataList

protected List<AnnotationData> annDataList
Stores the AnnotationData objects representing the annotations displayed by this view.


localSelectionUpdating

protected volatile boolean localSelectionUpdating
Flag used to mark the fact that the table selection is currently being updated, to synchronise it with the global selection. This is used to block update events being sent to the owner, while the current selection is adjusted.


mainPanel

protected JPanel mainPanel

statusLabel

protected JLabel statusLabel

filterTextField

protected JTextField filterTextField

textView

protected TextualDocumentView textView

editorsCache

protected Map<String,AnnotationVisualResource> editorsCache
A map that stores instantiated annotations editors in order to avoid the delay of building them at each request;

Constructor Detail

AnnotationListView

public AnnotationListView()
Method Detail

getAnnotationAtRow

public AnnotationData getAnnotationAtRow(int row)
(non-Javadoc)

Specified by:
getAnnotationAtRow in interface AnnotationList
See Also:
AnnotationList.getAnnotationAtRow(int)

getSelectionModel

public ListSelectionModel getSelectionModel()
Description copied from interface: AnnotationList
Obtains the selection model used by this list view.

Specified by:
getSelectionModel in interface AnnotationList
Returns:
a ListSelectionModel object.

cleanup

public void cleanup()
Description copied from class: AbstractResource
releases the memory allocated to this resource

Specified by:
cleanup in interface Resource
Overrides:
cleanup in class AbstractResource

initGUI

protected void initGUI()
Description copied from class: AbstractDocumentView
Implementers should override this method and use it for populating the GUI.

Specified by:
initGUI in class AbstractDocumentView

getGUI

public Component getGUI()
Description copied from interface: DocumentView
Returns the actual UI component this view represents.

Specified by:
getGUI in interface DocumentView
Returns:
a Component value.

initListeners

protected void initListeners()

getSpecificEditorActions

public List<Action> getSpecificEditorActions(AnnotationSet set,
                                             Annotation annotation)

getGenericEditorActions

public List<Action> getGenericEditorActions(AnnotationSet set,
                                            Annotation annotation)

registerHooks

protected void registerHooks()
Description copied from class: AbstractDocumentView
This method will be called whenever the view becomes active. Implementers should use this to add hooks (such as mouse listeners) to the other views as required by their functionality.

Specified by:
registerHooks in class AbstractDocumentView

unregisterHooks

protected void unregisterHooks()
Description copied from class: AbstractDocumentView
This method will be called whenever this view becomes inactive. Implementers should use it to unregister whatever hooks they registered in AbstractDocumentView.registerHooks().

Specified by:
unregisterHooks in class AbstractDocumentView

getType

public int getType()
Description copied from interface: DocumentView
Returns the type of this view.

Specified by:
getType in interface DocumentView
Returns:
an int value
See Also:
DocumentView.CENTRAL, DocumentView.HORIZONTAL, DocumentView.VERTICAL

addAnnotation

public AnnotationDataImpl addAnnotation(Annotation ann,
                                        AnnotationSet set)
Adds an annotation to be displayed in the list.

Parameters:
ann - the annotation
set - the set containing the annotation
Returns:
a tag that can be used to refer to this annotation for future operations, e.g. when removing the annotation from display.

removeAnnotation

public void removeAnnotation(AnnotationData tag)

removeAnnotations

public void removeAnnotations(Collection<AnnotationData> tags)

addAnnotations

public List<AnnotationData> addAnnotations(List<Annotation> annotations,
                                           AnnotationSet set)
Adds a batch of annotations in one go. For each annotation, a tag object will be created. The return value is list that returns the tags in the same order as the collection used for the input annotations. This method does not assume it was called from the UI Thread.

Parameters:
annotations - a collection of annotations
set - the annotation set to which all the annotations belong.
Returns:
a collection of tags corresponding to the annotations.

getAllAnnotations

public List<AnnotationData> getAllAnnotations()
Returns the tags for all the annotations currently displayed

Returns:
a list of AnnotationDataImpl.

annotationUpdated

public void annotationUpdated(AnnotationEvent e)
Description copied from interface: AnnotationListener
Called when an Annotation has been updated

Specified by:
annotationUpdated in interface AnnotationListener

setSelectedAnnotations

public void setSelectedAnnotations(List<AnnotationData> selectedAnnots)
Description copied from interface: DocumentView
Some document views can use the concept of selected annotations. This method is called to change the set of selected annotations. The recommended way to change the selected annotations set is by calling the DocumentEditor.setSelectedAnnotations(List) method.

Specified by:
setSelectedAnnotations in interface DocumentView
Overrides:
setSelectedAnnotations in class AbstractDocumentView

selectAnnotationForTag

public void selectAnnotationForTag(Object tag)
Selects the annotation for the given tag.

Parameters:
tag - the tag of the annotation to be selected.

annotationChanged

public void annotationChanged(Annotation ann,
                              AnnotationSet set,
                              String oldType)
Description copied from interface: AnnotationEditorOwner
Called by the annotation editor when an annotation has been changed.

Specified by:
annotationChanged in interface AnnotationEditorOwner
Parameters:
ann - the annotation modified (after the modification occurred).
set - the parent annotation set for the annotation
oldType - the old type of the annotation. This value is only set if the annotation modification included a change of type.

getNextAnnotation

public Annotation getNextAnnotation()
Description copied from interface: AnnotationEditorOwner
Called by the editor for obtaining the next annotation to be edited.

Specified by:
getNextAnnotation in interface AnnotationEditorOwner
Returns:
an Annotation value.

getPreviousAnnotation

public Annotation getPreviousAnnotation()
Description copied from interface: AnnotationEditorOwner
Called by the editor for obtaining the previous annotation to be edited.

Specified by:
getPreviousAnnotation in interface AnnotationEditorOwner
Returns:
an Annotation value.

getTextComponent

public JTextComponent getTextComponent()
Description copied from interface: AnnotationEditorOwner
Gets the UI component used to display the document text. This is used by the annotation editor for obtaining positioning information.

Specified by:
getTextComponent in interface AnnotationEditorOwner
Returns:
a JTextComponent object.

selectAnnotation

public void selectAnnotation(AnnotationData data)
Description copied from interface: AnnotationEditorOwner
Called by the editor when a new annotation needs to be selected.

Specified by:
selectAnnotation in interface AnnotationEditorOwner

getRowForAnnotation

public int getRowForAnnotation(AnnotationData data)
Description copied from interface: AnnotationList
Returns the display row for a given annotation.

Specified by:
getRowForAnnotation in interface AnnotationList
Parameters:
data - the annotation for which the row is required
Returns:
a positive int value if the annotation is found or -1 otherwise