net.rim.blackberry.api.sendmenu
Class SendCommandMenuItem

java.lang.Object
  extended by net.rim.device.api.ui.MenuItem
      extended by net.rim.blackberry.api.sendmenu.SendCommandMenuItem
All Implemented Interfaces:
Runnable

public class SendCommandMenuItem
extends MenuItem

Represents a menu item for a SendCommand.

This class of menu items is specialized for displaying SendCommand objects in a SendCommandMenu.

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 7.0.0

Field Summary
 
Fields inherited from class net.rim.device.api.ui.MenuItem
CANCEL_SELECT, CHANGE_OPTION, CLOSE, COPY, CUT, ORDINAL_COMPARATOR, PASTE, SAVE_CLOSE, SELECT
 
Constructor Summary
Category: Signed SendCommandMenuItem(SendCommand sendCommand, int ordinal, int priority)
          Constructs a new SendCommandMenuItem instance with the specified SendCommand, ordinal, and priority.
Category: Signed SendCommandMenuItem(SendCommand sendCommand, StringProvider text, int ordinal, int priority)
          Constructs a new SendCommandMenuItem instance with the specified SendCommand, text that is to be used as the label for this SendCommandMenuItem, ordinal, and priority.
 
Method Summary
Category: Signed  SendCommand getSendCommand()
          Returns the SendCommand that was provided to the constructor and is to be executed when this SendCommandMenuItem is selected by the user.
Category: Signed  void handleSendCommandException(SendCommand sendCommand, SendCommandException exception)
          Displays an error message in a dialog box.
Category: Signed  void run()
          Executes the SendCommand that is encapsulated in this SendCommandMenuItem.
 
Methods inherited from class net.rim.device.api.ui.MenuItem
createMenuItem, getBundle, getCommand, getCommandContext, getIcon, getId, getOrdinal, getPrefab, getPriority, getTarget, getTextStringProvider, isSeparator, separator, setCommand, setCommandContext, setIcon, setOrdinal, setPriority, setText, setText, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 



Constructor Detail

SendCommandMenuItem

public SendCommandMenuItem(SendCommand sendCommand,
                           int ordinal,
                           int priority)
Constructs a new SendCommandMenuItem instance with the specified SendCommand, ordinal, and priority.

The value that is returned from sendCommand.getDisplayName() is used as the label for the SendCommandMenuItem.

Parameters:
sendCommand - The command that will be executed when the user selects this menu item.
ordinal - The ordering of this menu item.
priority - The priority of this menu item.
Throws:
NullPointerException - if sendCommand is null.
IllegalArgumentException - if priority or ordinal is negative.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 7.0.0

SendCommandMenuItem

public SendCommandMenuItem(SendCommand sendCommand,
                           StringProvider text,
                           int ordinal,
                           int priority)
Constructs a new SendCommandMenuItem instance with the specified SendCommand, text that is to be used as the label for this SendCommandMenuItem, ordinal, and priority.

Parameters:
sendCommand - The command that will be executed when the user selects this menu item.
text - The name of this menu item.
ordinal - The ordering of this menu item.
priority - The priority of this menu item.
Throws:
NullPointerException - if sendCommand or text is null.
IllegalArgumentException - if priority or ordinal is negative.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 7.0.0


Method Detail

getSendCommand

public SendCommand getSendCommand()
Returns the SendCommand that was provided to the constructor and is to be executed when this SendCommandMenuItem is selected by the user.

Returns:
The SendCommand of this SendCommandMenuItem. This method never returns null.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 7.0.0

handleSendCommandException

public void handleSendCommandException(SendCommand sendCommand,
                                       SendCommandException exception)
Displays an error message in a dialog box.

This method is invoked by the SendCommandMenuItem.run() method of this SendCommandMenuItem if the SendCommand.run() method of the given SendCommand throws a SendCommandException.

This method may be overridden in subclasses.

Parameters:
sendCommand - The executed SendCommand.
exception - The SendCommandException that was thrown by the executed SendCommand.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 7.0.0

run

public void run()
Executes the SendCommand that is encapsulated in this SendCommandMenuItem.

This method invokes the SendCommand.run() method of the encapsulated SendCommand. If the invoked run() method throws a SendCommandException, then this SendCommandMenuItem objectís #handleSendCommandException() method is invoked.

Specified by:
run in interface Runnable
Overrides:
run in class MenuItem
See Also:
Thread.run()
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 7.0.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal