|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
net.sourceforge.nite.tools.videolabeler.AnnotationControlPanel
public class AnnotationControlPanel
An annotation control panel displays the current annotation and contains two buttons that allow the user to delete the current annotation or to edit a comment. Initially the current annotation is unassigned.
The panel is part of an annotation frame (see
AnnotationFrame
), which also contains an annotation
area (see AnnotationArea
) and a target control panel
(see TargetControlPanel
). The panel is an
annotation listener and an annotation selection listener, so it can keep
track of the current annotation.
The current annotation is changed either when the user starts a new annotation in the target control panel (notification through the annotation listener interface) or an existing annotation is selected (notification through the annotation selection listener interface).
When the panel receives an annotationTargetSet event through the annotation listener interface, it calls the setTarget() method of the specified target control panel and then it retrieves the target label through the annotation layer that is specified at construction. The label will be displayed in the panel.
When the panel receives an annotationEnded event, it inserts the annotation into the corpus, making sure that the annotations remain non-overlapping. Note that the incomplete annotation has already been added to the corpus after the annotationStarted event.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Field Summary |
---|
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.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
AnnotationControlPanel(NAgent agent,
AnnotationLayer layer)
Constructs a new annotation control panel for the specified annotation layer and agent. |
Method Summary | |
---|---|
boolean |
annotationEnded(TargetControlPanel panel)
Sets the current time as the end time of the current annotation and inserts the annotation into the Document . |
void |
annotationSelected(NOMObjectModelElement annotation)
Sets the selected annotation as the current annotation and updates this control panel. |
boolean |
annotationStarted(TargetControlPanel panel)
Creates a new annotation and makes it the current annotation. |
boolean |
annotationTargetSet(TargetControlPanel panel)
Calls setTarget() of the specified target control panel, so the target of the current annotation is set. |
NOMWriteElement |
getCurrentElement()
Returns the current element. |
void |
setDeleteActionEnabled(boolean enabled)
Enables or disables the delete action. |
void |
setFinishActionEnabled(boolean enabled)
Enables or disables the finish action. |
void |
setTimeDisplay(int displayType)
define the format of the time display |
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 AnnotationControlPanel(NAgent agent, AnnotationLayer layer)
Constructs a new annotation control panel for the specified annotation layer and agent. The agent parameter may be null if the layer belongs to an interaction coding rather than an agent coding
agent
- an agent (if the layer belongs to an agent coding) or null
(if the layer belongs to an interaction coding)layer
- an annotation layerMethod Detail |
---|
public void setFinishActionEnabled(boolean enabled)
Enables or disables the finish action. If enabled
is
true, this control panel will automatically enable/disable the finish
action depending on the currently selected annotation. If
enabled
is false, the finish action will always be
disabled.
enabled
- true if the finish action should automatically be
enabled/disabled depending on the currently selected annotation, false
if it should always be disabledpublic void setTimeDisplay(int displayType)
public void setDeleteActionEnabled(boolean enabled)
Enables or disables the delete action. If enabled
is
true, this control panel will automatically enable/disable the delete
action depending on the currently selected annotation. If
enabled
is false, the delete action will always be
disabled.
enabled
- true if the delete action should automatically be
enabled/disabled depending on the currently selected annotation, false
if it should always be disabledpublic boolean annotationStarted(TargetControlPanel panel)
Creates a new annotation and makes it the current annotation. The current time is set as the start time of the new annotation. This control panel is updated for the new annotation. If the new annotation cannot be created, an error is printed to standard output and this method returns false. In that case the current annotation will be unassigned.
annotationStarted
in interface AnnotationListener
panel
- the target control panel from which the annotation was
started
public boolean annotationTargetSet(TargetControlPanel panel)
Calls setTarget() of the specified target control panel, so the target of the current annotation is set. Then updates this control panel, so it shows the label of the current annotation's target. If the current annotation is unassigned, this method has no effect and returns false. If an error occurs while setting the target, this method prints an error to standard output and returns false.
annotationTargetSet
in interface AnnotationListener
panel
- the target control panel that fired the event
public boolean annotationEnded(TargetControlPanel panel)
Sets the current time as the end time of the current annotation and
inserts the annotation into the Document
. If the current
annotation is unassigned, if it already has an end time, or if the end
time is not greater than the start time, this method has no effect and
returns false. If an error occurs while setting the end time or while
inserting the annotation, an error is printed to standard output and this
method returns false. After calling this method, the current annotation
will be unassigned.
annotationEnded
in interface AnnotationListener
panel
- the target control panel that fired the event
public void annotationSelected(NOMObjectModelElement annotation)
Sets the selected annotation as the current annotation and updates this control panel.
annotationSelected
in interface AnnotationSelectionListener
annotation
- the selected annotationpublic NOMWriteElement getCurrentElement()
Returns the current element. Called after "set comment".
getCurrentElement
in interface NOMWriteElementContainer
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |