Search in sources :

Example 1 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 2 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 3 with CCEditableList

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

the class ServerEditViewBeanBase method setConfigProperties.

private void setConfigProperties(String serverName, ServerSiteModel model) throws AMConsoleException {
    if (!submitCycle) {
        Map attributeValues = model.getServerConfiguration(serverName);
        for (String name : activePropertyNames) {
            String propertyName = getActualPropertyName(name);
            String val = (String) attributeValues.get(propertyName);
            if (val == null) {
                propertySheetModel.setValue(name, "");
            } else {
                View view = this.getChild(name);
                if (view instanceof CCCheckBox) {
                    String trueValue = ServerPropertyValidator.getTrueValue(propertyName);
                    String v = (val.equals(trueValue)) ? "true" : "false";
                    propertySheetModel.setValue(name, v);
                } else if (view instanceof CCEditableList) {
                    CCEditableList list = (CCEditableList) view;
                    list.resetStateData();
                    // The list is stored as a comma delimited String
                    list.getModel().setOptionList(CollectionUtils.asSet(val.split(",")));
                    propertySheetModel.setValue(name, val);
                } else {
                    propertySheetModel.setValue(name, XMLUtils.escapeSpecialCharacters(val));
                }
            }
        }
    }
}
Also used : CCEditableList(com.sun.web.ui.view.editablelist.CCEditableList) CCCheckBox(com.sun.web.ui.view.html.CCCheckBox) HashMap(java.util.HashMap) Map(java.util.Map) View(com.iplanet.jato.view.View)

Example 4 with CCEditableList

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

the class SiteEditViewBean method handleButton1Request.

/**
     * Handles create site request.
     *
     * @param event Request invocation event
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    submitCycle = true;
    String siteName = (String) getPageSessionAttribute(PG_ATTR_SITE_NAME);
    String primaryURL = (String) getDisplayFieldValue(TF_URL);
    CCEditableList elist = (CCEditableList) getChild(EDITABLE_FAILOVER_URLS);
    elist.restoreStateData();
    Set failoverURLs = getValues(elist.getModel().getOptionList());
    ServerSiteModel model = (ServerSiteModel) getModel();
    try {
        model.modifySite(siteName, primaryURL, failoverURLs);
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "siteconfig.updated");
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
    forwardTo();
}
Also used : CCEditableList(com.sun.web.ui.view.editablelist.CCEditableList) Set(java.util.Set) TreeSet(java.util.TreeSet) ServerSiteModel(com.sun.identity.console.service.model.ServerSiteModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 5 with CCEditableList

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

the class SiteEditViewBean method getFailoverURLs.

private void getFailoverURLs(String siteName, ServerSiteModel model) throws AMConsoleException {
    if (!submitCycle) {
        Set failoverURLs = model.getSiteFailoverURLs(siteName);
        CCEditableList elist = (CCEditableList) getChild(EDITABLE_FAILOVER_URLS);
        CCEditableListModel m = (CCEditableListModel) elist.getModel();
        elist.resetStateData();
        m.setOptionList(failoverURLs);
    }
}
Also used : CCEditableList(com.sun.web.ui.view.editablelist.CCEditableList) Set(java.util.Set) TreeSet(java.util.TreeSet) CCEditableListModel(com.sun.web.ui.model.CCEditableListModel)

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