Class 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 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:
    • 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:
    • 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:
    • 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:
    • 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:
  • 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