Search in sources :

Example 6 with CCEditableList

use of com.sun.web.ui.view.editablelist.CCEditableList in project OpenAM by OpenRock.

the class AMPropertySheetModel method createChild.

public View createChild(View parent, String name, AMModel model) {
    String tagName = (String) childMap.get(name);
    View view = null;
    if (tagName != null) {
        if (tagName.equals(ORDERED_LIST)) {
            CCOrderedListModel m = new CCOrderedListModel();
            view = new CCOrderedList((ContainerView) parent, m, name);
            m.setAddButtonLabel(model.getLocalizedString("addremove.orderable.list.add.button"));
            m.setDeleteButtonLabel(model.getLocalizedString("addremove.orderable.list.delete.button"));
            setModel(name, m);
        } else if (tagName.equals(UNORDERED_LIST)) {
            CCUnOrderedListModel m = new CCUnOrderedListModel();
            view = new CCUnOrderedList((ContainerView) parent, m, name);
            setModel(name, m);
        } else if (tagName.equals(MAP_LIST) || tagName.equals(GLOBAL_MAP_LIST)) {
            CCMapListModel m = new CCMapListModel();
            view = new CCMapList((ContainerView) parent, m, name);
            m.setValueOptionList(mapOptionList.get(name));
            m.setKeyLabel(model.getLocalizedString("maplist.key.label"));
            m.setValueLabel(model.getLocalizedString("maplist.value.label"));
            m.setMsgInvalidEntry(model.getLocalizedString("maplist.msg.invalid.entry"));
            m.setMsgInvalidKey(model.getLocalizedString("maplist.msg.invalid.key"));
            m.setMsgInvalidValue(model.getLocalizedString("maplist.msg.invalid.value"));
            m.setMsgInvalidNoKey(model.getLocalizedString("maplist.msg.invalid.nokey"));
            setModel(name, m);
        } else if (tagName.equals(ADDREMOVE_LIST)) {
            CCAddRemoveModel m = (CCAddRemoveModel) getModel(name);
            if (m == null) {
                setModel(name, new CCAddRemoveModel());
            }
        }
    }
    if (view == null) {
        view = super.createChild(parent, name);
    }
    if (CCEditableList.class.isInstance(view)) {
        CCEditableList editable = (CCEditableList) view;
        CCEditableListModel m = (CCEditableListModel) editable.getModel();
        m.setAddBtnLabel(model.getLocalizedString("editableList.addButtonLabel"));
        m.setRemoveBtnLabel(model.getLocalizedString("editableList.deleteButtonLabel"));
    }
    children.add(view);
    return view;
}
Also used : CCEditableList(com.sun.web.ui.view.editablelist.CCEditableList) CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) CCMapListModel(com.sun.identity.console.ui.model.CCMapListModel) CCMapList(com.sun.identity.console.ui.view.CCMapList) CCUnOrderedListModel(com.sun.identity.console.ui.model.CCUnOrderedListModel) CCEditableListModel(com.sun.web.ui.model.CCEditableListModel) ContainerView(com.iplanet.jato.view.ContainerView) CCOrderedListModel(com.sun.identity.console.ui.model.CCOrderedListModel) CCOrderedList(com.sun.identity.console.ui.view.CCOrderedList) View(com.iplanet.jato.view.View) ContainerView(com.iplanet.jato.view.ContainerView) CCUnOrderedList(com.sun.identity.console.ui.view.CCUnOrderedList)

Example 7 with CCEditableList

use of com.sun.web.ui.view.editablelist.CCEditableList 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 8 with CCEditableList

use of com.sun.web.ui.view.editablelist.CCEditableList in project OpenAM by OpenRock.

the class AMPropertySheetModel method clear.

public void clear() {
    super.clear();
    for (Iterator iter = children.iterator(); iter.hasNext(); ) {
        View view = (View) iter.next();
        if (CCAddRemove.class.isInstance(view)) {
            CCAddRemoveModel m = (CCAddRemoveModel) getModel(view.getName());
            m.clear();
            m.setAvailableOptionList(new OptionList());
            m.setSelectedOptionList(new OptionList());
        } else if (CCEditableList.class.isInstance(view)) {
            CCEditableListModel m = (CCEditableListModel) getModel(view.getName());
            m.setOptionList(new OptionList());
            ((CCEditableList) view).resetStateData();
        } else if (CCOrderedList.class.isInstance(view)) {
            CCOrderedListModel m = (CCOrderedListModel) getModel(view.getName());
            m.setSelectedOptionList(new OptionList());
            ((CCOrderedList) view).resetStateData();
        } else if (CCUnOrderedList.class.isInstance(view)) {
            CCUnOrderedListModel m = (CCUnOrderedListModel) getModel(view.getName());
            m.setOptionList(new OptionList());
            ((CCUnOrderedList) view).resetStateData();
        } else if (CCMapList.class.isInstance(view)) {
            CCMapListModel m = (CCMapListModel) getModel(view.getName());
            m.setOptionList(new OptionList());
            ((CCMapList) view).resetStateData();
        } else {
            if (DisplayFieldImpl.class.isInstance(view)) {
                ((DisplayFieldImpl) view).setValues(null);
            }
        }
    }
}
Also used : DisplayFieldImpl(com.iplanet.jato.view.DisplayFieldImpl) CCEditableList(com.sun.web.ui.view.editablelist.CCEditableList) CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) CCMapListModel(com.sun.identity.console.ui.model.CCMapListModel) CCOrderedListModel(com.sun.identity.console.ui.model.CCOrderedListModel) CCOrderedList(com.sun.identity.console.ui.view.CCOrderedList) View(com.iplanet.jato.view.View) ContainerView(com.iplanet.jato.view.ContainerView) CCMapList(com.sun.identity.console.ui.view.CCMapList) Iterator(java.util.Iterator) CCEditableListModel(com.sun.web.ui.model.CCEditableListModel) CCUnOrderedListModel(com.sun.identity.console.ui.model.CCUnOrderedListModel) OptionList(com.iplanet.jato.view.html.OptionList) CCUnOrderedList(com.sun.identity.console.ui.view.CCUnOrderedList)

Example 9 with CCEditableList

use of com.sun.web.ui.view.editablelist.CCEditableList in project OpenAM by OpenRock.

the class ConditionOpViewBeanBase method getConditionValues.

protected Map getConditionValues(PolicyModel model, String realmName, String conditionType) {
    List propertyNames = model.getConditionPropertyNames(realmName, conditionType);
    Map values = new HashMap(propertyNames.size() * 2);
    for (Iterator iter = propertyNames.iterator(); iter.hasNext(); ) {
        String name = (String) iter.next();
        View child = getChild(name);
        if (child instanceof CCEditableList) {
            CCEditableList list = (CCEditableList) child;
            list.restoreStateData();
            CCEditableListModel m = (CCEditableListModel) list.getModel();
            Set selected = getValues(m.getOptionList());
            if ((selected != null) && !selected.isEmpty()) {
                values.put(name, selected);
            }
        } else {
            Object[] array = propertySheetModel.getValues(name);
            if ((array != null) && (array.length > 0)) {
                if (array.length == 1) {
                    String v = array[0].toString();
                    if ((v != null) && (v.trim().length() > 0)) {
                        Set val = new HashSet(2);
                        val.add(v.trim());
                        values.put(name, val);
                    }
                } else {
                    values.put(name, AMAdminUtils.toSet(array));
                }
            }
        }
    }
    return values;
}
Also used : CCEditableList(com.sun.web.ui.view.editablelist.CCEditableList) HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) Iterator(java.util.Iterator) CCEditableListModel(com.sun.web.ui.model.CCEditableListModel) CCEditableList(com.sun.web.ui.view.editablelist.CCEditableList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) View(com.iplanet.jato.view.View) HashSet(java.util.HashSet)

Example 10 with CCEditableList

use of com.sun.web.ui.view.editablelist.CCEditableList in project OpenAM by OpenRock.

the class SMDiscoveryBootstrapRefOffViewBeanBase method getValues.

protected SMDiscoEntryData getValues(boolean validated) throws AMConsoleException {
    SMDiscoEntryData smDisco = new SMDiscoEntryData();
    smDisco.abstractValue = ((String) propertySheetModel.getValue(ATTR_ABSTRACT)).trim();
    smDisco.serviceType = ((String) propertySheetModel.getValue(ATTR_SERVICE_TYPE)).trim();
    smDisco.providerId = ((String) propertySheetModel.getValue(ATTR_PROVIDER_ID)).trim();
    String optionFlag = (String) propertySheetModel.getValue(ATTR_RESOURCE_OFFERING_OPTIONS_OPTIONS);
    smDisco.noOption = optionFlag.equalsIgnoreCase("true");
    CCEditableList eList = (CCEditableList) getChild(ATTR_RESOURCE_OFFERING_OPTIONS_LIST);
    eList.restoreStateData();
    CCEditableListModel eModel = (CCEditableListModel) eList.getModel();
    OptionList options = eModel.getOptionList();
    if (options != null) {
        smDisco.options = AMAdminUtils.toList(options);
    }
    List descData = (List) removePageSessionAttribute(ATTR_SECURITY_MECH_ID);
    if (descData != null) {
        smDisco.descData = descData;
    }
    smDisco.directives = getDirectiveMechIDMapping();
    if (validated) {
        if ((descData == null) || descData.isEmpty()) {
            throw new AMConsoleException("discovery.service.bootstrapResOff.missing.service.desc.message");
        } else if (smDisco.serviceType.length() == 0) {
            throw new AMConsoleException("discovery.service.bootstrapResOff.missing.serviceType.message");
        } else if (smDisco.providerId.length() == 0) {
            throw new AMConsoleException("discovery.service.bootstrapResOff.missing.providerId.message");
        }
    }
    return smDisco;
}
Also used : CCEditableList(com.sun.web.ui.view.editablelist.CCEditableList) SMDiscoEntryData(com.sun.identity.console.service.model.SMDiscoEntryData) CCEditableListModel(com.sun.web.ui.model.CCEditableListModel) 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) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) OptionList(com.iplanet.jato.view.html.OptionList)

Aggregations

CCEditableList (com.sun.web.ui.view.editablelist.CCEditableList)12 CCEditableListModel (com.sun.web.ui.model.CCEditableListModel)7 View (com.iplanet.jato.view.View)6 Set (java.util.Set)6 CCUnOrderedList (com.sun.identity.console.ui.view.CCUnOrderedList)4 HashMap (java.util.HashMap)4 TreeSet (java.util.TreeSet)4 ContainerView (com.iplanet.jato.view.ContainerView)3 OptionList (com.iplanet.jato.view.html.OptionList)3 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)3 CCMapList (com.sun.identity.console.ui.view.CCMapList)3 CCOrderedList (com.sun.identity.console.ui.view.CCOrderedList)3 List (java.util.List)3 Map (java.util.Map)3 CCMapListModel (com.sun.identity.console.ui.model.CCMapListModel)2 CCOrderedListModel (com.sun.identity.console.ui.model.CCOrderedListModel)2 CCUnOrderedListModel (com.sun.identity.console.ui.model.CCUnOrderedListModel)2 CCAddRemoveModel (com.sun.web.ui.model.CCAddRemoveModel)2 CCCheckBox (com.sun.web.ui.view.html.CCCheckBox)2 ArrayList (java.util.ArrayList)2