net.rim.device.api.ui.menu
Class CommandItem

java.lang.Object
  extended by net.rim.device.api.ui.menu.CommandItem

public final class CommandItem
extends Object

Specifies the text, icon, and behavior of a command item.

See Also:
DefaultContextMenuProvider, CommandItemProvider
Since:
BlackBerry API 6.0.0

Constructor Summary
CommandItem()
          Creates a command item.
CommandItem(Command command)
          Creates a command item.
CommandItem(StringProvider text)
          Creates a command item.
CommandItem(StringProvider text, Image icon)
          Creates a command item.
CommandItem(StringProvider text, Image icon, Command command)
          Creates a command item.
 
Method Summary
 Command getCommand()
          Returns the command of this command item.
 Image getIcon()
          Returns the icon of this command item.
 StringProvider getStringProvider()
          Returns the text of this command item.
 String getText()
          Returns the text of this command item.
 void setCommand(Command command)
          Sets the command of this command item.
 void setIcon(Image icon)
          Sets the icon of this command item.
 void setText(StringProvider text)
          Sets the text of this command item.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

CommandItem

public CommandItem()
Creates a command item.

Since:
BlackBerry API 6.0.0

CommandItem

public CommandItem(Command command)
Creates a command item.

Parameters:
command - The Command associated with this item.
Since:
BlackBerry API 6.0.0

CommandItem

public CommandItem(StringProvider text)
Creates a command item.

Since:
BlackBerry API 6.0.0

CommandItem

public CommandItem(StringProvider text,
                   Image icon)
Creates a command item.

Parameters:
text - The text of this item.
icon - The icon of this item. If null, a default icon is used.
Since:
BlackBerry API 6.0.0

CommandItem

public CommandItem(StringProvider text,
                   Image icon,
                   Command command)
Creates a command item.

Parameters:
text - The text of this item.
icon - The icon of this item. If null, a default icon is used.
command - The Command associated with this item.
Since:
BlackBerry API 6.0.0


Method Detail

getCommand

public Command getCommand()
Returns the command of this command item.

Returns:
The Command of this command item.
Since:
BlackBerry API 6.0.0

getText

public String getText()
Returns the text of this command item.

Returns:
The text of this command item.
Since:
BlackBerry API 6.0.0

getStringProvider

public StringProvider getStringProvider()
Returns the text of this command item.

Returns:
The text of this command item.
Since:
BlackBerry API 6.0.0

getIcon

public Image getIcon()
Returns the icon of this command item.

If no icon was explicitly set, it looks at the CommandMetadata information to retrieve one. First, it checks to value associated with CommandMetadata.THEMED_ICON. If it is not set, the default of "command/" + getCommand().getId() is be used.

Returns:
The icon associated with this command item.
Since:
BlackBerry API 6.0.0

setCommand

public void setCommand(Command command)
Sets the command of this command item.

Parameters:
command - The command of this item.
Since:
BlackBerry API 6.0.0

setIcon

public void setIcon(Image icon)
Sets the icon of this command item.

Parameters:
icon - The icon of this item.
Since:
BlackBerry API 6.0.0

setText

public void setText(StringProvider text)
Sets the text of this command item.

Parameters:
text - The text of this item.
Since:
BlackBerry API 6.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.