Search in sources :

Example 6 with Option

use of com.sun.webui.jsf.model.Option in project Payara by payara.

the class WoodstockHandler method getMenuOptions.

private static OptionGroup getMenuOptions(List values, String label, String label2, boolean addLabel) {
    if (values == null) {
        return null;
    }
    ArrayList nList = new ArrayList();
    Collections.sort(values);
    ListIterator nl = values.listIterator();
    while (nl.hasNext()) {
        String name = (String) nl.next();
        if (addLabel && label2.equals("")) {
            if (!label.equals(name)) {
                nList.add(new Option(label + "/" + name, name));
            } else {
                nList.add(new Option(name, name));
            }
        } else if (addLabel && !label2.equals("")) {
            nList.add(new Option(label2 + "/" + label + "/" + name, name));
        } else {
            nList.add(new Option(name, name));
        }
    }
    Option[] groupedOptions3 = (Option[]) nList.toArray(new Option[nList.size()]);
    OptionGroup jumpGroup3 = new OptionGroup();
    jumpGroup3.setLabel(label);
    jumpGroup3.setOptions(groupedOptions3);
    return jumpGroup3;
}
Also used : OptionGroup(com.sun.webui.jsf.model.OptionGroup) ArrayList(java.util.ArrayList) Option(com.sun.webui.jsf.model.Option) ListIterator(java.util.ListIterator)

Aggregations

Option (com.sun.webui.jsf.model.Option)6 ArrayList (java.util.ArrayList)5 Handler (com.sun.jsftemplating.annotation.Handler)4 OptionGroup (com.sun.webui.jsf.model.OptionGroup)4 List (java.util.List)4 ListIterator (java.util.ListIterator)3 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1