public abstract class ListClass extends PropertyClass
Modifier and Type | Class and Description |
---|---|
protected class |
ListClass.MapComparator |
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_SEPARATOR
Default separator/delimiter to use to split or join a list stored as a string.
|
static String |
DISPLAYTYPE_CHECKBOX |
static String |
DISPLAYTYPE_INPUT |
static String |
DISPLAYTYPE_RADIO |
static String |
DISPLAYTYPE_SELECT |
static String |
FREE_TEXT_ALLOWED |
static String |
FREE_TEXT_DISCOURAGED |
static String |
FREE_TEXT_FORBIDDEN |
static char |
SEPARATOR_ESCAPE
Used to escape a separator character inside a string serialized list item.
|
cachedCustomDisplayer
currentReferenceDocumentReferenceResolver, fields, fieldsToRemove, number, relativeEntityReferenceResolver
documentReference, ownerDocument, referenceCache
Constructor and Description |
---|
ListClass() |
ListClass(PropertyMetaClass wclass) |
ListClass(String name,
String prettyname,
PropertyMetaClass wclass) |
Modifier and Type | Method and Description |
---|---|
void |
displayEdit(StringBuffer buffer,
String name,
String prefix,
BaseCollection object,
XWikiContext context) |
void |
displayHidden(StringBuffer buffer,
String name,
String prefix,
BaseCollection object,
XWikiContext context) |
protected void |
displayRadioEdit(StringBuffer buffer,
String name,
String prefix,
BaseCollection object,
XWikiContext context) |
protected void |
displaySelectEdit(StringBuffer buffer,
String name,
String prefix,
BaseCollection object,
XWikiContext context) |
void |
displayView(StringBuffer buffer,
String name,
String prefix,
BaseCollection object,
XWikiContext context) |
void |
fromList(BaseProperty<?> property,
List<String> list)
Set the passed
List into the passed property. |
protected void |
fromList(BaseProperty<?> property,
List<String> list,
boolean filterEmptyValues)
Set the passed
List into the passed property. |
BaseProperty |
fromString(String value) |
BaseProperty |
fromStringArray(String[] strings) |
String |
getDefaultValue() |
String |
getDisplayType() |
protected String |
getDisplayValue(Object rawvalue,
String name,
Map<String,ListItem> map,
XWikiContext context)
Search for an internationalizable display text for the current value.
|
String |
getDisplayValue(String value,
String name,
Map<String,ListItem> map,
XWikiContext context)
Search for an internationalizable display text for the current value.
|
protected String |
getElementValue(Object rawvalue)
If the list is populated with value=name pairs selected from the database, then return only the value.
|
protected String |
getFirstSeparator() |
String |
getFreeText() |
abstract List<String> |
getList(XWikiContext context) |
static List<String> |
getListFromString(String value)
Convenience method, using "|" as separator and parsing key=value items.
|
static List<String> |
getListFromString(String value,
String separators,
boolean withMap) |
protected static List<String> |
getListFromString(String value,
String separators,
boolean withMap,
boolean filterEmptyValues) |
abstract Map<String,ListItem> |
getMap(XWikiContext context) |
static Map<String,ListItem> |
getMapFromString(String value) |
String |
getSeparator() |
String |
getSeparators() |
int |
getSize() |
String |
getSort() |
static String |
getStringFromList(List<String> list)
Convenience method, using "|" as separator.
|
static String |
getStringFromList(List<String> list,
String separators) |
boolean |
isCache() |
boolean |
isLargeStorage() |
boolean |
isMultiSelect() |
boolean |
isPicker() |
boolean |
isRelationalStorage() |
protected <T extends EntityReference> |
mergeNotOrderedListProperty(BaseProperty<T> currentProperty,
BaseProperty<T> previousProperty,
BaseProperty<T> newProperty,
MergeConfiguration configuration,
XWikiContext context,
MergeResult mergeResult) |
<T extends EntityReference> |
mergeProperty(BaseProperty<T> currentProperty,
BaseProperty<T> previousProperty,
BaseProperty<T> newProperty,
MergeConfiguration configuration,
XWikiContext context,
MergeResult mergeResult)
Apply a 3 ways merge on passed current, previous and new version of the same property.
|
BaseProperty |
newProperty() |
BaseProperty |
newPropertyfromXML(org.dom4j.Element ppcel) |
void |
setCache(boolean cache) |
void |
setDefaultValue(String separator) |
void |
setDisplayType(String type) |
void |
setFreeText(String type) |
void |
setLargeStorage(boolean largeStorage) |
void |
setMultiSelect(boolean multiSelect) |
void |
setPicker(boolean picker) |
void |
setRelationalStorage(boolean relationalStorage) |
void |
setSeparator(String separator) |
void |
setSeparators(String separators) |
void |
setSize(int size) |
void |
setSort(String sort) |
String |
toFormString(BaseProperty property)
|
List<String> |
toList(BaseProperty<?> property)
ListClass does not produce only ListProperty s and this method allows to access the value as
List whatever property is actually storing it. |
clone, compareTo, createReference, displayCustom, displayEdit, displayEdit, displayHidden, displayHidden, displayView, displayView, flushCache, fromValue, fromXML, getCachedDefaultCustomDisplayer, getClassName, getClassType, getCustomDisplay, getDefaultCustomDisplayer, getFieldFullName, getFullQueryPropertyName, getHint, getId, getName, getNumber, getObject, getPrettyName, getPrettyName, getTooltip, getTooltip, getTranslatedPrettyName, getValidationMessage, getValidationRegExp, getXClass, getxWikiClass, initLazyCollections, isCustomDisplayed, isDisabled, isUnmodifiable, isValidColumnTypes, renderContentInContext, renderContentInContext, setClassType, setCustomDisplay, setDisabled, setHint, setId, setName, setNumber, setObject, setPrettyName, setTooltip, setUnmodifiable, setValidationMessage, setValidationRegExp, setxWikiClass, toFormString, toString, toXML, toXML, validateProperty
addField, addPropertyForRemoval, apply, equals, get, getCurrentReferenceDocumentReferenceResolver, getCustomMappingMap, getDateValue, getDiff, getDoubleValue, getField, getFieldList, getFieldsToRemove, getFloatValue, getIntValue, getIntValue, getLargeStringValue, getListValue, getLongValue, getProperties, getPropertyList, getPropertyNames, getRelativeEntityReferenceResolver, getRelativeXClassReference, getSetValue, getSortedIterator, getStringValue, getXClassReference, merge, merge, mergeField, put, removeField, safeget, safeput, setClassName, setDateValue, setDBStringListValue, setDocumentReference, setDoubleValue, setFields, setFieldsToRemove, setFloatValue, setIntValue, setLargeStringValue, setLongValue, setOwnerDocument, setSetValue, setStringListValue, setStringValue, setXClassReference, toXMLString
fromXML, getDocumentReference, getLocalEntityReferenceSerializer, getLocalization, getLocalKey, getLocalUidStringEntityReferenceSerializer, getMergeManager, getOwnerDocument, getReference, getXWikiContext, hashCode, localizePlain, localizePlainOrKey, toString, toXMLString
finalize, getClass, notify, notifyAll, wait, wait, wait
displayView
get, put, safeget, safeput
apply, getDocumentReference, getReference, merge, setDocumentReference, toString
public static final String DISPLAYTYPE_INPUT
public static final String DISPLAYTYPE_RADIO
public static final String DISPLAYTYPE_CHECKBOX
public static final String DISPLAYTYPE_SELECT
public static final String DEFAULT_SEPARATOR
getSeparator()
and getSeparator()
which are used only for UI view and edit operations.public static final char SEPARATOR_ESCAPE
public static final String FREE_TEXT_DISCOURAGED
public static final String FREE_TEXT_FORBIDDEN
public static final String FREE_TEXT_ALLOWED
public ListClass(String name, String prettyname, PropertyMetaClass wclass)
public ListClass(PropertyMetaClass wclass)
public ListClass()
public String getSeparators()
displayEdit(StringBuffer, String, String, BaseCollection, XWikiContext)
,
fromString(String)
public void setSeparators(String separators)
separators
- a string of characters used to split/deserialize an input string coming from the UI (filled by
the user) that represents a serialized listpublic String getDisplayType()
public void setDisplayType(String type)
public String getSort()
public void setSort(String sort)
public int getSize()
public void setSize(int size)
public boolean isCache()
public void setCache(boolean cache)
public boolean isMultiSelect()
public void setMultiSelect(boolean multiSelect)
public boolean isRelationalStorage()
public void setRelationalStorage(boolean relationalStorage)
relationalStorage
- if false, the list items will be concatenated into a VARCHAR column on a single row.
Otherwise, items are stored in their own entries in the database. In most cases, this property should
have the same value as the multiSelect
propertypublic boolean isPicker()
public void setPicker(boolean picker)
public boolean isLargeStorage()
public void setLargeStorage(boolean largeStorage)
public String getSeparator()
displayView(StringBuffer, String, String, BaseCollection, XWikiContext)
public void setSeparator(String separator)
separator
- a string (usually just 1 character long) used to join this list's items when displaying it in
the UI in view mode.public String getDefaultValue()
public void setDefaultValue(String separator)
separator
- the default value used in the select editorpublic String getFreeText()
public void setFreeText(String type)
type
- the value of freeText (forbidden, discouraged or allowed)public static List<String> getListFromString(String value)
value
- the string holding a serialized listgetListFromString(String, String, boolean)
protected String getFirstSeparator()
DEFAULT_SEPARATOR
.public static List<String> getListFromString(String value, String separators, boolean withMap)
value
- the string holding a serialized listseparators
- the separator characters (given as a string) used to delimit the list's items inside the input
string. These separators can also be present, in escaped (92) form, inside
list itemswithMap
- set to true if the list's values contain map entries (key=value pairs) that should also be parsed.
Only the keys are extracted from such list itemsprotected static List<String> getListFromString(String value, String separators, boolean withMap, boolean filterEmptyValues)
value
- the string holding a serialized listseparators
- the separator characters (given as a string) used to delimit the list's items inside the input
string. These separators can also be present, in escaped (92) form, inside
list itemswithMap
- set to true if the list's values contain map entries (key=value pairs) that should also be parsed.
Only the keys are extracted from such list itemsfilterEmptyValues
- true
if the result should not contain any empty values.public static String getStringFromList(List<String> list)
list
- the list to serializegetStringFromList(List, String)
public static String getStringFromList(List<String> list, String separators)
list
- the list to serializeseparators
- the separator characters (given as a string) used when the list was populated with values. The
list's items can contain these separators in plain/unescaped form. The first separator character will
be used to join the list in the output.public String toFormString(BaseProperty property)
property
- a property to be used in an form inputListProperty
is passed, the list's separators
defined by getSeparators()
are escaped for each list item and the items are joined by the first
separatorgetStringFromList(List, String)
public BaseProperty newProperty()
newProperty
in interface PropertyClassInterface
newProperty
in class PropertyClass
public BaseProperty fromString(String value)
fromString
in interface PropertyClassInterface
fromString
in class PropertyClass
public BaseProperty fromStringArray(String[] strings)
fromStringArray
in class PropertyClass
public BaseProperty newPropertyfromXML(org.dom4j.Element ppcel)
newPropertyfromXML
in class PropertyClass
@Unstable public String getDisplayValue(String value, String name, Map<String,ListItem> map, XWikiContext context)
<option>
element, and
D = the displayed value<fieldFullName>_<V>
exists, return it as Doption_<fieldName>_<V>
exists, return it as Doption_<V>
exists, return it as Dvalue
- The internal value.name
- The name of the ListProperty.map
- The value=name mapping specified in the "values" parameter of the property.context
- The request context.protected String getDisplayValue(Object rawvalue, String name, Map<String,ListItem> map, XWikiContext context)
rawvalue
- The internal value, or a value=name pair.name
- The name of the ListProperty.map
- The value=name mapping specified in the "values" parameter of the property.context
- The request context.getDisplayValue(String, String, Map, XWikiContext)
protected String getElementValue(Object rawvalue)
rawvalue
- public void displayHidden(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context)
displayHidden
in interface PropertyClassInterface
displayHidden
in class PropertyClass
public void displayView(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context)
displayView
in interface PropertyClassInterface
displayView
in class PropertyClass
public void displayEdit(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context)
displayEdit
in interface PropertyClassInterface
displayEdit
in class PropertyClass
protected void displayRadioEdit(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context)
protected void displaySelectEdit(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context)
public abstract List<String> getList(XWikiContext context)
public abstract Map<String,ListItem> getMap(XWikiContext context)
public List<String> toList(BaseProperty<?> property)
ListClass
does not produce only ListProperty
s and this method allows to access the value as
List
whatever property is actually storing it.
There is no guarantees the returned List
will be modifiable.
property
- the property created by this classList
representation of this propertypublic void fromList(BaseProperty<?> property, List<String> list)
List
into the passed property.property
- the property to modifylist
- the list to setprotected void fromList(BaseProperty<?> property, List<String> list, boolean filterEmptyValues)
List
into the passed property.property
- the property to modifylist
- the list to setfilterEmptyValues
- if true
filter out the empty values from the list.public <T extends EntityReference> void mergeProperty(BaseProperty<T> currentProperty, BaseProperty<T> previousProperty, BaseProperty<T> newProperty, MergeConfiguration configuration, XWikiContext context, MergeResult mergeResult)
PropertyClass
mergeProperty
in class PropertyClass
currentProperty
- the current version of the element and the one to modifypreviousProperty
- the previous version of the elementnewProperty
- the new version of the propertyconfiguration
- the configuration of the merge Indicate how to deal with some conflicts use cases, etc.context
- the XWiki contextmergeResult
- the merge reportprotected <T extends EntityReference> void mergeNotOrderedListProperty(BaseProperty<T> currentProperty, BaseProperty<T> previousProperty, BaseProperty<T> newProperty, MergeConfiguration configuration, XWikiContext context, MergeResult mergeResult)
Copyright © 2004–2022 XWiki. All rights reserved.