Java Doc for Command.java in  » 6.0-JDK-Modules » j2me » javax » microedition » lcdui » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » javax.microedition.lcdui 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.microedition.lcdui.Command

All known Subclasses:   com.sun.midp.chameleon.SubMenuCommand,
Command
public class Command (Code)
The Command class is a construct that encapsulates the semantic information of an action. The behavior that the command activates is not encapsulated in this object. This means that command contains only information about "command" not the actual action that happens when command is activated. The action is defined in a CommandListener CommandListener associated with the Displayable. Command objects are presented in the user interface and the way they are presented may depend on the semantic information contained within the command.

Commands may be implemented in any user interface construct that has semantics for activating a single action. This, for example, can be a soft button, item in a menu, or some other direct user interface construct. For example, a speech interface may present these commands as voice tags.

The mapping to concrete user interface constructs may also depend on the total number of the commands. For example, if an application asks for more abstract commands than can be mapped onto the available physical buttons on a device, then the device may use an alternate human interface such as a menu. For example, the abstract commands that cannot be mapped onto physical buttons are placed in a menu and the label "Menu" is mapped onto one of the programmable buttons.

A command contains four pieces of information: a short label, an optional long label, a type, and a priority. One of the labels is used for the visual representation of the command, whereas the type and the priority indicate the semantics of the command.

Labels

Each command includes one or two label strings. The label strings are what the application requests to be shown to the user to represent this command. For example, one of these strings may appear next to a soft button on the device or as an element in a menu. For command types other than SCREEN, the labels provided may be overridden by a system-specific label that is more appropriate for this command on this device. The contents of the label strings are otherwise not interpreted by the implementation.

All commands have a short label. The long label is optional. If the long label is not present on a command, the short label is always used.

The short label string should be as short as possible so that it consumes a minimum of screen real estate. The long label can be longer and more descriptive, but it should be no longer than a few words. For example, a command's short label might be "Play", and its long label might be "Play Sound Clip".

The implementation chooses one of the labels to be presented in the user interface based on the context and the amount of space available. For example, the implementation might use the short label if the command appears on a soft button, and it might use the long label if the command appears on a menu, but only if there is room on the menu for the long label. The implementation may use the short labels of some commands and the long labels of other commands, and it is allowed to switch between using the short and long label at will. The application cannot determine which label is being used at any given time.

Type

The application uses the command type to specify the intent of this command. For example, if the application specifies that the command is of type BACK, and if the device has a standard of placing the "back" operation on a certain soft-button, the implementation can follow the style of the device by using the semantic information as a guide. The defined types are Command.BACK BACK , Command.CANCEL CANCEL , Command.EXIT EXIT , Command.HELP HELP , Command.ITEM ITEM , Command.OK OK , Command.SCREEN SCREEN , and Command.STOP STOP .

Priority

The application uses the priority value to describe the importance of this command relative to other commands on the same screen. Priority values are integers, where a lower number indicates greater importance. The actual values are chosen by the application. A priority value of one might indicate the most important command, priority values of two, three, four, and so on indicate commands of lesser importance.

Typically, the implementation first chooses the placement of a command based on the type of command and then places similar commands based on a priority order. This could mean that the command with the highest priority is placed so that user can trigger it directly and that commands with lower priority are placed on a menu. It is not an error for there to be commands on the same screen with the same priorities and types. If this occurs, the implementation will choose the order in which they are presented.

For example, if the application has the following set of commands:


 new Command("Buy", Command.ITEM, 1);
 new Command("Info", Command.ITEM, 1);
 new Command("Back", Command.BACK, 1);    

An implementation with two soft buttons may map the BACK command to the right soft button and create an "Options" menu on the left soft button to contain the other commands.

When user presses the left soft button, a menu with the two remaining Commands appears:

If the application had three soft buttons, all commands can be mapped to soft buttons:

The application is always responsible for providing the means for the user to progress through different screens. An application may set up a screen that has no commands. This is allowed by the API but is generally not useful; if this occurs the user would have no means to move to another screen. Such program would simply considered to be in error. A typical device should provide a means for the user to direct the application manager to kill the erroneous application.
since:
   MIDP 1.0



Field Summary
final public static  intBACK
     A navigation command that returns the user to the logically previous screen.
final public static  intCANCEL
     A command that is a standard negative answer to a dialog implemented by current screen. Nothing is cancelled automatically by the implementation; cancellation is implemented by the CommandListener.commandAction commandAction provided by the application.

With this command type, the application hints to the implementation that the user wants to dismiss the current screen without taking any action on anything that has been entered into the current screen, and usually that the user wants to return to the prior screen.

final public static  intEXIT
     A command used for exiting from the application.
final public static  intHELP
     This command specifies a request for on-line help. No help information is shown automatically by the implementation. The CommandListener.commandAction commandAction provided by the application is responsible for showing the help information.
final public static  intITEM
     With this command type the application can hint to the implementation that the command is specific to the items of the Screen or the elements of a Choice.
final public static  intOK
     A command that is a standard positive answer to a dialog implemented by current screen. Nothing is done automatically by the implementation; any action taken is implemented by the CommandListener.commandAction commandAction provided by the application.

With this command type the application hints to the implementation that the user will use this command to ask the application to confirm the data that has been entered in the current screen and to proceed to the next logical screen.

final public static  intSCREEN
     Specifies an application-defined command that pertains to the current screen.
final public static  intSTOP
     A command that will stop some currently running process, operation, etc. Nothing is stopped automatically by the implementation. The cessation must be performed by the CommandListener.commandAction commandAction provided by the application.

With this command type the application hints to the implementation that the user will use this command to stop any currently running process visible to the user on the current screen.

 intcommandType
    
 StringlongLabel
    
 intpriority
    
 StringshortLabel
     The label rendered on the screen for this Command.

Constructor Summary
public  Command(String label, int commandType, int inp_priority)
     Creates a new command object with the given short label, type, and priority. The newly created command has no long label.
public  Command(String shortLabel, String longLabel, int commandType, int inp_priority)
     Creates a new command object with the given labels, type, and priority.

The short label is required and must not be null.


Method Summary
public  intgetCommandType()
     Gets the type of the command.
 intgetID()
    
public  StringgetLabel()
     Gets the short label of the command.
public  StringgetLongLabel()
     Gets the long label of the command.
public  intgetPriority()
     Gets the priority of the command.
 voidsetInternalID(int num)
     Sets the internal id used to uniquely identify this command.

Field Detail
BACK
final public static int BACK(Code)
A navigation command that returns the user to the logically previous screen. The jump to the previous screen is not done automatically by the implementation but by the CommandListener.commandAction commandAction provided by the application. Note that the application defines the actual action since the strictly previous screen may not be logically correct.

Value 2 is assigned to BACK.


See Also:   Command.CANCEL
See Also:   Command.STOP



CANCEL
final public static int CANCEL(Code)
A command that is a standard negative answer to a dialog implemented by current screen. Nothing is cancelled automatically by the implementation; cancellation is implemented by the CommandListener.commandAction commandAction provided by the application.

With this command type, the application hints to the implementation that the user wants to dismiss the current screen without taking any action on anything that has been entered into the current screen, and usually that the user wants to return to the prior screen. In many cases CANCEL is interchangeable with BACK, but BACK is mainly used for navigation as in a browser-oriented applications.

Value 3 is assigned to CANCEL.


See Also:   Command.BACK
See Also:   Command.STOP



EXIT
final public static int EXIT(Code)
A command used for exiting from the application. When the user invokes this command, the implementation does not exit automatically. The application's CommandListener.commandAction commandAction will be called, and it should exit the application if it is appropriate to do so.

Value 7 is assigned to EXIT.




HELP
final public static int HELP(Code)
This command specifies a request for on-line help. No help information is shown automatically by the implementation. The CommandListener.commandAction commandAction provided by the application is responsible for showing the help information.

Value 5 is assigned to HELP.




ITEM
final public static int ITEM(Code)
With this command type the application can hint to the implementation that the command is specific to the items of the Screen or the elements of a Choice. Normally this means that command relates to the focused item or element. For example, an implementation of List can use this information for creating context sensitive menus.

Value 8 is assigned to ITEM.




OK
final public static int OK(Code)
A command that is a standard positive answer to a dialog implemented by current screen. Nothing is done automatically by the implementation; any action taken is implemented by the CommandListener.commandAction commandAction provided by the application.

With this command type the application hints to the implementation that the user will use this command to ask the application to confirm the data that has been entered in the current screen and to proceed to the next logical screen.

CANCEL is often used together with OK.

Value 4 is assigned to OK.


See Also:   Command.CANCEL



SCREEN
final public static int SCREEN(Code)
Specifies an application-defined command that pertains to the current screen. Examples could be "Load" and "Save". A SCREEN command generally applies to the entire screen's contents or to navigation among screens. This is in contrast to the ITEM type, which applies to the currently activated or focused item or element contained within this screen.

Value 1 is assigned to SCREEN.




STOP
final public static int STOP(Code)
A command that will stop some currently running process, operation, etc. Nothing is stopped automatically by the implementation. The cessation must be performed by the CommandListener.commandAction commandAction provided by the application.

With this command type the application hints to the implementation that the user will use this command to stop any currently running process visible to the user on the current screen. Examples of running processes might include downloading or sending of data. Use of the STOP command does not necessarily imply a switch to another screen.

Value 6 is assigned to STOP.


See Also:   Command.BACK
See Also:   Command.CANCEL



commandType
int commandType(Code)
The type of this Command



longLabel
String longLabel(Code)
The long Label for this Command



priority
int priority(Code)
The priority of this Command



shortLabel
String shortLabel(Code)
The label rendered on the screen for this Command. Chosen from the available set of labels.




Constructor Detail
Command
public Command(String label, int commandType, int inp_priority)(Code)
Creates a new command object with the given short label, type, and priority. The newly created command has no long label. This constructor is identical to Command(label, null, commandType, priority).
Parameters:
  label - the command's short label
Parameters:
  commandType - the command's type
Parameters:
  inp_priority - the command's priority value
throws:
  NullPointerException - if label is null
throws:
  IllegalArgumentException - if the commandTypeis an invalid type
See Also:   Command.Command(String,String,int,int)



Command
public Command(String shortLabel, String longLabel, int commandType, int inp_priority)(Code)
Creates a new command object with the given labels, type, and priority.

The short label is required and must not be null. The long label is optional and may be null if the command is to have no long label.


Parameters:
  shortLabel - the command's short label
Parameters:
  longLabel - the command's long label, or null if none
Parameters:
  commandType - the command's type
Parameters:
  inp_priority - the command's priority value
throws:
  NullPointerException - if shortLabel isnull
throws:
  IllegalArgumentException - if the commandType is aninvalid type




Method Detail
getCommandType
public int getCommandType()(Code)
Gets the type of the command. type of the Command



getID
int getID()(Code)
Get the internal ID of this Command int The integer id associated with this specific Command



getLabel
public String getLabel()(Code)
Gets the short label of the command. the Command's short label



getLongLabel
public String getLongLabel()(Code)
Gets the long label of the command. the Command's long label, ornull if the Command has no longlabel



getPriority
public int getPriority()(Code)
Gets the priority of the command. priority of the Command



setInternalID
void setInternalID(int num)(Code)
Sets the internal id used to uniquely identify this command. This method is intended to be called from Displayable addCommand()
Parameters:
  num - the int to set this id to



Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.