public class SideMenuBar

  1. Object
  2. Component
  3. Container
  4. MenuBar
  5. SideMenuBar

ImplementsActionListener, Animation, Editable, Iterable<Component>, StyleListener

Deprecated. this class is still used internally but code should be migrated to use the com.codename1.ui.Toolbar
This is Menu Bar that displays it’s commands on a side bar navigation similar to Google+/Facbook apps navigation

Fields

public static final String COMMAND_PLACEMENT_KEY = "placement"This string can be used in putClientProperty within command to hint about the placement of the command
public static final String COMMAND_PLACEMENT_VALUE_RIGHT = "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);
public static final String COMMAND_PLACEMENT_VALUE_TOP = "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);
public static final String COMMAND_SIDE_COMPONENT = "SideComponent"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);
public static final String COMMAND_ACTIONABLE = "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.

Constructors

public SideMenuBar()

Methods

public static boolean isShowing()Returns true if a side menu is currently controlling the screen
public static void closeCurrentMenu()Folds the current side menu if it is open, notice that the menu will close asynchronously
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
protected void initMenuBar(Form parent)Initialize the MenuBar
protected void removeAllCommands()Remove all commands from the menuBar
protected void unInstallMenuBar()Removes the MenuBar from the parent Form
protected Button createOpenButton()Creates the Side Menu open button.
protected void installMenuBar()Adds the MenuBar on the parent Form
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.
public void addCommand(Command cmd)Adds a Command to the MenuBar
public void setBackCommand(Command backCommand)Indicates the command that is defined as the back command out of this form.
public int getCommandBehavior()
protected void addCommand(Command cmd, int index)Add a Command to the MenuBar
protected void removeCommand(Command cmd)Removes a Command from the MenuBar
public void keyReleased(int keyCode)If this Component is focused, the key released event will call this method
public void closeMenu()Closes the menu if it is currently open
public void openMenu(String direction)Opens the menu if it is currently closed
public boolean isMenuOpen()Deprecated Returns true if the Menu is currently open
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 Container constructSideNavigationComponent()Creates an empty side navigation panel.
protected void addComponentToSideMenu(Container menu, Component cmp)This method responsible to add a Component to the side navigation panel.
protected Button createTouchCommandButton(Command c)Creates a touch command for use as a touch menu item
public Form getParentForm()Returns the Parent Form of this menu

Inherited fields

Inherited methods

From Container

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

From Component

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

Field details

COMMAND_PLACEMENT_KEY

public static final String COMMAND_PLACEMENT_KEY = "placement"
This string can be used in putClientProperty within command to hint about the placement of the command

COMMAND_PLACEMENT_VALUE_RIGHT

public static final String COMMAND_PLACEMENT_VALUE_RIGHT = "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);

COMMAND_PLACEMENT_VALUE_TOP

public static final String COMMAND_PLACEMENT_VALUE_TOP = "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);

COMMAND_SIDE_COMPONENT

public static final String COMMAND_SIDE_COMPONENT = "SideComponent"
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);

COMMAND_ACTIONABLE

public static final String COMMAND_ACTIONABLE = "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);

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 Runnable
will be invoked when the menu is actually closed

initMenuBar

protected void initMenuBar(Form parent)
Initialize the MenuBar

Parameters

parent Form
the associated Form

removeAllCommands

protected void removeAllCommands()
Remove all commands from the menuBar

unInstallMenuBar

protected void unInstallMenuBar()
Removes the MenuBar from the parent Form

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

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 int
x location for the touch
y int
y location for the touch

Returns

one of the DRAG_REGION_* values

addCommand

public void addCommand(Command cmd)
Adds a Command to the MenuBar

Parameters

cmd Command
Command to add

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 Command
the command to treat as the back Command

getCommandBehavior

public int getCommandBehavior()

addCommand

protected void addCommand(Command cmd, int index)
Add a Command to the MenuBar

Parameters

cmd Command
Command to Add
index int
determines the order of the added commands

removeCommand

protected void removeCommand(Command cmd)
Removes a Command from the MenuBar

Parameters

cmd Command
Command to remove

keyReleased

public void keyReleased(int keyCode)
If this Component is focused, the key released event will call this method

Parameters

keyCode int
the key code value to indicate a physical key.

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()
Deprecated. this code references functionality that is no longer supported and currently always returns false
Returns true if the Menu is currently open

Returns

true if menu open

createSideNavigationComponent

protected Container createSideNavigationComponent(Vector commands)
Creates the side navigation component with the Commands

Parameters

commands Vector
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 Vector
the Command objects
placement String
Not documented.

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 Container
the Menu Container that was created in the constructSideNavigationComponent() method
cmp Component
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
command to map into the returned button

Returns

a button that would fire the touch command appropriately

getParentForm

public Form getParentForm()
Returns the Parent Form of this menu

Returns

Form Object