Search in sources :

Example 1 with Option

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

the class ServerEditGeneralViewBean method getParentSites.

private void getParentSites(String serverName, ServerSiteModel model) throws AMConsoleException {
    Set sites = model.getSiteNames();
    OptionList choices = createOptionList(sites);
    choices.add(0, new Option(model.getLocalizedString("none.site"), ""));
    String parentSite = model.getServerSite(serverName);
    if (parentSite == null) {
        parentSite = "";
    }
    CCDropDownMenu cb = (CCDropDownMenu) getChild(PARENT_SITE);
    cb.resetStateData();
    cb.setValue(parentSite);
    cb.setOptions(choices);
}
Also used : Set(java.util.Set) Option(com.iplanet.jato.view.html.Option) CCDropDownMenu(com.sun.web.ui.view.html.CCDropDownMenu) OptionList(com.iplanet.jato.view.html.OptionList)

Example 2 with Option

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

the class SelectTypeViewBeanBase method setDefaultServiceOption.

protected void setDefaultServiceOption(CCRadioButton rb) {
    OptionList optList = rb.getOptions();
    if ((optList != null) && (optList.size() > 0)) {
        Option opt = optList.get(0);
        rb.setValue(opt.getValue());
    }
}
Also used : Option(com.iplanet.jato.view.html.Option) OptionList(com.iplanet.jato.view.html.OptionList)

Example 3 with Option

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

the class IdentityMembershipHelper method getSelectedIdentities.

/**
     * Returns a map of
     * <code>AMIdentityMembershipCondition.AM_IDENTITY_NAME</code> to a set
     * of identity IDs.
     *
     * @param child Add Remove Child Component which contains the selected
     *        identity IDs.
     * @return a map of
     *         <code>AMIdentityMembershipCondition.AM_IDENTITY_NAME</code>
     *         to a set of identity IDs.
     */
public static Map getSelectedIdentities(CCAddRemove child) {
    Map map = new HashMap(2);
    child.restoreStateData();
    CCAddRemoveModel addRemoveModel = (CCAddRemoveModel) child.getModel();
    OptionList selected = addRemoveModel.getSelectedOptionList();
    Set setValues = new HashSet();
    for (int i = 0; i < selected.size(); i++) {
        Option opt = selected.get(i);
        setValues.add(opt.getValue());
    }
    map.put(AMIdentityMembershipCondition.AM_IDENTITY_NAME, setValues);
    return map;
}
Also used : CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) Option(com.iplanet.jato.view.html.Option) HashMap(java.util.HashMap) Map(java.util.Map) OptionList(com.iplanet.jato.view.html.OptionList) HashSet(java.util.HashSet)

Example 4 with Option

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

the class CCOrderedList method getOptions.

protected String getOptions(OptionList optionList) {
    StringBuilder buffer = new StringBuilder();
    if (optionList != null) {
        for (int i = 0; i < optionList.size(); i++) {
            Option option = optionList.get(i);
            if (option != null) {
                if (buffer.length() > 0) {
                    buffer.append(CCOrderedListModelBase.SEPARATOR);
                }
                String label = option.getLabel();
                if (label.length() == 0) {
                    label = " ";
                }
                String value = option.getValue();
                if (value.length() == 0) {
                    value = " ";
                }
                buffer.append(label).append(CCOrderedListModelBase.SEPARATOR).append(value);
            }
        }
    }
    return buffer.toString();
}
Also used : Option(com.iplanet.jato.view.html.Option)

Example 5 with Option

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

the class AMPropertySheet method setValuesToAddRemove.

private boolean setValuesToAddRemove(View view, String name, Object values, AMModel amModel, AMPropertySheetModel model) {
    boolean set = false;
    if (CCAddRemove.class.isInstance(view)) {
        CCAddRemoveModel m = (CCAddRemoveModel) model.getModel(name);
        if (Set.class.isInstance(values)) {
            Set selectedSet = (Set) values;
            OptionList possibleOptions = model.getAddRemoveAvailOptions(name);
            if (possibleOptions != null) {
                OptionList availOptions = new OptionList();
                if ((selectedSet != null) && !selectedSet.isEmpty()) {
                    OptionList optList = new OptionList();
                    for (Iterator i = selectedSet.iterator(); i.hasNext(); ) {
                        String val = (String) i.next();
                        optList.add(possibleOptions.getValueLabel(val), val);
                    }
                    m.setSelectedOptionList(optList);
                    for (int i = 0; i < possibleOptions.size(); i++) {
                        Option opt = possibleOptions.get(i);
                        if (!selectedSet.contains(opt.getValue())) {
                            availOptions.add(opt);
                        }
                    }
                    m.setAvailableOptionList(availOptions);
                } else {
                    m.setAvailableOptionList(possibleOptions);
                }
            } else {
                m.setSelectedOptionList(AMViewBeanBase.createOptionList(selectedSet, amModel.getUserLocale()));
            }
        }
        set = true;
    }
    return set;
}
Also used : CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) Iterator(java.util.Iterator) Option(com.iplanet.jato.view.html.Option) OptionList(com.iplanet.jato.view.html.OptionList)

Aggregations

Option (com.iplanet.jato.view.html.Option)11 OptionList (com.iplanet.jato.view.html.OptionList)7 Set (java.util.Set)6 HashSet (java.util.HashSet)4 OrderedSet (com.sun.identity.shared.datastruct.OrderedSet)3 CCAddRemoveModel (com.sun.web.ui.model.CCAddRemoveModel)3 CCSelectableList (com.sun.web.ui.view.html.CCSelectableList)2 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 LinkedHashSet (java.util.LinkedHashSet)2 Map (java.util.Map)2 TreeSet (java.util.TreeSet)2 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)1 RMRealmModel (com.sun.identity.console.realm.model.RMRealmModel)1 CCDropDownMenu (com.sun.web.ui.view.html.CCDropDownMenu)1 CCSelect (com.sun.web.ui.view.html.CCSelect)1