# Class SideMenuBar

java.lang.Object
com.codename1.ui.Component
com.codename1.ui.Container
com.codename1.ui.MenuBar
com.codename1.ui.SideMenuBar

All Implemented Interfaces:
  `Animation, Editable, ActionListener, StyleListener, Iterable<Component>`

public class SideMenuBar extends MenuBar
This is Menu Bar that displays it's commands on a side bar navigation similar to Google+/Facbook apps navigation

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `COMMAND_ACTIONABLE`
  When using a side component we might want to only have it behave as a visual tool and still execute the command when it is clicked.
  `static final String`
  `COMMAND_PLACEMENT_KEY`
  This string can be used in putClientProperty within command to hint about the placement of the command
  `static final String`
  `COMMAND_PLACEMENT_VALUE_RIGHT`
  This string can be used in putClientProperty within command to hint about the placement of the command e.g.
  `static final String`
  `COMMAND_PLACEMENT_VALUE_TOP`
  This string can be used in putClientProperty within command to hint about the placement of the command e.g.
  `static final String`
  `COMMAND_SIDE_COMPONENT`
  Allows placing a component instance into the client properties of the command so it is shown instead of the command e.g.: putClientProperty(SideMenuBar.COMMAND_SIDE_COMPONENT, myCustomComponentInstance);

  ### Fields inherited from class Component

  `BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, CROSSHAIR_CURSOR, DEFAULT_CURSOR, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, E_RESIZE_CURSOR, HAND_CURSOR, LEFT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NW_RESIZE_CURSOR, RIGHT, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, TOP, W_RESIZE_CURSOR, WAIT_CURSOR`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SideMenuBar()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addCommand(Command cmd)`
  Adds a Command to the MenuBar
  `protected void`
  `addCommand(Command cmd, int index)`
  Add a Command to the MenuBar
  `protected void`
  `addComponentToSideMenu(Container menu, Component cmp)`
  This method responsible to add a Component to the side navigation panel.
  `static void`
  `closeCurrentMenu()`
  Folds the current side menu if it is open, notice that the menu will close asynchronously
  `static void`
  `closeCurrentMenu(Runnable callback)`
  Folds the current side menu if it is open, when the menu is closed it will invoke the runnable callback method
  `void`
  `closeMenu()`
  Closes the menu if it is currently open
  `protected Container`
  `constructSideNavigationComponent()`
  Creates an empty side navigation panel.
  `protected Button`
  `createOpenButton()`
  Creates the Side Menu open button.
  `protected Container`
  `createSideNavigationComponent(Vector commands)`
  Creates the side navigation component with the Commands
  `protected Container`
  `createSideNavigationComponent(Vector commands, String placement)`
  Creates the side navigation component with the Commands
  `protected Button`
  `createTouchCommandButton(Command c)`
  Creates a touch command for use as a touch menu item
  `int`
  `getCommandBehavior()`
  `protected int`
  `getDragRegionStatus(int x, int y)`
  Indicates if the section within the X/Y area is a "drag region" where we expect people to drag or press in which case we can instantly start dragging making perceived performance faster.
  `Form`
  `getParentForm()`
  Returns the Parent Form of this menu
  `protected void`
  `initMenuBar(Form parent)`
  Initialize the MenuBar
  `protected void`
  `installMenuBar()`
  Adds the MenuBar on the parent Form
  `boolean`
  `isMenuOpen()`
  Returns true if the Menu is currently open
  `static boolean`
  `isShowing()`
  Returns true if a side menu is currently controlling the screen
  `void`
  `keyReleased(int keyCode)`
  If this Component is focused, the key released event will call this method
  `void`
  `openMenu(String direction)`
  Opens the menu if it is currently closed
  `protected void`
  `removeAllCommands()`
  Remove all commands from the menuBar
  `protected void`
  `removeCommand(Command cmd)`
  Removes a Command from the MenuBar
  `void`
  `setBackCommand(Command backCommand)`
  Indicates the command that is defined as the back command out of this form.
  `protected void`
  `unInstallMenuBar()`
  Removes the MenuBar from the parent Form

  ### Methods inherited from class MenuBar

  `actionPerformed, calcPreferredSize, calculateTouchCommandGridColumns, createBackCommandButton, createCommandComponent, createCommandList, createMenuCancelCommand, createMenuSelectCommand, createSelectCommand, createSoftButton, findCommandComponent, getBackCommand, getCancelMenuItem, getClearCommand, getCommand, getCommandCount, getCommands, getDefaultCommand, getMenuStyle, getSelectCommand, getSelectMenuItem, getTitleAreaContainer, getTitleComponent, handlesKeycode, isMenuShowing, isMinimizeOnBack, isReverseSoftButtons, keyPressed, refreshTheme, removeEmptySoftbuttons, setClearCommand, setCommandUIID, setDefaultCommand, setMenuCellRenderer, setMinimizeOnBack, setSelectCommand, setTransitions, setUnselectedStyle, showMenu, showMenuDialog`

  ### Methods inherited from class Container

  `add, add, add, add, add, add, addAll, addComponent, addComponent, addComponent, addComponent, animateHierarchy, animateHierarchyAndWait, animateHierarchyFade, animateHierarchyFadeAndWait, animateLayout, animateLayoutAndWait, animateLayoutFade, animateLayoutFadeAndWait, animateUnlayout, animateUnlayoutAndWait, applyRTL, cancelRepaints, clearClientProperties, constrainHeightWhenScrollable, constrainWidthWhenScrollable, contains, createAnimateHierarchy, createAnimateHierarchyFade, createAnimateLayout, createAnimateLayoutFade, createAnimateLayoutFadeAndWait, createAnimateMotion, createAnimateUnlayout, createReplaceTransition, dragInitiated, drop, encloseIn, encloseIn, findDropTargetAt, findFirstFocusable, fireClicked, flushReplace, forceRevalidate, getBottomGap, getChildrenAsList, getClosestComponentTo, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getGridPosX, getGridPosY, getLayout, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getResponderAt, getSafeAreaRoot, getScrollIncrement, getSideGap, getUIManager, initLaf, invalidate, isEnabled, isSafeArea, isSafeAreaRoot, isScrollableX, isScrollableY, isSelectableInteraction, isSurface, iterator, iterator, layoutContainer, morph, morphAndWait, paint, paintComponentBackground, paintGlass, paramString, pointerPressed, removeAll, removeComponent, replace, replace, replaceAndWait, replaceAndWait, replaceAndWait, revalidate, revalidateLater, revalidateWithAnimationSafety, scrollComponentToVisible, setCellRenderer, setEnabled, setLayout, setLeadComponent, setSafeArea, setSafeAreaRoot, setScrollable, setScrollableX, setScrollableY, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout, setUIManager, updateTabIndices`

  ### Methods inherited from class Component

  `addContextMenuListener, addDragFinishedListener, addDragOverListener, addDropListener, addFocusListener, addLongPressListener, addMouseWheelListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, addStateChangeListener, addStylusListener, animate, announceForAccessibility, bindProperty, blocksSideSwipe, calcScrollSize, contains, containsOrOwns, createStyleAnimation, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, dragFinished, draggingOver, drawDraggedImage, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getAccessibilityText, getAllStyles, getAnimationManager, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBoundPropertyValue, getBounds, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getCursor, getDefaultDragTransparency, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragSpeed, getDragTransparency, getEditingDelegate, getHeight, getInlineAllStyles, getInlineDisabledStyles, getInlinePressedStyles, getInlineSelectedStyles, getInlineStylesTheme, getInlineUnselectedStyles, getInnerHeight, getInnerPreferredH, getInnerPreferredW, getInnerWidth, getInnerX, getInnerY, getLabelForComponent, getName, getNativeOverlay, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getOuterHeight, getOuterPreferredH, getOuterPreferredW, getOuterWidth, getOuterX, getOuterY, getOwner, getParent, getPreferredH, getPreferredSize, getPreferredSizeStr, getPreferredTabIndex, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypeNames, getPropertyTypes, getPropertyValue, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getStyle, getTabIndex, getTensileLength, getTextSelectionSupport, getTooltip, getUIID, getUnselectedStyle, getVisibleBounds, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFixedPreferredSize, hasFocus, hideNativeOverlay, initComponent, initCustomStyle, initDisabledStyle, initPressedStyle, initSelectedStyle, initUnselectedStyle, installDefaultPainter, isAlwaysTensile, isBlockLead, isCellRenderer, isChildOf, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEditable, isEditing, isFlatten, isFocusable, isGrabsPointerEvents, isHidden, isHidden, isHideInLandscape, isHideInPortrait, isHScrollThumbGrabbed, isHScrollThumbHover, isIgnorePointerEvents, isInClippingRegion, isInitialized, isOpaque, isOwnedBy, isPinchBlocksDragAndDrop, isRippleEffect, isRTL, isScrollable, isScrollVisible, isSetCursorSupported, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isTraversable, isVisible, isVScrollThumbGrabbed, isVScrollThumbHover, keyRepeated, laidOut, longKeyPress, longPointerPress, onScrollX, onScrollY, onSetFocusable, paintBackground, paintBackgrounds, paintBorder, paintBorderBackground, paintComponent, paintComponent, paintIntersectingComponentsAbove, paintLock, paintLockRelease, paintRippleOverlay, paintScrollbars, paintScrollbarX, paintScrollbarY, paintShadows, parsePreferredSize, pinch, pinch, pinchReleased, pointerDragged, pointerDragged, pointerHover, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, pointerReleased, putClientProperty, refreshTheme, refreshTheme, remove, removeContextMenuListener, removeDragFinishedListener, removeDragOverListener, removeDropListener, removeFocusListener, removeLongPressListener, removeMouseWheelListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, removeStateChangeListener, removeStylusListener, repaint, repaint, requestFocus, resetFocusable, respondsToPointerEvents, rotation, scrollRectToVisible, scrollRectToVisible, setAccessibilityText, setAlwaysTensile, setBlockLead, setBoundPropertyValue, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setCursor, setDefaultDragTransparency, setDirtyRegion, setDisabledStyle, setDraggable, setDragTransparency, setDropTarget, setEditingDelegate, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHidden, setHidden, setHideInLandscape, setHideInPortrait, setHorizontalScrollBounds, setIgnorePointerEvents, setInitialized, setInlineAllStyles, setInlineDisabledStyles, setInlinePressedStyles, setInlineSelectedStyles, setInlineStylesTheme, setInlineUnselectedStyles, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setOpaque, setOwner, setPinchBlocksDragAndDrop, setPreferredH, setPreferredSize, setPreferredSizeStr, setPreferredTabIndex, setPreferredW, setPressedStyle, setPropertyValue, setPullToRefresh, setRippleEffect, setRTL, setSameHeight, setSameSize, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setTabIndex, setTactileTouch, setTensileDragEnabled, setTensileLength, setTooltip, setTraversable, setUIID, setUIID, setUIIDFinal, setVerticalScrollBounds, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, shouldRenderComponentSelection, showNativeOverlay, startEditingAsync, stopEditing, stripMarginAndPadding, styleChanged, toImage, toString, unbindProperty, updateNativeOverlay, visibleBoundsContains`

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface Iterable

  `forEach`

- ## Field Details

  - ### COMMAND_PLACEMENT_KEY

    public static final String COMMAND_PLACEMENT_KEY
    This string can be used in putClientProperty within command to hint about the placement of the command
    See Also:
      - Constant Field Values

  - ### COMMAND_PLACEMENT_VALUE_RIGHT

    public static final String COMMAND_PLACEMENT_VALUE_RIGHT
    This string can be used in putClientProperty within command to hint about the placement of the command e.g. putClientProperty(SideMenuBar.COMMAND_PLACEMENT_KEY, SideMenuBar.COMMAND_PLACEMENT_VALUE_RIGHT);
    See Also:
      - Constant Field Values

  - ### COMMAND_PLACEMENT_VALUE_TOP

    public static final String COMMAND_PLACEMENT_VALUE_TOP
    This string can be used in putClientProperty within command to hint about the placement of the command e.g. putClientProperty(SideMenuBar.COMMAND_PLACEMENT_KEY, SideMenuBar.COMMAND_PLACEMENT_VALUE_TOP);
    See Also:
      - Constant Field Values

  - ### COMMAND_SIDE_COMPONENT

    public static final String COMMAND_SIDE_COMPONENT
    Allows placing a component instance into the client properties of the command so it is shown instead of the command e.g.: putClientProperty(SideMenuBar.COMMAND_SIDE_COMPONENT, myCustomComponentInstance);
    See Also:
      - Constant Field Values

  - ### COMMAND_ACTIONABLE

    public static final String COMMAND_ACTIONABLE
    When using a side component we might want to only have it behave as a visual tool and still execute the command when it is clicked. The default behavior is to delegate events to the component, however if this flag is used the command will act as normal while using the COMMAND_SIDE_COMPONENT only for visual effect e.g.: putClientProperty(SideMenuBar.COMMAND_ACTIONABLE, Boolean.TRUE);
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### SideMenuBar

    public SideMenuBar()

- ## Method Details

  - ### isShowing

    public static boolean isShowing()

    Returns true if a side menu is currently controlling the screen

    ###### Returns

    true if a side menu is currently controlling the screen

  - ### closeCurrentMenu

    public static void closeCurrentMenu()
    Folds the current side menu if it is open, notice that the menu will close asynchronously

  - ### closeCurrentMenu

    public static void closeCurrentMenu(Runnable callback)

    Folds the current side menu if it is open, when the menu is closed it will invoke the runnable callback method

    ###### Parameters

    - `callback`: will be invoked when the menu is actually closed

  - ### initMenuBar

    protected void initMenuBar(Form parent)

    Initialize the MenuBar

    ###### Parameters

    - `parent`: the associated Form
    Overrides:
      `initMenuBar` in class `MenuBar`

  - ### removeAllCommands

    protected void removeAllCommands()
    Remove all commands from the menuBar
    Overrides:
      `removeAllCommands` in class `MenuBar`

  - ### unInstallMenuBar

    protected void unInstallMenuBar()
    Removes the MenuBar from the parent Form
    Overrides:
      `unInstallMenuBar` in class `MenuBar`

  - ### createOpenButton

    protected Button createOpenButton()

    Creates the Side Menu open button.

    ###### Returns

    a Button instance to place on the TitleArea

  - ### installMenuBar

    protected void installMenuBar()
    Adds the MenuBar on the parent Form
    Overrides:
      `installMenuBar` in class `MenuBar`

  - ### getDragRegionStatus

    protected int getDragRegionStatus(int x, int y)

    Indicates if the section within the X/Y area is a "drag region" where we expect people to drag or press in which case we can instantly start dragging making perceived performance faster. This is invoked by the implementation code to optimize drag start behavior

    ###### Parameters

    - `x`: x location for the touch

    - `y`: y location for the touch

    ###### Returns

    one of the DRAG_REGION_* values

    Overrides:
      `getDragRegionStatus` in class `MenuBar`

  - ### addCommand

    public void addCommand(Command cmd)

    Adds a Command to the MenuBar

    ###### Parameters

    - `cmd`: Command to add
    Overrides:
      `addCommand` in class `MenuBar`

  - ### setBackCommand

    public void setBackCommand(Command backCommand)

    Indicates the command that is defined as the back command out of this form. A back command can be used both to map to a hardware button (e.g. on the Sony Ericsson devices) and by elements such as transitions etc. to change the behavior based on direction (e.g. slide to the left to enter screen and slide to the right to exit with back).

    ###### Parameters

    - `backCommand`: the command to treat as the back Command
    Overrides:
      `setBackCommand` in class `MenuBar`

  - ### getCommandBehavior

    public int getCommandBehavior()
    Overrides:
      `getCommandBehavior` in class `MenuBar`

  - ### addCommand

    protected void addCommand(Command cmd, int index)

    Add a Command to the MenuBar

    ###### Parameters

    - `cmd`: Command to Add

    - `index`: determines the order of the added commands

    Overrides:
      `addCommand` in class `MenuBar`

  - ### removeCommand

    protected void removeCommand(Command cmd)

    Removes a Command from the MenuBar

    ###### Parameters

    - `cmd`: Command to remove
    Overrides:
      `removeCommand` in class `MenuBar`

  - ### keyReleased

    public void keyReleased(int keyCode)
    Description copied from class: `MenuBar`

    If this Component is focused, the key released event will call this method

    ###### Parameters

    - `keyCode`: the key code value to indicate a physical key.
    Overrides:
      `keyReleased` in class `MenuBar`

  - ### closeMenu

    public void closeMenu()
    Closes the menu if it is currently open

  - ### openMenu

    public void openMenu(String direction)
    Opens the menu if it is currently closed

  - ### isMenuOpen

    public boolean isMenuOpen()

    Returns true if the Menu is currently open

    ###### Returns

    true if menu open

    ###### Deprecated

    this code references functionality that is no longer supported and currently always returns false

  - ### createSideNavigationComponent

    protected Container createSideNavigationComponent(Vector commands)

    Creates the side navigation component with the Commands

    ###### Parameters

    - `commands`: the Command objects

    ###### Returns

    the Component to display on the navigation

  - ### createSideNavigationComponent

    protected Container createSideNavigationComponent(Vector commands, String placement)

    Creates the side navigation component with the Commands

    ###### Parameters

    - `commands`: the Command objects

    ###### Returns

    the Component to display on the navigation

  - ### constructSideNavigationComponent

    protected Container constructSideNavigationComponent()
    Creates an empty side navigation panel.

  - ### addComponentToSideMenu

    protected void addComponentToSideMenu(Container menu, Component cmp)

    This method responsible to add a Component to the side navigation panel.

    ###### Parameters

    - `menu`: @param menu the Menu Container that was created in the constructSideNavigationComponent() method

    - `cmp`: the Component to add to the side menu

  - ### createTouchCommandButton

    protected Button createTouchCommandButton(Command c)

    Creates a touch command for use as a touch menu item

    ###### Parameters

    - `c`: command to map into the returned button

    ###### Returns

    a button that would fire the touch command appropriately

    Overrides:
      `createTouchCommandButton` in class `MenuBar`

  - ### getParentForm

    public Form getParentForm()

    Returns the Parent Form of this menu

    ###### Returns

    Form Object