public class TextContextualPopupMenu extends javax.swing.JPopupMenu
Modifier and Type | Class and Description |
---|---|
protected class |
TextContextualPopupMenu.RedoAction |
protected class |
TextContextualPopupMenu.UndoAction |
javax.swing.JPopupMenu.AccessibleJPopupMenu, javax.swing.JPopupMenu.Separator
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected javax.swing.text.JTextComponent |
component |
private static java.lang.String |
EDITABLE |
protected java.beans.PropertyChangeListener |
propertyChangeListener |
protected TextContextualPopupMenu.RedoAction |
redoAction |
protected javax.swing.undo.UndoManager |
undo |
protected TextContextualPopupMenu.UndoAction |
undoAction |
protected javax.swing.event.UndoableEditListener |
undoEditListener |
protected boolean |
undoRedo |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Modifier | Constructor and Description |
---|---|
protected |
TextContextualPopupMenu()
Creates a new
TextContextualPopupMenu . |
Modifier and Type | Method and Description |
---|---|
private void |
addMenuEntries() |
protected void |
addMenuEntry(javax.swing.text.JTextComponent component,
java.lang.String label,
java.lang.String actionName,
java.lang.String iconName) |
protected TextContextualPopupMenu |
attach(javax.swing.text.JTextComponent component,
boolean undoRedo)
Attaches this contextual menu to the given text component.
|
protected TextContextualPopupMenu |
detach()
Detaches this contextual menu from its text component.
|
static void |
disableMenuFor(javax.swing.text.JTextComponent component,
PopupMenuLauncher launcher)
Disables the
TextContextualPopupMenu attached to the given popup menu launcher and text component. |
static PopupMenuLauncher |
enableMenuFor(javax.swing.text.JTextComponent component,
boolean undoRedo)
Creates a new
TextContextualPopupMenu and enables it for the given text component. |
boolean |
isAttached()
Determines if this popup is currently attached to a component.
|
add, add, add, addMenuKeyListener, addPopupMenuListener, addSeparator, createActionChangeListener, createActionComponent, firePopupMenuCanceled, firePopupMenuWillBecomeInvisible, firePopupMenuWillBecomeVisible, getAccessibleContext, getComponent, getComponentAtIndex, getComponentIndex, getDefaultLightWeightPopupEnabled, getInvoker, getLabel, getMargin, getMenuKeyListeners, getPopupMenuListeners, getSelectionModel, getSubElements, getUI, getUIClassID, insert, insert, isBorderPainted, isLightWeightPopupEnabled, isPopupTrigger, isVisible, menuSelectionChanged, pack, paintBorder, paramString, processFocusEvent, processKeyEvent, processKeyEvent, processMouseEvent, remove, removeMenuKeyListener, removePopupMenuListener, setBorderPainted, setDefaultLightWeightPopupEnabled, setInvoker, setLabel, setLightWeightPopupEnabled, setLocation, setPopupSize, setPopupSize, setSelected, setSelectionModel, setUI, setVisible, show, updateUI
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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, 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
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, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
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, 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, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
private static final java.lang.String EDITABLE
protected javax.swing.text.JTextComponent component
protected boolean undoRedo
protected final TextContextualPopupMenu.UndoAction undoAction
protected final TextContextualPopupMenu.RedoAction redoAction
protected final javax.swing.undo.UndoManager undo
protected final javax.swing.event.UndoableEditListener undoEditListener
protected final java.beans.PropertyChangeListener propertyChangeListener
protected TextContextualPopupMenu()
TextContextualPopupMenu
.protected TextContextualPopupMenu attach(javax.swing.text.JTextComponent component, boolean undoRedo)
component
- The text component that will display the menu and handle its actions.this
detach()
private void addMenuEntries()
protected TextContextualPopupMenu detach()
this
attach(JTextComponent, boolean)
public static PopupMenuLauncher enableMenuFor(javax.swing.text.JTextComponent component, boolean undoRedo)
TextContextualPopupMenu
and enables it for the given text component.component
- The component that will display the menu and handle its actions.undoRedo
- Enables or not Undo/Redo feature. Not recommended for table cell editors, unless each cell provides its own editorPopupMenuLauncher
responsible of displaying the popup menu.
Call disableMenuFor(javax.swing.text.JTextComponent, org.openstreetmap.josm.gui.widgets.PopupMenuLauncher)
with this object if you want to disable the menu later.disableMenuFor(javax.swing.text.JTextComponent, org.openstreetmap.josm.gui.widgets.PopupMenuLauncher)
public static void disableMenuFor(javax.swing.text.JTextComponent component, PopupMenuLauncher launcher)
TextContextualPopupMenu
attached to the given popup menu launcher and text component.component
- The component that currently displays the menu and handles its actions.launcher
- The PopupMenuLauncher
obtained via enableMenuFor(javax.swing.text.JTextComponent, boolean)
.enableMenuFor(javax.swing.text.JTextComponent, boolean)
public final boolean isAttached()
true
if this popup is currently attached to a component, false
otherwise.protected void addMenuEntry(javax.swing.text.JTextComponent component, java.lang.String label, java.lang.String actionName, java.lang.String iconName)