swingwtx.swing
Class JSWTMenuComponent

java.lang.Object
  extended byswingwt.awt.Component
      extended byswingwt.awt.Container
          extended byswingwtx.swing.JComponent
              extended byswingwtx.swing.AbstractButton
                  extended byswingwtx.swing.JSWTMenuComponent
All Implemented Interfaces:
ImageObserver, MenuContainer, SwingConstants
Direct Known Subclasses:
JMenu, JMenuItem, JSeparator

public abstract class JSWTMenuComponent
extends AbstractButton


Nested Class Summary
 
Nested classes inherited from class swingwtx.swing.JComponent
JComponent.InternalFrameSelectionListener
 
Field Summary
protected  java.lang.String actionCommand
          Action command
protected  java.util.Vector actionListeners
          Action Listener objects
protected static int CANCELED
           
protected static int DESELECTED
           
protected  Action menuAction
          Swing action used to generate the component
protected  java.util.Vector menuListeners
          Menu Listener objects
protected  int pAccelerator
          Cache value
protected  org.eclipse.swt.widgets.MenuItem peer
          The SWT peer this component is representing
protected  boolean pEnabled
          Cache value
protected  Icon pImage
          Cache value
protected  char pMnemonic
          Cache value
protected  java.lang.String pNamedAccelerator
           
protected  java.lang.String pText
          Cache value
protected static int SELECTED
           
 
Fields inherited from class swingwtx.swing.AbstractButton
changeListeners, itemListeners, pAction, pGroup, pHAlign, pHTextPosition, pIcon, pModel, ppeer, pSelection, pVAlign, pVTextPosition
 
Fields inherited from class swingwtx.swing.JComponent
accessibleContext, actionMap, ancestorInputMap, border, clientProperties, descendantHasPeer, focusInputMap, internalFrameAdapter, internalFrameParent, opaque, propertyChangeListeners, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, windowInputMap
 
Fields inherited from class swingwt.awt.Container
composite, comps, containerListeners, layout, queuedValidateRequest
 
Fields inherited from class swingwt.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListeners, componentName, consumeAvailableHeight, consumeAvailableWidth, focusable, focusListeners, graphicsConfig, inputMethodListeners, isUserSetFont, keyListeners, layoutModifier, LEFT_ALIGNMENT, LOCK, mouseListeners, mouseMotionListeners, mouseWheelListeners, parent, pBackground, pCursor, pDoubleBuffered, pFont, pForeground, pLayoutData, pLocation, pMaxSize, pMinSize, pPrefSize, pSize, pToolTipText, pVisible, RIGHT_ALIGNMENT, swingWTDefaultActionEventAdapter, swingWTEventAdapter, TOP_ALIGNMENT
 
Fields inherited from interface swingwtx.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface swingwt.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JSWTMenuComponent()
           
 
Method Summary
 void addActionListener(ActionListener l)
          Add an ActionListener to this component
 void addMenuListener(MenuListener l)
           
 void dispose()
          Destroys the component
 java.lang.String getActionCommand()
          If the action command is null, return the button text like Swing
 java.lang.String getLabel()
          Deprecated. - Replaced by getText
 org.eclipse.swt.widgets.Widget getMenuPeer()
          Returns the SWT Menu peer
 int getMnemonic()
           
 java.lang.String getText()
           
 java.lang.String getToolTipText()
          Returns the tooltip text used on the component
 boolean isEnabled()
          Returns true if the component is enabled
 void processActionEvent(int id)
          Sends action events to listeners
 void processMenuEvent(int id)
          Sends menu events to listeners
 void registerEvents()
          When the component has been added to a container, this routine gets called to tell it to set up SWT listeners for all its events.
 void removeActionListener(ActionListener l)
          Remove an ActionListener from the component
 void removeMenuListener(MenuListener l)
           
 void requestFocus()
          Unworkable on native platforms
 void setAccelerator(KeyStroke k)
          Handles registering of accelerator keys for menu items.
 void setActionCommand(java.lang.String command)
          Sets the action command for this component
 void setCachedProperties()
          If the component has just been added to a container, but properties were set in the meantime, this routine gets called by JMenu/JMenuBar to set the cached properties.
 void setEnabled(boolean b)
          Change the enabled state of the component
 void setIcon(Icon icon)
           
 void setLabel(java.lang.String label)
          Deprecated. - Replaced by setText
 void setMnemonic(char mnemonic)
           
 void setMnemonic(int mnemonic)
           
 void setSwingWTParent(org.eclipse.swt.widgets.Menu parent, org.eclipse.swt.widgets.Shell shell)
           
 void setText(java.lang.String text)
           
 void setToolTipText(java.lang.String tip)
          Sets the tooltip text used on the component - overridden here, so that if we have a mnemonic, we can tack it on the end.
protected  void showMnemonic()
           
 
Methods inherited from class swingwtx.swing.AbstractButton
addChangeListener, addItemListener, getAction, getHorizontalAlignment, getHorizontalTextPosition, getModel, getVerticalAlignment, getVerticalTextPosition, isSelected, processItemEvent, registerActionEvents, removeChangeListener, removeItemListener, setAction, setAction, setBorderPainted, setContentAreaFilled, setDisabledIcon, setFocusPainted, setGroup, setHorizontalAlignment, setHorizontalTextPosition, setModel, setPressedIcon, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setVerticalAlignment, setVerticalTextPosition
 
Methods inherited from class swingwtx.swing.JComponent
add, add, add, add, add, addPropertyChangeListener, addPropertyChangeListener, checkInternalFrameChild, getAccessibleContext, getActionMap, getAutoscrolls, getBorder, getClientProperty, getInputMap, getInsets, getToolTipLocation, getToolTipText, getTopLevelAncestor, getVisibleRect, isDoubleBuffered, isOpaque, isOptimizedDrawingEnabled, isValidateRoot, paint, paintBackground, paintChildren, paintComponent, paintImmediately, paintImmediately, putClientProperty, remove, remove, removePropertyChangeListener, removePropertyChangeListener, repaint, revalidate, scrollRectToVisible, setActionMap, setAutoscrolls, setBorder, setDoubleBuffered, setInputMap, setMargin, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setSwingWTParent
 
Methods inherited from class swingwt.awt.Container
addComponentToLayout, addContainerListener, debug_showContainmentTree, doAdd, doLayout, getComponent, getComponentCount, getComponentOrientation, getComponents, getComposite, getLayout, getMaximumSize, getMinimumSize, getParent, getPreferredSize, invalidate, minimumSize, preferredSize, processContainerEvent, processEvent, queuedValidate, removeAll, removeComponentFromCache, removeContainerListener, setLayout, setLayoutImpl, validate
 
Methods inherited from class swingwt.awt.Component
add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, calculatePreferredSize, componentOnlyDispose, computePreferredSize, contains, contains, createImage, createListenerArrayFromVector, createVolatileImage, dispatchEvent, getAlignmentX, getAlignmentY, getBackground, getBounds, getCursor, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getListeners, getLocation, getLocationOnScreen, getName, getPeer, getPeerSize, getSize, getSize, getSWTPeer, getToolkit, getTreeLock, getWidth, getX, getY, grabFocus, hasFocus, hasSetFont, hide, imageUpdate, inside, isFocusable, isMinimumSizeSet, isShowing, isVisible, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, processTraverseEvent, registerComponentEvents, registerExtendedModifyEvents, registerFocusEvents, registerKeyEvents, registerModifyEvents, registerMouseEvents, registerPaintEvents, registerTraversalEvents, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, repaint, repaint, repaint, setAlignmentX, setAlignmentY, setBackground, setBounds, setBounds, setComponentOrientation, setComponentRemoved, setCursor, setFocusable, setFocusTraversalKeysEnabled, setFont, setForeground, setHeight, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setSize, setSize, setVisible, setWidth, show, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

peer

protected org.eclipse.swt.widgets.MenuItem peer
The SWT peer this component is representing


pEnabled

protected boolean pEnabled
Cache value


pImage

protected Icon pImage
Cache value


pMnemonic

protected char pMnemonic
Cache value


pAccelerator

protected int pAccelerator
Cache value


pNamedAccelerator

protected java.lang.String pNamedAccelerator

pText

protected java.lang.String pText
Cache value


actionCommand

protected java.lang.String actionCommand
Action command


menuAction

protected Action menuAction
Swing action used to generate the component


actionListeners

protected java.util.Vector actionListeners
Action Listener objects


menuListeners

protected java.util.Vector menuListeners
Menu Listener objects


SELECTED

protected static final int SELECTED
See Also:
Constant Field Values

DESELECTED

protected static final int DESELECTED
See Also:
Constant Field Values

CANCELED

protected static final int CANCELED
See Also:
Constant Field Values
Constructor Detail

JSWTMenuComponent

public JSWTMenuComponent()
Method Detail

setIcon

public void setIcon(Icon icon)
Overrides:
setIcon in class AbstractButton

addMenuListener

public void addMenuListener(MenuListener l)

removeMenuListener

public void removeMenuListener(MenuListener l)

getMnemonic

public int getMnemonic()
Overrides:
getMnemonic in class AbstractButton

setMnemonic

public void setMnemonic(char mnemonic)
Overrides:
setMnemonic in class AbstractButton

setMnemonic

public void setMnemonic(int mnemonic)
Overrides:
setMnemonic in class AbstractButton

getLabel

public java.lang.String getLabel()
Deprecated. - Replaced by getText


setLabel

public void setLabel(java.lang.String label)
Deprecated. - Replaced by setText


getText

public java.lang.String getText()
Overrides:
getText in class AbstractButton

setText

public void setText(java.lang.String text)
Overrides:
setText in class AbstractButton

getToolTipText

public java.lang.String getToolTipText()
Description copied from class: Component
Returns the tooltip text used on the component

Overrides:
getToolTipText in class Component

setToolTipText

public void setToolTipText(java.lang.String tip)
Description copied from class: AbstractButton
Sets the tooltip text used on the component - overridden here, so that if we have a mnemonic, we can tack it on the end. Only applies to JButton and JToggleButton

Overrides:
setToolTipText in class AbstractButton

getActionCommand

public java.lang.String getActionCommand()
Description copied from class: AbstractButton
If the action command is null, return the button text like Swing

Overrides:
getActionCommand in class AbstractButton

setActionCommand

public void setActionCommand(java.lang.String command)
Description copied from class: Component
Sets the action command for this component

Overrides:
setActionCommand in class Component

showMnemonic

protected void showMnemonic()
Overrides:
showMnemonic in class AbstractButton

setSwingWTParent

public void setSwingWTParent(org.eclipse.swt.widgets.Menu parent,
                             org.eclipse.swt.widgets.Shell shell)
                      throws java.lang.Exception
Throws:
java.lang.Exception

setAccelerator

public void setAccelerator(KeyStroke k)
Handles registering of accelerator keys for menu items.


getMenuPeer

public org.eclipse.swt.widgets.Widget getMenuPeer()
Returns the SWT Menu peer


setEnabled

public void setEnabled(boolean b)
Change the enabled state of the component

Overrides:
setEnabled in class Component

isEnabled

public boolean isEnabled()
Returns true if the component is enabled

Overrides:
isEnabled in class Component

dispose

public void dispose()
Destroys the component

Overrides:
dispose in class JComponent

requestFocus

public void requestFocus()
Unworkable on native platforms

Overrides:
requestFocus in class Component

addActionListener

public void addActionListener(ActionListener l)
Add an ActionListener to this component

Overrides:
addActionListener in class Component

removeActionListener

public void removeActionListener(ActionListener l)
Remove an ActionListener from the component

Overrides:
removeActionListener in class Component

processActionEvent

public void processActionEvent(int id)
Sends action events to listeners

Overrides:
processActionEvent in class AbstractButton

processMenuEvent

public void processMenuEvent(int id)
Sends menu events to listeners


registerEvents

public void registerEvents()
When the component has been added to a container, this routine gets called to tell it to set up SWT listeners for all its events. We can map these then to the AWT-style events and Swing events

Overrides:
registerEvents in class Component

setCachedProperties

public void setCachedProperties()
If the component has just been added to a container, but properties were set in the meantime, this routine gets called by JMenu/JMenuBar to set the cached properties.

Overrides:
setCachedProperties in class Component