Search in sources :

Example 6 with CCSelect

use of com.sun.web.ui.view.html.CCSelect in project OpenAM by OpenRock.

the class SelectRealmViewBean method setSchemes.

private void setSchemes(String realm) {
    if ((realm == null) || (realm.length() == 0)) {
        realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    }
    SelectRealmModel model = (SelectRealmModel) getModel();
    try {
        Set schemes = model.getAuthenticationInstances(realm);
        CCSelect sl = (CCSelect) getChild(ATTR_SCHEMES);
        sl.setOptions(createOptionList(schemes));
    } catch (AMConsoleException e) {
        if (!isInlineAlertMessageSet()) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        }
    }
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) CCSelect(com.sun.web.ui.view.html.CCSelect) SelectRealmModel(com.sun.identity.console.policy.model.SelectRealmModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 7 with CCSelect

use of com.sun.web.ui.view.html.CCSelect in project OpenAM by OpenRock.

the class SubjectOpViewBeanBase method setPossibleValues.

private void setPossibleValues(String childName) {
    if (canModify) {
        CCSelect selectView = (CCSelect) getChild(childName);
        Set values = getValidValues();
        if (values != null) {
            OptionList optList = createOptionList(values);
            selectView.setOptions(optList);
        }
        String defaultVal = "";
        if (!bFilter) {
            Set defaultsValues = getDefaultValues();
            if ((defaultsValues != null) && !defaultsValues.isEmpty()) {
                defaultVal = (String) defaultsValues.iterator().next();
            }
            selectView.setValue("");
        }
    } else {
        if (!bFilter) {
            Set defaultsValues = getDefaultValues();
            propertySheetModel.setValue(childName, defaultsValues.iterator().next());
        }
    }
}
Also used : Set(java.util.Set) CCSelect(com.sun.web.ui.view.html.CCSelect) OptionList(com.iplanet.jato.view.html.OptionList)

Example 8 with CCSelect

use of com.sun.web.ui.view.html.CCSelect in project OpenAM by OpenRock.

the class PMDefaultAuthSchemeConditionEditViewBean method setPropertiesValues.

protected void setPropertiesValues(Map values) {
    if ((values != null) && !values.isEmpty()) {
        for (Iterator i = values.keySet().iterator(); i.hasNext(); ) {
            String propName = (String) i.next();
            Set propValue = (Set) values.get(propName);
            if ((propValue != null) && !propValue.isEmpty()) {
                if (propName.equals(AuthSchemeCondition.AUTH_SCHEME) && canModify) {
                    Set val = (Set) values.get(propName);
                    AMModel model = getModel();
                    CCSelect sl = (CCSelect) getChild(AuthSchemeCondition.AUTH_SCHEME);
                    sl.setOptions(createOptionList(getLabelValueMap(propValue)));
                    propertySheetModel.setValues(propName, propValue.toArray(), model);
                } else {
                    StringBuilder strValue = new StringBuilder(16);
                    for (Iterator x = propValue.iterator(); x.hasNext(); ) {
                        String tmp = (String) x.next();
                        if (strValue.length() > 0) {
                            strValue.append(", ");
                        }
                        strValue.append(tmp);
                    }
                    setDisplayFieldValue(propName, strValue.toString());
                }
            }
        }
    }
}
Also used : Set(java.util.Set) AMModel(com.sun.identity.console.base.model.AMModel) Iterator(java.util.Iterator) CCSelect(com.sun.web.ui.view.html.CCSelect)

Example 9 with CCSelect

use of com.sun.web.ui.view.html.CCSelect in project OpenAM by OpenRock.

the class PMDefaultAuthSchemeConditionAddViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    CCSelect sl = (CCSelect) getChild(AuthSchemeCondition.AUTH_SCHEME);
    OptionList optList = sl.getOptions();
    if (optList != null) {
        int size = optList.size();
        String emptyRealm = getModel().getLocalizedString("policy.condition.null.realm");
        for (int i = 0; i < size; i++) {
            Option opt = optList.get(i);
            if (opt.getLabel().startsWith(":")) {
                opt.setLabel(emptyRealm + opt.getLabel());
            }
        }
    }
}
Also used : CCSelect(com.sun.web.ui.view.html.CCSelect) Option(com.iplanet.jato.view.html.Option) OptionList(com.iplanet.jato.view.html.OptionList)

Example 10 with CCSelect

use of com.sun.web.ui.view.html.CCSelect in project OpenAM by OpenRock.

the class PMDefaultAuthSchemeConditionAddViewBean method setPropertiesValues.

protected void setPropertiesValues(Map values) {
    if ((values != null) && !values.isEmpty()) {
        for (Iterator i = values.keySet().iterator(); i.hasNext(); ) {
            String propName = (String) i.next();
            if (propName.equals(AuthSchemeCondition.AUTH_SCHEME)) {
                Set val = (Set) values.get(propName);
                if ((val != null) && !val.isEmpty()) {
                    AMModel model = getModel();
                    CCSelect sl = (CCSelect) getChild(AuthSchemeCondition.AUTH_SCHEME);
                    sl.setOptions(createOptionList(getLabelValueMap(val)));
                    propertySheetModel.setValues(propName, val.toArray(), model);
                }
            }
        }
    }
}
Also used : Set(java.util.Set) AMModel(com.sun.identity.console.base.model.AMModel) Iterator(java.util.Iterator) CCSelect(com.sun.web.ui.view.html.CCSelect)

Aggregations

CCSelect (com.sun.web.ui.view.html.CCSelect)16 Set (java.util.Set)15 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)7 OptionList (com.iplanet.jato.view.html.OptionList)5 HashSet (java.util.HashSet)5 AMModel (com.sun.identity.console.base.model.AMModel)2 Iterator (java.util.Iterator)2 Option (com.iplanet.jato.view.html.Option)1 PolicyModel (com.sun.identity.console.policy.model.PolicyModel)1 SelectRealmModel (com.sun.identity.console.policy.model.SelectRealmModel)1 OrderedSet (com.sun.identity.shared.datastruct.OrderedSet)1 CCStaticTextField (com.sun.web.ui.view.html.CCStaticTextField)1 CCTextField (com.sun.web.ui.view.html.CCTextField)1 HashMap (java.util.HashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 Map (java.util.Map)1 TreeSet (java.util.TreeSet)1