## gate.gui
Class SchemaAnnotationEditor

    java.lang.Object
      |
      +--java.awt.Component
            |
            +--java.awt.Container
                  |
                  +--javax.swing.JComponent
                        |
                        +--javax.swing.JPanel
                              |
                              +--gate.creole.AbstractVisualResource
                                    |
                                    +--gate.gui.SchemaAnnotationEditor

All Implemented Interfaces:
  Accessible, AnnotationVisualResource, FeatureBearer, ImageObserver, MenuContainer, NameBearer, Resource, Serializable, VisualResource

public class SchemaAnnotationEditor
extends AbstractVisualResource
implements AnnotationVisualResource

This class is a viewer which adds/edits features on a GATE annotation. This viewer is `AnnotationSchema` driven.

See Also:
  Serialized Form

Inner Class Summary
`protected class` `SchemaAnnotationEditor.FeaturesTableModel`
`(package private) class` `SchemaAnnotationEditor.InnerFeaturesEditor` This inner class deals with the feature type being eddited.
`(package private) class` `SchemaAnnotationEditor.RowData` Internal class used in the inner FeaturesTableModel class

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
`(package private) JButton` `addFeatButton` This button does the opposite of the above
`(package private) JComboBox` `annotSchemaComboBox` Displays all possible annotation schema loaded into the system
`(package private) Annotation` `currentAnnot` The curent annotation used by the editor
`(package private) List` `currentAnnotationSchemaList` The annotation schema present into the system
`(package private) FeatureMap` `currentAnnotFeaturesMap` The current FeatureMap used by the editor
`(package private) AnnotationSchema` `currentAnnotSchema` This is the currentAnnotSchema being 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
`(package private) JList` `featureSchemaList` Displays all possible features of the annotation being editted (taken from AnnotationSchema)
`(package private) SchemaAnnotationEditor.InnerFeaturesEditor` `featuresEditor` This inner class deals with feature editting
`(package private) JScrollPane` `featuresListScroll` A JScroll for the featuresTable component
`(package private) JTable` `featuresTable` Displays the current features of the annotation being editted
`(package private) JScrollPane` `featuresTableScroll` A JScroll for the featuresTable component
`(package private) DefaultListModel` `listModel` A list model used to represent the features not assigned to an annot
`(package private) Map` `name2annotSchemaMap` A map from annotation type to its AnnotationSchema definition
`(package private) Map` `name2featureSchemaMap` A map from feature name to its FeatureSchema definition
`(package private) JButton` `removeFeatButton` This button removes current features and add them to possible feature list
`(package private) FeatureMap` `responseMap` This field is returned when a featureMap was editted or created
`(package private) SchemaAnnotationEditor.FeaturesTableModel` `tableModel` This field is the table model used to represent features

Fields inherited from class gate.creole.AbstractVisualResource
`features`

Fields inherited from class javax.swing.JPanel
`defaultLayout, uiClassID`

Fields inherited from class javax.swing.JComponent

`_bounds, accessibleContext, actionMap, ACTIONMAP_CREATED, alignmentX, alignmentY, ANCESTOR_INPUTMAP_CREATED, ANCESTOR_USING_BUFFER, ancestorInputMap, ancestorNotifier, autoscroller, border, changeSupport, clientProperties, CREATED_DOUBLE_BUFFER, flags, FOCUS_INPUTMAP_CREATED, focusInputMap, HAS_FOCUS, htmlKey, htmlView, inputVerifier, IS_DOUBLE_BUFFERED, IS_OPAQUE, IS_PAINTING_TILE, IS_PRINTING, IS_PRINTING_ALL, KEY_EVENTS_ENABLED, KEYBOARD_BINDINGS_KEY, listenerList, maximumSize, minimumSize, NEXT_FOCUS, paintImmediatelyClip, paintingChild, preferredSize, readObjectCallbacks, REQUEST_FOCUS_DISABLED, tmpRect, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, verifyInputWhenFocusTarget, vetoableChangeSupport, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, WHEN_IN_FOCUSED_WINDOW_BINDINGS, WIF_INPUTMAP_CREATED, windowInputMap`

Fields inherited from class java.awt.Container
`component, containerListener, containerSerializedDataVersion, dbg, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads, serialVersionUID`

Fields inherited from class java.awt.Component

`actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y`

Fields inherited from interface java.awt.image.ImageObserver
`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

Constructor Summary
`SchemaAnnotationEditor()` Default constructor

Method Summary
`protected void` `buildGuiComponents()` This method creates the GUI components and paces them into the layout
`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.
`private void` `doAddFeature(String aFeatureName)` This method adds a feature from the list to the table
`private void` `doAddFeatures()` This method adds features from the list to the table
`private void` `doRemoveFeature(int rowIndex)` This removes the feature @ rowIndex
`private void` `doRemoveFeatures()` This method remove a feature from the table and adds it to the list
`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 needed by the GUI components to initialize
`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 annotType)` 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
`<clinit>, getAccessibleContext, getUIClassID, paramString, updateUI, writeObject`

Methods inherited from class javax.swing.JComponent

`_paintImmediately, addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, adjustPaintFlags, alwaysOnTop, checkIfChildObscuredBySibling, clearFocusOwners, componentInputMapChanged, computeVisibleRect, computeVisibleRect, compWriteObjectNotify, contains, createToolTip, disable, enable, enableSerialization, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperties, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getCreatedDoubleBuffer, getDebugGraphicsOptions, getFlag, getGraphics, getHeight, getInputMap, 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, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paintWithBuffer, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyBindings, processKeyBindingsForAllComponents, processKeyEvent, processMouseMotionEvent, putClientProperty, readObject, rectangleIsObscured, rectangleIsObscuredBySibling, registerKeyboardAction, registerKeyboardAction, registerWithKeyboardManager, registerWithKeyboardManager, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setCreatedDoubleBuffer, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFlag, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPaintingChild, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, shouldDebugGraphics, superProcessMouseMotionEvent, unregisterKeyboardAction, unregisterWithKeyboardManager, unregisterWithKeyboardManager, update`

Methods inherited from class java.awt.Container

`add, add, add, add, add, addContainerListener, addImpl, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getLayout, getMouseEventTarget, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paintComponents, paintHeavyweightComponents, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setFocusOwner, setLayout, transferFocus, validate, validateTree`

Methods inherited from class java.awt.Component

`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, constructComponentName, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getToolkit, getToolkitImpl, getTreeLock, getWindowForObject, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isEnabledImpl, isLightweight, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resetGC, 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
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, 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

### currentAnnotationSchemaList

    List currentAnnotationSchemaList

  The annotation schema present into the system

### 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

### currentAnnotSchema

    AnnotationSchema currentAnnotSchema

  This is the currentAnnotSchema being used by the editor

### currentAnnotFeaturesMap

    FeatureMap currentAnnotFeaturesMap

  The current FeatureMap used by the editor

### responseMap

    FeatureMap responseMap

  This field is returned when a featureMap was editted or created

### tableModel

    SchemaAnnotationEditor.FeaturesTableModel tableModel

  This field is the table model used to represent features

### name2featureSchemaMap

    Map name2featureSchemaMap

  A map from feature name to its FeatureSchema definition

### name2annotSchemaMap

    Map name2annotSchemaMap

  A map from annotation type to its AnnotationSchema definition

### listModel

    DefaultListModel listModel

  A list model used to represent the features not assigned to an annot

### featuresTable

    JTable featuresTable

  Displays the current features of the annotation being editted

### featuresTableScroll

    JScrollPane featuresTableScroll

  A JScroll for the featuresTable component

### featureSchemaList

    JList featureSchemaList

  Displays all possible features of the annotation being editted (taken from AnnotationSchema)

### featuresListScroll

    JScrollPane featuresListScroll

  A JScroll for the featuresTable component

### removeFeatButton

    JButton removeFeatButton

  This button removes current features and add them to possible feature list

### addFeatButton

    JButton addFeatButton

  This button does the opposite of the above

### annotSchemaComboBox

    JComboBox annotSchemaComboBox

  Displays all possible annotation schema loaded into the system

### featuresEditor

    SchemaAnnotationEditor.InnerFeaturesEditor featuresEditor

  This inner class deals with feature editting

Constructor Detail

### SchemaAnnotationEditor

    public SchemaAnnotationEditor()

  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 annotType)

  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`

### 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`

### 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 needed by the GUI components to initialize

### buildGuiComponents

    protected void buildGuiComponents()

  This method creates the GUI components and paces them into the layout

### initGuiComponents

    protected void initGuiComponents()

  Init GUI components with values taken from local data

### initListeners

    protected void initListeners()

  Init all the listeners

### doRemoveFeatures

    private void doRemoveFeatures()

  This method remove a feature from the table and adds it to the list

### doRemoveFeature

    private void doRemoveFeature(int rowIndex)

  This removes the feature @ rowIndex

### doAddFeatures

    private void doAddFeatures()

  This method adds features from the list to the table

### doAddFeature

    private void doAddFeature(String aFeatureName)

  This method adds a feature from the list to the table