Search in sources :

Example 66 with OptionList

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

the class AuthToServiceEditViewBean method beginDisplay.

/**
     * Set the realm names and service names.
     *
     * @param event Display event.
     * @throws ModelControlException if default <code>JATO</code> cannot be
     *         instantiated.
     */
public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    String filter = (String) getDisplayFieldValue(AuthToServiceHelper.ATTR_FILTER);
    if ((filter == null) || (filter.trim().length() == 0)) {
        setDisplayFieldValue(AuthToServiceHelper.ATTR_FILTER, "*");
    }
    Set realmNames = getRealmNames(filter);
    if (realmNames != null) {
        realmNames.add("");
    }
    boolean nolongExistRealm = false;
    String realmValue = (String) propertySheetModel.getValue(AuthToServiceHelper.ATTR_REALM);
    if (!bSearchForRealm && !bRealmSelect) {
        if (realmValue == null) {
            realmValue = "";
        }
        if (realmNames == null) {
            realmNames = new HashSet(2);
        }
        if (!realmNames.contains(realmValue)) {
            realmNames.add(realmValue);
            nolongExistRealm = true;
            if (!isInlineAlertMessageSet()) {
                String msg = getModel().getLocalizedString("policy.condition.authlevel.no.longer.exist.realm");
                String[] param = { realmValue };
                setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", MessageFormat.format(msg, (Object[]) param));
            }
        }
    }
    if ((realmNames != null) && !realmNames.isEmpty()) {
        CCSelect sl = (CCSelect) getChild(AuthToServiceHelper.ATTR_REALM);
        sl.setOptions(createOptionList(getLabelValueMap(realmNames)));
        String realm = (bSearchForRealm) ? (String) realmNames.iterator().next() : (String) sl.getValue();
        if (realm == null) {
            realm = realmValue;
            sl.setValue(realm);
        }
        if (!nolongExistRealm) {
            setServiceNames(realm);
        } else {
            CCSelect slService = (CCSelect) getChild(AuthToServiceHelper.ATTR_SERVICE);
            Set svcName = new HashSet(2);
            svcName.add(propertySheetModel.getValue(AuthToServiceHelper.ATTR_SERVICE));
            slService.setOptions(createOptionList(svcName));
        }
    } else {
        CCSelect slService = (CCSelect) getChild(AuthToServiceHelper.ATTR_SERVICE);
        slService.setOptions(new OptionList());
    }
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) CCSelect(com.sun.web.ui.view.html.CCSelect) OptionList(com.iplanet.jato.view.html.OptionList) HashSet(java.util.HashSet)

Example 67 with OptionList

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

the class ActionTiledView method displayMultipleChoiceAction.

private boolean displayMultipleChoiceAction(ActionSchema actionSchema, String childName, int type, int syntax) {
    boolean display = false;
    RuleOpViewBeanBase parentVB = (RuleOpViewBeanBase) getParentViewBean();
    String serviceType = (String) parentVB.propertySheetModel.getValue(RuleOpViewBeanBase.SERVICE_TYPE);
    if (type == AMDisplayType.TYPE_MULTIPLE_CHOICE) {
        CCSelectableList child = (CCSelectableList) getChild(childName);
        child.resetStateData();
        CCAddRemoveModel addRemoveModel = (CCAddRemoveModel) model.getModel(childName);
        Set defaultValues = parentVB.getValues(addRemoveModel.getSelectedOptionList());
        if ((defaultValues == null) || defaultValues.isEmpty()) {
            defaultValues = parentVB.getDefaultActionValues(actionSchema);
        }
        OptionList optList = parentVB.getChoiceValues(serviceType, actionSchema);
        int sz = optList.size();
        OptionList availList = new OptionList();
        for (int i = 0; i < sz; i++) {
            Option opt = (Option) optList.get(i);
            if (!defaultValues.contains(opt.getValue())) {
                availList.add(opt);
            }
        }
        addRemoveModel.setAvailableOptionList(availList);
        addRemoveModel.setSelectedOptionList(parentVB.createOptionList(defaultValues));
        display = true;
    }
    return display;
}
Also used : CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) Set(java.util.Set) CCSelectableList(com.sun.web.ui.view.html.CCSelectableList) Option(com.iplanet.jato.view.html.Option) OptionList(com.iplanet.jato.view.html.OptionList)

Example 68 with OptionList

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

the class AuthActionTiledView method displayModuleNameMenu.

private boolean displayModuleNameMenu(String childName, int index) {
    boolean display = false;
    AuthConfigViewBean parentVB = (AuthConfigViewBean) getParentViewBean();
    String value = parentVB.getModuleName(index);
    CCDropDownMenu list = (CCDropDownMenu) getChild(childName);
    OptionList optList = parentVB.getModuleNameChoiceValues();
    if ((optList != null) && (optList.size() > 0)) {
        if ((value != null) && (value.length() != 0)) {
            if (!containsOption(optList, value)) {
                optList.add(0, value, value);
            }
            list.setOptions(optList);
            list.setValue(value);
            display = true;
        }
    }
    return display;
}
Also used : CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) OptionList(com.iplanet.jato.view.html.OptionList)

Example 69 with OptionList

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

the class AuthActionTiledView method displayCriteriaMenu.

private boolean displayCriteriaMenu(String childName, int index) {
    boolean display = false;
    AuthConfigViewBean parentVB = (AuthConfigViewBean) getParentViewBean();
    CCDropDownMenu list = (CCDropDownMenu) getChild(childName);
    OptionList optList = parentVB.getCriteriaNameChoiceValues();
    list.setOptions(optList);
    if ((optList != null) && (optList.size() > 0)) {
        String value = parentVB.getModuleFlag(index);
        if ((value != null) && (value.length() != 0)) {
            list.setValue(value);
            display = true;
        }
    }
    return display;
}
Also used : CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) OptionList(com.iplanet.jato.view.html.OptionList)

Example 70 with OptionList

use of com.iplanet.jato.view.html.OptionList 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)

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