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);
}
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());
}
}
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;
}
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();
}
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;
}
Aggregations