Module org.icepdf.ri.viewer
Class PopupAnnotationComponent
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- org.icepdf.ri.common.views.annotations.AbstractAnnotationComponent<PopupAnnotation>
-
- org.icepdf.ri.common.views.annotations.PopupAnnotationComponent
-
- All Implemented Interfaces:
DropTargetListener,ActionListener,FocusListener,MouseListener,MouseMotionListener,MouseWheelListener,ImageObserver,MenuContainer,PropertyChangeListener,Serializable,EventListener,DocumentListener,MouseInputListener,TreeSelectionListener,AnnotationComponent,PageViewAnnotationComponent,ResizeableComponent
- Direct Known Subclasses:
AnnotationSummaryBox
public class PopupAnnotationComponent extends AbstractAnnotationComponent<PopupAnnotation> implements TreeSelectionListener, ActionListener, DocumentListener, PropertyChangeListener, MouseWheelListener, DropTargetListener, PageViewAnnotationComponent
The PopupAnnotationComponent encapsulates a PopupAnnotation objects. It also provides basic editing of the parent MarkupAnnotation's review state: accepted, rejected, cancelled, completed, none. The component can also add replyTo text annotations as well as delete comments.
The PopupAnnotationComponent is slightly more complex than the other annotations components. Most annotations let the page pain the annotation but in this case PopupAnnotationComponent paints itself along with controls for editing, replying and deleting TextAnnotation comments. appearance stream.
Font size can be changed via a wheel mouse or crt-0 (reset), ctr--(zoom out) and crt-+ (zoom in).- Since:
- 5.0
- See Also:
FreeTextAnnotationPanel, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description static ColorbackgroundColorstatic DimensionBUTTON_SIZEprotected JPanelcommentPanelprotected JTreecommentTreeprotected JScrollPanecommentTreeScrollPaneprotected JLabelcreationLabelstatic intDEFAULT_HEIGHTstatic intDEFAULT_WIDTHprotected booleandisableSpellCheckprotected MarkupGlueComponentmarkupGlueComponentprotected JButtonminimizeButtonprotected AbstractPageViewComponentparentPageViewComponentprotected ColorpopupBackgroundColorprotected MouseListenerpopupListenerprotected JToggleButtonprivateToggleButtonprotected MarkupAnnotationselectedMarkupAnnotationprotected JTextAreatextAreaprotected JLabeltitleLabel-
Fields inherited from class org.icepdf.ri.common.views.annotations.AbstractAnnotationComponent
annotation, annotationHighlightAlpha, annotationHighlightColor, contextMenu, currentRotation, currentZoom, cursor, documentViewController, dx, dy, endOfMousePress, isEditable, isMousePressed, isMovable, isResizable, isRollover, isSelected, isShowInvisibleBorder, isSynthetic, logger, messageBundle, pageViewComponent, previousAnnotationState, resizableBorder, resizeBoxSize, resized, startOfMousePress, startPos, wasResized
-
Fields inherited from class javax.swing.JComponent
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.Component
accessibleContext, 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
Constructors Constructor Description PopupAnnotationComponent(PopupAnnotation annotation, DocumentViewController documentViewController, AbstractPageViewComponent pageViewComponent)PopupAnnotationComponent(PopupAnnotation annotation, DocumentViewController documentViewController, AbstractPageViewComponent pageViewComponent, boolean disableSpellCheck)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(ActionEvent e)voidbuildContextMenu()protected ColorcalculateContrastColor(int rgb)voidchangedUpdate(DocumentEvent e)voidchangeFontSize(float changeValue)voiddeleteSelectedMarkupExecute(boolean deleteRoot)Deletes the root annotation element or the selected tree node of the annotation popup view depending on the the value of the deleteRoot parameter.voiddispose()Dispose this component resources.voiddragEnter(DropTargetDragEvent dtde)voiddragExit(DropTargetEvent dte)voiddragOver(DropTargetDragEvent dtde)voiddrop(DropTargetDropEvent dropTargetDropEvent)When a file is dropped on this component, the respective file's extension is used to find a FileDropHandler that is registered with the AnnotationFileDropHandler.voiddropActionChanged(DropTargetDragEvent dtde)protected AnnotationComponentfindAnnotationComponent(Annotation annotation)voidfocusTextArea()List<Annotation>getAllAnnotations()AnnotationComponentgetAnnotationParentComponent()intgetHeaderFontSize()MarkupAnnotationComponentgetMarkupAnnotationComponent()MarkupGlueComponentgetMarkupGlueComponent()intgetTextAreaFontSize()voidinsertUpdate(DocumentEvent e)booleanisActive()protected RectanglelimitAnnotationPosition(int x, int y, int width, int height)voidmouseEntered(MouseEvent e)voidmouseMoved(MouseEvent me)voidmousePressed(MouseEvent e)voidmouseWheelMoved(MouseWheelEvent e)voidpaintComponent(Graphics g)voidpropertyChange(PropertyChangeEvent evt)voidrefreshAnnotationRect()Refreshes/transforms the page space bounds back to user space.voidrefreshDirtyBounds()Refreshes the components bounds for the current page transformation.voidrefreshPopupState()voidremoveUpdate(DocumentEvent e)voidreplyToSelectedMarkupExecute()voidresetAppearanceShapes()Rest the annotation appearance stream.protected voidresetComponentColors()voidsetBounds(int x, int y, int width, int height)voidsetBounds(Rectangle r)voidsetBoundsRelativeToParent(int x, int y, AffineTransform pageInverseTransform)voidsetFontSize(float size)voidsetHeaderLabelsFontSize(float size)voidsetMarkupGlueComponent(MarkupGlueComponent markupGlueComponent)voidsetParentPageComponent(AbstractPageViewComponent pageViewComponent)voidsetStatusSelectedMarkupExecute(String messageTitle, String messageBody, String status)voidsetTextAreaFontSize(float size)voidsetVisible(boolean aFlag)voidshowHidePopupAnnotations(boolean visible)protected voidupdateContent(DocumentEvent e)voidvalueChanged(TreeSelectionEvent e)-
Methods inherited from class org.icepdf.ri.common.views.annotations.AbstractAnnotationComponent
additionalActionsHandler, convertToPageSpace, convertToPageSpace, focusGained, focusLost, getAnnotation, getDocument, getPageIndex, getPageSpaceTransform, getPageViewComponent, getToPageSpaceTransform, initiateMouseMoved, isBorderStyle, isEditable, isMovable, isResizable, isRollover, isSelected, isShowInvisibleBorder, isSynthetic, mouseClicked, mouseDragged, mouseExited, mouseReleased, removeMouseListeners, resize, setSelected, setSynthetic, validate
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update, updateUI
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.icepdf.ri.common.views.AnnotationComponent
hasFocus, repaint
-
Methods inherited from interface org.icepdf.ri.common.views.annotations.PageViewAnnotationComponent
repaint
-
-
-
-
Field Detail
-
DEFAULT_WIDTH
public static final int DEFAULT_WIDTH
- See Also:
- Constant Field Values
-
DEFAULT_HEIGHT
public static final int DEFAULT_HEIGHT
- See Also:
- Constant Field Values
-
backgroundColor
public static final Color backgroundColor
-
BUTTON_SIZE
public static final Dimension BUTTON_SIZE
-
popupBackgroundColor
protected Color popupBackgroundColor
-
popupListener
protected MouseListener popupListener
-
commentPanel
protected JPanel commentPanel
-
textArea
protected JTextArea textArea
-
creationLabel
protected JLabel creationLabel
-
titleLabel
protected JLabel titleLabel
-
minimizeButton
protected JButton minimizeButton
-
privateToggleButton
protected JToggleButton privateToggleButton
-
commentTree
protected JTree commentTree
-
commentTreeScrollPane
protected JScrollPane commentTreeScrollPane
-
selectedMarkupAnnotation
protected MarkupAnnotation selectedMarkupAnnotation
-
markupGlueComponent
protected MarkupGlueComponent markupGlueComponent
-
disableSpellCheck
protected final boolean disableSpellCheck
-
parentPageViewComponent
protected AbstractPageViewComponent parentPageViewComponent
-
-
Constructor Detail
-
PopupAnnotationComponent
public PopupAnnotationComponent(PopupAnnotation annotation, DocumentViewController documentViewController, AbstractPageViewComponent pageViewComponent)
-
PopupAnnotationComponent
public PopupAnnotationComponent(PopupAnnotation annotation, DocumentViewController documentViewController, AbstractPageViewComponent pageViewComponent, boolean disableSpellCheck)
-
-
Method Detail
-
setParentPageComponent
public void setParentPageComponent(AbstractPageViewComponent pageViewComponent)
- Specified by:
setParentPageComponentin interfacePageViewAnnotationComponent
-
limitAnnotationPosition
protected Rectangle limitAnnotationPosition(int x, int y, int width, int height)
- Overrides:
limitAnnotationPositionin classAbstractAnnotationComponent<PopupAnnotation>
-
refreshDirtyBounds
public void refreshDirtyBounds()
Refreshes the components bounds for the current page transformation. Bounds are already in user space.- Specified by:
refreshDirtyBoundsin interfaceAnnotationComponent- Specified by:
refreshDirtyBoundsin interfacePageViewAnnotationComponent- Overrides:
refreshDirtyBoundsin classAbstractAnnotationComponent<PopupAnnotation>
-
refreshAnnotationRect
public void refreshAnnotationRect()
Refreshes/transforms the page space bounds back to user space. This must be done in order refresh the annotation user space rectangle after UI manipulation, otherwise the annotation will be incorrectly located on the next repaint.- Specified by:
refreshAnnotationRectin interfaceAnnotationComponent- Overrides:
refreshAnnotationRectin classAbstractAnnotationComponent<PopupAnnotation>
-
dispose
public void dispose()
Description copied from interface:AnnotationComponentDispose this component resources.- Specified by:
disposein interfaceAnnotationComponent- Overrides:
disposein classAbstractAnnotationComponent<PopupAnnotation>
-
mouseMoved
public void mouseMoved(MouseEvent me)
- Specified by:
mouseMovedin interfaceMouseMotionListener- Overrides:
mouseMovedin classAbstractAnnotationComponent<PopupAnnotation>
-
mousePressed
public void mousePressed(MouseEvent e)
- Specified by:
mousePressedin interfaceMouseListener- Overrides:
mousePressedin classAbstractAnnotationComponent<PopupAnnotation>
-
setBounds
public void setBounds(int x, int y, int width, int height)- Overrides:
setBoundsin classAbstractAnnotationComponent<PopupAnnotation>
-
paintComponent
public void paintComponent(Graphics g)
- Overrides:
paintComponentin classAbstractAnnotationComponent<PopupAnnotation>
-
setVisible
public void setVisible(boolean aFlag)
- Overrides:
setVisiblein classJComponent
-
mouseEntered
public void mouseEntered(MouseEvent e)
- Specified by:
mouseEnteredin interfaceMouseListener- Overrides:
mouseEnteredin classAbstractAnnotationComponent<PopupAnnotation>
-
focusTextArea
public void focusTextArea()
-
setBoundsRelativeToParent
public void setBoundsRelativeToParent(int x, int y, AffineTransform pageInverseTransform)
-
buildContextMenu
public void buildContextMenu()
-
replyToSelectedMarkupExecute
public void replyToSelectedMarkupExecute()
-
getAnnotationParentComponent
public AnnotationComponent getAnnotationParentComponent()
-
deleteSelectedMarkupExecute
public void deleteSelectedMarkupExecute(boolean deleteRoot)
Deletes the root annotation element or the selected tree node of the annotation popup view depending on the the value of the deleteRoot parameter.- Parameters:
deleteRoot- true delete the entire annotation sub comments, false delete just the selected node.
-
setStatusSelectedMarkupExecute
public void setStatusSelectedMarkupExecute(String messageTitle, String messageBody, String status)
-
mouseWheelMoved
public void mouseWheelMoved(MouseWheelEvent e)
- Specified by:
mouseWheelMovedin interfaceMouseWheelListener
-
actionPerformed
public void actionPerformed(ActionEvent e)
- Specified by:
actionPerformedin interfaceActionListener
-
showHidePopupAnnotations
public void showHidePopupAnnotations(boolean visible)
-
insertUpdate
public void insertUpdate(DocumentEvent e)
- Specified by:
insertUpdatein interfaceDocumentListener
-
removeUpdate
public void removeUpdate(DocumentEvent e)
- Specified by:
removeUpdatein interfaceDocumentListener
-
changedUpdate
public void changedUpdate(DocumentEvent e)
- Specified by:
changedUpdatein interfaceDocumentListener
-
updateContent
protected void updateContent(DocumentEvent e)
-
valueChanged
public void valueChanged(TreeSelectionEvent e)
- Specified by:
valueChangedin interfaceTreeSelectionListener
-
refreshPopupState
public void refreshPopupState()
-
propertyChange
public void propertyChange(PropertyChangeEvent evt)
- Specified by:
propertyChangein interfacePropertyChangeListener
-
getAllAnnotations
public List<Annotation> getAllAnnotations()
-
isActive
public boolean isActive()
- Specified by:
isActivein interfaceAnnotationComponent- Specified by:
isActivein classAbstractAnnotationComponent<PopupAnnotation>
-
getMarkupAnnotationComponent
public MarkupAnnotationComponent getMarkupAnnotationComponent()
-
findAnnotationComponent
protected AnnotationComponent findAnnotationComponent(Annotation annotation)
-
resetComponentColors
protected void resetComponentColors()
-
resetAppearanceShapes
public void resetAppearanceShapes()
Description copied from interface:AnnotationComponentRest the annotation appearance stream.- Specified by:
resetAppearanceShapesin interfaceAnnotationComponent- Specified by:
resetAppearanceShapesin classAbstractAnnotationComponent<PopupAnnotation>
-
dragEnter
public void dragEnter(DropTargetDragEvent dtde)
- Specified by:
dragEnterin interfaceDropTargetListener
-
dragOver
public void dragOver(DropTargetDragEvent dtde)
- Specified by:
dragOverin interfaceDropTargetListener
-
dropActionChanged
public void dropActionChanged(DropTargetDragEvent dtde)
- Specified by:
dropActionChangedin interfaceDropTargetListener
-
dragExit
public void dragExit(DropTargetEvent dte)
- Specified by:
dragExitin interfaceDropTargetListener
-
drop
public void drop(DropTargetDropEvent dropTargetDropEvent)
When a file is dropped on this component, the respective file's extension is used to find a FileDropHandler that is registered with the AnnotationFileDropHandler. If a FileDropHandler is found for the extension then the file is passed to the FileDropHandler object along with the instnce of the annotation for processing.- Specified by:
dropin interfaceDropTargetListener- Parameters:
dropTargetDropEvent- drop target drop event
-
calculateContrastColor
protected Color calculateContrastColor(int rgb)
-
setTextAreaFontSize
public void setTextAreaFontSize(float size)
-
setHeaderLabelsFontSize
public void setHeaderLabelsFontSize(float size)
-
changeFontSize
public void changeFontSize(float changeValue)
-
getMarkupGlueComponent
public MarkupGlueComponent getMarkupGlueComponent()
-
setMarkupGlueComponent
public void setMarkupGlueComponent(MarkupGlueComponent markupGlueComponent)
-
setFontSize
public void setFontSize(float size)
-
getTextAreaFontSize
public int getTextAreaFontSize()
-
getHeaderFontSize
public int getHeaderFontSize()
-
-