com.jstatcom.ts
Class DefaultTSListPopup
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPopupMenu
-
- com.jstatcom.ts.DefaultTSListPopup
-
- All Implemented Interfaces:
- java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.MenuElement
public class DefaultTSListPopup extends javax.swing.JPopupMenuAPopupMenuespecially designed to work with theTSListcomponent. It is invoked, when the RIGHT mouse button is pressed over a time series list. The underlyingTSListcan be referenced bygetTSListafter the popup was triggered. The component also takes care, that the registeredTSActionTypesandTSMenuTypesget a reference to the underlyingTSListvia theTSListAccessorinterface.The
DefaultTSListPopupcan be customized by adding/removingTSActionTypesorTSMenuTypes. New actions/menus can easily be created by subclassingTSActionTypesorTSMenuTypes. This is the preferred and easiest way of costumizing theDefaultTSListPopup, although subclassing or using other methods provided byJPopupMenuare also possible.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPopupMenu
javax.swing.JPopupMenu.Separator
-
-
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
-
-
Constructor Summary
Constructors Constructor and Description DefaultTSListPopup(java.lang.String label)Creates aDefaultTSListPopupwith a descriptive name.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddTSAction(TSActionTypes actionType)Adds an action to this popup menu.voidaddTSActionAt(TSActionTypes actionType, int pos)Adds an action to this popup menu at a given index.voidaddTSMenu(com.jstatcom.ts.TSMenuTypes tsMenu)Adds a menu to this popup menu.voidaddTSMenuAt(com.jstatcom.ts.TSMenuTypes tsMenu, int pos)Adds a menu to this popup menu at a given index.static DefaultTSListPopupgetSharedInstance()Returns an instance of the popup, that can be shared across allTSListinstances.TSListgetTSList()Gets the reference to the underlyingTSListthat this popup is invoked on.voidprocessMouseEvent(java.awt.event.MouseEvent e, javax.swing.MenuElement[] path, javax.swing.MenuSelectionManager manager)Triggers the popup menu if the invoker was aTSList.voidremoveAction(TSActionTypes actionType)Removes actions from the popupmenu.voidsetTSList(TSList newTsList)Sets the reference to theTSListthat this popup is invoked on.java.lang.StringtoString()Returns a string representation ofDefaultTSListPopup.-
Methods inherited from class javax.swing.JPopupMenu
add, add, add, addMenuKeyListener, addPopupMenuListener, addSeparator, getAccessibleContext, getComponent, getComponentAtIndex, getComponentIndex, getDefaultLightWeightPopupEnabled, getInvoker, getLabel, getMargin, getMenuKeyListeners, getPopupMenuListeners, getSelectionModel, getSubElements, getUI, getUIClassID, insert, insert, isBorderPainted, isLightWeightPopupEnabled, isPopupTrigger, isVisible, menuSelectionChanged, pack, processKeyEvent, remove, removeMenuKeyListener, removePopupMenuListener, setBorderPainted, setDefaultLightWeightPopupEnabled, setInvoker, setLabel, setLightWeightPopupEnabled, setLocation, setPopupSize, setPopupSize, setSelected, setSelectionModel, setUI, setVisible, show, 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, getBaseline, getBaselineResizeBehavior, 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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, 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, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, 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, 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, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Constructor Detail
-
DefaultTSListPopup
public DefaultTSListPopup(java.lang.String label)
Creates aDefaultTSListPopupwith a descriptive name. Use this constructor only, if you need a instance that should be different fromgetSharedInstance.- Parameters:
label- String
-
-
Method Detail
-
addTSAction
public final void addTSAction(TSActionTypes actionType)
Adds an action to this popup menu. Nothing is done, if the same action was already added.- Parameters:
actionType- the action to add
-
addTSActionAt
public final void addTSActionAt(TSActionTypes actionType, int pos)
Adds an action to this popup menu at a given index. Nothing is done, if the same action was already added.- Parameters:
actionType- the action to addpos- index of new position- Throws:
java.lang.IllegalArgumentException- ifposnot valid
-
addTSMenu
public final void addTSMenu(com.jstatcom.ts.TSMenuTypes tsMenu)
Adds a menu to this popup menu. Nothing is done, if the same menu was already added.- Parameters:
tsMenu- the menu to add
-
addTSMenuAt
public final void addTSMenuAt(com.jstatcom.ts.TSMenuTypes tsMenu, int pos)Adds a menu to this popup menu at a given index. Nothing is done, if the same menu was already added.- Parameters:
tsMenu- the menu to addpos- index of new position- Throws:
java.lang.IllegalArgumentException- ifposnot valid
-
getSharedInstance
public static DefaultTSListPopup getSharedInstance()
Returns an instance of the popup, that can be shared across allTSListinstances. It is also possible to create instances with the constructor that can be individually configured and set to aTSListthat should have a different popup.- Returns:
- an instance of this class that can be shared
-
getTSList
public final TSList getTSList()
Gets the reference to the underlyingTSListthat this popup is invoked on.- Returns:
- the currently referenced
TSList
-
processMouseEvent
public void processMouseEvent(java.awt.event.MouseEvent e, javax.swing.MenuElement[] path, javax.swing.MenuSelectionManager manager)Triggers the popup menu if the invoker was aTSList.- Specified by:
processMouseEventin interfacejavax.swing.MenuElement- Overrides:
processMouseEventin classjavax.swing.JPopupMenu- Parameters:
e- the mouse eventpath- can benullin this contextmanager- can benullin this context
-
removeAction
public final void removeAction(TSActionTypes actionType)
Removes actions from the popupmenu. Nothing is done, if the action does not exist.- Parameters:
actionType- the action to be removed
-
setTSList
public final void setTSList(TSList newTsList)
Sets the reference to theTSListthat this popup is invoked on.- Parameters:
newTsList- the list to be referenced
-
toString
public java.lang.String toString()
Returns a string representation ofDefaultTSListPopup.- Overrides:
toStringin classjava.awt.Component- Returns:
- string representation
-
-
DMelt 3.0 © DataMelt by jWork.ORG