net.sourceforge.nite.tools.videolabeler
Class AnnotationArea

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.text.JTextComponent
                  extended by javax.swing.JEditorPane
                      extended by javax.swing.JTextPane
                          extended by net.sourceforge.nite.gui.textviewer.NTextArea
                              extended by net.sourceforge.nite.tools.videolabeler.AnnotationArea
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.io.Serializable, java.util.Observer, javax.accessibility.Accessible, javax.swing.Scrollable, QueryResultHandler, SimpleQueryResultHandler, ScrollingTimeHandler, TimeHandler, AnnotationListener

public class AnnotationArea
extends NTextArea
implements java.util.Observer, AnnotationListener

An annotation area can display the annotations of a certain layer. If the layer belongs to an agent coding rather than an interaction coding, an agent should be specified as well. The display format of the annotations is determined by the element formatter of the annotation layer that is specified at construction.

Before an annotation area is created, the global singleton document should be created (see Document).

This class is an observer for the document, so the annotation area can be refreshed whenever the document changes. This possibly costly operation is only performed when the annotation area is visible.

The user can select one or more annotations by clicking or clicking and dragging. If annotation selection listeners (see AnnotationSelectionListener) are registered with this annotation area, they are notified when the user selects one annotation.

An annotation area is an annotation listener. When a new annotation is started, the selected annotations will be deselected.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.KeyBinding
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
 
Fields inherited from class net.sourceforge.nite.gui.textviewer.NTextArea
QUERY_HIGHLIGHTS, SELECTION_HIGHLIGHTS, TIME_HIGHLIGHTS, USER_HIGHLIGHTS
 
Fields inherited from class javax.swing.JEditorPane
HONOR_DISPLAY_PROPERTIES, W3C_LENGTH_UNITS
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
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 java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AnnotationArea(NAgent agent, AnnotationLayer layer, boolean markselect)
          Constructs a new annotation area for the specified layer and agent.
 
Method Summary
 void addAnnotationSelectionListener(AnnotationSelectionListener l)
          Registers an annotation selection listener with this annotation area.
 boolean annotationEnded(TargetControlPanel panel)
          Called when the end of the current annotation is marked.
 boolean annotationStarted(TargetControlPanel panel)
          Deselects the selected annotations.
 boolean annotationTargetSet(TargetControlPanel panel)
          Called when the target of the current annotation is set.
 void removeAnnotationSelectionListener(AnnotationSelectionListener l)
          Unregisters an annotation selection listener from this annotation area.
 void update(java.util.Observable o, java.lang.Object arg)
          Updates the annotation area for the changed document.
 
Methods inherited from class net.sourceforge.nite.gui.textviewer.NTextArea
acceptQueryResult, acceptQueryResults, acceptResults, acceptTimeChange, acceptTimeSpanChange, addCaretListener, addElement, addElement, addNTASelectionListener, clear, clearHighlights, clearSelection, getClock, getElementsBetweenTimes, getHighlightedModelElements, getHighlightedNOMElements, getHighlightedTextElements, getMaxTime, getNTextElementAtPoint, getNTextElementAtPosition, getObjectModelElementAtPoint, getObjectModelElementAtPosition, getSelectedElements, getSelectedElementsOrdered, getSelectedNOMElements, getSelectedNOMElementsOrdered, getSelectedTextElements, getSelectionEndPosition, getSelectionStartPosition, getTextElements, gotoDocumentEnd, gotoDocumentStart, insertCopyOfStyle, insertDisplayElement, insertElement, isResultRelevant, newSelection, newTimeSelection, print, printTextArea, redisplayElement, redisplayElement, redisplayElement, redisplayTextElement, removeDisplayComponent, removeHighlighted, removeNTASelectionListener, removeStyleFromChain, scrollTo, setAutoScroll, setClock, setHighlighted, setHighlighted, setHighlighted, setHighlighted, setHighlighted, setHighlighted, setHighlightingStyle, setQueryHighlightColor, setReplayEnabled, setSelected, setTime, setTimeHighlightColor, setTimeSpan, showTimeSpan
 
Methods inherited from class javax.swing.JTextPane
addStyle, getCharacterAttributes, getInputAttributes, getLogicalStyle, getParagraphAttributes, getStyle, getStyledDocument, getUIClassID, insertComponent, insertIcon, removeStyle, replaceSelection, setCharacterAttributes, setDocument, setEditorKit, setLogicalStyle, setParagraphAttributes, setStyledDocument
 
Methods inherited from class javax.swing.JEditorPane
addHyperlinkListener, createEditorKitForContentType, fireHyperlinkUpdate, getAccessibleContext, getContentType, getEditorKit, getEditorKitClassNameForContentType, getEditorKitForContentType, getHyperlinkListeners, getPage, getPreferredSize, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getText, read, registerEditorKitForContentType, registerEditorKitForContentType, removeHyperlinkListener, scrollToReference, setContentType, setEditorKitForContentType, setPage, setPage, setText
 
Methods inherited from class javax.swing.text.JTextComponent
addInputMethodListener, addKeymap, copy, cut, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, read, removeCaretListener, removeKeymap, removeNotify, select, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write
 
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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, 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, 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, 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, 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, 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

AnnotationArea

public AnnotationArea(NAgent agent,
                      AnnotationLayer layer,
                      boolean markselect)

Constructs a new annotation area 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. The annotation area will immediately show the annotations for the specified layer and agent (if not null).

Parameters:
agent - an agent (if the layer belongs to an agent coding) or null (if the layer belongs to an interaction coding)
layer - the layer for which annotations will be shown
markselect - true if the user can select annotations, false otherwise
Method Detail

addAnnotationSelectionListener

public void addAnnotationSelectionListener(AnnotationSelectionListener l)

Registers an annotation selection listener with this annotation area. The listener will be notified whenever one annotation is selected.

Parameters:
l - an annotation selection listener

removeAnnotationSelectionListener

public void removeAnnotationSelectionListener(AnnotationSelectionListener l)

Unregisters an annotation selection listener from this annotation area.

Parameters:
l - an annotation selection listener

update

public void update(java.util.Observable o,
                   java.lang.Object arg)

Updates the annotation area for the changed document.

Specified by:
update in interface java.util.Observer

annotationStarted

public boolean annotationStarted(TargetControlPanel panel)

Deselects the selected annotations.

Specified by:
annotationStarted in interface AnnotationListener
Parameters:
panel - the target control panel that fired the event
Returns:
true if the new annotation was created successfully, false otherwise

annotationTargetSet

public boolean annotationTargetSet(TargetControlPanel panel)
Description copied from interface: AnnotationListener

Called when the target of the current annotation is set. When this event occurs, the method setTarget() of the specified target control panel should be called with the current annotation.

Specified by:
annotationTargetSet in interface AnnotationListener
Parameters:
panel - the target control panel that fired the event
Returns:
true if the target of the current annotation was set successfully, false otherwise

annotationEnded

public boolean annotationEnded(TargetControlPanel panel)
Description copied from interface: AnnotationListener

Called when the end of the current annotation is marked. When this event occurs, the current time should be set as the end time of the current annotation and the annotation should be inserted into the Document.

Specified by:
annotationEnded in interface AnnotationListener
Parameters:
panel - the target control panel that fired the event
Returns:
true if the annotation was added to the corpus successfully, false otherwise