summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-23 02:51:55 +0000
committerhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-23 02:51:55 +0000
commit453a815ba0a3bdae7ec565b9a77549fb112b0c3d (patch)
tree42e4e4085fdb2eb06aeaf1e796afee7897875213
parentbf1168562b2634023053692b129c09fa8444f7ca (diff)
downloadedk2-platforms-453a815ba0a3bdae7ec565b9a77549fb112b0c3d.tar.xz
1. Update ICheckBoxList to add one attribute "selected". Set the first item of ICheckBoxList selected when it is inited.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1820 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxList.java25
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListItem.java10
2 files changed, 35 insertions, 0 deletions
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxList.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxList.java
index 2361c77e61..6fbdf03ddd 100644
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxList.java
+++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxList.java
@@ -50,6 +50,14 @@ public class ICheckBoxList extends JList {
model.addElement(items.elementAt(index));
}
}
+
+ //
+ // If there exists at least one item, set first item selected.
+ //
+ if (model.size() > 0) {
+ ICheckBoxListItem listItem = (ICheckBoxListItem) model.get(0);
+ listItem.setSelected(true);
+ }
this.setCellRenderer(cellrenderer);
this.setModel(model);
this.addMouseListener(listener);
@@ -69,6 +77,14 @@ public class ICheckBoxList extends JList {
model.addElement(new ICheckBoxListItem(items.elementAt(index)));
}
}
+
+ //
+ // If there exists at least one item, set first item selected.
+ //
+ if (model.size() > 0) {
+ ICheckBoxListItem listItem = (ICheckBoxListItem) model.get(0);
+ listItem.setSelected(true);
+ }
}
/**
@@ -149,6 +165,15 @@ public class ICheckBoxList extends JList {
}
}
}
+
+ //
+ // If there exists at least one item, set first item selected.
+ //
+ if (model.size() > 0) {
+ ICheckBoxListItem listItem = (ICheckBoxListItem) model.get(0);
+ listItem.setSelected(true);
+ }
+
this.validate();
}
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListItem.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListItem.java
index 39fa641d0e..a087887e2f 100644
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListItem.java
+++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/iCheckBoxList/ICheckBoxListItem.java
@@ -22,6 +22,8 @@ public class ICheckBoxListItem {
protected String text;
protected boolean checked;
+
+ protected boolean selected;
/**
This is the default constructor to set check box item string
@@ -71,4 +73,12 @@ public class ICheckBoxListItem {
this.text = text;
}
+ public boolean isSelected() {
+ return selected;
+ }
+
+ public void setSelected(boolean selected) {
+ this.selected = selected;
+ }
+
}