Search in sources :

Example 26 with CCDropDownMenu

use of com.sun.web.ui.view.html.CCDropDownMenu 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 27 with CCDropDownMenu

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

the class IdentitySubjectEditViewBean method handleBtnFilterRequest.

/**
     * Handles filter results request.
     *
     * @param event Request invocation event.
     */
public void handleBtnFilterRequest(RequestInvocationEvent event) {
    CCDropDownMenu menu = (CCDropDownMenu) getChild(FILTER_TYPE);
    setPageSessionAttribute(ENTITY_TYPE, (String) menu.getValue());
    super.handleBtnFilterRequest(event);
}
Also used : CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu)

Example 28 with CCDropDownMenu

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

the class TimeConditionHelper method setTimeZone.

public void setTimeZone(ConditionOpViewBeanBase viewBean, boolean canModify, String tz) {
    if ((tz != null) && (tz.trim().length() > 0)) {
        AMPropertySheetModel propModel = viewBean.getPropertySheetModel();
        if (canModify) {
            CCDropDownMenu list = (CCDropDownMenu) viewBean.getChild(STANDARDTIMEZONE);
            OptionList optList = list.getOptions();
            if ((optList != null) && optList.hasValue(tz)) {
                propModel.setValue(STANDARDTIMEZONE, tz);
                propModel.setValue(RADIOTIMEZONE, "standard");
            } else {
                propModel.setValue(CUSTOMTIMEZONE, tz);
                propModel.setValue(RADIOTIMEZONE, "custom");
            }
        } else {
            String[] ids = TimeZone.getAvailableIDs();
            boolean contains = false;
            for (int i = 0; (i < ids.length) && !contains; i++) {
                contains = ids[i].equals(tz);
            }
            if (contains) {
                propModel.setValue(STANDARDTIMEZONE, tz);
                propModel.setValue(RADIOTIMEZONE, "standard");
            } else {
                propModel.setValue(CUSTOMTIMEZONE, tz);
                propModel.setValue(RADIOTIMEZONE, "custom");
            }
        }
    }
}
Also used : AMPropertySheetModel(com.sun.identity.console.base.model.AMPropertySheetModel) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) OptionList(com.iplanet.jato.view.html.OptionList)

Example 29 with CCDropDownMenu

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

the class ConfigureOAuth2ViewBean method beginDisplay.

public void beginDisplay(DisplayEvent e) {
    try {
        OAuth2Model model = (OAuth2Model) getModel();
        Set realms = model.getRealms();
        CCDropDownMenu menuRealm = (CCDropDownMenu) getChild(REALM);
        menuRealm.setOptions(createOptionList(realms));
        String realm = getRequestContext().getRequest().getParameter("realm");
        if (realm != null && !realm.trim().isEmpty()) {
            setDisplayFieldValue(REALM, realm);
        }
        final String titleMessage = model.getLocalizedString(TITLE_MESSAGE);
        ptModel.setPageTitleText(MessageFormat.format(titleMessage, model.getDisplayName()));
        ptModel.setPageTitleHelpMessage(model.getLocalizedHelpMessage());
    } catch (AMConsoleException ex) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", ex.getMessage());
    }
}
Also used : Set(java.util.Set) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) OAuth2Model(com.sun.identity.console.task.model.OAuth2Model) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu)

Example 30 with CCDropDownMenu

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

the class SMProfileViewBean method beginDisplay.

/**
     * Sets the required information to display the page.
     *
     * @param event display event.
     * @throws ModelControlException if problem access value of component.
     */
public void beginDisplay(DisplayEvent event) throws ModelControlException {
    if (validSession) {
        super.beginDisplay(event);
        SMProfileModel model = (SMProfileModel) getModel();
        Map map = model.getServerNames();
        OptionList optList = new OptionList();
        CCDropDownMenu child = (CCDropDownMenu) getChild(CHILD_SERVER_NAME_MENU);
        String value = (String) child.getValue();
        if (map != null && !map.isEmpty()) {
            for (Iterator iter = map.keySet().iterator(); iter.hasNext(); ) {
                String str = (String) iter.next();
                String val = (String) map.get(str);
                optList.add(str, val);
                if (value == null) {
                    child.setValue(val);
                }
            }
        }
        child.setOptions(optList);
        value = (String) child.getValue();
        model.setProfileServerName(value);
        SMSessionCache cache = null;
        try {
            cache = model.getSessionCache(getFilterString());
            if (cache != null) {
                populateTableModel(cache.getSessions());
                String errorMessage = cache.getErrorMessage();
                if (errorMessage != null && errorMessage.length() > 0) {
                    setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", errorMessage);
                }
            }
        } catch (AMConsoleException ae) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", ae.getMessage());
        }
        if (cache == null) {
            populateTableModel(Collections.EMPTY_LIST);
        }
        setPageSessionAttribute(SERVER_NAME, value);
        // Set our Sub-Tabs
        addSessionsTab(model, 1);
        // Both the SFO is Enabled and Repository Type has been Specified for view of HA Tabs.
        if ((!SystemPropertiesManager.get(CoreTokenConstants.IS_SFO_ENABLED, "false").equalsIgnoreCase("true")) && (SystemPropertiesManager.get(CoreTokenConstants.SYS_PROPERTY_SESSION_HA_REPOSITORY_TYPE, "None").equalsIgnoreCase("None"))) {
            removeSessionsTab();
        }
    }
}
Also used : SMSessionCache(com.sun.identity.console.session.model.SMSessionCache) SMProfileModel(com.sun.identity.console.session.model.SMProfileModel) Iterator(java.util.Iterator) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) OptionList(com.iplanet.jato.view.html.OptionList)

Aggregations

CCDropDownMenu (com.sun.web.ui.view.html.CCDropDownMenu)37 OptionList (com.iplanet.jato.view.html.OptionList)25 Set (java.util.Set)23 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)16 Map (java.util.Map)10 TaskModel (com.sun.identity.console.task.model.TaskModel)9 Iterator (java.util.Iterator)8 TreeSet (java.util.TreeSet)7 HashSet (java.util.HashSet)6 HttpServletRequest (javax.servlet.http.HttpServletRequest)6 IdentitySubjectModel (com.sun.identity.console.policy.model.IdentitySubjectModel)4 CCAddRemove (com.sun.web.ui.view.addremove.CCAddRemove)4 List (java.util.List)4 PolicyModel (com.sun.identity.console.policy.model.PolicyModel)2 OrderedSet (com.sun.identity.shared.datastruct.OrderedSet)2 HashMap (java.util.HashMap)2 View (com.iplanet.jato.view.View)1 Option (com.iplanet.jato.view.html.Option)1 AuthPropertiesModel (com.sun.identity.console.authentication.model.AuthPropertiesModel)1 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)1