use of com.xpn.xwiki.internal.xml.XMLAttributeValueFilter in project xwiki-platform by xwiki.
the class BooleanClass method displayCheckboxEdit.
public void displayCheckboxEdit(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context) {
org.apache.ecs.xhtml.input check = new input(input.checkbox, prefix + name, 1);
check.setAttributeFilter(new XMLAttributeValueFilter());
check.setID(prefix + name);
check.setDisabled(isDisabled());
// If the (visible) checkbox is unchecked, it will not post anything back so the hidden input by the same
// name will post back 0 and the save function will save the first entry it finds.
org.apache.ecs.xhtml.input checkNo = new input(input.hidden, prefix + name, 0);
checkNo.setAttributeFilter(new XMLAttributeValueFilter());
try {
IntegerProperty prop = (IntegerProperty) object.safeget(name);
if (prop != null) {
Integer ivalue = (Integer) prop.getValue();
if (ivalue != null) {
int value = ivalue.intValue();
if (value == 1) {
check.setChecked(true);
} else if (value == 0) {
check.setChecked(false);
}
} else {
int value = getDefaultValue();
if (value == 1) {
check.setChecked(true);
} else {
check.setChecked(false);
}
}
}
} catch (Exception e) {
// This should not happen
e.printStackTrace();
}
buffer.append(check.toString());
buffer.append(checkNo.toString());
}
Aggregations