Class TargetControlPanel

  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer,, javax.accessibility.Accessible, AnnotationSelectionListener
Direct Known Subclasses:
AgentTargetControlPanel, FeeltraceTargetControlPanel, LabelTargetControlPanel, TreeTargetControlPanel

public abstract class TargetControlPanel
extends javax.swing.JPanel
implements AnnotationSelectionListener

A target control panel is a panel that allows the user to make annotations in a certain layer. If the layer belongs to an agent coding rather than an interaction coding, an agent should be specified as well. The panel is part of an annotation frame (see AnnotationFrame). It interacts with an annotation listener. An annotation listener is registered with this panel by calling addAnnotationListener().

According to user input the panel should notify the annotation listener of the following three events: annotationStarted, annotationTargetSet and annotationEnded, in that order. A subclass can notify the registered annotation listeners by calling processAnnotationStarted(), processAnnotationTargetSet() and processAnnotationEnded().

After the annotationTargetSet event, an annotation listener can call the setTarget() method of this control panel, which should be implemented by a subclass.

A target control panel is registered as an annotation selection listener with the annotation area in the same annotation frame. Subclasses can override annotationSelected() to handle the event when an existing annotation is selected in the annotation area.

If something needs to be done before the annotation frame that contains the control panel, is closed, register a ComponentListener and listen to componentHidden. For instance, any actions that were added to the global input map, should be removed.

See Also:
Serialized Form

Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
Field Summary
Fields inherited from class javax.swing.JComponent
Fields inherited from class java.awt.Component
Fields inherited from interface java.awt.image.ImageObserver
Constructor Summary
TargetControlPanel(AnnotationFrame frame, AnnotationLayer layer, org.w3c.dom.Node layerInfo, NAgent agent)
          Constructs a new target control panel for the specified layer and agent.
Method Summary
 void addAnnotationListener(AnnotationListener l)
          Registers an annotation listener with this control panel.
 void annotationSelected(NOMObjectModelElement annotation)
          Called when an existing annotation is selected in the annotation area of the same annotation frame.
 NAgent getAgent()
          Returns the agent of this control panel, if the annotation layer belongs to an agent coding.
 AnnotationLayer getLayer()
          Returns the annotation layer for this control panel.
 void removeAnnotationListener(AnnotationListener l)
          Unregisters an annotation listener from this control panel.
abstract  boolean setTarget(NOMWriteElement annotation)
          Sets the target of the current annotation.
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public TargetControlPanel(AnnotationFrame frame,
                          AnnotationLayer layer,
                          org.w3c.dom.Node layerInfo,
                          NAgent agent)

Constructs a new target control panel for the specified layer and agent. The agent parameter may be null if the layer belongs to an interaction coding rather than an agent coding.

frame - the annotation frame that contains this control panel
layer - an annotation layer
layerInfo - the layerinfo element from the configuration file
agent - an agent (if the layer belongs to an agent coding) or null (if the layer belongs to an interaction coding)
Method Detail


public NAgent getAgent()

Returns the agent of this control panel, if the annotation layer belongs to an agent coding. If the annotation layer belongs to an interaction coding, this method returns null.

an agent or null


public AnnotationLayer getLayer()

Returns the annotation layer for this control panel.

an annotation layer


public void addAnnotationListener(AnnotationListener l)

Registers an annotation listener with this control panel.

l - an annotation listener


public void removeAnnotationListener(AnnotationListener l)

Unregisters an annotation listener from this control panel.

l - an annotation listener


public void annotationSelected(NOMObjectModelElement annotation)

Called when an existing annotation is selected in the annotation area of the same annotation frame. This method does nothing, but may be overridden.

Specified by:
annotationSelected in interface AnnotationSelectionListener
annotation - the selected annotation


public abstract boolean setTarget(NOMWriteElement annotation)

Sets the target of the current annotation. This method is called by an annotation listener after the annotationTargetSet event.

annotation - the current annotation
true if the target was set successfully, false otherwise