Added method findItemByValue() to ComponentsFinder
FEA: ItEr74S04BugFixing
This commit is contained in:
parent
7ee546afb2
commit
a19e4f53e6
1 changed files with 16 additions and 0 deletions
|
|
@ -26,6 +26,8 @@ import java.util.List;
|
||||||
|
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
import org.zkoss.zul.Grid;
|
import org.zkoss.zul.Grid;
|
||||||
|
import org.zkoss.zul.Listbox;
|
||||||
|
import org.zkoss.zul.Listitem;
|
||||||
import org.zkoss.zul.Row;
|
import org.zkoss.zul.Row;
|
||||||
import org.zkoss.zul.api.Rows;
|
import org.zkoss.zul.api.Rows;
|
||||||
|
|
||||||
|
|
@ -73,4 +75,18 @@ public class ComponentsFinder {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Listitem findItemByValue(Listbox listbox, Object needle) {
|
||||||
|
if (needle == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (Object each : listbox.getItems()) {
|
||||||
|
Listitem item = (Listitem) each;
|
||||||
|
Object value = item.getValue();
|
||||||
|
if (needle.toString().equals(value.toString())) {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue