use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class AMPropertySheetModel method extractAddRemoveOptions.
private String extractAddRemoveOptions(String strXML) {
int idx = strXML.indexOf(ADDREMOVE_LIST);
addRemoveOptions = new HashMap();
while (idx != -1) {
String name = getPropertyValue(strXML, idx, "name");
OptionList options = new OptionList();
idx = strXML.indexOf(">", idx);
int idx2 = strXML.indexOf("</cc>", idx);
int idx3 = strXML.indexOf("<option ", idx);
if ((idx2 != -1) && (idx3 != -1)) {
while ((idx3 != -1) && (idx3 < idx2)) {
int idx4 = strXML.indexOf("/>", idx3);
String label = getPropertyValue(strXML, idx4, "label");
String value = getPropertyValue(strXML, idx4, "value");
options.add(label, value);
strXML = strXML.substring(0, idx3) + strXML.substring(idx4 + 2);
idx3 = strXML.indexOf("<option ", idx);
idx2 = strXML.indexOf("</cc>", idx);
}
addRemoveOptions.put(name, options);
idx = strXML.indexOf(ADDREMOVE_LIST, idx2);
} else {
idx = strXML.indexOf(ADDREMOVE_LIST, idx);
}
}
return strXML;
}
use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class AMPropertySheetModel method parseNodeList.
private void parseNodeList(NodeList nodeList) {
if (nodeList != null) {
int length = nodeList.getLength();
mapOptionList = new HashMap<String, OptionList>();
for (int i = 0; i < length; i++) {
Node node = nodeList.item(i);
// Check node for name attribute.
if (node.hasAttributes()) {
NamedNodeMap nodeAttrs = node.getAttributes();
Node nameNode = nodeAttrs.getNamedItem(NAME_ATTRIBUTE);
Node tagclassNode = nodeAttrs.getNamedItem(CCDescriptor.CC_ELEMENT_TAGCLASS);
if ((nameNode != null) && (tagclassNode != null)) {
String name = nameNode.getNodeValue();
String v = tagclassNode.getNodeValue();
if (name.startsWith(DATE_MARKER_NAME)) {
String dateName = name.substring(DATE_MARKER_NAME.length());
dateComponents.add(dateName);
} else if (v != null) {
if (v.equals(CCTagClass.EDITABLELIST)) {
setModel(name, new CCEditableListModel());
} else if (v.equals(CCTagClass.PASSWORD)) {
passwordComponents.add(name);
} else if (v.equals(CCTagClass.RADIOBUTTON)) {
String def = getNodeDefaultValue(node);
if (def != null) {
radioDefaultValue.put(name, def);
}
}
childMap.put(name, v);
NodeList optionElements = ((Element) node).getElementsByTagName(VALUE_OPTION_TAG_NAME);
if (optionElements.getLength() > 0) {
OptionList optionList = new OptionList();
int numOptions = optionElements.getLength();
for (int j = 0; j < numOptions; j++) {
Node option = optionElements.item(j);
if (option.hasAttributes()) {
NamedNodeMap optAttrs = option.getAttributes();
optionList.add(j, optAttrs.getNamedItem(OPTION_LABEL_ATTR_NAME).getNodeValue(), optAttrs.getNamedItem(OPTION_VALUE_ATTR_NAME).getNodeValue());
}
}
mapOptionList.put(name, optionList);
}
}
if (name.equals(TBL_SUB_CONFIG)) {
hasSubConfigTable = true;
}
}
}
}
}
}
use of com.iplanet.jato.view.html.OptionList in project OpenAM by OpenRock.
the class ReferralOpViewBeanBase 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 referralType = (String) propertySheetModel.getValue(REFERRAL_TYPE);
Map mapLabels = model.getDisplayNameForReferralValues(realmName, referralType, values);
for (Iterator iter = values.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 ReferralOpViewBeanBase method setPossibleValues.
private void setPossibleValues(CCSelect selectView) {
String filter = (String) propertySheetModel.getValue(FILTER);
String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
String referralType = (String) propertySheetModel.getValue(REFERRAL_TYPE);
PolicyModel model = (PolicyModel) getModel();
ValidValues validValues = model.getReferralPossibleValues(realmName, referralType, filter);
if (validValues != null) {
int errCode = validValues.getErrorCode();
if (errCode == ValidValues.SIZE_LIMIT_EXCEEDED) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "policy.referral.sizelimit.exceeded.message");
} else if (errCode == ValidValues.SIZE_LIMIT_EXCEEDED) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "policy.referral.timelimit.exceeded.message");
}
OptionList optList = createOptionList(validValues.getSearchResults());
selectView.setOptions(optList);
}
}
use of com.iplanet.jato.view.html.OptionList 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);
}
Aggregations