1. Update ICheckBoxList to add one attribute "selected". Set the first item of ICheck...
authorhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Oct 2006 02:51:55 +0000 (02:51 +0000)
committerhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Oct 2006 02:51:55 +0000 (02:51 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1820 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxList.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListItem.java

index 2361c77e617b6fd1fa0af54a412d21d3c8e8fead..6fbdf03dddd6a7cb820d4fe0af03cbd6f89fec6a 100644 (file)
@@ -50,6 +50,14 @@ public class ICheckBoxList extends JList {
                 model.addElement(items.elementAt(index));\r
             }\r
         }\r
+        \r
+        //\r
+        // If there exists at least one item, set first item selected.\r
+        //\r
+        if (model.size() > 0) {\r
+            ICheckBoxListItem listItem = (ICheckBoxListItem) model.get(0);\r
+            listItem.setSelected(true);\r
+        }\r
         this.setCellRenderer(cellrenderer);\r
         this.setModel(model);\r
         this.addMouseListener(listener);\r
@@ -69,6 +77,14 @@ public class ICheckBoxList extends JList {
                 model.addElement(new ICheckBoxListItem(items.elementAt(index)));\r
             }\r
         }\r
+        \r
+        //\r
+        // If there exists at least one item, set first item selected.\r
+        //\r
+        if (model.size() > 0) {\r
+            ICheckBoxListItem listItem = (ICheckBoxListItem) model.get(0);\r
+            listItem.setSelected(true);\r
+        }\r
     }\r
 \r
     /**\r
@@ -149,6 +165,15 @@ public class ICheckBoxList extends JList {
                 }\r
             }\r
         }\r
+        \r
+        //\r
+        // If there exists at least one item, set first item selected.\r
+        //\r
+        if (model.size() > 0) {\r
+            ICheckBoxListItem listItem = (ICheckBoxListItem) model.get(0);\r
+            listItem.setSelected(true);\r
+        }\r
+        \r
         this.validate();\r
     }\r
     \r
index 39fa641d0e5596f0340d8a4c8dbd2e96da269d39..a087887e2f4ad0e793846a1034d4741cc3dd3aa1 100644 (file)
@@ -22,6 +22,8 @@ public class ICheckBoxListItem {
     protected String text;\r
 \r
     protected boolean checked;\r
+    \r
+    protected boolean selected;\r
 \r
     /**\r
      This is the default constructor to set check box item string\r
@@ -71,4 +73,12 @@ public class ICheckBoxListItem {
         this.text = text;\r
     }\r
 \r
+    public boolean isSelected() {\r
+        return selected;\r
+    }\r
+\r
+    public void setSelected(boolean selected) {\r
+        this.selected = selected;\r
+    }\r
+\r
 }\r