use of com.xpn.xwiki.objects.BaseProperty in project xwiki-platform by xwiki.
the class NumberClass method newProperty.
@Override
public BaseProperty newProperty() {
String ntype = getNumberType();
BaseProperty property;
if (ntype.equals("integer")) {
property = new IntegerProperty();
} else if (ntype.equals("float")) {
property = new FloatProperty();
} else if (ntype.equals("double")) {
property = new DoubleProperty();
} else {
property = new LongProperty();
}
property.setName(getName());
return property;
}
use of com.xpn.xwiki.objects.BaseProperty 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());
}
use of com.xpn.xwiki.objects.BaseProperty in project xwiki-platform by xwiki.
the class PropertyClass method toXML.
@Override
public Element toXML() {
Element pel = new DOMElement(getName());
// Iterate over values sorted by field name so that the values are
// exported to XML in a consistent order.
Iterator it = getSortedIterator();
while (it.hasNext()) {
BaseProperty bprop = (BaseProperty) it.next();
pel.add(bprop.toXML());
}
Element el = new DOMElement("classType");
String classType = getClassType();
if (this.getClass().getSimpleName().equals(classType + "Class")) {
// Keep exporting the full Java class name for old/default property types to avoid breaking the XAR format
// (to allow XClasses created with the current version of XWiki to be imported in an older version).
classType = this.getClass().getName();
}
el.addText(classType);
pel.add(el);
return pel;
}
use of com.xpn.xwiki.objects.BaseProperty in project xwiki-platform by xwiki.
the class PropertyClass method fromValue.
@Override
public BaseProperty fromValue(Object value) {
BaseProperty property = newProperty();
property.setValue(value);
return property;
}
use of com.xpn.xwiki.objects.BaseProperty in project xwiki-platform by xwiki.
the class StringClass method newProperty.
@Override
public BaseProperty newProperty() {
BaseProperty property = new StringProperty();
property.setName(getName());
return property;
}
Aggregations