com.qoppa.pdfNotes.contextmenus
Class AnnotationContextMenu

java.lang.Object
  extended by com.qoppa.pdfNotes.contextmenus.AnnotationContextMenu

public class AnnotationContextMenu
extends Object

The AnnotationContextMenu represents the context menu displayed when a user right-clicks on an AnnotationComponent or a row in the CommentPanelNotes. There is one instance of this class per PDFNotesBean, it can be retrieved with PDFNotesBean.getCommentPanelNotes().getAnnotContextMenu().

Different context menus are displayed depending on the selected annotations. All possible menu items are represented in this class and can be retrieved by the provided getters. When initially constructed, all menu items in this class are added to the JPopupMenu. After the JPopupMenu is constructed, only the visibility and enabled state of its menu items can be modified, the actual contents of the list of items can not. Therefore, any changes developers make to the JPopupMenu's component list will be persistent. This is the recommended way to either add or remove components to the AnnotationContextMenu. The contents of the AnnotationContextMenu may be accessed and modified with the getPopupMenu() method. For example, to add a new menu item to the popup menu:

     PDFNotesBean notesBean = new PDFNotesBean();
     AnnotationContextMenu contextMenu = notesBean.getCommentPanelNotes().getAnnotContextMenu();
     JMenuItem menuItem = new JMenuItem("My Menu Item");
     contextMenu.getPopupMenu().add(menuItem);
 
The visibility and enabled state of the preset menu items is adjusted each time the JPopupMenu is displayed. The behavior of these adjustments is documented on each individual getter method. If a developer desires a different behavior for a particular item, they may remove the item and add their own. Or, they can add a PopupMenuListener to the JPopupMenu. Their Listener will be notified after any adjustments have been completed, and they can make adjustments as they wish.


Constructor Summary
AnnotationContextMenu()
           
 
Method Summary
 JMenu getAlignmentMenu()
          The Alignment menu.
 JMenuItem getCheckmarkMenuItem()
          The CheckmarkMenuItem.
 JMenuItem getConvertToPerimeterMenuItem()
          The Convert to Perimeter menu item.
 JMenuItem getCopyMenuItem()
          The Copy menu item.
 JMenuItem getCopyTextMenuItem()
          The Copy Text menu item.
 JMenuItem getCreatePerimeterMenuItem()
          The Create Perimeter menu item.
 JMenuItem getCutMenuItem()
          The Cut menu item.
 JMenuItem getDeleteMenuItem()
          The Delete menu item.
 JMenuItem getEditMenuItem()
          The Edit menu item.
 JSeparator getFlattenDivider()
          The JSeparator that follows the FlattenMenuItem

This Separator is only visible if the FlattenMenuItem or DeleteMenuItem or CopyMenuItem or CutMenuItem are visible
 JMenuItem getFlattenMenuItem()
          The Flatten menu item.
 JSeparator getGroupDivider()
          The JSeparator that follows the GroupMenuItem

This Separator is only visible if the GroupMenuItem is visible
 JMenuItem getGroupMenuItem()
          The Group menu item.
 JSeparator getNoteDivider()
          The JSeparator that follows the ShowNoteMenuItem

This Separator is only visible if the ShowNoteMenuItem is visible
 JMenuItem getOpenAttachmentMenuItem()
          The Open attachment menu item.
 JPopupMenu getPopupMenu()
          Returns the actual JPopupMenu.
 JMenuItem getPropertiesMenuItem()
          The Properties menu item.
 JSeparator getPropertiesSeparator()
          The JSeparator that follows the PropertiesMenuItem.
 JSeparator getReviewDivider()
          The JSeparator that follows the ReviewMenu

This Separator is only visible if the ReviewMenu or the CheckMarkMenuItem are visible
 JMenu getReviewMenu()
          The Review status menu.
 JMenuItem getSaveAttachmentMenuItem()
          The Save attachment menu item.
 JMenuItem getShowNoteMenuItem()
          The ShowNoteMenuItem.
 JSeparator getSizeSeparator()
          The JSeparator that follows the AlignmentMenu.
 JMenuItem getSoundMenuItem()
          The Play sound menu item.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationContextMenu

public AnnotationContextMenu()
Method Detail

getPopupMenu

public JPopupMenu getPopupMenu()
Returns the actual JPopupMenu. The list of components for this menu is constructed when JPopupMenu is instantiated, and is not modified afterwards. Therefore, any modifications that developers make to this list, will be persistent.

Returns:
the PopupMenu

getShowNoteMenuItem

public JMenuItem getShowNoteMenuItem()
The ShowNoteMenuItem. When pressed, this will show the popup note associated with the selected annotation.

This MenuItem is invisible if the selected annotation does not support popup notes. It will be visible but disabled if multiple annotations are selected.

Returns:
the ShowNoteMenuItem

getCheckmarkMenuItem

public JMenuItem getCheckmarkMenuItem()
The CheckmarkMenuItem. When pressed, this mark annotations with a checkmark, if they currently are unchecked. If checked, it will remove the checkmark.

This MenuItem is invisible if AnnotationTools.isReviewEnabled() is false.

Returns:
the CheckmarkMenuItem

getReviewMenu

public JMenu getReviewMenu()
The Review status menu. This menu contains review items for setting the annotations' review status.

This MenuItem is invisible if AnnotationTools.isReviewEnabled() is false.

Returns:
the ReviewMenu

getGroupMenuItem

public JMenuItem getGroupMenuItem()
The Group menu item. When pressed, the currently selected annotations are grouped. If the currently selected annotations already belong to the same group, they are ungrouped.

This MenuItem is invisible if AnnotationTools.isGroupingEnabled() is false.
It is disabled if less than two annotations are selected, or the selection contains annotations that are not groupable.

Returns:
the GroupMenuItem

getCutMenuItem

public JMenuItem getCutMenuItem()
The Cut menu item. When pressed, the currently selected annotations are copied to the system clipboard and deleted.

This MenuItem is disabled if any selected annotations are unable to be modified.

Returns:
the CutMenuItem

getCopyMenuItem

public JMenuItem getCopyMenuItem()
The Copy menu item. When pressed, the currently selected annotations are copied to the system clipboard

Returns:
the CopyMenuItem

getDeleteMenuItem

public JMenuItem getDeleteMenuItem()
The Delete menu item. When pressed, the currently selected annotations are deleted.

This MenuItem is invisible if AnnotationTools.isDeleteEnabled() is false.
It is disabled if any selected annotations are unable to be modified.

Returns:
the DeleteMenuItem

getEditMenuItem

public JMenuItem getEditMenuItem()
The Edit menu item. Used to switch link annotations into edit mode.

This MenuItem is only visible if only one annotation is selected, and that annotation is a Link.

Returns:
the EditMenuItem

getFlattenMenuItem

public JMenuItem getFlattenMenuItem()
The Flatten menu item. When pressed, the currently selected annotations are flattened.

This MenuItem is invisible if AnnotationTools.isFlatteningEnabled() is false or an unflattenable annotation is selected.
It is disabled if any selected annotations are unable to be modified.

Returns:
the FlattenMenuItem

getAlignmentMenu

public JMenu getAlignmentMenu()
The Alignment menu. This menu contains options for realigning the selected annotations.

This Menu is invisible if only one annotation is selected.

Returns:
the AlignmentMenu

getPropertiesMenuItem

public JMenuItem getPropertiesMenuItem()
The Properties menu item. When pressed, the properties dialog for the selected annotation is displayed.

This MenuItem is disabled if multiple annotations are selected.

Returns:
the FlattenMenuItem

getSoundMenuItem

public JMenuItem getSoundMenuItem()
The Play sound menu item. When pressed, plays the sound for the selected Sound.

This menu item is only visible if the only selected annotation is a Sound.

Returns:
the SoundMenuItem

getOpenAttachmentMenuItem

public JMenuItem getOpenAttachmentMenuItem()
The Open attachment menu item. When pressed, plays opens the attached doc for the FileAttachment.

This menu item is only visible if the only selected annotation is a FileAttachment.

Returns:
the OpenAttachmentItem

getSaveAttachmentMenuItem

public JMenuItem getSaveAttachmentMenuItem()
The Save attachment menu item. When pressed, plays saves the attached doc for the FileAttachment.

This menu item is only visible if the only selected annotation is a FileAttachment.

Returns:
the SaveAttachmentItem

getCreatePerimeterMenuItem

public JMenuItem getCreatePerimeterMenuItem()
The Create Perimeter menu item. When pressed, creates a new perimeter annotation from the area annotation.

This menu item is only visible if the selected annotation is an area annotation.

Returns:
the CreatePerimeterItem

getConvertToPerimeterMenuItem

public JMenuItem getConvertToPerimeterMenuItem()
The Convert to Perimeter menu item. When pressed, converts the selected area annotation to a perimeter annotation.

This menu item is only visible if the selected annotation is an area annotation.

Returns:
the ConvertToPerimeterItem

getNoteDivider

public JSeparator getNoteDivider()
The JSeparator that follows the ShowNoteMenuItem

This Separator is only visible if the ShowNoteMenuItem is visible

Returns:
the JSeparator

getReviewDivider

public JSeparator getReviewDivider()
The JSeparator that follows the ReviewMenu

This Separator is only visible if the ReviewMenu or the CheckMarkMenuItem are visible

Returns:
the JSeparator

getGroupDivider

public JSeparator getGroupDivider()
The JSeparator that follows the GroupMenuItem

This Separator is only visible if the GroupMenuItem is visible

Returns:
the JSeparator

getFlattenDivider

public JSeparator getFlattenDivider()
The JSeparator that follows the FlattenMenuItem

This Separator is only visible if the FlattenMenuItem or DeleteMenuItem or CopyMenuItem or CutMenuItem are visible

Returns:
the JSeparator

getSizeSeparator

public JSeparator getSizeSeparator()
The JSeparator that follows the AlignmentMenu. This Separator is only visible if the AlignmentMenu is visible

Returns:
the JSeparator

getPropertiesSeparator

public JSeparator getPropertiesSeparator()
The JSeparator that follows the PropertiesMenuItem. Since the PropertiesMenuItem is typically the last item on the list, this Separator is only visible if the PropertiesMenuItem is visible and the SaveAttachmentMenuItem or the OpenAttachmentMenuItem or the PlaySoundMenuItem are visible.

Returns:
the JSeparator

getCopyTextMenuItem

public JMenuItem getCopyTextMenuItem()
The Copy Text menu item. When pressed, the text enclosed by the quadrilaterals of a TextMarkup annotation is copied to the clipboard

Returns:
the CopyTextMenuItem