Search in sources :

Example 51 with OptionList

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

the class ReorderAuthChainsViewBean method handleButton1Request.

/**
     * Handles change request.
     *
     * @param event Request invocation event
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    String xml = (String) getPageSessionAttribute(AuthConfigViewBean.ENTRY_LIST);
    List chains = new ArrayList(AMAuthConfigUtils.xmlToAuthConfigurationEntry(xml));
    List newChains = new ArrayList();
    CCOrderableList list = (CCOrderableList) getChild(REORDER_LIST);
    list.restoreStateData();
    CCOrderableListModel model = (CCOrderableListModel) list.getModel();
    OptionList optList = model.getSelectedOptionList();
    int sz = optList.size();
    for (int i = 0; i < sz; i++) {
        String idx = optList.getValue(i);
        int num = Integer.parseInt(idx);
        newChains.add(chains.get(num));
    }
    setPageSessionAttribute(AuthConfigViewBean.ENTRY_LIST, AMAuthConfigUtils.authConfigurationEntryToXMLString(newChains));
    forwardToAuthConfigViewBean();
}
Also used : CCOrderableListModel(com.sun.web.ui.model.CCOrderableListModel) ArrayList(java.util.ArrayList) CCOrderableList(com.sun.web.ui.view.orderablelist.CCOrderableList) ArrayList(java.util.ArrayList) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) CCOrderableList(com.sun.web.ui.view.orderablelist.CCOrderableList) OptionList(com.iplanet.jato.view.html.OptionList)

Example 52 with OptionList

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

the class AuthPropertiesViewBean method populateConfigMenu.

private void populateConfigMenu() {
    String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    if ((realm == null) || (realm.length() == 0)) {
        realm = AMModelBase.getStartDN(getRequestContext().getRequest());
    }
    AuthPropertiesModel model = (AuthPropertiesModel) getModel();
    OrderedSet configs = new OrderedSet();
    configs.addAll(AuthConfigurationModelImpl.getNamedConfigurations(model.getUserSSOToken(), realm));
    OptionList containers = new OptionList();
    for (Iterator i = configs.iterator(); i.hasNext(); ) {
        String entry = (String) i.next();
        containers.add(entry, entry);
    }
    CCDropDownMenu ac = (CCDropDownMenu) getChild(AUTH_CONFIG);
    ac.setOptions(containers);
    CCDropDownMenu aac = (CCDropDownMenu) getChild(ADMIN_AUTH_CONFIG);
    aac.setOptions(containers);
}
Also used : OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) Iterator(java.util.Iterator) AuthPropertiesModel(com.sun.identity.console.authentication.model.AuthPropertiesModel) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) OptionList(com.iplanet.jato.view.html.OptionList)

Example 53 with OptionList

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

the class ImportEntityViewBean method populateRealmData.

private void populateRealmData() {
    Set realmNames = Collections.EMPTY_SET;
    ImportEntityModel model = (ImportEntityModel) getModel();
    try {
        realmNames = model.getRealmNames("/", "*");
        CCDropDownMenu menu = (CCDropDownMenu) getChild(ImportEntityModel.REALM_NAME);
        OptionList sortedList = createOptionList(realmNames);
        OptionList optList = new OptionList();
        int size = sortedList.size();
        for (int i = 0; i < size; i++) {
            String name = sortedList.getValue(i);
            optList.add(getPath(name), name);
        }
        menu.setOptions(optList);
    } catch (AMConsoleException e) {
        debug.warning("ImportEntityViewBean.populateRealmData ", e);
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "import.entity.populaterealmdata.error");
    }
}
Also used : Set(java.util.Set) ImportEntityModel(com.sun.identity.console.federation.model.ImportEntityModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) OptionList(com.iplanet.jato.view.html.OptionList)

Example 54 with OptionList

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

the class AMViewBeanBase method createOptionList.

/**
      * Returns an option list object that contains options for a given
      * collection of string.
      *
      * @param collection Collection of strings to be included in option list.
      * @param locale Locale defining how the entries should be sorted.
      * @param bSort <code>true</code> to sort the options.
      * @return a option list object that contains options for a given
      *        collection of string.
      */
public static OptionList createOptionList(Collection collection, Locale locale, boolean bSort) {
    OptionList optionList = new OptionList();
    if ((collection != null) && !collection.isEmpty()) {
        if (bSort) {
            collection = AMFormatUtils.sortItems(collection, locale);
        }
        for (Iterator iter = collection.iterator(); iter.hasNext(); ) {
            String value = (String) iter.next();
            optionList.add(value, value);
        }
    }
    return optionList;
}
Also used : Iterator(java.util.Iterator) OptionList(com.iplanet.jato.view.html.OptionList)

Example 55 with OptionList

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

the class AMViewBeanBase method createOptionList.

/**
     * Returns a option list object that contains options for a given map
     * of value to its localized string.
     *
     * @param map Map of value to its localized string.
     * @return a option list object that contains options for a given map
     *        of value to its localized string.
     */
public static OptionList createOptionList(Map map, Locale locale) {
    OptionList optionList = new OptionList();
    if ((map != null) && !map.isEmpty()) {
        Map reverseMap = AMFormatUtils.reverseStringMap(map);
        List list = AMFormatUtils.sortKeyInMap(reverseMap, locale);
        for (Iterator iter = list.iterator(); iter.hasNext(); ) {
            String label = (String) iter.next();
            optionList.add(label, (String) reverseMap.get(label));
        }
    }
    return optionList;
}
Also used : Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) OptionList(com.iplanet.jato.view.html.OptionList) Map(java.util.Map) HashMap(java.util.HashMap) 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