Search in sources :

Example 71 with OptionList

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

the class ServicesSelectViewBean method setRadioButtons.

private void setRadioButtons(CCRadioButton rb) {
    try {
        EntitiesModel model = (EntitiesModel) getModel();
        String universalId = (String) getPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID);
        Map assigned = model.getAssignedServiceNames(universalId);
        Map assignables = model.getAssignableServiceNames(universalId);
        for (Iterator i = assigned.keySet().iterator(); i.hasNext(); ) {
            assignables.remove(i.next());
        }
        if (!assignables.isEmpty()) {
            OptionList optList = AMFormatUtils.getSortedOptionList(assignables, model.getUserLocale());
            rb.setOptions(optList);
            if (!submitCycle) {
                rb.setValue(optList.getValue(0));
            }
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
}
Also used : Iterator(java.util.Iterator) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) OptionList(com.iplanet.jato.view.html.OptionList) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel)

Example 72 with OptionList

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

the class IdentityMembershipConditionAddViewBean method beginDisplay.

/**
     * Sets the values to UI model.
     *
     * @param event Display Event.
     * @throws ModelControlException if the default UI model is not accessible.
     */
public void beginDisplay(DisplayEvent event) throws ModelControlException {
    IdentitySubjectModel subjectModel = getSubjectModel();
    PolicyModel model = (PolicyModel) getModel();
    super.beginDisplay(event);
    CCDropDownMenu menu = (CCDropDownMenu) getChild(FILTER_TYPE);
    Map supportedEntityTypes = model.getSupportedEntityTypes(realmName);
    OptionList entityTypes = createOptionList(supportedEntityTypes);
    entityTypes.add(0, "policy.subject.select.identity.type", "");
    menu.setOptions(entityTypes);
    menu.setValue("");
    // initialize the available/selected component
    CCAddRemove child = (CCAddRemove) getChild(VALUES_MULTIPLE_CHOICE_VALUE);
    child.restoreStateData();
    OptionList selected = addRemoveModel.getSelectedOptionList();
    OptionList possible = helper.createOptionList(model.getUserSSOToken(), model.getUserLocale(), this, getPossibleValues(subjectModel, realmName));
    child.resetStateData();
    addRemoveModel.setAvailableOptionList(possible);
}
Also used : IdentitySubjectModel(com.sun.identity.console.policy.model.IdentitySubjectModel) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) Map(java.util.Map) CCAddRemove(com.sun.web.ui.view.addremove.CCAddRemove) OptionList(com.iplanet.jato.view.html.OptionList)

Example 73 with OptionList

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

the class IdentityMembershipConditionEditViewBean method beginDisplay.

/**
     * Sets the values to UI model.
     *
     * @param event Display Event.
     */
public void beginDisplay(DisplayEvent event) throws ModelControlException {
    IdentitySubjectModel subjectModel = getSubjectModel();
    PolicyModel model = (PolicyModel) getModel();
    super.beginDisplay(event);
    if (!canModify) {
        Map mapValues = getDefaultValues();
        if ((mapValues != null) && !mapValues.isEmpty()) {
            Set values = (Set) mapValues.get(AMIdentityMembershipCondition.AM_IDENTITY_NAME);
            Set identityNames = helper.getAMIdentityNames(model.getUserSSOToken(), values);
            propertySheetModel.setValue(VALUES_MULTIPLE_CHOICE_VALUE, AMAdminUtils.getString(identityNames, ",", false));
        }
    } else {
        CCDropDownMenu menu = (CCDropDownMenu) getChild(FILTER_TYPE);
        Map supportedEntityTypes = model.getSupportedEntityTypes(realmName);
        OptionList entityTypes = createOptionList(supportedEntityTypes);
        entityTypes.add(0, "policy.subject.select.identity.type", "");
        menu.setOptions(entityTypes);
        menu.setValue("");
        CCAddRemove child = (CCAddRemove) getChild(VALUES_MULTIPLE_CHOICE_VALUE);
        child.restoreStateData();
        if (!submitCycle) {
            helper.setSelectedIdentities(child, model.getUserSSOToken(), model.getUserLocale(), this, getDefaultValues());
        } else {
            // initialize the available/selected component
            OptionList possible = helper.createOptionList(model.getUserSSOToken(), model.getUserLocale(), this, getPossibleValues(subjectModel, realmName));
            OptionList selected = addRemoveModel.getSelectedOptionList();
            List selectedIds = AMAdminUtils.toList(selected);
            child.resetStateData();
            addRemoveModel.setAvailableOptionList(possible);
            addRemoveModel.setSelectedOptionList(helper.createOptionList(model.getUserSSOToken(), model.getUserLocale(), this, selectedIds));
        }
    }
}
Also used : IdentitySubjectModel(com.sun.identity.console.policy.model.IdentitySubjectModel) Set(java.util.Set) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) Map(java.util.Map) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) CCAddRemove(com.sun.web.ui.view.addremove.CCAddRemove) OptionList(com.iplanet.jato.view.html.OptionList)

Example 74 with OptionList

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

the class IdentitySubjectEditViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    IdentitySubjectModel model = (IdentitySubjectModel) getModel();
    String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    Set values = null;
    if (bFilter) {
        Set defaultValue = getValues();
        if (defaultValue != null) {
            values = getAMIdentity(model, defaultValue);
        }
    } else {
        values = getAMIdentity(model, getDefaultValues(model));
    }
    super.beginDisplay(event);
    if (canModify) {
        Map supportedEntityTypes = model.getSupportedEntityTypes(realmName);
        CCDropDownMenu menu = (CCDropDownMenu) getChild(FILTER_TYPE);
        OptionList entityTypes = createOptionList(supportedEntityTypes);
        entityTypes.add(0, "policy.subject.select.identity.type", "");
        menu.setOptions(entityTypes);
        menu.setValue("");
        CCAddRemove child = (CCAddRemove) getChild(VALUES_MULTIPLE_CHOICE_VALUE);
        child.restoreStateData();
        OptionList selected = addRemoveModel.getSelectedOptionList();
        child.resetStateData();
        addRemoveModel.setAvailableOptionList(createOptionList(getPossibleValues(model, realmName, values)));
        if (submitCycle) {
            addRemoveModel.setSelectedOptionList(selected);
        } else {
            addRemoveModel.setSelectedOptionList(createOptionList(values));
        }
    } else {
        propertySheetModel.setValue(VALUES_MULTIPLE_CHOICE_VALUE, AMAdminUtils.getString(getDefaultValues(), ",", false));
    }
}
Also used : IdentitySubjectModel(com.sun.identity.console.policy.model.IdentitySubjectModel) HashSet(java.util.HashSet) Set(java.util.Set) Map(java.util.Map) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) CCAddRemove(com.sun.web.ui.view.addremove.CCAddRemove) OptionList(com.iplanet.jato.view.html.OptionList)

Example 75 with OptionList

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

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