gate.gui
Class UnrestrictedAnnotationEditor

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

public class UnrestrictedAnnotationEditor
extends AbstractVisualResource
implements AnnotationVisualResource, ResizableVisualResource

This class visually adds/edits features and annot type of an annotation It does this without using an AnnotationSchema. The user can manipulate annotation and features at his own will. It's his responsability.

See Also:
Serialized Form

Nested Class Summary
(package private)  class UnrestrictedAnnotationEditor.MyCustomFeatureBearer
          This class implements a feature bearer.
 
Field Summary
(package private)  JLabel annotTypeLabel
           
(package private)  JTextField annotTypeTextField
           
(package private)  Annotation currentAnnot
          The curent annotation used by the editor
(package private)  AnnotationSet currentAnnotSet
          The curent annotation set used by the editor
(package private)  Long currentEndOffset
          The end offset of the span covered by the currentAnnot
(package private)  Long currentStartOffset
          The start offset of the span covered by the currentAnnot
private  UnrestrictedAnnotationEditor.MyCustomFeatureBearer data
           
(package private)  FeaturesEditor featuresEditor
           
(package private)  JLabel featuresLabel
           
 
Fields inherited from class gate.creole.AbstractVisualResource
features
 
Fields inherited from class javax.swing.JPanel
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
UnrestrictedAnnotationEditor()
          Default constructor
 
Method Summary
 void cancelAction()
          Called by the GUI when the user has pressed the "Cancel" button.
 boolean canDisplayAnnotationType(String annotationType)
          Checks whether this viewer/editor can handle a specific annotation type.
 String getAnnotType()
          Returns annot type edited with this tool
protected  FeatureMap getCurrentAnnotationFeatures()
          Returns the features edited with this tool
protected  void initGuiComponents()
          Init GUI components with values taken from local data
protected  void initListeners()
          Init all the listeners
protected  void initLocalData()
          Init local data
 void okAction()
          Called by the GUI when the user has pressed the "OK" button.
 void setAnnotation(Annotation ann)
          Used when the viewer/editor has to display/edit an existing annotation
 void setSpan(Long startOffset, Long endOffset, String annotationType)
          Used when the viewer has to create new annotations.
 void setTarget(Object target)
          Called by the GUI when this viewer/editor has to initialise itself for a specific annotation or text span.
 
Methods inherited from class gate.creole.AbstractVisualResource
cleanup, getFeatures, getParameterValue, init, setFeatures, setHandle, setParameterValue, setParameterValues
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gate.VisualResource
setHandle
 
Methods inherited from interface gate.Resource
cleanup, getParameterValue, init, setParameterValue, setParameterValues
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures, setFeatures
 
Methods inherited from interface gate.util.NameBearer
getName, setName
 

Field Detail

currentAnnotSet

AnnotationSet currentAnnotSet
The curent annotation set used by the editor


currentAnnot

Annotation currentAnnot
The curent annotation used by the editor


currentStartOffset

Long currentStartOffset
The start offset of the span covered by the currentAnnot


currentEndOffset

Long currentEndOffset
The end offset of the span covered by the currentAnnot


data

private UnrestrictedAnnotationEditor.MyCustomFeatureBearer data

annotTypeLabel

JLabel annotTypeLabel

annotTypeTextField

JTextField annotTypeTextField

featuresLabel

JLabel featuresLabel

featuresEditor

FeaturesEditor featuresEditor
Constructor Detail

UnrestrictedAnnotationEditor

public UnrestrictedAnnotationEditor()
Default constructor

Method Detail

setTarget

public void setTarget(Object target)
Called by the GUI when this viewer/editor has to initialise itself for a specific annotation or text span.

Specified by:
setTarget in interface AnnotationVisualResource
Overrides:
setTarget in class AbstractVisualResource
Parameters:
target - the object which will always be a AnnotationSet

setAnnotation

public void setAnnotation(Annotation ann)
Used when the viewer/editor has to display/edit an existing annotation

Specified by:
setAnnotation in interface AnnotationVisualResource
Parameters:
ann - the annotation to be displayed or edited. If ann is null then the method simply returns

setSpan

public void setSpan(Long startOffset,
                    Long endOffset,
                    String annotationType)
Used when the viewer has to create new annotations.

Specified by:
setSpan in interface AnnotationVisualResource
Parameters:
startOffset - the start offset of the span covered by the new annotation(s). If is null the method will simply return.
endOffset - the end offset of the span covered by the new annotation(s). If is null the method will simply return.

okAction

public void okAction()
              throws GateException
Called by the GUI when the user has pressed the "OK" button. This should trigger the saving of the newly created annotation(s)

Specified by:
okAction in interface AnnotationVisualResource
GateException

cancelAction

public void cancelAction()
                  throws GateException
Description copied from interface: AnnotationVisualResource
Called by the GUI when the user has pressed the "Cancel" button. This should trigger cleaning up action, if the editor has done any changes to the annotation sets or document or annotation

Specified by:
cancelAction in interface AnnotationVisualResource
GateException

canDisplayAnnotationType

public boolean canDisplayAnnotationType(String annotationType)
Checks whether this viewer/editor can handle a specific annotation type.

Specified by:
canDisplayAnnotationType in interface AnnotationVisualResource
Parameters:
annotationType - represents the annotation type being questioned.If it is null then the method will return false.
Returns:
true if the SchemaAnnotationEditor can handle the annotationType or false otherwise.

initLocalData

protected void initLocalData()
Init local data


initGuiComponents

protected void initGuiComponents()
Init GUI components with values taken from local data


initListeners

protected void initListeners()
Init all the listeners


getAnnotType

public String getAnnotType()
Returns annot type edited with this tool


getCurrentAnnotationFeatures

protected FeatureMap getCurrentAnnotationFeatures()
Returns the features edited with this tool