public abstract class PopupMenuItemHttpMessageContainer extends ExtensionPopupMenuItemMessageContainer
ExtensionPopupMenuItemMessageContainer
that exposes the state of HttpMessageContainer
s.Modifier and Type | Class and Description |
---|---|
protected static class |
PopupMenuItemHttpMessageContainer.Invoker
The invokers of the the pop up menu.
|
JMenuItem.AccessibleJMenuItem
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
ATTACK_MENU_INDEX, CONTEXT_FLAG_MENU_INDEX, EXCLUDE_MENU_INDEX, FLAG_MENU_INDEX
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
PopupMenuItemHttpMessageContainer(String label)
Constructs a
PopupMenuItemHttpMessageContainer with the given label and with no
support for multiple selected messages (the menu item button will not be enabled when the
invoker has multiple selected messages). |
PopupMenuItemHttpMessageContainer(String label,
boolean multiSelect)
Constructs a
PopupMenuItemHttpMessageContainer with the given label and whether or
not the menu item supports multiple selected messages (if false the menu item button
will not be enabled when the invoker has multiple selected messages). |
Modifier and Type | Method and Description |
---|---|
void |
dismissed(ExtensionPopupMenuComponent selectedMenuComponent)
Clears the reference to the invoker of this pop up menu item, if this was not the selected
menu.
|
protected PopupMenuItemHttpMessageContainer.Invoker |
getInvoker()
Returns the invoker of the pop up menu item.
|
protected int |
getNumberOfSelectedMessages(HttpMessageContainer httpMessageContainer)
Returns the number of selected messages of the given message container.
|
protected List<HttpMessage> |
getSelectedMessages(HttpMessageContainer httpMessageContainer)
Returns the selected messages of the given message container.
|
protected boolean |
isButtonEnabledForHttpMessageContainerState(HttpMessageContainer httpMessageContainer)
Tells whether or not the button should be enabled for the state of the given message
container.
|
protected boolean |
isButtonEnabledForNumberOfSelectedMessages(HttpMessageContainer httpMessageContainer)
Tells whether or not the button should be enabled for the number of selected messages of the
given message container.
|
protected boolean |
isButtonEnabledForNumberOfSelectedMessages(int numberOfSelectedMessages)
Tells whether or not the button should be enabled for the given number of selected messages.
|
protected boolean |
isButtonEnabledForSelectedHttpMessage(HttpMessage httpMessage)
Tells whether or not the button should be enabled for the given selected message.
|
protected boolean |
isButtonEnabledForSelectedMessages(HttpMessageContainer httpMessageContainer)
Tells whether or not the button should be enabled for the selected messages of the given
message container.
|
protected boolean |
isButtonEnabledForSelectedMessages(List<HttpMessage> httpMessages)
Tells whether or not the button should be enabled for the given selected messages.
|
protected boolean |
isEnable(HttpMessageContainer httpMessageContainer)
Tells whether or not the menu is enable for the given HTTP message container.
|
protected boolean |
isEnableForInvoker(PopupMenuItemHttpMessageContainer.Invoker invoker,
HttpMessageContainer httpMessageContainer)
Tells whether or not the menu item is enable for the given invoker (or optionally the given
message container).
|
boolean |
isEnableForMessageContainer(MessageContainer<?> messageContainer)
To determine if the menu item is enable for the given message container following steps are
done:
Check if message container is
HttpMessageContainer , if not returns immediately
with false ;
Call the method isEnable(HttpMessageContainer) , if it doesn't return true the method returns immediately with false ;
Call the method isEnableForInvoker(Invoker, HttpMessageContainer) , if it
doesn't return true the method returns immediately with false . |
protected boolean |
isMultiSelect()
Tells whether or not the menu item supports multiple selected messages.
|
protected boolean |
isSelectedMessagesInSessionScope(HttpMessageContainer httpMessageContainer)
Tells whether or not the selected messages of the given message container are in scope.
|
protected abstract void |
performAction(HttpMessage httpMessage)
Performs an action on the given message.
|
protected void |
performActions(HttpMessageContainer httpMessageContainer)
Performs the actions on the the given message container.
|
protected void |
performActions(List<HttpMessage> httpMessages)
Performs the actions on all the the given messages.
|
isEnableForComponent
getMenuIndex, getParentMenuIndex, getParentMenuName, isDummyItem, isSafe, isSubMenu, isSuperMenu, precedeWithSeparator, setMenuIndex, setParentMenuIndex, setPrecedeWithSeparator, setSucceedWithSeparator, succeedWithSeparator
actionPropertyChanged, addMenuDragMouseListener, addMenuKeyListener, configurePropertiesFromAction, fireMenuDragMouseDragged, fireMenuDragMouseEntered, fireMenuDragMouseExited, fireMenuDragMouseReleased, fireMenuKeyPressed, fireMenuKeyReleased, fireMenuKeyTyped, getAccelerator, getAccessibleContext, getComponent, getMenuDragMouseListeners, getMenuKeyListeners, getSubElements, getUIClassID, init, isArmed, menuSelectionChanged, paramString, processKeyEvent, processMenuDragMouseEvent, processMenuKeyEvent, processMouseEvent, removeMenuDragMouseListener, removeMenuKeyListener, setAccelerator, setArmed, setEnabled, setModel, setUI, updateUI
addActionListener, addChangeListener, addImpl, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHideActionText, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, removeNotify, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setFocusPainted, setHideActionText, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition
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, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public PopupMenuItemHttpMessageContainer(String label)
PopupMenuItemHttpMessageContainer
with the given label and with no
support for multiple selected messages (the menu item button will not be enabled when the
invoker has multiple selected messages).label
- the label of the menuisEnableForMessageContainer(MessageContainer)
public PopupMenuItemHttpMessageContainer(String label, boolean multiSelect)
PopupMenuItemHttpMessageContainer
with the given label and whether or
not the menu item supports multiple selected messages (if false
the menu item button
will not be enabled when the invoker has multiple selected messages).label
- the label of the menumultiSelect
- true
if the menu supports multiple selected messages, false
otherwise.isEnableForMessageContainer(MessageContainer)
protected boolean isMultiSelect()
false
the
menu item button will not be enabled when the invoker has multiple selected messages.true
if the menu item supports multiple selected messages, false
otherwise.isButtonEnabledForNumberOfSelectedMessages(int)
protected PopupMenuItemHttpMessageContainer.Invoker getInvoker()
null
if has not been invoked or not a valid invoker.public boolean isEnableForMessageContainer(MessageContainer<?> messageContainer)
HttpMessageContainer
, if not returns immediately
with false
;
isEnable(HttpMessageContainer)
, if it doesn't return true
the method returns immediately with false
;
isEnableForInvoker(Invoker, HttpMessageContainer)
, if it
doesn't return true
the method returns immediately with false
.
To determine if menu item's button is enabled it is called the method isButtonEnabledForHttpMessageContainerState(HttpMessageContainer)
and used its the return
value.
Note: If the menu item is declared as not safe (isSafe()
) the
button will be disabled if in Mode.Safe
or if in Mode.Protected
and not all
the selected messages are in scope.
Note: Override of this method should be done with extra care as it might break all the expected functionality.
isEnableForMessageContainer
in interface ExtensionPopupMenuComponent
isEnableForMessageContainer
in class ExtensionPopupMenuItemMessageContainer
messageContainer
- the message container where the pop up menu was invokedtrue
if the menu component is enable for the given invoker
, false
otherwise.isEnable(HttpMessageContainer)
,
isEnableForInvoker(Invoker, HttpMessageContainer)
,
getInvoker(HttpMessageContainer)
,
isButtonEnabledForHttpMessageContainerState(HttpMessageContainer)
public void dismissed(ExtensionPopupMenuComponent selectedMenuComponent)
dismissed
in interface ExtensionPopupMenuComponent
dismissed
in class ExtensionPopupMenuItem
selectedMenuComponent
- the selected menu component or null
if noneExtensionPopupMenuComponent.isEnableForComponent(Component)
,
ExtensionPopupMenuComponent.isEnableForMessageContainer(MessageContainer)
protected boolean isEnable(HttpMessageContainer httpMessageContainer)
By default is enable for SingleHttpMessageContainer
s and SelectableHttpMessagesContainer
s.
Normally overridden if other implementations of HttpMessageContainer
are
supported. The methods getSelectedMessages(HttpMessageContainer)
and getNumberOfSelectedMessages(HttpMessageContainer)
might need to be overridden accordingly to
the supported implementations.
httpMessageContainer
- the message container that will be evaluatedtrue
if the given message container is a SingleHttpMessageContainer
or SelectableHttpMessagesContainer
.getSelectedMessages(HttpMessageContainer)
,
getNumberOfSelectedMessages(HttpMessageContainer)
,
SingleHttpMessageContainer
,
SelectableHttpMessagesContainer
protected boolean isEnableForInvoker(PopupMenuItemHttpMessageContainer.Invoker invoker, HttpMessageContainer httpMessageContainer)
By default, the menu item is enable for all invokers.
The message container can be used to identify Invoker#UNKNOWN
invokers by using
its name or component. No hard reference should be kept to the message container.
invoker
- the invokerhttpMessageContainer
- the message container of the invokertrue
if the menu item is enable for the given invoker.protected boolean isButtonEnabledForHttpMessageContainerState(HttpMessageContainer httpMessageContainer)
isEnableForMessageContainer(MessageContainer)
.
By default, is only enabled if both methods isButtonEnabledForNumberOfSelectedMessages(HttpMessageContainer)
and isButtonEnabledForSelectedMessages(HttpMessageContainer)
(called only if the former method
returns true
) return true
.
Not normally overridden.
httpMessageContainer
- the message container that will be evaluatedtrue
if the button should be enabled for the message container, false
otherwise.isEnableForMessageContainer(MessageContainer)
,
isButtonEnabledForNumberOfSelectedMessages(HttpMessageContainer)
,
isButtonEnabledForSelectedMessages(HttpMessageContainer)
protected boolean isButtonEnabledForNumberOfSelectedMessages(HttpMessageContainer httpMessageContainer)
Defaults to call the method isButtonEnabledForNumberOfSelectedMessages(int)
with
the number of selected messages obtained by calling the method getNumberOfSelectedMessages(HttpMessageContainer)
, with the given message container as
parameter.
Normally overridden if other implementations of HttpMessageContainer
are
supported.
httpMessageContainer
- the container that will be evaluatedtrue
if the button should be enabled for the number of selected message,
false
otherwise.isButtonEnabledForNumberOfSelectedMessages(int)
,
getNumberOfSelectedMessages(HttpMessageContainer)
protected boolean isButtonEnabledForSelectedMessages(HttpMessageContainer httpMessageContainer)
Defaults to call the method isButtonEnabledForSelectedMessages(List)
with the
selected messages obtained by calling the method getSelectedMessages(HttpMessageContainer)
, with the given message container as parameter.
Normally overridden if other implementations of HttpMessageContainer
are
supported.
httpMessageContainer
- the container that will be evaluatedtrue
if the button should be enabled for the selected messages, false
otherwise.isButtonEnabledForSelectedMessages(List)
,
getSelectedMessages(HttpMessageContainer)
protected int getNumberOfSelectedMessages(HttpMessageContainer httpMessageContainer)
By default it returns the number of selected messages from SelectableHttpMessagesContainer
s and for SingleHttpMessageContainer
s returns 1 if it
contains a message, 0 otherwise.
Normally overridden if other implementations of HttpMessageContainer
are
supported. Default are SingleHttpMessageContainer
and SelectableHttpMessagesContainer
.
httpMessageContainer
- the container that will be evaluatedSingleHttpMessageContainer
,
SelectableHttpMessagesContainer
protected boolean isButtonEnabledForNumberOfSelectedMessages(int numberOfSelectedMessages)
By default, it returns false
when there are no messages selected or when isMultiSelect()
returns true
and there is more than one message selected.
If overridden the method isMultiSelect()
should be taken into account.
numberOfSelectedMessages
- the number of selected messages in the message containertrue
if the button should be enabled for the given number of selected
messages, false
otherwise.isMultiSelect()
protected List<HttpMessage> getSelectedMessages(HttpMessageContainer httpMessageContainer)
By default it returns the selected messages from SelectableHttpMessagesContainer
s
and for SingleHttpMessageContainer
s returns the contained message or empty List
if none.
Normally overridden if other implementations of HttpMessageContainer
are
supported. Default are SingleHttpMessageContainer
and SelectableHttpMessagesContainer
.
httpMessageContainer
- the container that will be evaluatedList
containing the selected messagesisButtonEnabledForSelectedMessages(List)
,
isSelectedMessagesInSessionScope(HttpMessageContainer)
,
SingleHttpMessageContainer
,
SelectableHttpMessagesContainer
protected boolean isButtonEnabledForSelectedMessages(List<HttpMessage> httpMessages)
By default, it returns true
unless the method isButtonEnabledForSelectedHttpMessage(HttpMessage)
returns false for one of the selected
messages.
httpMessages
- the selected messages in the message containertrue
if the button should be enabled for the given selected messages, false
otherwise.isButtonEnabledForSelectedHttpMessage(HttpMessage)
protected boolean isButtonEnabledForSelectedHttpMessage(HttpMessage httpMessage)
By default, it returns true
.
httpMessage
- the selected message, never null
true
if the button should be enabled for the given selected message, false
otherwise.protected boolean isSelectedMessagesInSessionScope(HttpMessageContainer httpMessageContainer)
By default, the selected messages are obtained by calling the method
getSelectedMessages(httpMessageContainer) with the given message container as parameter and
for each selected message is called the method HttpMessage#isInScope()
.
Normally overridden if other implementations of HttpMessageContainer
are
supported. Default are SingleHttpMessageContainer
and SelectableHttpMessagesContainer
.
httpMessageContainer
- the container that will be evaluatedtrue
if all the selected messages are in scope, false
otherwise.isEnableForMessageContainer(MessageContainer)
,
HttpMessage.isInScope()
protected void performActions(HttpMessageContainer httpMessageContainer)
Defaults to call the method performActions(List)
with the selected messages
obtained by calling the method getSelectedMessages(HttpMessageContainer)
, with the
given message container as parameter.
Normally overridden if other implementations of HttpMessageContainer
are supported
(or not the desired behaviour).
httpMessageContainer
- the container with the selected messagesperformActions(List)
,
getSelectedMessages(HttpMessageContainer)
protected void performActions(List<HttpMessage> httpMessages)
Defaults to call the method performAction(HttpMessage)
for each message (with the
message as parameter).
Normally overridden if other implementations of HttpMessageContainer
are supported
(or not the desired behaviour).
httpMessages
- the messages that will be used to perform the actionsperformAction(HttpMessage)
protected abstract void performAction(HttpMessage httpMessage)
httpMessage
- the message, never null