/* returns the value of the first item in the listbox, if any */ private String getFirstListboxItem() { Option[] items = (Option[]) lbxItems.getItems(); if ((items != null) && items.length > 0) { Option item = items[0]; if (item != null) return (String) item.getValue(); } return null; }
public void initializePopedomList() { List list = TPopedomUtil.getAllPopedom(); List option = new ArrayList(); for (int i = 0; (list != null) && (i < list.size()); i++) { Option newoption = new Option(); TPopedom temp = (TPopedom) list.get(i); newoption.setValue(temp.getPopedomName()); option.add(newoption); } addRemoveList_configPopedom.setItems(option); }
/* * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) */ public int compare(Option opt1, Option opt2) { // if one object is null, ignore it and return the other as having precedence if (opt1 == null) return -1; if (opt2 == null) return 1; String label1 = opt1.getLabel(); String label2 = opt2.getLabel(); // compare label strings return label1.compareToIgnoreCase(label2); }