use of com.xpn.xwiki.objects.classes.BooleanClass in project xwiki-platform by xwiki.
the class AbstractMandatoryDocumentInitializer method updateBooleanClassDefaultValue.
/**
* Set the default value of a boolean field of a XWiki class.
*
* @param baseClass the XWiki class.
* @param fieldName the name of the field.
* @param value the default value.
* @return true if <code>baseClass</code> modified.
*/
protected boolean updateBooleanClassDefaultValue(BaseClass baseClass, String fieldName, Boolean value) {
boolean needsUpdate = false;
BooleanClass bc = (BooleanClass) baseClass.get(fieldName);
int old = bc.getDefaultValue();
int intvalue = intFromBoolean(value);
if (intvalue != old) {
bc.setDefaultValue(intvalue);
needsUpdate = true;
}
return needsUpdate;
}
use of com.xpn.xwiki.objects.classes.BooleanClass in project xwiki-platform by xwiki.
the class ListMetaClass method newCheckBox.
/**
* Creates a new boolean property that is displayed as a check box.
*
* @param checked whether the check box is checked or not by default
* @return a new {@link BooleanClass} instance that is displayed as a check box
*/
private BooleanClass newCheckBox(boolean checked) {
BooleanClass checkBox = new BooleanClass(this);
checkBox.setDisplayType("yesno");
checkBox.setDisplayFormType("checkbox");
checkBox.setDefaultValue(checked ? 1 : 0);
return checkBox;
}
use of com.xpn.xwiki.objects.classes.BooleanClass in project xwiki-platform by xwiki.
the class ListMetaClass method addPresentationMetaProperties.
/**
* Adds the meta properties that control how the XClass property is displayed in edit and view mode.
*/
private void addPresentationMetaProperties() {
StaticListClass displayTypeClass = new StaticListClass(this);
displayTypeClass.setName("displayType");
displayTypeClass.setPrettyName("Display Type");
displayTypeClass.setValues("input|select|radio|checkbox");
safeput(displayTypeClass.getName(), displayTypeClass);
BooleanClass multiSelectClass = newCheckBox(false);
multiSelectClass.setName("multiSelect");
multiSelectClass.setPrettyName("Multiple Select");
safeput(multiSelectClass.getName(), multiSelectClass);
BooleanClass pickerClass = newCheckBox(true);
pickerClass.setName("picker");
pickerClass.setPrettyName("Use Suggest");
safeput(pickerClass.getName(), pickerClass);
NumberClass sizeClass = new NumberClass(this);
sizeClass.setName("size");
sizeClass.setPrettyName("Size");
sizeClass.setSize(5);
sizeClass.setNumberType("integer");
safeput(sizeClass.getName(), sizeClass);
addValueSeparatorMetaProperties();
StaticListClass sortClass = new StaticListClass(this);
sortClass.setName("sort");
sortClass.setPrettyName("Sort");
sortClass.setValues("none|id|value");
safeput(sortClass.getName(), sortClass);
}
Aggregations