use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class ReorderAuthChainsViewBean method handleButton1Request.
/**
* Handles change request.
*
* @param event Request invocation event
*/
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
String xml = (String) getPageSessionAttribute(AuthConfigViewBean.ENTRY_LIST);
List chains = new ArrayList(AMAuthConfigUtils.xmlToAuthConfigurationEntry(xml));
List newChains = new ArrayList();
CCOrderableList list = (CCOrderableList) getChild(REORDER_LIST);
list.restoreStateData();
CCOrderableListModel model = (CCOrderableListModel) list.getModel();
OptionList optList = model.getSelectedOptionList();
int sz = optList.size();
for (int i = 0; i < sz; i++) {
String idx = optList.getValue(i);
int num = Integer.parseInt(idx);
newChains.add(chains.get(num));
}
setPageSessionAttribute(AuthConfigViewBean.ENTRY_LIST, AMAuthConfigUtils.authConfigurationEntryToXMLString(newChains));
forwardToAuthConfigViewBean();
}
use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class AuthPropertiesViewBean method populateConfigMenu.
private void populateConfigMenu() {
String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
if ((realm == null) || (realm.length() == 0)) {
realm = AMModelBase.getStartDN(getRequestContext().getRequest());
}
AuthPropertiesModel model = (AuthPropertiesModel) getModel();
OrderedSet configs = new OrderedSet();
configs.addAll(AuthConfigurationModelImpl.getNamedConfigurations(model.getUserSSOToken(), realm));
OptionList containers = new OptionList();
for (Iterator i = configs.iterator(); i.hasNext(); ) {
String entry = (String) i.next();
containers.add(entry, entry);
}
CCDropDownMenu ac = (CCDropDownMenu) getChild(AUTH_CONFIG);
ac.setOptions(containers);
CCDropDownMenu aac = (CCDropDownMenu) getChild(ADMIN_AUTH_CONFIG);
aac.setOptions(containers);
}
use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class ImportEntityViewBean method populateRealmData.
private void populateRealmData() {
Set realmNames = Collections.EMPTY_SET;
ImportEntityModel model = (ImportEntityModel) getModel();
try {
realmNames = model.getRealmNames("/", "*");
CCDropDownMenu menu = (CCDropDownMenu) getChild(ImportEntityModel.REALM_NAME);
OptionList sortedList = createOptionList(realmNames);
OptionList optList = new OptionList();
int size = sortedList.size();
for (int i = 0; i < size; i++) {
String name = sortedList.getValue(i);
optList.add(getPath(name), name);
}
menu.setOptions(optList);
} catch (AMConsoleException e) {
debug.warning("ImportEntityViewBean.populateRealmData ", e);
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "import.entity.populaterealmdata.error");
}
}
use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class AMViewBeanBase method createOptionList.
/**
* Returns an option list object that contains options for a given
* collection of string.
*
* @param collection Collection of strings to be included in option list.
* @param locale Locale defining how the entries should be sorted.
* @param bSort <code>true</code> to sort the options.
* @return a option list object that contains options for a given
* collection of string.
*/
public static OptionList createOptionList(Collection collection, Locale locale, boolean bSort) {
OptionList optionList = new OptionList();
if ((collection != null) && !collection.isEmpty()) {
if (bSort) {
collection = AMFormatUtils.sortItems(collection, locale);
}
for (Iterator iter = collection.iterator(); iter.hasNext(); ) {
String value = (String) iter.next();
optionList.add(value, value);
}
}
return optionList;
}
use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class AMViewBeanBase method createOptionList.
/**
* Returns a option list object that contains options for a given map
* of value to its localized string.
*
* @param map Map of value to its localized string.
* @return a option list object that contains options for a given map
* of value to its localized string.
*/
public static OptionList createOptionList(Map map, Locale locale) {
OptionList optionList = new OptionList();
if ((map != null) && !map.isEmpty()) {
Map reverseMap = AMFormatUtils.reverseStringMap(map);
List list = AMFormatUtils.sortKeyInMap(reverseMap, locale);
for (Iterator iter = list.iterator(); iter.hasNext(); ) {
String label = (String) iter.next();
optionList.add(label, (String) reverseMap.get(label));
}
}
return optionList;
}
Aggregations