|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.lwuit.Component com.sun.lwuit.Container com.sun.lwuit.MenuBar
public class MenuBar
This class represents the Form MenuBar. This class is responsible to show the Form Commands and to handle device soft keys, back key, clear key, etc... This class can be overridden and replaced in the LookAndFeel
LookAndFeel.setMenuBarClass(java.lang.Class)
Field Summary |
---|
Fields inherited from class com.sun.lwuit.Component |
---|
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP |
Constructor Summary | |
---|---|
MenuBar()
Empty Constructor |
Method Summary | |
---|---|
void |
actionPerformed(ActionEvent evt)
Invoked when a softbutton is pressed |
void |
addCommand(Command cmd)
Adds a Command to the MenuBar |
protected void |
addCommand(Command cmd,
int index)
Add a Command to the MenuBar |
protected Dimension |
calcPreferredSize()
Prevents scaling down of the menu when there is no text on the menu bar |
protected int |
calculateTouchCommandGridColumns(Container grid)
Calculates the amount of columns to give to the touch commands within the grid |
protected Component |
createCommandComponent(java.util.Vector commands)
Creates the component containing the commands within the given vector used for showing the menu dialog, this method calls the createCommandList method by default however it allows more elaborate menu creation. |
protected List |
createCommandList(java.util.Vector commands)
Creates the list component containing the commands within the given vector used for showing the menu dialog |
protected Command |
createMenuCancelCommand()
Factory method that returns the Form Menu cancel Command. |
protected Command |
createMenuSelectCommand()
Factory method that returns the Form Menu select Command. |
protected Command |
createSelectCommand()
Factory method that returns the Form select Command. |
protected Button |
createSoftButton(java.lang.String uiid)
Creates a soft button Component |
protected Button |
createTouchCommandButton(Command c)
Creates a touch command for use as a touch menu item |
Command |
getBackCommand()
Indicates the command that is defined as the back command out of this form. |
protected Command |
getCancelMenuItem()
This method returns the cancel menu item, when a menu is opened |
Command |
getClearCommand()
Indicates the command that is defined as the clear command in this form. |
Command |
getCommand(int index)
Returns the command occupying the given index |
int |
getCommandCount()
Returns number of commands |
protected java.util.Vector |
getCommands()
This method returns a Vector of Command objects |
Command |
getDefaultCommand()
Default command is invoked when a user presses fire, this functionality works well in some situations but might collide with elements such as navigation and combo boxes. |
Style |
getMenuStyle()
Returns the Menu Dialog Style |
Command |
getSelectCommand()
The selectCommand is the command to invoke when a Component has foucs in Third Soft Button state. |
protected Command |
getSelectMenuItem()
This method returns the select menu item, when a menu is opened |
boolean |
handlesKeycode(int keyCode)
This method returns true if the MenuBar should handle the given keycode. |
protected void |
initMenuBar(Form parent)
Initialize the MenuBar |
protected void |
installMenuBar()
Adds the MenuBar on the parent Form |
protected boolean |
isReverseSoftButtons()
Allows an individual form to reverse the layout direction of the softbuttons, this method is RTL sensitive and might reverse the result based on RTL state |
void |
keyPressed(int keyCode)
If this Component is focused, the key pressed event will call this method |
void |
keyReleased(int keyCode)
If this Component is focused, the key released event will call this method |
void |
refreshTheme()
Makes sure the component is up to date with the current style object |
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. |
void |
setClearCommand(Command clearCommand)
Indicates the command that is defined as the clear command in this form. |
void |
setDefaultCommand(Command defaultCommand)
Default command is invoked when a user presses fire, this functionality works well in some situations but might collide with elements such as navigation and combo boxes. |
void |
setMenuCellRenderer(ListCellRenderer menuCellRenderer)
The MenuBar default implementation shows the menu commands in a List contained in a Dialog. |
void |
setSelectCommand(Command selectCommand)
Sets the select command |
void |
setTransitions(Transition transitionIn,
Transition transitionOut)
Sets the menu transitions for showing/hiding the menu, can be null... |
void |
setUnselectedStyle(Style style)
Changes the Component Style by replacing the Component Style with the given Style |
void |
showMenu()
This method shows the menu on the Form. |
protected Command |
showMenuDialog(Dialog menu)
A menu is implemented as a dialog, this method allows you to override dialog display in order to customize the dialog menu in various ways |
protected void |
unInstallMenuBar()
Removes the MenuBar from the parent Form |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MenuBar()
Method Detail |
---|
protected void initMenuBar(Form parent)
parent
- the associated Formpublic void setDefaultCommand(Command defaultCommand)
defaultCommand
- the command to treat as defaultpublic Command getDefaultCommand()
public void setClearCommand(Command clearCommand)
clearCommand
- the command to treat as the clear Commandpublic Command getClearCommand()
public void setBackCommand(Command backCommand)
backCommand
- the command to treat as the back Commandpublic Command getBackCommand()
public Command getSelectCommand()
public void setSelectCommand(Command selectCommand)
selectCommand
- public void actionPerformed(ActionEvent evt)
actionPerformed
in interface ActionListener
evt
- event object describing the source of the action as well as
its triggerprotected Button createSoftButton(java.lang.String uiid)
public void setUnselectedStyle(Style style)
Component
setUnselectedStyle
in class Component
style
- the component Style objectprotected Dimension calcPreferredSize()
calcPreferredSize
in class Container
public void setTransitions(Transition transitionIn, Transition transitionOut)
public void showMenu()
public void addCommand(Command cmd)
cmd
- Command to addpublic Command getCommand(int index)
index
- offset of the command
public int getCommandCount()
protected void addCommand(Command cmd, int index)
cmd
- Command to Addindex
- determines the order of the added commandsprotected void installMenuBar()
protected void unInstallMenuBar()
protected void removeAllCommands()
protected void removeCommand(Command cmd)
cmd
- Command to removeprotected Command createSelectCommand()
protected Command createMenuSelectCommand()
protected Command createMenuCancelCommand()
public void setMenuCellRenderer(ListCellRenderer menuCellRenderer)
menuCellRenderer
- public Style getMenuStyle()
public boolean handlesKeycode(int keyCode)
keyCode
- to determine if the MenuBar is responsible for.
public void keyPressed(int keyCode)
Component
keyPressed
in class Container
keyCode
- the key code value to indicate a physical key.public void keyReleased(int keyCode)
Component
keyReleased
in class Container
keyCode
- the key code value to indicate a physical key.public void refreshTheme()
Component
refreshTheme
in class Container
protected Command showMenuDialog(Dialog menu)
menu
- a dialog containing menu options that can be customized
protected boolean isReverseSoftButtons()
protected int calculateTouchCommandGridColumns(Container grid)
grid
- container that will be arranged in the grid containing the
components
protected Button createTouchCommandButton(Command c)
c
- command to map into the returned button
protected Component createCommandComponent(java.util.Vector commands)
commands
- list of command objects
protected java.util.Vector getCommands()
protected List createCommandList(java.util.Vector commands)
commands
- list of command objects
protected Command getSelectMenuItem()
protected Command getCancelMenuItem()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |