Search in sources :

Example 6 with CCCheckBox

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

the class ServerEditViewBeanBase method getAttributeValues.

protected Map<String, String> getAttributeValues() {
    Map<String, String> map = new HashMap<String, String>();
    for (String uiName : activePropertyNames) {
        View view = getChild(uiName);
        String value;
        if (view instanceof CCEditableList) {
            CCEditableList list = (CCEditableList) view;
            list.restoreStateData();
            // Create a comma delimited String from the items in the OptionList for storage.
            value = StringUtils.join(getValues(list.getModel().getOptionList()), ",");
        } else {
            value = (String) getDisplayFieldValue(uiName);
        }
        String propertyName = getActualPropertyName(uiName);
        if (view instanceof CCCheckBox) {
            value = (value.equals("true")) ? ServerPropertyValidator.getTrueValue(propertyName) : ServerPropertyValidator.getFalseValue(propertyName);
        }
        if (view instanceof CCPassword) {
            // encrypt and include in the map of attribute values to save
            if (!AMPropertySheetModel.passwordRandom.equals(value)) {
                value = AccessController.doPrivileged(new EncodeAction(value));
                map.put(propertyName, value);
            }
        } else {
            map.put(propertyName, value);
        }
    }
    return map;
}
Also used : CCEditableList(com.sun.web.ui.view.editablelist.CCEditableList) EncodeAction(com.sun.identity.security.EncodeAction) HashMap(java.util.HashMap) CCCheckBox(com.sun.web.ui.view.html.CCCheckBox) View(com.iplanet.jato.view.View) CCPassword(com.sun.web.ui.view.html.CCPassword)

Example 7 with CCCheckBox

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

the class SessionPropertyConditionEditViewBean method getConditionValues.

protected Map getConditionValues(boolean validate) {
    Map map = (Map) getPageSessionAttribute(SessionPropertyConditionHelper.PG_SESSION_PROPERTY_VALUES);
    if (map != null) {
        map.remove(SessionPropertyCondition.VALUE_CASE_INSENSITIVE);
        if (!validate || !map.isEmpty()) {
            CCCheckBox cb = (CCCheckBox) getChild(SessionPropertyConditionHelper.CB_CASE);
            Set set = new HashSet(2);
            set.add(cb.isChecked() ? "true" : "false");
            map.put(SessionPropertyCondition.VALUE_CASE_INSENSITIVE, set);
        }
    } else if (!validate) {
        map = new HashMap();
        setPageSessionAttribute(SessionPropertyConditionHelper.PG_SESSION_PROPERTY_VALUES, (HashMap) map);
        CCCheckBox cb = (CCCheckBox) getChild(SessionPropertyConditionHelper.CB_CASE);
        Set set = new HashSet(2);
        set.add(cb.isChecked() ? "true" : "false");
        map.put(SessionPropertyCondition.VALUE_CASE_INSENSITIVE, set);
    }
    return map;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) CCCheckBox(com.sun.web.ui.view.html.CCCheckBox) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) HashSet(java.util.HashSet)

Example 8 with CCCheckBox

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

the class SessionPropertyConditionAddViewBean method getConditionValues.

private Map getConditionValues(boolean validate) {
    Map map = (Map) getPageSessionAttribute(SessionPropertyConditionHelper.PG_SESSION_PROPERTY_VALUES);
    if (map != null) {
        map.remove(SessionPropertyCondition.VALUE_CASE_INSENSITIVE);
        if (!validate || !map.isEmpty()) {
            CCCheckBox cb = (CCCheckBox) getChild(SessionPropertyConditionHelper.CB_CASE);
            Set set = new HashSet(2);
            set.add(cb.isChecked() ? "true" : "false");
            map.put(SessionPropertyCondition.VALUE_CASE_INSENSITIVE, set);
        }
    } else if (!validate) {
        map = new HashMap();
        setPageSessionAttribute(SessionPropertyConditionHelper.PG_SESSION_PROPERTY_VALUES, (HashMap) map);
        CCCheckBox cb = (CCCheckBox) getChild(SessionPropertyConditionHelper.CB_CASE);
        Set set = new HashSet(2);
        set.add(cb.isChecked() ? "true" : "false");
        map.put(SessionPropertyCondition.VALUE_CASE_INSENSITIVE, set);
    }
    return map;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) CCCheckBox(com.sun.web.ui.view.html.CCCheckBox) HashMap(java.util.HashMap) HashMap(java.util.HashMap) Map(java.util.Map) HashSet(java.util.HashSet)

Example 9 with CCCheckBox

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

the class SMDiscoveryBootstrapRefOffViewBeanBase method setDirectiveMechIDMapping.

private void setDirectiveMechIDMapping(SMDiscoEntryData smDisco) {
    populateDirectiveMechIDRefs(smDisco);
    Map directives = smDisco.directives;
    Set directiveNames = directives.keySet();
    for (Iterator iter = DIRECTIVES_MECHID.iterator(); iter.hasNext(); ) {
        String directiveName = (String) iter.next();
        String childName = (String) MAP_DIRECTIVES_MECHID.get(directiveName);
        CCCheckBox cb = null;
        CCStaticTextField staticText = null;
        if (canModify) {
            cb = (CCCheckBox) getChild(childName.substring(0, childName.length() - 4));
        } else {
            staticText = (CCStaticTextField) getChild(childName.substring(0, childName.length() - 4));
        }
        if (directiveNames.contains(directiveName)) {
            List refIds = (List) directives.get(directiveName);
            if (canModify) {
                cb.setChecked(true);
                CCSelectableList child = (CCSelectableList) getChild(childName);
                if ((refIds != null) && !refIds.isEmpty()) {
                    child.setValues(refIds.toArray());
                } else {
                    child.setValues(null);
                }
            } else {
                staticText.setValue("true");
                CCStaticTextField child = (CCStaticTextField) getChild(childName);
                if ((refIds != null) && !refIds.isEmpty()) {
                    child.setValue(AMAdminUtils.getString(refIds, ",", false));
                } else {
                    child.setValue("");
                }
            }
        } else {
            if (canModify) {
                cb.setChecked(false);
            } else {
                staticText.setValue("false");
            }
        }
    }
}
Also used : Set(java.util.Set) CCCheckBox(com.sun.web.ui.view.html.CCCheckBox) Iterator(java.util.Iterator) CCSelectableList(com.sun.web.ui.view.html.CCSelectableList) CCSelectableList(com.sun.web.ui.view.html.CCSelectableList) ArrayList(java.util.ArrayList) CCEditableList(com.sun.web.ui.view.editablelist.CCEditableList) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) CCStaticTextField(com.sun.web.ui.view.html.CCStaticTextField)

Example 10 with CCCheckBox

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

the class FSSAMLSetTrustedPartnerTypeViewBean method setCheck.

private void setCheck(String childName) {
    CCCheckBox cb = (CCCheckBox) getChild(childName);
    cb.setChecked(true);
}
Also used : CCCheckBox(com.sun.web.ui.view.html.CCCheckBox)

Aggregations

CCCheckBox (com.sun.web.ui.view.html.CCCheckBox)11 Set (java.util.Set)6 HashMap (java.util.HashMap)5 Map (java.util.Map)4 View (com.iplanet.jato.view.View)3 CCEditableList (com.sun.web.ui.view.editablelist.CCEditableList)3 HashSet (java.util.HashSet)3 OptionList (com.iplanet.jato.view.html.OptionList)2 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)2 UMUserPasswordResetOptionsModel (com.sun.identity.console.user.model.UMUserPasswordResetOptionsModel)2 Iterator (java.util.Iterator)2 List (java.util.List)2 ContainerView (com.iplanet.jato.view.ContainerView)1 TaskModel (com.sun.identity.console.task.model.TaskModel)1 EncodeAction (com.sun.identity.security.EncodeAction)1 OrderedSet (com.sun.identity.shared.datastruct.OrderedSet)1 CCDropDownMenu (com.sun.web.ui.view.html.CCDropDownMenu)1 CCPassword (com.sun.web.ui.view.html.CCPassword)1 CCSelectableList (com.sun.web.ui.view.html.CCSelectableList)1 CCStaticTextField (com.sun.web.ui.view.html.CCStaticTextField)1