Search in sources :

Example 26 with OptionList

use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.

the class AMPropertySheetModel method extractAddRemoveOptions.

private String extractAddRemoveOptions(String strXML) {
    int idx = strXML.indexOf(ADDREMOVE_LIST);
    addRemoveOptions = new HashMap();
    while (idx != -1) {
        String name = getPropertyValue(strXML, idx, "name");
        OptionList options = new OptionList();
        idx = strXML.indexOf(">", idx);
        int idx2 = strXML.indexOf("</cc>", idx);
        int idx3 = strXML.indexOf("<option ", idx);
        if ((idx2 != -1) && (idx3 != -1)) {
            while ((idx3 != -1) && (idx3 < idx2)) {
                int idx4 = strXML.indexOf("/>", idx3);
                String label = getPropertyValue(strXML, idx4, "label");
                String value = getPropertyValue(strXML, idx4, "value");
                options.add(label, value);
                strXML = strXML.substring(0, idx3) + strXML.substring(idx4 + 2);
                idx3 = strXML.indexOf("<option ", idx);
                idx2 = strXML.indexOf("</cc>", idx);
            }
            addRemoveOptions.put(name, options);
            idx = strXML.indexOf(ADDREMOVE_LIST, idx2);
        } else {
            idx = strXML.indexOf(ADDREMOVE_LIST, idx);
        }
    }
    return strXML;
}
Also used : HashMap(java.util.HashMap) OptionList(com.iplanet.jato.view.html.OptionList)

Example 27 with OptionList

use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.

the class AMPropertySheetModel method parseNodeList.

private void parseNodeList(NodeList nodeList) {
    if (nodeList != null) {
        int length = nodeList.getLength();
        mapOptionList = new HashMap<String, OptionList>();
        for (int i = 0; i < length; i++) {
            Node node = nodeList.item(i);
            // Check node for name attribute.
            if (node.hasAttributes()) {
                NamedNodeMap nodeAttrs = node.getAttributes();
                Node nameNode = nodeAttrs.getNamedItem(NAME_ATTRIBUTE);
                Node tagclassNode = nodeAttrs.getNamedItem(CCDescriptor.CC_ELEMENT_TAGCLASS);
                if ((nameNode != null) && (tagclassNode != null)) {
                    String name = nameNode.getNodeValue();
                    String v = tagclassNode.getNodeValue();
                    if (name.startsWith(DATE_MARKER_NAME)) {
                        String dateName = name.substring(DATE_MARKER_NAME.length());
                        dateComponents.add(dateName);
                    } else if (v != null) {
                        if (v.equals(CCTagClass.EDITABLELIST)) {
                            setModel(name, new CCEditableListModel());
                        } else if (v.equals(CCTagClass.PASSWORD)) {
                            passwordComponents.add(name);
                        } else if (v.equals(CCTagClass.RADIOBUTTON)) {
                            String def = getNodeDefaultValue(node);
                            if (def != null) {
                                radioDefaultValue.put(name, def);
                            }
                        }
                        childMap.put(name, v);
                        NodeList optionElements = ((Element) node).getElementsByTagName(VALUE_OPTION_TAG_NAME);
                        if (optionElements.getLength() > 0) {
                            OptionList optionList = new OptionList();
                            int numOptions = optionElements.getLength();
                            for (int j = 0; j < numOptions; j++) {
                                Node option = optionElements.item(j);
                                if (option.hasAttributes()) {
                                    NamedNodeMap optAttrs = option.getAttributes();
                                    optionList.add(j, optAttrs.getNamedItem(OPTION_LABEL_ATTR_NAME).getNodeValue(), optAttrs.getNamedItem(OPTION_VALUE_ATTR_NAME).getNodeValue());
                                }
                            }
                            mapOptionList.put(name, optionList);
                        }
                    }
                    if (name.equals(TBL_SUB_CONFIG)) {
                        hasSubConfigTable = true;
                    }
                }
            }
        }
    }
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) Node(org.w3c.dom.Node) NodeList(org.w3c.dom.NodeList) CCEditableListModel(com.sun.web.ui.model.CCEditableListModel) OptionList(com.iplanet.jato.view.html.OptionList)

Example 28 with OptionList

use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.

the class ReferralOpViewBeanBase method createOptionList.

protected OptionList createOptionList(Set values) {
    OptionList optList = new OptionList();
    if ((values != null) && !values.isEmpty()) {
        PolicyModel model = (PolicyModel) getModel();
        String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        String referralType = (String) propertySheetModel.getValue(REFERRAL_TYPE);
        Map mapLabels = model.getDisplayNameForReferralValues(realmName, referralType, values);
        for (Iterator iter = values.iterator(); iter.hasNext(); ) {
            String value = (String) iter.next();
            optList.add((String) mapLabels.get(value), value);
        }
    }
    return optList;
}
Also used : Iterator(java.util.Iterator) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) Map(java.util.Map) OptionList(com.iplanet.jato.view.html.OptionList)

Example 29 with OptionList

use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.

the class ReferralOpViewBeanBase method setPossibleValues.

private void setPossibleValues(CCSelect selectView) {
    String filter = (String) propertySheetModel.getValue(FILTER);
    String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    String referralType = (String) propertySheetModel.getValue(REFERRAL_TYPE);
    PolicyModel model = (PolicyModel) getModel();
    ValidValues validValues = model.getReferralPossibleValues(realmName, referralType, filter);
    if (validValues != null) {
        int errCode = validValues.getErrorCode();
        if (errCode == ValidValues.SIZE_LIMIT_EXCEEDED) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "policy.referral.sizelimit.exceeded.message");
        } else if (errCode == ValidValues.SIZE_LIMIT_EXCEEDED) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "policy.referral.timelimit.exceeded.message");
        }
        OptionList optList = createOptionList(validValues.getSearchResults());
        selectView.setOptions(optList);
    }
}
Also used : ValidValues(com.sun.identity.policy.ValidValues) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) OptionList(com.iplanet.jato.view.html.OptionList)

Example 30 with OptionList

use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.

the class ServerEditGeneralViewBean method getParentSites.

private void getParentSites(String serverName, ServerSiteModel model) throws AMConsoleException {
    Set sites = model.getSiteNames();
    OptionList choices = createOptionList(sites);
    choices.add(0, new Option(model.getLocalizedString("none.site"), ""));
    String parentSite = model.getServerSite(serverName);
    if (parentSite == null) {
        parentSite = "";
    }
    CCDropDownMenu cb = (CCDropDownMenu) getChild(PARENT_SITE);
    cb.resetStateData();
    cb.setValue(parentSite);
    cb.setOptions(choices);
}
Also used : Set(java.util.Set) Option(com.iplanet.jato.view.html.Option) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) OptionList(com.iplanet.jato.view.html.OptionList)

Aggregations

OptionList (com.iplanet.jato.view.html.OptionList)75 Set (java.util.Set)35 Iterator (java.util.Iterator)27 CCDropDownMenu (com.sun.web.ui.view.html.CCDropDownMenu)25 Map (java.util.Map)24 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)21 HashSet (java.util.HashSet)17 List (java.util.List)15 HashMap (java.util.HashMap)13 ArrayList (java.util.ArrayList)9 Option (com.iplanet.jato.view.html.Option)7 CCAddRemoveModel (com.sun.web.ui.model.CCAddRemoveModel)7 CCAddRemove (com.sun.web.ui.view.addremove.CCAddRemove)7 EntitiesModel (com.sun.identity.console.idm.model.EntitiesModel)6 PolicyModel (com.sun.identity.console.policy.model.PolicyModel)6 CCRadioButton (com.sun.web.ui.view.html.CCRadioButton)6 TreeSet (java.util.TreeSet)6 IdentitySubjectModel (com.sun.identity.console.policy.model.IdentitySubjectModel)5 TaskModel (com.sun.identity.console.task.model.TaskModel)5 CCSelect (com.sun.web.ui.view.html.CCSelect)5