use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class TimeConditionHelper method setTimeZoneOptions.
public void setTimeZoneOptions(boolean canModify, ConditionOpViewBeanBase viewBean, AMModel model) {
if (canModify) {
CCDropDownMenu list = (CCDropDownMenu) viewBean.getChild(STANDARDTIMEZONE);
OptionList optList = new OptionList();
String[] ids = TimeZone.getAvailableIDs();
Set set = new HashSet(ids.length * 2);
Map map = new HashMap(ids.length * 2);
for (int i = 0; i < ids.length; i++) {
String displayName = model.getLocalizedString(ids[i]);
set.add(displayName);
map.put(displayName, ids[i]);
}
List sorted = AMFormatUtils.sortItems(set, model.getUserLocale());
for (Iterator iter = sorted.iterator(); iter.hasNext(); ) {
String displayName = (String) iter.next();
optList.add(displayName, (String) map.get(displayName));
}
list.setOptions(optList);
}
}
use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class PolicyModelImpl method getAttrRadioBooleanChoiceValue.
private OptionList getAttrRadioBooleanChoiceValue(ActionSchema actionSchema, ResourceBundle rb) {
OptionList optionList = new OptionList();
String trueValue = actionSchema.getTrueValue();
String falseValue = actionSchema.getFalseValue();
if (trueValue == null) {
trueValue = "true";
}
if (falseValue == null) {
falseValue = "false";
}
String trueI18nKey = actionSchema.getTrueValueI18NKey();
String falseI18nKey = actionSchema.getFalseValueI18NKey();
if (trueI18nKey != null) {
String label = com.sun.identity.shared.locale.Locale.getString(rb, trueI18nKey, debug);
if ((label == null) || (label.length() == 0)) {
optionList.add(trueValue, trueValue);
} else {
optionList.add(label, trueValue);
}
} else {
optionList.add(trueValue, trueValue);
}
if (falseI18nKey != null) {
String label = com.sun.identity.shared.locale.Locale.getString(rb, falseI18nKey, debug);
if ((label == null) || (label.length() == 0)) {
optionList.add(falseValue, falseValue);
} else {
optionList.add(label, falseValue);
}
} else {
optionList.add(falseValue, falseValue);
}
return optionList;
}
use of com.iplanet.jato.view.html.OptionList 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;
}
use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class ReorderAuthChainsViewBean method beginDisplay.
public void beginDisplay(DisplayEvent event) throws ModelControlException {
super.beginDisplay(event);
CCOrderableList list = (CCOrderableList) getChild(REORDER_LIST);
CCOrderableListModel model = (CCOrderableListModel) list.getModel();
String xml = (String) getPageSessionAttribute(AuthConfigViewBean.ENTRY_LIST);
List chains = new ArrayList(AMAuthConfigUtils.xmlToAuthConfigurationEntry(xml));
OptionList optList = new OptionList();
int sz = chains.size();
for (int i = 0; i < sz; i++) {
AuthConfigurationEntry entry = (AuthConfigurationEntry) chains.get(i);
String name = entry.getLoginModuleName();
String flag = entry.getControlFlag();
String options = entry.getOptions();
String displayName = name + " - " + flag;
if ((options != null) && (options.trim().length() > 0)) {
displayName += " - " + options;
}
optList.add(displayName, Integer.toString(i));
}
model.setSelectedOptionList(optList);
}
use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class ActionTiledView method displaySingleChoiceAction.
private boolean displaySingleChoiceAction(ActionSchema actionSchema, String childName, int type, int syntax) {
boolean display = false;
RuleOpViewBeanBase parentVB = (RuleOpViewBeanBase) getParentViewBean();
String serviceType = (String) parentVB.propertySheetModel.getValue(RuleOpViewBeanBase.SERVICE_TYPE);
if (type == AMDisplayType.TYPE_SINGLE_CHOICE) {
CCDropDownMenu list = (CCDropDownMenu) getChild(childName);
OptionList optList = parentVB.getChoiceValues(serviceType, actionSchema);
list.setOptions(optList);
if ((optList != null) && (optList.size() > 0)) {
if (!parentVB.isSubmitCycle()) {
Set set = parentVB.getDefaultActionValues(actionSchema);
String value = ((set == null) || set.isEmpty()) ? optList.getValue(0) : (String) set.iterator().next();
list.setValue(value);
}
display = true;
}
}
return display;
}
Aggregations