Merge "Fix [2944349] - WDocAction panel not assigning selected item" from /release

Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2944349
This commit is contained in:
Heng Sin Low 2010-02-02 03:57:19 +00:00
parent ff099422bd
commit 4d1300ed0f
1 changed files with 8 additions and 1 deletions

View File

@ -176,6 +176,7 @@ public class WDocActionPanel extends Window implements EventListener
* Fill actionCombo * Fill actionCombo
*/ */
boolean firstadded = true;
for (int i = 0; i < index; i++) for (int i = 0; i < index; i++)
{ {
// Serach for option and add it // Serach for option and add it
@ -185,11 +186,17 @@ public class WDocActionPanel extends Window implements EventListener
{ {
if (options[i].equals(s_value[j])) if (options[i].equals(s_value[j]))
{ {
lstDocAction.appendItem(s_name[j],s_value[j]); Listitem newitem = lstDocAction.appendItem(s_name[j],s_value[j]);
if (firstadded) {
// select by default the first added item - can be changed below
lstDocAction.setSelectedItem(newitem);
firstadded = false;
}
added = true; added = true;
} }
} }
} }
// look if the current DocAction is within the list and assign it as selected if it exists
List<Listitem> lst = (List<Listitem>)lstDocAction.getItems(); List<Listitem> lst = (List<Listitem>)lstDocAction.getItems();
for(Listitem item: lst) for(Listitem item: lst)
{ {