org.wings
Class SMenuBar

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

public class SMenuBar
extends SContainer

Contains SMenu objects to construct a menu.

When the user selects a SMenu object, its associated SMenu is displayed, allowing the user to select one of the SMenuItems on it.

Component are rendered in the order of the container. If a component is right aligned, every following components are also right aligned. So you have to sort the components in the order you want and have to take care that te components are sorted by their horizontal alignment

Author:
Andre Lison, Armin Haaf
See Also:
SMenu, Serialized Form

Field Summary
 
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
SMenuBar()
          Creates a new menu bar.
 
Method Summary
 SMenuItem add(SMenu menu)
          Appends the specified menu to the end of the menu bar.
 int getComponentIndex(SComponent c)
          Returns the index of the specified component.
 Insets getMargin()
          Returns the margin between the menubar's border and its menus.
 SMenu getMenu(int index)
          Gets the menu at the specified position in the menu bar.
 int getMenuCount()
          Returns the number of items in the menu bar.
 ArrayList getMenus()
           
 SingleSelectionModel getSelectionModel()
          Returns the model object that handles single selections.
 boolean isBorderPainted()
          Returns true if the Menubar's border should be painted.
 boolean isSelected()
          Returns true if the MenuBar currently has a component selected
protected  String paramString()
          Returns a string representation of this SMenuBar.
 void remove(SMenu menu)
          Removes the specified menu from the menu bar.
 void setBorderPainted(boolean b)
          Sets whether the border should be painted.
 void setCG(MenuBarCG cg)
           
 void setMargin(Insets m)
          Sets the margin between the menubar's border and its menus.
 void setSelected(SComponent sel)
          Sets the currently selected component, producing a a change to the selection model.
 void setSelectionModel(SingleSelectionModel model)
          Set the model object to handle single selections.
 
Methods inherited from class org.wings.SContainer
add, add, add, add, addComponent, addComponent, addComponent, addComponent, addContainerListener, addNotify, clone, fireContainerEvent, getComponent, getComponentCount, getComponentList, getComponents, getConstraintAt, getConstraintList, getLayout, invite, inviteEachComponent, isShowingChildren, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setCG, setLayout, setParentFrame, updateCG
 
Methods inherited from class org.wings.SComponent
addComponentListener, addDynamicStyle, addEventListener, addParentFrameListener, addPropertyChangeListener, addPropertyChangeListener, addRenderListener, addScriptListener, addStyle, 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, isDifferent, isEnabled, isFocusOwner, isRecursivelyVisible, isReloadForced, isUpdatePossible, isVisible, processComponentEvent, processKeyEvents, processLowLevelEvent, putClientProperty, reload, reloadIfChange, reloadIfChange, reloadIfChange, reloadIfChange, reloadIfChange, reloadIfChange, reloadIfChange, reloadIfChange, reloadIfChange, removeComponentListener, removeDynamicStyle, removeEventListener, removeParentFrameListener, removePropertyChangeListener, removePropertyChangeListener, removeRenderListener, removeScriptListener, removeStyle, requestFocus, scrollRectToVisible, setActionMap, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setBackground, setBorder, setCG, setComponentPopupMenu, setDynamicStyles, setEnabled, setFocusTraversalIndex, setFont, setForeground, setHorizontalAlignment, setInputMap, setInputMap, setName, setNameRaw, setParent, setPreferredSize, setReloadForced, setShowAsFormComponent, setStyle, setToolTipText, setVerticalAlignment, setVisible, toString, update, write
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SMenuBar

public SMenuBar()
Creates a new menu bar.

Method Detail

getSelectionModel

public SingleSelectionModel getSelectionModel()
Returns the model object that handles single selections.

Returns:
the SingleSelectionModel in use
See Also:
SingleSelectionModel

setSelectionModel

public void setSelectionModel(SingleSelectionModel model)
Set the model object to handle single selections.

Parameters:
model - the SingleSelectionModel to use description: The selection model, recording which child is selected.
See Also:
SingleSelectionModel

add

public SMenuItem add(SMenu menu)
Appends the specified menu to the end of the menu bar.

Parameters:
menu - the SMenu component to add

remove

public void remove(SMenu menu)
Removes the specified menu from the menu bar.

Parameters:
menu - the SMenu component to remove

getMenu

public SMenu getMenu(int index)
Gets the menu at the specified position in the menu bar.

Parameters:
index - an int giving the position in the menu bar, where 0 is the first position
Returns:
the SMenu at that position

getMenuCount

public int getMenuCount()
Returns the number of items in the menu bar.

Returns:
the number of items in the menu bar

getComponentIndex

public int getComponentIndex(SComponent c)
Returns the index of the specified component.

Parameters:
c - the SComponent to find
Returns:
an integer giving the component's position, where 0 is first; or -1 if it can't be found

setSelected

public void setSelected(SComponent sel)
Sets the currently selected component, producing a a change to the selection model.

Parameters:
sel - the SComponent to select

isSelected

public boolean isSelected()
Returns true if the MenuBar currently has a component selected

Returns:
true if a selection has been made, else false

isBorderPainted

public boolean isBorderPainted()
Returns true if the Menubar's border should be painted.

Returns:
true if the border should be painted, else false

setBorderPainted

public void setBorderPainted(boolean b)
Sets whether the border should be painted.

Parameters:
b - if true and border property is not null, the border is painted. attribute: visualUpdate true description: Whether the border should be painted.
See Also:
isBorderPainted()

setMargin

public void setMargin(Insets m)
Sets the margin between the menubar's border and its menus. Setting to null will cause the menubar to use the default margins.

Parameters:
m - an Insets object containing the margin values attribute: visualUpdate true description: The space between the menubar's border and its contents
See Also:
Insets

getMargin

public Insets getMargin()
Returns the margin between the menubar's border and its menus.

Returns:
an Insets object containing the margin values
See Also:
Insets

paramString

protected String paramString()
Returns a string representation of this SMenuBar. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Overrides:
paramString in class SComponent
Returns:
a string representation of this SMenuBar.

setCG

public void setCG(MenuBarCG cg)

getMenus

public ArrayList getMenus()


wingS Swings ;-)