public class AnnotationSetsView extends AbstractDocumentView implements DocumentListener, AnnotationSetListener, AnnotationEditorOwner
Modifier and Type | Class and Description |
---|---|
protected class |
AnnotationSetsView.DeleteSelectedAnnotationsAction |
protected class |
AnnotationSetsView.EditAnnotationAction |
protected class |
AnnotationSetsView.HandleDocumentEventsAction |
protected class |
AnnotationSetsView.HighlightMenuItem
The popup menu items used to select annotations
Apart from the normal
JMenuItem behaviour, this menu
item also highlights the annotation which it would select if pressed. |
protected class |
AnnotationSetsView.MouseStoppedMovingAction
Used to select an annotation for editing.
|
protected class |
AnnotationSetsView.NewAnnotationAction |
protected class |
AnnotationSetsView.NewAnnotationSetAction |
class |
AnnotationSetsView.SetHandler
Stores the data related to an annotation set
|
protected class |
AnnotationSetsView.SetSelectedAnnotationsAction |
protected class |
AnnotationSetsView.SetsTableCellEditor |
protected class |
AnnotationSetsView.SetsTableCellRenderer |
protected class |
AnnotationSetsView.SetsTableModel |
protected class |
AnnotationSetsView.TextMouseListener
A mouse listener used for events in the text view.
|
class |
AnnotationSetsView.TypeHandler |
Modifier and Type | Field and Description |
---|---|
protected static ColorGenerator |
colourGenerator |
protected ComponentOrientation |
currentOrientation |
protected Timer |
eventMinder
Timer used to handle events coming from the document
|
protected String |
lastAnnotationType |
protected Timer |
mouseMovementTimer |
protected AnnotationSetsView.MouseStoppedMovingAction |
mouseStoppedMovingAction |
protected BlockingQueue<GateEvent> |
pendingEvents |
protected PropertyChangeListener |
textChangeListener
Listener for property changes on the text pane.
|
protected AnnotationSetsView.TextMouseListener |
textMouseListener
The listener for mouse and mouse motion events in the text view.
|
protected BlockingQueue<gate.gui.docview.AnnotationSetsView.TypeSpec> |
visibleAnnotationTypes
Stores the list of visible annotation types when the view is inactivated
so that the selection can be restored when the view is made active again.
|
active, document, guiInitialised, handle, owner
name
features
CENTRAL, HORIZONTAL, VERTICAL
Constructor and Description |
---|
AnnotationSetsView() |
Modifier and Type | Method and Description |
---|---|
void |
annotationAdded(AnnotationSetEvent e)
Called when a new
Annotation has been added |
void |
annotationChanged(Annotation ann,
AnnotationSet set,
String oldType)
Called by the annotation editor when an annotation has been
changed.
|
void |
annotationRemoved(AnnotationSetEvent e)
Called when an
Annotation has been removed |
void |
annotationSetAdded(DocumentEvent e)
Called when a new
AnnotationSet has been added |
void |
annotationSetRemoved(DocumentEvent e)
Called when an
AnnotationSet has been removed |
void |
changeOrientation(ComponentOrientation orientation)
changes the orientation of the annotation editor component only
|
void |
cleanup()
releases the memory allocated to this resource
|
void |
contentEdited(DocumentEvent e)
Called when the content of the document has changed through an edit
operation.
|
protected OwnedAnnotationEditor |
createAnnotationEditor(TextualDocumentView textView,
AnnotationSetsView asView)
Create the annotation editor (responsible for creating the window
used to edit individual annotations).
|
static Color |
getColor(String annotationSet,
String annotationType)
Get the saved colour for this annotation type or create a new one
and save it.
|
Component |
getGUI()
Returns the actual UI component this view represents.
|
AnnotationList |
getListComponent() |
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.
|
protected AnnotationSetsView.SetHandler |
getSetHandler(String name)
Get an annotation set handler in this annotation set view.
|
JTextComponent |
getTextComponent()
Gets the UI component used to display the document text.
|
int |
getType()
Returns the type of this view.
|
AnnotationSetsView.TypeHandler |
getTypeHandler(String set,
String type)
Get an annotation type handler in this annotation set view.
|
protected void |
initGUI()
Implementers should override this method and use it for populating the GUI.
|
protected void |
initListeners() |
protected void |
populateUI() |
protected void |
registerHooks()
This method will be called whenever the view becomes active.
|
void |
restoreSavedSelectedTypes()
Restore previously selected types from the preferences.
|
protected void |
restoreSelectedTypes()
Restores the selected types based on the state saved in the
visibleAnnotationTypes data structure. |
protected void |
saveColor(String annotationSet,
String annotationType,
Color colour) |
void |
saveType(String setName,
String typeName,
boolean selected)
Save type or remove unselected type in the preferences.
|
void |
selectAnnotation(Annotation ann,
AnnotationSet annSet)
Sets a particular annotation as selected.
|
void |
selectAnnotation(AnnotationData aData)
Queues an an action for selecting the provided annotation
|
void |
setNewAnnSetCreationEnabled(boolean b)
Enables or disables creation of the new annotation set.
|
void |
setSelectedAnnotations(List<AnnotationData> selectedAnnots)
Some document views can use the concept of selected annotations.
|
void |
setTypeSelected(String setName,
String typeName,
boolean selected)
Un/select an annotation type in this annotation set view
and indirectly highlight it in the document view.
|
protected void |
storeSelectedTypes()
Populates the
visibleAnnotationTypes structure based on the
current selection |
protected void |
unregisterHooks()
This method will be called whenever this view becomes inactive.
|
getActions, getDocument, getHandle, getOwner, isActive, setActive, setHandle, setOwner, setTarget
checkParameterValues, flushBeanInfoCache, forgetBeanInfo, getBeanInfo, getInitParameterValues, getInitParameterValues, getName, getParameterValue, getParameterValue, getParameterValues, init, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners, toString
getFeatures, setFeatures
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDocument
targetReinitialised
getParameterValue, init, setParameterValue, setParameterValues
getFeatures, setFeatures
getName, setName
protected AnnotationSetsView.TextMouseListener textMouseListener
protected PropertyChangeListener textChangeListener
protected BlockingQueue<gate.gui.docview.AnnotationSetsView.TypeSpec> visibleAnnotationTypes
protected Timer mouseMovementTimer
protected Timer eventMinder
protected BlockingQueue<GateEvent> pendingEvents
protected AnnotationSetsView.MouseStoppedMovingAction mouseStoppedMovingAction
protected String lastAnnotationType
protected ComponentOrientation currentOrientation
protected static final ColorGenerator colourGenerator
public void annotationChanged(Annotation ann, AnnotationSet set, String oldType)
AnnotationEditorOwner
annotationChanged
in interface AnnotationEditorOwner
ann
- the annotation modified (after the modification occurred).set
- the parent annotation set for the annotationoldType
- the old type of the annotation. This value is only set if
the annotation modification included a change of type.public void changeOrientation(ComponentOrientation orientation)
orientation
- public void selectAnnotation(AnnotationData aData)
selectAnnotation
in interface AnnotationEditorOwner
public Annotation getNextAnnotation()
AnnotationEditorOwner
getNextAnnotation
in interface AnnotationEditorOwner
Annotation
value.public Annotation getPreviousAnnotation()
AnnotationEditorOwner
getPreviousAnnotation
in interface AnnotationEditorOwner
Annotation
value.public JTextComponent getTextComponent()
AnnotationEditorOwner
getTextComponent
in interface AnnotationEditorOwner
JTextComponent
object.public AnnotationList getListComponent()
public int getType()
DocumentView
getType
in interface DocumentView
DocumentView.CENTRAL
,
DocumentView.HORIZONTAL
,
DocumentView.VERTICAL
protected void initGUI()
AbstractDocumentView
initGUI
in class AbstractDocumentView
protected OwnedAnnotationEditor createAnnotationEditor(TextualDocumentView textView, AnnotationSetsView asView) throws ResourceInstantiationException
ResourceInstantiationException
- if an error occursprotected void populateUI()
public Component getGUI()
DocumentView
getGUI
in interface DocumentView
Component
value.public static Color getColor(String annotationSet, String annotationType)
annotationType
- type to get a colour forpublic void saveType(String setName, String typeName, boolean selected)
setName
- set name to save/remove or null for the default settypeName
- type name to save/removeselected
- state of the selectionpublic void restoreSavedSelectedTypes()
public void setNewAnnSetCreationEnabled(boolean b)
protected void registerHooks()
registerHooks
in class AbstractDocumentView
protected void unregisterHooks()
registerHooks()
.unregisterHooks
in class AbstractDocumentView
protected void storeSelectedTypes()
visibleAnnotationTypes
structure based on the
current selectionprotected void restoreSelectedTypes()
visibleAnnotationTypes
data structure.protected void initListeners()
public void cleanup()
AbstractResource
cleanup
in interface Resource
cleanup
in class AbstractResource
public void annotationSetAdded(DocumentEvent e)
DocumentListener
AnnotationSet
has been addedannotationSetAdded
in interface DocumentListener
public void annotationSetRemoved(DocumentEvent e)
DocumentListener
AnnotationSet
has been removedannotationSetRemoved
in interface DocumentListener
public void contentEdited(DocumentEvent e)
contentEdited
in interface DocumentListener
public void annotationAdded(AnnotationSetEvent e)
AnnotationSetListener
Annotation
has been addedannotationAdded
in interface AnnotationSetListener
public void annotationRemoved(AnnotationSetEvent e)
AnnotationSetListener
Annotation
has been removedannotationRemoved
in interface AnnotationSetListener
protected AnnotationSetsView.SetHandler getSetHandler(String name)
name
- name of the annotation set or null for the default setpublic AnnotationSetsView.TypeHandler getTypeHandler(String set, String type)
set
- name of the annotation set or null for the default settype
- type of the annotationpublic void setTypeSelected(String setName, String typeName, boolean selected)
setName
- name of the annotation set or null for the default settypeName
- type of the annotationselected
- state of the selectionpublic void setSelectedAnnotations(List<AnnotationData> selectedAnnots)
DocumentView
DocumentEditor.setSelectedAnnotations(List)
method.setSelectedAnnotations
in interface DocumentView
setSelectedAnnotations
in class AbstractDocumentView
public void selectAnnotation(Annotation ann, AnnotationSet annSet)
ann
- the annotationannSet
- the parent setCopyright © 2024 GATE. All rights reserved.