|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JPanel | +--gate.creole.AbstractVisualResource | +--gate.gui.DocumentEditor
This class implements a viewer/editor for the annotations on a document.
As a viewer, this visual resource will display all the annotations found on
the document. The editor needs to have some data about annotation types in
order to allow the editing of annotations. This data comes from the
AnnotationSchema
objects that are loaded in the Gate
system at a given moment. If there are no such objects the editing of
annotations will be restricted to a very crude method allowing the user to
add any type of annotations having any features with any String values.
Inner Class Summary | |
protected class |
DocumentEditor.AnnotationsTableModel
A custom table model used to render a table containing the annotations from a set of annotation sets. |
protected class |
DocumentEditor.CorefData
|
(package private) class |
DocumentEditor.CorefNodeRenderer
A tree node renderer used by the coref tree |
(package private) class |
DocumentEditor.CorefNodeRenderer1
A tree node renderer used byt the coref tree |
class |
DocumentEditor.CustomLabelView
Fixes the 4406598 bug in swing text components. |
class |
DocumentEditor.CustomStyledEditorKit
Fixes the 4406598 bug in swing text components. |
class |
DocumentEditor.CustomStyledViewFactory
Fixes the 4406598 bug in swing text components. |
protected class |
DocumentEditor.DeleteSelectedAnnotationsAction
|
protected class |
DocumentEditor.DumpAsXmlAction
The action that is fired when the user wants to edit an annotation. |
protected class |
DocumentEditor.EditAnnotationAction
The action that is fired when the user wants to edit an annotation. |
(package private) class |
DocumentEditor.EventsHandler
All the events from the document or its annotation sets are handled by this inner class. |
(package private) class |
DocumentEditor.LazyJPanel
Panels used in cell/node renderers |
(package private) class |
DocumentEditor.NewAnnotationAction
The action that is fired when the user wants to create a new annotation. |
(package private) class |
DocumentEditor.NodeRenderer
Displays an entry in the right hand side tree. |
(package private) class |
DocumentEditor.NodeRenderer1
Displays an entry in the right hand side tree. |
protected class |
DocumentEditor.PrintAction
|
(package private) class |
DocumentEditor.Range
Describes a range in the data structure. |
protected class |
DocumentEditor.SelectAnnotationPopupItem
The popup menu items used to select annotations at right click. |
(package private) class |
DocumentEditor.SelectionBlinker
This class handles the blinking for the selected annotations in the text display. |
class |
DocumentEditor.TypeData
Holds the GUI metadata for a given annotation type. |
Inner classes inherited from class javax.swing.JPanel |
JPanel.AccessibleJPanel |
Inner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent, JComponent.ActionStandin, JComponent.IntVector, JComponent.KeyboardState |
Inner classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.AWTTreeLock |
Field Summary | |
protected XJTable |
annotationsTable
The table placed below the text display used for showing annotations |
protected DocumentEditor.AnnotationsTableModel |
annotationsTableModel
Model for the annotations table |
private boolean |
annotationsTableVisible
|
private JToggleButton |
annotationsTableVisibleBtn
|
protected ColorGenerator |
colGenerator
A random colour generator used to generate initial default colours for highlighting various types of annotations. |
private boolean |
coreferenceVisible
|
private JToggleButton |
coreferenceVisibleBtn
|
private boolean |
corefOptionAvailable
|
protected JScrollPane |
corefScroll
The scroller for the coref list |
protected JTree |
corefTree
The Jtree that displays the coreference data |
protected DefaultTreeModel |
corefTreeModel
The model for the coref tree |
protected DefaultMutableTreeNode |
corefTreeRoot
The root for the coref tree |
protected List |
data
holds the data for the annotations table: a list of Annotation objects |
private Document |
document
The Document currently displayed. |
private boolean |
editable
Should this component bahave as an editor as well as an viewer |
protected DocumentEditor.EventsHandler |
eventHandler
The listener for the events coming from the document (annotations and annotation sets added or removed). |
protected Highlighter |
highlighter
The highlighter used to help the user select annotations that overlap and for highligting in the text the annotations selected in the lower table. |
protected JSplitPane |
leftSplit
|
protected Object |
lock
Object used to sychronise all the various threads involved in GUI updating; |
protected JSplitPane |
mainSplit
The main horizontal split that contains all the contents of this viewer |
protected Handle |
myHandle
|
protected JProgressBar |
progressBar
The progress bar used during updating the text |
protected Box |
progressBox
A box containing a JProgressBar used to keep the user
entertained while the text display is being updated |
private PropertyChangeSupport |
propertyChangeListeners
|
protected List |
ranges
a list containing AnnotationEditor.Range objects. |
protected JSplitPane |
rightSplit
The split that contains the styles tree and the coreference viewer. |
protected DocumentEditor.SelectionBlinker |
selectionBlinker
The object responsible with blinking the selected annotations. |
protected Highlighter |
selectionHighlighter
This highlighter is actually used as a data structure. |
protected TextAttributesChooser |
styleChooser
The dialog used for editing the styles used to highlight annotations |
protected JTree |
stylesTree
The right hand side tree with all the annotation sets and types of annotations |
protected DefaultTreeModel |
stylesTreeModel
The model for the styles tree |
protected DefaultMutableTreeNode |
stylesTreeRoot
The root for the styles tree |
protected JScrollPane |
stylesTreeScroll
Scroller for the styles tree |
protected JScrollPane |
tableScroll
Scroller for the annotations table |
protected JTextPane |
textPane
The text display. |
protected JScrollPane |
textScroll
Scroller used for the text diaplay |
private boolean |
textVisible
|
private JToggleButton |
textVisibleBtn
|
protected JToolBar |
toolbar
The toolbar displayed on the top part of the component |
protected Map |
typeDataMap
A composed map used to get the metadata for an annotation type starting from the annotation set name and the type name. |
private boolean |
typesTreeVisible
|
private JToggleButton |
typesTreeVisibleBtn
|
Fields inherited from class gate.creole.AbstractVisualResource |
features |
Fields inherited from class javax.swing.JPanel |
defaultLayout, uiClassID |
Fields inherited from class java.awt.Container |
component, containerListener, containerSerializedDataVersion, dbg, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads, serialVersionUID |
Fields inherited from interface gate.creole.ANNIEConstants |
ANNOTATION_COREF_FEATURE_NAME, DOCUMENT_COREF_FEATURE_NAME, PR_NAMES |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
DocumentEditor()
Default constructor. |
Method Summary | |
void |
addPropertyChangeListener(PropertyChangeListener l)
|
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener l)
|
void |
cleanup()
Does nothing now, but meant to clear all internal data |
protected Set |
getAnnotationSchemas()
Gets all the AnnotationSchema objects currently
loaded in the system. |
protected DocumentEditor.TypeData |
getTypeData(String setName,
String type)
Gets the data related to a given annotation type. |
Resource |
init()
Initialise this resource, and return it. |
protected void |
initGuiComponents()
Builds all the graphical components |
protected void |
initListeners()
Initialises all the listeners that this component has to register with other classes. |
protected void |
initLocalData()
Initialises the local variables to their default values |
boolean |
isAnnotationsTableVisible()
|
boolean |
isCoreferenceVisible()
|
boolean |
isCorefOptionAvailable()
|
boolean |
isEditable()
Is the editor functionality enabled |
private boolean |
isTextSelected()
This method returns true if a text is selected in the textPane |
boolean |
isTextVisible()
|
boolean |
isTypesTreeVisible()
|
protected void |
layoutComponents()
Creates the layout of this component acording to the set of subcomponents (text display, annotations table, etc.) that need to be visible. |
static void |
main(String[] args)
Test code |
void |
removePropertyChangeListener(PropertyChangeListener l)
|
protected void |
selectAnnotation(String set,
Annotation ann)
Updates the GUI when the user has selected an annotation e.g. |
void |
setAnnotationsTableVisible(boolean annotationsTableVisible)
|
void |
setCoreferenceVisible(boolean coreferenceVisible)
|
void |
setCorefOptionAvailable(boolean corefOptionAvailable)
|
void |
setEditable(boolean newEditable)
Should the editor functionality of this component be enabled |
void |
setHandle(Handle handle)
Used by the main GUI to tell this VR what handle created it. |
void |
setTarget(Object target)
Sets the document to be displayed |
void |
setTextVisible(boolean textVisible)
|
void |
setTypesTreeVisible(boolean typesTreeVisible)
|
protected void |
showHighlights(Set annotations,
AttributeSet style)
Repaints the highlighting for annotation types in the text display. |
protected void |
this_documentChanged()
Updates this component when the underlying document is changed. |
protected void |
updateCorefTree()
Updates the coref tree from the coref data on the document's features |
Methods inherited from class gate.creole.AbstractVisualResource |
getFeatures, getParameterValue, setFeatures, setParameterValue, setParameterValues |
Methods inherited from class javax.swing.JPanel |
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait |
Methods inherited from interface gate.util.NameBearer |
getName, setName |
Field Detail |
private transient PropertyChangeSupport propertyChangeListeners
private Document document
Document
currently displayed.protected ColorGenerator colGenerator
protected JTextPane textPane
protected JScrollPane textScroll
protected XJTable annotationsTable
protected DocumentEditor.AnnotationsTableModel annotationsTableModel
protected JScrollPane tableScroll
protected JSplitPane leftSplit
protected JSplitPane rightSplit
protected JSplitPane mainSplit
protected JTree stylesTree
protected JToolBar toolbar
protected JScrollPane stylesTreeScroll
protected DefaultMutableTreeNode stylesTreeRoot
protected DefaultTreeModel stylesTreeModel
protected TextAttributesChooser styleChooser
protected JTree corefTree
protected DefaultMutableTreeNode corefTreeRoot
protected DefaultTreeModel corefTreeModel
protected JScrollPane corefScroll
protected Box progressBox
JProgressBar
used to keep the user
entertained while the text display is being updatedprotected JProgressBar progressBar
protected Highlighter highlighter
protected Highlighter selectionHighlighter
AnnotationEditor#highlighter
as using two different
highlighters on the same text component is looking for trouble.protected DocumentEditor.SelectionBlinker selectionBlinker
protected Handle myHandle
protected List data
protected List ranges
AnnotationEditor.Range
objects. These are the
ranges in the AnnotationEditor#data
structure. A range is a bunch
of annotations belonging to the same annotation set that are contiguous
in the AnnotationEditor#data
structure.protected Map typeDataMap
AnnotationEditor.TypeData
Maps from String to Map to AnnotationEditor.TypeData
.protected DocumentEditor.EventsHandler eventHandler
protected Object lock
private boolean editable
private JToggleButton textVisibleBtn
private JToggleButton typesTreeVisibleBtn
private JToggleButton annotationsTableVisibleBtn
private JToggleButton coreferenceVisibleBtn
private boolean annotationsTableVisible
private boolean coreferenceVisible
private boolean textVisible
private boolean typesTreeVisible
private boolean corefOptionAvailable
Constructor Detail |
public DocumentEditor()
Method Detail |
public Resource init()
AbstractVisualResource
init
in class AbstractVisualResource
public static void main(String[] args)
protected void initListeners()
protected void initLocalData()
protected void initGuiComponents()
private boolean isTextSelected()
protected Set getAnnotationSchemas()
AnnotationSchema
objects currently
loaded in the system.public void removePropertyChangeListener(PropertyChangeListener l)
removePropertyChangeListener
in class JComponent
public void addPropertyChangeListener(PropertyChangeListener l)
addPropertyChangeListener
in class JComponent
public void addPropertyChangeListener(String propertyName, PropertyChangeListener l)
addPropertyChangeListener
in class JComponent
public void setTarget(Object target)
setTarget
in class AbstractVisualResource
gate.creole.AbstractVisualResource
target
- the object (be it a Resource
,
DataStore
or whatever) this viewer has to displaypublic void setHandle(Handle handle)
AbstractVisualResource
setHandle
in class AbstractVisualResource
public void cleanup()
AbstractVisualResource
cleanup
in class AbstractVisualResource
protected void this_documentChanged()
protected DocumentEditor.TypeData getTypeData(String setName, String type)
AnnotationEditor.TypeData
value has been obtained it can be used to change
the way the respective type of annotations are displayed.setName
- a String
, the name of the annotation settype
- a String
, the name of the type.AnnotationEditor.TypeData
valueprotected void showHighlights(Set annotations, AttributeSet style)
protected void selectAnnotation(String set, Annotation ann)
protected void layoutComponents()
protected void updateCorefTree()
public void setEditable(boolean newEditable)
public boolean isEditable()
public void setAnnotationsTableVisible(boolean annotationsTableVisible)
public boolean isAnnotationsTableVisible()
public void setCoreferenceVisible(boolean coreferenceVisible)
public boolean isCoreferenceVisible()
public void setTextVisible(boolean textVisible)
public boolean isTextVisible()
public void setTypesTreeVisible(boolean typesTreeVisible)
public boolean isTypesTreeVisible()
public void setCorefOptionAvailable(boolean corefOptionAvailable)
public boolean isCorefOptionAvailable()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |