Search in sources :

Example 11 with OptionList

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

the class EntityEditViewBean method getOptionListForEntities.

protected OptionList getOptionListForEntities(Collection entities) {
    OptionList optList = new OptionList();
    if ((entities != null) && !entities.isEmpty()) {
        EntitiesModel model = (EntitiesModel) getModel();
        Map lookup = new HashMap(entities.size() * 2);
        Set unsorted = new HashSet(entities.size() * 2);
        for (Iterator iter = entities.iterator(); iter.hasNext(); ) {
            AMIdentity entity = (AMIdentity) iter.next();
            String name = AMFormatUtils.getIdentityDisplayName(model, entity);
            String universalId = IdUtils.getUniversalId(entity);
            lookup.put(universalId, name);
            unsorted.add(name);
        }
        List list = AMFormatUtils.sortItems(unsorted, model.getUserLocale());
        for (Iterator iter = list.iterator(); iter.hasNext(); ) {
            String name = (String) iter.next();
            String id = null;
            String tmp = null;
            for (Iterator it = lookup.keySet().iterator(); it.hasNext(); ) {
                id = (String) it.next();
                if (lookup.get(id).equals(name)) {
                    tmp = name + "(" + LDAPUtils.rdnValueFromDn(id) + ")";
                    optList.add(tmp, id);
                }
            }
        }
    }
    return optList;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) AMIdentity(com.sun.identity.idm.AMIdentity) Iterator(java.util.Iterator) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) OptionList(com.iplanet.jato.view.html.OptionList) EntitiesModel(com.sun.identity.console.idm.model.EntitiesModel) HashSet(java.util.HashSet)

Example 12 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.
     * @return a option list object that contains options for a given
     *        collection of string.
     */
public OptionList createOptionList(Collection collection) {
    OptionList optionList = new OptionList();
    if ((collection != null) && !collection.isEmpty()) {
        // first sort the entries in the collection
        collection = AMFormatUtils.sortItems(collection, getModel().getUserLocale());
        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 13 with OptionList

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

the class AMViewBeanBase method createOptionList.

// End of Abstract Methods ------------------------------------------------
/**
     * 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 OptionList createOptionList(Map map) {
    OptionList optionList = new OptionList();
    if ((map != null) && !map.isEmpty()) {
        List sorted = AMFormatUtils.sortItems(map.values(), getModel().getUserLocale());
        Map reversed = AMFormatUtils.reverseStringMap(map);
        for (Iterator iter = sorted.iterator(); iter.hasNext(); ) {
            String label = (String) iter.next();
            optionList.add(label, (String) reversed.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)

Example 14 with OptionList

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

the class AMViewBeanBase method getList.

/**
     * Returns a list of string from a option list items.
     *
     * @param optList Option list that contains the items.
     * @return list of string from a option list items.
     */
public static List getList(OptionList optList) {
    int sz = optList.size();
    List list = new ArrayList(sz);
    for (int i = 0; i < sz; i++) {
        list.add(optList.getValue(i));
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) OptionList(com.iplanet.jato.view.html.OptionList)

Example 15 with OptionList

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

the class SubSchemaTypeSelectViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    SubConfigModel model = (SubConfigModel) getModel();
    Map createables = model.getCreateableSubSchemaNames();
    CCRadioButton rb = (CCRadioButton) getChild(RB_SUBCONFIG);
    OptionList optList = AMFormatUtils.getSortedOptionList(createables, model.getUserLocale());
    rb.setOptions(optList);
    String val = (String) rb.getValue();
    if ((val == null) || (val.length() == 0)) {
        rb.setValue(optList.getValue(0));
    }
}
Also used : CCRadioButton(com.sun.web.ui.view.html.CCRadioButton) SubConfigModel(com.sun.identity.console.service.model.SubConfigModel) Map(java.util.Map) 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