| [ directory ] |
|
10.2 StringItemRead-only strings can be added to a Form either directly as Strings (Java String objects) or as StringItems. StringItem is a simple class that is used to wrap Strings so they can be treated consistently with the other Items. Strings are converted to StringItems automatically when they are appended to a Form. These kinds of StringItems have null labels. When an Item that was appended as a String is retrieved from a Form, it is returned as a StringItem. Continuing the example started in Section 9.4, "Form," the following code illustrates how to add a new StringItem to the Form:
When a sequence of StringItems is displayed, the text is concatenated and wrapped to as many lines as needed. This has the effect that sequential StringItems are displayed as a paragraph of text. Any newline characters within StringItems are treated as row breaks (see Section 10.9.1, "Row Breaks"). Also, a label may cause a row break either before or after the label, or both. Generally, the label is used as a paragraph title. Here is an example that illustrates the use of concatenated StringItems:
10.2.1 Appearance Modes
Simply having an item with HYPERLINK or BUTTON appearance mode does not do anything. When either of these modes is used, the application must also add at least one Command to the item. Preferably, the Command is set as the default Command. In addition, an ItemCommandListener must be registered that actually will implement the action for the hyperlink or button. Here's an example that illustrates the use of the HYPERLINK appearance mode:
Note that the linkCommand variable in the above code is set to the link StringItem whereas the backCommand variable is set to the entire Form. This means that the linkCommand operation is only accessible when the user is manipulating the link item. In other words, the presence of the linkCommand operation is context-sensitive. |
| [ directory ] |
|