gate.gui
Class DocumentEditor

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--gate.creole.AbstractVisualResource
                                |
                                +--gate.gui.DocumentEditor
All Implemented Interfaces:
Accessible, ANNIEConstants, FeatureBearer, ImageObserver, MenuContainer, NameBearer, Resource, Serializable, VisualResource

public class DocumentEditor
extends AbstractVisualResource
implements ANNIEConstants

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.

See Also:
Serialized Form

Inner Class Summary
 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.
 class DocumentEditor.TypeData
          Holds the GUI metadata for a given annotation type.
 
Inner classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface gate.creole.ANNIEConstants
ANNOTATION_COREF_FEATURE_NAME, DATE_ANNOTATION_TYPE, DOCUMENT_COREF_FEATURE_NAME, LOCATION_ANNOTATION_TYPE, LOOKUP_ANNOTATION_TYPE, LOOKUP_CLASS_FEATURE_NAME, LOOKUP_MAJOR_TYPE_FEATURE_NAME, LOOKUP_MINOR_TYPE_FEATURE_NAME, LOOKUP_ONTOLOGY_FEATURE_NAME, MONEY_ANNOTATION_TYPE, ORGANIZATION_ANNOTATION_TYPE, PERSON_ANNOTATION_TYPE, PERSON_GENDER_FEATURE_NAME, PR_NAMES, SENTENCE_ANNOTATION_TYPE, SPACE_TOKEN_ANNOTATION_TYPE, TOKEN_ANNOTATION_TYPE, TOKEN_CATEGORY_FEATURE_NAME, TOKEN_KIND_FEATURE_NAME, TOKEN_LENGTH_FEATURE_NAME, TOKEN_ORTH_FEATURE_NAME, TOKEN_STRING_FEATURE_NAME
 
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
 Set getDisplayedAnnotations()
          This method returns a list of annotations which are currently shown in the annotations table or null of the table is empty.
 Document getDocument()
          Return the current selected document
 Resource init()
          Initialise this resource, and return it.
 boolean isAnnotationsTableVisible()
           
 boolean isCoreferenceVisible()
           
 boolean isCorefOptionAvailable()
           
 boolean isEditable()
          Is the editor functionality enabled
 boolean isTextVisible()
           
 boolean isTypesTreeVisible()
           
static void main(String[] args)
          Test code
 void removePropertyChangeListener(PropertyChangeListener l)
           
 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)
           
 
Methods inherited from class gate.creole.AbstractVisualResource
getFeatures, getParameterValue, setFeatures, setParameterValue, setParameterValues
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setLayout, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, contains, createImage, createImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gate.util.NameBearer
getName, setName
 

Constructor Detail

DocumentEditor

public DocumentEditor()
Default constructor. Creats all the components and initialises all the internal data to default values where possible.
Method Detail

init

public Resource init()
Description copied from class: AbstractVisualResource
Initialise this resource, and return it.
Overrides:
init in class AbstractVisualResource

main

public static void main(String[] args)
Test code

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Overrides:
removePropertyChangeListener in class JComponent

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Overrides:
addPropertyChangeListener in class JComponent

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener l)
Overrides:
addPropertyChangeListener in class JComponent

getDocument

public Document getDocument()
Return the current selected document

setTarget

public void setTarget(Object target)
Sets the document to be displayed
Overrides:
setTarget in class AbstractVisualResource
Following copied from class: gate.creole.AbstractVisualResource
Parameters:
target - the object (be it a Resource, DataStore or whatever) this viewer has to display

setHandle

public void setHandle(Handle handle)
Description copied from class: AbstractVisualResource
Used by the main GUI to tell this VR what handle created it. The VRs can use this information e.g. to add items to the popup for the resource.
Overrides:
setHandle in class AbstractVisualResource

cleanup

public void cleanup()
Description copied from class: AbstractVisualResource
Does nothing now, but meant to clear all internal data
Overrides:
cleanup in class AbstractVisualResource

getDisplayedAnnotations

public Set getDisplayedAnnotations()
This method returns a list of annotations which are currently shown in the annotations table or null of the table is empty.

setEditable

public void setEditable(boolean newEditable)
Should the editor functionality of this component be enabled

isEditable

public boolean isEditable()
Is the editor functionality enabled

setAnnotationsTableVisible

public void setAnnotationsTableVisible(boolean annotationsTableVisible)

isAnnotationsTableVisible

public boolean isAnnotationsTableVisible()

setCoreferenceVisible

public void setCoreferenceVisible(boolean coreferenceVisible)

isCoreferenceVisible

public boolean isCoreferenceVisible()

setTextVisible

public void setTextVisible(boolean textVisible)

isTextVisible

public boolean isTextVisible()

setTypesTreeVisible

public void setTypesTreeVisible(boolean typesTreeVisible)

isTypesTreeVisible

public boolean isTypesTreeVisible()

setCorefOptionAvailable

public void setCorefOptionAvailable(boolean corefOptionAvailable)

isCorefOptionAvailable

public boolean isCorefOptionAvailable()