Search in sources :

Example 1 with CCSelect

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

the class AuthToRealmEditViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    String filter = (String) getDisplayFieldValue(AuthToRealmHelper.ATTR_FILTER);
    if ((filter == null) || (filter.trim().length() == 0)) {
        setDisplayFieldValue(AuthToRealmHelper.ATTR_FILTER, "*");
    }
    try {
        Set realmNames = helper.getRealmNames(filter, (PolicyModel) getModel());
        if (realmNames.isEmpty()) {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "policy.condition.authtorealm.no.search.result.message");
        }
        if (realmValue != null) {
            realmNames.add(realmValue);
        }
        CCSelect sl = (CCSelect) getChild(AuthToRealmHelper.ATTR_VALUE);
        sl.setOptions(createOptionList(realmNames));
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
}
Also used : Set(java.util.Set) CCSelect(com.sun.web.ui.view.html.CCSelect) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 2 with CCSelect

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

the class AuthToServiceAddViewBean 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.isEmpty()) {
        realmNames.add("");
        CCSelect sl = (CCSelect) getChild(AuthToServiceHelper.ATTR_REALM);
        sl.setOptions(createOptionList(getLabelValueMap(realmNames)));
        String realm = null;
        if (!bRealmSelect) {
            realm = (String) realmNames.iterator().next();
            sl.setValue(realm);
        } else {
            realm = (String) sl.getValue();
        }
        setServiceNames(realm);
    } else {
        CCSelect slService = (CCSelect) getChild(AuthToServiceHelper.ATTR_SERVICE);
        slService.setOptions(new OptionList());
    }
}
Also used : Set(java.util.Set) CCSelect(com.sun.web.ui.view.html.CCSelect) OptionList(com.iplanet.jato.view.html.OptionList)

Example 3 with CCSelect

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

the class AuthToServiceAddViewBean method setServiceNames.

private void setServiceNames(String realm) {
    try {
        Set serviceNames = helper.getAssignedServiceNamesInRealm(realm, (PolicyModel) getModel());
        CCSelect slService = (CCSelect) getChild(AuthToServiceHelper.ATTR_SERVICE);
        slService.setOptions(createOptionList(serviceNames));
    } catch (AMConsoleException e) {
        if (!isInlineAlertMessageSet()) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        }
    }
}
Also used : Set(java.util.Set) CCSelect(com.sun.web.ui.view.html.CCSelect) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 4 with CCSelect

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

the class AuthToServiceEditViewBean method setServiceNames.

private void setServiceNames(String realm) {
    try {
        Set serviceNames = helper.getAssignedServiceNamesInRealm(realm, (PolicyModel) getModel());
        CCSelect slService = (CCSelect) getChild(AuthToServiceHelper.ATTR_SERVICE);
        slService.setOptions(createOptionList(serviceNames));
    } catch (AMConsoleException e) {
        if (!isInlineAlertMessageSet()) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        }
    }
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) CCSelect(com.sun.web.ui.view.html.CCSelect) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 5 with CCSelect

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

the class ReferralOpViewBeanBase method beginChildDisplay.

public boolean beginChildDisplay(ChildDisplayEvent event) {
    super.endDisplay(event);
    boolean display = true;
    String childName = event.getChildName();
    int syntax = Integer.parseInt((String) propertySheetModel.getValue(SYNTAX));
    if ((childName.indexOf(LBL_FILTER) != -1) || (childName.indexOf(BTN_FILTER) != -1) || (childName.indexOf(FILTER) != -1)) {
        display = (syntax == AMDisplayType.SYNTAX_SINGLE_CHOICE) || (syntax == AMDisplayType.SYNTAX_MULTIPLE_CHOICE);
    } else if (childName.indexOf(VALUES_TEXT_VALUE) != -1) {
        display = (syntax == AMDisplayType.SYNTAX_TEXTFIELD);
        Set values = getDefaultValues();
        if ((values != null) && !values.isEmpty()) {
            if (canModify) {
                CCTextField tf = (CCTextField) getChild(childName);
                tf.setValue(values.iterator().next());
            } else {
                CCStaticTextField tf = (CCStaticTextField) getChild(childName);
                tf.setValue(values.iterator().next());
            }
        }
    } else if (childName.indexOf(VALUES_SINGLE_CHOICE_VALUE) != -1) {
        display = (syntax == AMDisplayType.SYNTAX_SINGLE_CHOICE);
        if (display) {
            Set values = getDefaultValues();
            if (canModify) {
                CCSelect child = (CCSelect) getChild(childName);
                setPossibleValues(child);
                if ((values != null) && !values.isEmpty()) {
                    child.setValue(values.iterator().next());
                }
            } else {
                CCStaticTextField tf = (CCStaticTextField) getChild(childName);
                tf.setValue(values.iterator().next());
            }
        }
    } else if (childName.indexOf(VALUES_MULTIPLE_CHOICE_VALUE) != -1) {
        display = (syntax == AMDisplayType.SYNTAX_MULTIPLE_CHOICE);
        if (display) {
            Set values = getDefaultValues();
            if (canModify) {
                CCSelect child = (CCSelect) getChild(childName);
                setPossibleValues(child);
                if ((values != null) && !values.isEmpty()) {
                    child.setValues(values.toArray());
                }
            } else {
                CCStaticTextField tf = (CCStaticTextField) getChild(childName);
                tf.setValue(AMAdminUtils.getString(values, ",", false));
            }
        }
    }
    return display;
}
Also used : Set(java.util.Set) CCTextField(com.sun.web.ui.view.html.CCTextField) CCSelect(com.sun.web.ui.view.html.CCSelect) CCStaticTextField(com.sun.web.ui.view.html.CCStaticTextField)

Aggregations

CCSelect (com.sun.web.ui.view.html.CCSelect)16 Set (java.util.Set)15 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)7 OptionList (com.iplanet.jato.view.html.OptionList)5 HashSet (java.util.HashSet)5 AMModel (com.sun.identity.console.base.model.AMModel)2 Iterator (java.util.Iterator)2 Option (com.iplanet.jato.view.html.Option)1 PolicyModel (com.sun.identity.console.policy.model.PolicyModel)1 SelectRealmModel (com.sun.identity.console.policy.model.SelectRealmModel)1 OrderedSet (com.sun.identity.shared.datastruct.OrderedSet)1 CCStaticTextField (com.sun.web.ui.view.html.CCStaticTextField)1 CCTextField (com.sun.web.ui.view.html.CCTextField)1 HashMap (java.util.HashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 Map (java.util.Map)1 TreeSet (java.util.TreeSet)1