use of com.xpn.xwiki.internal.xml.XMLAttributeValueFilter in project xwiki-platform by xwiki.
the class NumberClass method displayEdit.
@Override
public void displayEdit(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context) {
input input = new input();
input.setAttributeFilter(new XMLAttributeValueFilter());
BaseProperty prop = (BaseProperty) object.safeget(name);
if (prop != null) {
input.setValue(prop.toText());
}
input.setType("text");
input.setName(prefix + name);
input.setID(prefix + name);
input.setSize(getSize());
input.setDisabled(isDisabled());
buffer.append(input.toString());
}
use of com.xpn.xwiki.internal.xml.XMLAttributeValueFilter in project xwiki-platform by xwiki.
the class DBTreeListClass method displayTreeSelectEdit.
protected void displayTreeSelectEdit(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context) {
select select = new select(prefix + name, 1);
select.setAttributeFilter(new XMLAttributeValueFilter());
select.setMultiple(isMultiSelect());
select.setSize(getSize());
select.setName(prefix + name);
select.setID(prefix + name);
select.setDisabled(isDisabled());
Map<String, ListItem> map = getMap(context);
Map<String, List<ListItem>> treemap = getTreeMap(context);
List<String> selectlist;
BaseProperty prop = (BaseProperty) object.safeget(name);
if (prop == null) {
selectlist = new ArrayList<String>();
} else if (prop instanceof ListProperty) {
selectlist = ((ListProperty) prop).getList();
} else {
selectlist = new ArrayList<String>();
selectlist.add(String.valueOf(prop.getValue()));
}
// Add options from Set
addToSelect(select, selectlist, map, treemap, "", "", context);
buffer.append(select.toString());
}
use of com.xpn.xwiki.internal.xml.XMLAttributeValueFilter in project xwiki-platform by xwiki.
the class LevelsClass method displayEdit.
@Override
public void displayEdit(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context) {
select select = new select(prefix + name, 1);
select.setAttributeFilter(new XMLAttributeValueFilter());
select.setMultiple(isMultiSelect());
select.setSize(getSize());
select.setName(prefix + name);
select.setID(prefix + name);
select.setDisabled(isDisabled());
List<String> list = getList(context);
BaseProperty prop = (BaseProperty) object.safeget(name);
List<String> selectlist = toList(prop);
// Add options from Set
for (String value : list) {
String display = getText(value, context);
option option = new option(display, value);
option.setAttributeFilter(new XMLAttributeValueFilter());
option.addElement(XMLUtils.escape(display));
// If we don't have this option in the list then add it
if (!list.contains(value)) {
list.add(value);
}
if (selectlist.contains(value)) {
option.setSelected(true);
}
select.addElement(option);
}
buffer.append(select.toString());
input in = new input();
in.setAttributeFilter(new XMLAttributeValueFilter());
in.setType("hidden");
in.setName(prefix + name);
in.setDisabled(isDisabled());
buffer.append(in.toString());
}
use of com.xpn.xwiki.internal.xml.XMLAttributeValueFilter in project xwiki-platform by xwiki.
the class ListClass method displaySelectEdit.
protected void displaySelectEdit(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context) {
select select = new select(prefix + name, 1);
select.setAttributeFilter(new XMLAttributeValueFilter());
select.setMultiple(isMultiSelect());
select.setSize(getSize());
select.setName(prefix + name);
select.setID(prefix + name);
select.setDisabled(isDisabled());
List<String> list = getList(context);
Map<String, ListItem> map = getMap(context);
String sort = getSort();
if (!"none".equals(sort)) {
if ("id".equals(sort)) {
Collections.sort(list);
}
if ("value".equals(sort)) {
Collections.sort(list, new MapComparator(map));
}
}
List<String> selectlist = toList((BaseProperty) object.safeget(name));
// Add the selected values that are not in the predefined list.
for (String item : selectlist) {
if (!list.contains(item)) {
list.add(item);
}
}
// Add options from Set
for (String rawvalue : list) {
String value = getElementValue(rawvalue);
String display = getDisplayValue(rawvalue, name, map, context);
option option = new option(display, value);
option.setAttributeFilter(new XMLAttributeValueFilter());
option.addElement(XMLUtils.escape(display));
if (selectlist.contains(value)) {
option.setSelected(true);
}
select.addElement(option);
}
buffer.append(select.toString());
}
use of com.xpn.xwiki.internal.xml.XMLAttributeValueFilter in project xwiki-platform by xwiki.
the class PropertyClass method displayEdit.
@Override
public void displayEdit(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context) {
input input = new input();
input.setAttributeFilter(new XMLAttributeValueFilter());
BaseProperty prop = (BaseProperty) object.safeget(name);
if (prop != null) {
input.setValue(prop.toText());
}
input.setType("text");
input.setName(prefix + name);
input.setID(prefix + name);
input.setDisabled(isDisabled());
buffer.append(input.toString());
}
Aggregations