org.wings
Class SPopupMenu

java.lang.Object
  extended by org.wings.SComponent
      extended by org.wings.SPopupMenu
All Implemented Interfaces:
Serializable, Cloneable, Renderable

public class SPopupMenu
extends SComponent

A popup or context menu that can be attached to abitrary components.

Author:
hengels
See Also:
Serialized Form

Field Summary
protected  List menuItems
           
 
Fields inherited from class org.wings.SComponent
DONE_RENDERING, dynamicStyles, enabled, propertyChangeSupport, SELECTOR_ALL, START_RENDERING, visible, WHEN_FOCUSED_OR_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_IN_FOCUSED_FRAME
 
Constructor Summary
SPopupMenu()
           
 
Method Summary
 void add(SComponent menuItem)
          Add a menu item to this menu.
 void add(SMenuItem menuItem)
          Add a menu item to this menu.
 void add(String menuitem)
          Add a menu item to this menu.
 void addSeparator()
          Add a separator to this menu.
 SComponent getMenuComponent(int pos)
           
 int getMenuComponentCount()
          Return the number of items on the menu, including separators.
 double getWidthScaleFactor()
          Returns the scale factor for the width of the Menu components.
 void remove(int pos)
          Removes the menu item at specified index from the menu.
 void remove(SComponent comp)
          removes a specific menu item component.
 void removeAll()
          Remove all SMenuItem from this menu.
 void setCG(PopupMenuCG cg)
           
 void setEnabled(boolean enabled)
          Set wether this component should be enabled.
 void setParentFrame(SFrame f)
          Sets the parent frame.
 void setWidthScaleFactor(double widthScaleFactor)
          Sets the scale factor for the width of the Menu components.
 
Methods inherited from class org.wings.SComponent
addComponentListener, addDynamicStyle, addEventListener, addNotify, addParentFrameListener, addPropertyChangeListener, addPropertyChangeListener, addRenderListener, addScriptListener, addStyle, clone, fireComponentChangeEvent, fireFinalEvents, fireKeyEvents, fireRenderEvent, getActionMap, getBackground, getBorder, getCG, getClientProperty, getComponentPopupMenu, getDynamicStyle, getDynamicStyles, getFocusTraversalIndex, getFont, getForeground, getHorizontalAlignment, getInputMap, getInputMap, getListenerCount, getListenerList, getListeners, getLowLevelEventId, getName, getParent, getParentFrame, getPreferredSize, getRequestURL, getResidesInForm, getScriptListenerList, getScriptListeners, getSession, getShowAsFormComponent, getStyle, getToolTipText, getVerticalAlignment, invite, isDifferent, isEnabled, isFocusOwner, isRecursivelyVisible, isReloadForced, isUpdatePossible, isVisible, paramString, processComponentEvent, processKeyEvents, processLowLevelEvent, putClientProperty, reload, reloadIfChange, reloadIfChange, reloadIfChange, reloadIfChange, reloadIfChange, reloadIfChange, reloadIfChange, reloadIfChange, reloadIfChange, removeComponentListener, removeDynamicStyle, removeEventListener, removeNotify, removeParentFrameListener, removePropertyChangeListener, removePropertyChangeListener, removeRenderListener, removeScriptListener, removeStyle, requestFocus, scrollRectToVisible, setActionMap, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setBackground, setBorder, setCG, setComponentPopupMenu, setDynamicStyles, setFocusTraversalIndex, setFont, setForeground, setHorizontalAlignment, setInputMap, setInputMap, setName, setNameRaw, setParent, setPreferredSize, setReloadForced, setShowAsFormComponent, setStyle, setToolTipText, setVerticalAlignment, setVisible, toString, update, updateCG, write
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

menuItems

protected final List menuItems
Constructor Detail

SPopupMenu

public SPopupMenu()
Method Detail

add

public void add(SMenuItem menuItem)
Add a menu item to this menu.


add

public void add(SComponent menuItem)
Add a menu item to this menu.


addSeparator

public void addSeparator()
Add a separator to this menu.


setParentFrame

public void setParentFrame(SFrame f)
Description copied from class: SComponent
Sets the parent frame.

Overrides:
setParentFrame in class SComponent
Parameters:
f - the frame

add

public void add(String menuitem)
Add a menu item to this menu.


getMenuComponent

public SComponent getMenuComponent(int pos)

getMenuComponentCount

public int getMenuComponentCount()
Return the number of items on the menu, including separators.


removeAll

public void removeAll()
Remove all SMenuItem from this menu.


remove

public void remove(int pos)
Removes the menu item at specified index from the menu.


remove

public void remove(SComponent comp)
removes a specific menu item component.


setCG

public void setCG(PopupMenuCG cg)

getWidthScaleFactor

public double getWidthScaleFactor()
Returns the scale factor for the width of the Menu components. The length of the children texts is multiplied by this factor and set as width (in em) for the children.

Returns:
Returns the widthScaleFactor.

setWidthScaleFactor

public void setWidthScaleFactor(double widthScaleFactor)
Sets the scale factor for the width of the Menu components. The length of the children texts is multiplied by this factor and set as width (in em) for the children. Default value is 0.8.

Parameters:
widthScaleFactor - The widthScaleFactor to set.

setEnabled

public void setEnabled(boolean enabled)
Description copied from class: SComponent
Set wether this component should be enabled.

Overrides:
setEnabled in class SComponent
Parameters:
enabled - true if the component is enabled, false otherwise


wingS Swings ;-)