javauis/tsrc/fute/lcdui/Midp_StringItem_01/src/FormStringItemTests.java
branchRCL_3
changeset 24 6c158198356e
parent 18 9ac0a0a7da70
--- a/javauis/tsrc/fute/lcdui/Midp_StringItem_01/src/FormStringItemTests.java	Thu Jul 15 18:31:06 2010 +0300
+++ b/javauis/tsrc/fute/lcdui/Midp_StringItem_01/src/FormStringItemTests.java	Thu Aug 19 09:48:13 2010 +0300
@@ -62,9 +62,11 @@
 
     //the command to create the StringItem with the entered label and text and with focus
     private Command cmdCreateHL = new Command("Create as Hyperlink", Command.SCREEN, 1);
+    private Command cmdCreateHLM = new Command("Create as Hyperlink 2 cmds", Command.SCREEN, 1);
 
     //the command to create the StringItem with the entered label and text and with focus
     private Command cmdCreateButton = new Command("Create as Button", Command.SCREEN, 1);
+    private Command cmdCreateButtonM = new Command("Create as Button 2 cmds", Command.SCREEN, 1);
 
     //the command to unlock the Item
     private Command cmdUnlock = new Command("Unlock", Command.SCREEN, 1);
@@ -97,6 +99,11 @@
     private Command cmdNext = new Command("Next", Command.SCREEN, 1);
     private Command cmdExit = new Command("Exit", Command.EXIT, 1);
 
+    // commands for the form
+    private Command cmdItemF = new Command("ItemF", Command.ITEM, 1);
+    private Command cmdOkF = new Command("OkF", Command.OK, 1);
+    private Command cmdScreenF = new Command("Add form commands", Command.SCREEN, 1);
+
     static int change = -1;
 
     public FormStringItemTests(Midp_StringItem_01 m)
@@ -118,7 +125,9 @@
         append(cg);
         addCommand(cmdCreate);
         addCommand(cmdCreateHL);
+        addCommand(cmdCreateHLM);
         addCommand(cmdCreateButton);
+        addCommand(cmdCreateButtonM);
         addCommand(cmdLayout);
         addCommand(cmdLayoutHL);
         addCommand(cmdLayoutButton);
@@ -134,6 +143,7 @@
         //create StringItemForm
         stringItemForm = new Form("StringItem");
         stringItemForm.addCommand(cmdBack);
+        stringItemForm.addCommand(cmdScreenF);
         stringItemForm.setCommandListener(this);
     }
 
@@ -223,39 +233,27 @@
         }
         else if (c == cmdLayout)
         {
-
             layoutTest(Item.PLAIN);
-
         }
         else if (c == cmdLayoutHL)
         {
-
             layoutTest(Item.HYPERLINK);
-
         }
         else if (c == cmdLayoutButton)
         {
-
             layoutTest(Item.BUTTON);
-
         }
         else if (c == cmdVLayout)
         {
-
             verticalLayoutTest(Item.PLAIN);
-
         }
         else if (c == cmdVLayoutHL)
         {
-
             verticalLayoutTest(Item.HYPERLINK);
-
         }
         else if (c == cmdVLayoutButton)
         {
-
             verticalLayoutTest(Item.BUTTON);
-
         }
         else if (c == cmdAddListeners)
         {
@@ -272,6 +270,11 @@
             m.destroyApp(false);
             m.notifyDestroyed();
         }
+        else if (c == cmdScreenF)
+        {
+            stringItemForm.addCommand(cmdItemF);
+            stringItemForm.addCommand(cmdOkF);
+        }
         else
         {
             String l = label.getString();
@@ -282,12 +285,12 @@
 
             if (c == cmdCreate)
                 si = new StringItem(l, t);
-            else if (c == cmdCreateHL)
+            else if (c == cmdCreateHL || c == cmdCreateHLM)
             {
                 si = new StringItem(l, t, Item.HYPERLINK);
                 si.setDefaultCommand(cmdItem);
             }
-            else if (c == cmdCreateButton)
+            else if (c == cmdCreateButton || c == cmdCreateButtonM)
             {
                 si = new StringItem(l, t, Item.BUTTON);
                 si.setDefaultCommand(cmdItem);
@@ -352,6 +355,10 @@
             stringItemForm.addCommand(cmdRemoveCommand);
             stringItemForm.addCommand(cmdRestoreCommand);
             stringItemForm.addCommand(cmdRemoveItem);
+            if (c == cmdCreateButtonM || c == cmdCreateHLM)
+            {
+                si.addCommand(cmdBack);
+            }
             Display.getDisplay(m).setCurrent(stringItemForm);
         }
     }