com.jstatcom.table
Class JSCPopupTypes

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPopupMenu
                  extended by com.jstatcom.table.JSCPopupTypes
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.MenuElement

public abstract class JSCPopupTypes
extends javax.swing.JPopupMenu
implements java.awt.event.ActionListener

The DataTablePopupTypes class defines different popups that can be used by data tables. This class can be extended to provide special popup menus in a certain context on a JSCDataTable.

It implements the typesave enum pattern (Joshua Bloch, "Effective Java", Item 21) . If you compare DataTablePopupTypes, always use the == operator. This is save, because they are Singletons (Gamma et al., 1995) .

Author:
Markus Kraetzig
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPopupMenu
javax.swing.JPopupMenu.Separator
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
static JSCPopupTypes CLICK_01
          PopupMenu for click change between * and 0.
static JSCPopupTypes CLICK_012
          PopupMenu for click change between * , 0 and !.
static JSCPopupTypes PRECISION
          PopupMenu for precision change, as well as to toggle the use of scientific representation of numbers.
static JSCPopupTypes PRECISION_NOSCIENTIFIC
          PopupMenu for precision change.
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          DataTablePopupTypes implement ActionListener and can therefore register themselves as listeners, for example with the menu items that are added to them.
 boolean equals(java.lang.Object o)
          Override prevention method to enforce a.equals(b) if and only if a==b.
 java.awt.Component getDataTable()
          Gets a reference to the unterlying data table.
 java.lang.String getName()
          Gets the name of this type.
 int hashCode()
          Override prevention method invokes super method.
 void processMouseEvent(java.awt.event.MouseEvent e, javax.swing.MenuElement[] path, javax.swing.MenuSelectionManager manager)
          Triggers the popup menu if the invoker was a JSCDataTable with a number type.
 void setDataTable(java.awt.Component newDataTable)
          Sets a reference to the unterlying data table.
 java.lang.String toString()
          Gets a string representing this type, do not use for comparisons.
 
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, 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
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CLICK_01

public static final JSCPopupTypes CLICK_01
PopupMenu for click change between * and 0. If a subset restriction is set, the corresponding element is not changed.


CLICK_012

public static final JSCPopupTypes CLICK_012
PopupMenu for click change between * , 0 and !. If a subset restriction is set, the corresponding element is not changed.


PRECISION

public static final JSCPopupTypes PRECISION
PopupMenu for precision change, as well as to toggle the use of scientific representation of numbers.


PRECISION_NOSCIENTIFIC

public static final JSCPopupTypes PRECISION_NOSCIENTIFIC
PopupMenu for precision change.

Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
DataTablePopupTypes implement ActionListener and can therefore register themselves as listeners, for example with the menu items that are added to them. Subclasses can overwrite the empty default implementation of this method.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
evt - the action event

equals

public final boolean equals(java.lang.Object o)
Override prevention method to enforce a.equals(b) if and only if a==b.

Overrides:
equals in class java.lang.Object
Parameters:
o - object to compare with
Returns:
true if equal, false otherwise

getDataTable

public final java.awt.Component getDataTable()
Gets a reference to the unterlying data table.

Returns:
the data table

getName

public final java.lang.String getName()
Gets the name of this type.

Overrides:
getName in class java.awt.Component
Returns:
a descriptive name

hashCode

public final int hashCode()
Override prevention method invokes super method.

Overrides:
hashCode in class java.lang.Object
Returns:
hash code

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 a JSCDataTable with a number type.

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

setDataTable

public final void setDataTable(java.awt.Component newDataTable)
Sets a reference to the unterlying data table.

Parameters:
newDataTable - the data table

toString

public final java.lang.String toString()
Gets a string representing this type, do not use for comparisons.

Overrides:
toString in class java.awt.Component
Returns:
string representation