Search in sources :

Example 6 with OptionGroup

use of com.sun.webui.jsf.model.OptionGroup 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)

Example 7 with OptionGroup

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

the class WoodstockHandler method getWebComponentMenuOptions.

private static List getWebComponentMenuOptions(String appname, String modulename, List vsList, String monitorURL, HandlerContext handlerCtx) {
    String endpoint = monitorURL + "/applications/" + appname;
    List menuList = new ArrayList();
    if (modulename != null && !modulename.trim().equals("") && !appname.equals(modulename)) {
        endpoint += "/" + modulename;
    }
    if (vsList != null) {
        ListIterator vl = vsList.listIterator();
        while (vl.hasNext()) {
            String name = (String) vl.next();
            try {
                List servlets = new ArrayList(RestUtil.getChildMap(endpoint + "/" + name).keySet());
                if (!servlets.isEmpty()) {
                    OptionGroup menuOptions = getMenuOptions(servlets, name, "", true);
                    menuList.add(menuOptions);
                }
            } catch (Exception ex) {
                GuiUtil.getLogger().severe("Error in getWebComponentMenuOptions ; \nendpoint = " + endpoint + "/" + name + "method=GET");
            }
        }
    }
    return menuList;
}
Also used : OptionGroup(com.sun.webui.jsf.model.OptionGroup) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) ListIterator(java.util.ListIterator) IOException(java.io.IOException)

Aggregations

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