Class DefaultTSListPopup

  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPopupMenu
                  extended by com.jstatcom.ts.DefaultTSListPopup
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer,, javax.accessibility.Accessible, javax.swing.MenuElement

public class DefaultTSListPopup
extends javax.swing.JPopupMenu

A PopupMenu especially designed to work with the TSList component. It is invoked, when the RIGHT mouse button is pressed over a time series list. The underlying TSList can be referenced by getTSList after the popup was triggered. The component also takes care, that the registered TSActionTypes and TSMenuTypes get a reference to the underlying TSList via the TSListAccessor interface.

The DefaultTSListPopup can be customized by adding/removing TSActionTypes or TSMenuTypes. New actions/menus can easily be created by subclassing TSActionTypes or TSMenuTypes. This is the preferred and easiest way of costumizing the DefaultTSListPopup, although subclassing or using other methods provided by JPopupMenu are also possible.

Markus Kraetzig
See Also:
Serialized Form

Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPopupMenu
Nested classes/interfaces inherited from class javax.swing.JComponent
Nested classes/interfaces inherited from class java.awt.Component
Field Summary
Fields inherited from class javax.swing.JComponent
Fields inherited from class java.awt.Component
Fields inherited from interface java.awt.image.ImageObserver
Constructor Summary
DefaultTSListPopup(java.lang.String label)
          Creates a DefaultTSListPopup with a descriptive name.
Method Summary
 void addTSAction(TSActionTypes actionType)
          Adds an action to this popup menu.
 void addTSActionAt(TSActionTypes actionType, int pos)
          Adds an action to this popup menu at a given index.
 void addTSMenu(com.jstatcom.ts.TSMenuTypes tsMenu)
          Adds a menu to this popup menu.
 void addTSMenuAt(com.jstatcom.ts.TSMenuTypes tsMenu, int pos)
          Adds a menu to this popup menu at a given index.
static DefaultTSListPopup getSharedInstance()
          Returns an instance of the popup, that can be shared across all TSList instances.
 TSList getTSList()
          Gets the reference to the underlying TSList that this popup is invoked on.
 void processMouseEvent(java.awt.event.MouseEvent e, javax.swing.MenuElement[] path, javax.swing.MenuSelectionManager manager)
          Triggers the popup menu if the invoker was a TSList.
 void removeAction(TSActionTypes actionType)
          Removes actions from the popupmenu.
 void setTSList(TSList newTsList)
          Sets the reference to the TSList that this popup is invoked on.
 java.lang.String toString()
          Returns a string representation of DefaultTSListPopup.
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, 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, transferFocusBackward, 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, hide, 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, transferFocusUpCycle
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public DefaultTSListPopup(java.lang.String label)
Creates a DefaultTSListPopup with a descriptive name. Use this constructor only, if you need a instance that should be different from getSharedInstance.

label - String
Method Detail


public final void addTSAction(TSActionTypes actionType)
Adds an action to this popup menu. Nothing is done, if the same action was already added.

actionType - the action to add


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.

actionType - the action to add
pos - index of new position
java.lang.IllegalArgumentException - if pos not valid


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.

tsMenu - the menu to add


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.

tsMenu - the menu to add
pos - index of new position
java.lang.IllegalArgumentException - if pos not valid


public static DefaultTSListPopup getSharedInstance()
Returns an instance of the popup, that can be shared across all TSList instances. It is also possible to create instances with the constructor that can be individually configured and set to a TSList that should have a different popup.

an instance of this class that can be shared


public final TSList getTSList()
Gets the reference to the underlying TSList that this popup is invoked on.

the currently referenced TSList


public void processMouseEvent(java.awt.event.MouseEvent e,
                              javax.swing.MenuElement[] path,
                              javax.swing.MenuSelectionManager manager)
Triggers the popup menu if the invoker was a TSList.

Specified by:
processMouseEvent in interface javax.swing.MenuElement
processMouseEvent in class javax.swing.JPopupMenu
e - the mouse event
path - can be null in this context
manager - can be null in this context


public final void removeAction(TSActionTypes actionType)
Removes actions from the popupmenu. Nothing is done, if the action does not exist.

actionType - the action to be removed


public final void setTSList(TSList newTsList)
Sets the reference to the TSList that this popup is invoked on.

newTsList - the list to be referenced


public java.lang.String toString()
Returns a string representation of DefaultTSListPopup.

toString in class java.awt.Component
string representation