use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class SAMLv2Base method populateAuthenticationContext.
/**
* For the given set of authContexts read from the extended metadata, populate the table and dropdown menu
* @param authContexts The set of SAMLv2AuthContexts read from the extended metadata
* @param tblAuthContextsModel The table model to populate
* @param dropdownContextRef The name of the context dropdown menu component to populate
*/
protected void populateAuthenticationContext(SAMLv2AuthContexts authContexts, CCActionTableModel tblAuthContextsModel, String dropdownContextRef) {
// Create lists from defaults that can be updated as there maybe custom entries from the extended metadata.
Set<String> contextNames = new LinkedHashSet<String>(DEFAULT_AUTH_CONTEXT_REF_NAMES);
OptionList options = new OptionList();
// Used to indicate no default context
options.add(getLabel("none"), "none");
for (String name : contextNames) {
options.add(getLabel(name), name);
}
// Need to compare the list from the metadata to the default list and any that are missing should be added
// to the set being shown in the console as they will be custom entries
Map<String, SAMLv2AuthContexts.SAMLv2AuthContext> contexts = authContexts.getCollections();
for (SAMLv2AuthContexts.SAMLv2AuthContext value : contexts.values()) {
if (contextNames.add(value.name)) {
options.add(getLabel(value.name), value.name);
}
}
CCDropDownMenu ac = (CCDropDownMenu) getChild(dropdownContextRef);
ac.setOptions(options);
tblAuthContextsModel.clear();
int i = 0;
for (String name : contextNames) {
populateAuthenticationContext(name, authContexts, i++, tblAuthContextsModel, dropdownContextRef);
}
}
use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class SubjectOpViewBeanBase method createOptionList.
protected OptionList createOptionList(Set values) {
OptionList optList = new OptionList();
if ((values != null) && !values.isEmpty()) {
PolicyModel model = (PolicyModel) getModel();
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
String subjectType = (String) propertySheetModel.getValue(SUBJECT_TYPE);
Map mapLabels = model.getDisplayNameForSubjectValues(realmName, subjectType, values);
List tmp = AMFormatUtils.sortItems(values, model.getUserLocale());
for (Iterator iter = tmp.iterator(); iter.hasNext(); ) {
String value = (String) iter.next();
optList.add((String) mapLabels.get(value), value);
}
}
return optList;
}
use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class SubjectOpViewBeanBase method setPossibleValues.
private void setPossibleValues(String childName) {
if (canModify) {
CCSelect selectView = (CCSelect) getChild(childName);
Set values = getValidValues();
if (values != null) {
OptionList optList = createOptionList(values);
selectView.setOptions(optList);
}
String defaultVal = "";
if (!bFilter) {
Set defaultsValues = getDefaultValues();
if ((defaultsValues != null) && !defaultsValues.isEmpty()) {
defaultVal = (String) defaultsValues.iterator().next();
}
selectView.setValue("");
}
} else {
if (!bFilter) {
Set defaultsValues = getDefaultValues();
propertySheetModel.setValue(childName, defaultsValues.iterator().next());
}
}
}
use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class SelectServiceTypeViewBean method getTypeOptions.
protected OptionList getTypeOptions() {
PolicyModel model = (PolicyModel) getModel();
String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
try {
Policy policy = getCachedPolicy().getPolicy();
Map map = model.getServiceTypeNames();
Map options = new HashMap();
for (Iterator iter = map.keySet().iterator(); iter.hasNext(); ) {
String name = (String) iter.next();
String label = (String) map.get(name);
if (model.requiredResourceName(policy, curRealm, name)) {
String[] param = { label };
String lbl = MessageFormat.format(model.getLocalizedString("policy.rules.withResourceName"), (Object[]) param);
options.put(name + "|" + WITH_RESOURCE_SUFFIX, lbl);
}
if (model.notRequiredResourceName(policy, curRealm, name)) {
String[] param = { label };
String lbl = MessageFormat.format(model.getLocalizedString("policy.rules.withoutResourceName"), (Object[]) param);
options.put(name + "|" + WITHOUT_RESOURCE_SUFFIX, lbl);
}
}
return AMFormatUtils.getSortedOptionList(options, model.getUserLocale());
} catch (AMConsoleException e) {
debug.message("SelectServiceTypeViewBean.getTypeOptions " + "creating empty option list");
return new OptionList();
}
}
use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class SubjectOpViewBeanBase method setAddRemoveModel.
protected void setAddRemoveModel() throws ModelControlException {
if (canModify) {
Set values = getValidValues();
CCAddRemove child = (CCAddRemove) getChild(VALUES_MULTIPLE_CHOICE_VALUE);
Set defaultValues = (bFilter) ? getValues() : getDefaultValues();
child.resetStateData();
if (values != null) {
if (defaultValues != null) {
values.removeAll(defaultValues);
}
addRemoveModel.setAvailableOptionList(createOptionList(values));
} else {
addRemoveModel.setAvailableOptionList(new OptionList());
}
addRemoveModel.setSelectedOptionList(createOptionList(defaultValues));
}
}
Aggregations