Search in sources :

Example 6 with CCOrderedListModel

use of com.sun.identity.console.ui.model.CCOrderedListModel in project OpenAM by OpenRock.

the class AMPropertySheet method setValuesToOrderedList.

private boolean setValuesToOrderedList(View view, String name, Object values, AMModel amModel, AMPropertySheetModel model) {
    boolean set = false;
    if (CCOrderedList.class.isInstance(view)) {
        ((CCOrderedList) view).resetStateData();
        CCOrderedListModel m = (CCOrderedListModel) model.getModel(name);
        if (Set.class.isInstance(values)) {
            Set sorted = new TreeSet(new OrderedListComparator());
            sorted.addAll((Set) values);
            if (sorted.size() == 1) {
                String tmp = (String) sorted.iterator().next();
                if (tmp.equals("[0]=")) {
                    sorted.clear();
                }
            }
            List list = new ArrayList();
            for (Iterator i = sorted.iterator(); i.hasNext(); ) {
                String val = (String) i.next();
                int idx = val.indexOf(']');
                idx = val.indexOf('=', idx);
                list.add(val.substring(idx + 1).trim());
            }
            m.setSelectedOptionList(AMViewBeanBase.createOptionList(list, amModel.getUserLocale(), false));
        }
        set = true;
    }
    return set;
}
Also used : TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) CCOrderedList(com.sun.identity.console.ui.view.CCOrderedList) ArrayList(java.util.ArrayList) CCUnOrderedList(com.sun.identity.console.ui.view.CCUnOrderedList) CCMapList(com.sun.identity.console.ui.view.CCMapList) CCEditableList(com.sun.web.ui.view.editablelist.CCEditableList) OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) CCOrderedList(com.sun.identity.console.ui.view.CCOrderedList) CCOrderedListModel(com.sun.identity.console.ui.model.CCOrderedListModel)

Aggregations

CCOrderedListModel (com.sun.identity.console.ui.model.CCOrderedListModel)6 CCAddRemoveModel (com.sun.web.ui.model.CCAddRemoveModel)4 CCEditableListModel (com.sun.web.ui.model.CCEditableListModel)4 Iterator (java.util.Iterator)4 CCMapListModel (com.sun.identity.console.ui.model.CCMapListModel)3 CCUnOrderedListModel (com.sun.identity.console.ui.model.CCUnOrderedListModel)3 CCMapList (com.sun.identity.console.ui.view.CCMapList)3 CCOrderedList (com.sun.identity.console.ui.view.CCOrderedList)3 CCUnOrderedList (com.sun.identity.console.ui.view.CCUnOrderedList)3 OrderedSet (com.sun.identity.shared.datastruct.OrderedSet)3 CCEditableList (com.sun.web.ui.view.editablelist.CCEditableList)3 HashSet (java.util.HashSet)3 LinkedHashSet (java.util.LinkedHashSet)3 Set (java.util.Set)3 TreeSet (java.util.TreeSet)3 ContainerView (com.iplanet.jato.view.ContainerView)2 View (com.iplanet.jato.view.View)2 OptionList (com.iplanet.jato.view.html.OptionList)2 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)2 AMPropertySheetModel (com.sun.identity.console.base.model.AMPropertySheetModel)2