com.xpn.xwiki.objects.classes
Class DBTreeListClass

java.lang.Object
  extended by com.xpn.xwiki.objects.BaseElement<R>
      extended by com.xpn.xwiki.objects.BaseCollection<ClassPropertyReference>
          extended by com.xpn.xwiki.objects.classes.PropertyClass
              extended by com.xpn.xwiki.objects.classes.ListClass
                  extended by com.xpn.xwiki.objects.classes.DBListClass
                      extended by com.xpn.xwiki.objects.classes.DBTreeListClass
All Implemented Interfaces:
PropertyClassInterface, ElementInterface, ObjectInterface, PropertyInterface, Serializable, Cloneable, Comparable<PropertyClass>

public class DBTreeListClass
extends DBListClass

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.xpn.xwiki.objects.classes.ListClass
ListClass.MapComparator
 
Field Summary
 
Fields inherited from class com.xpn.xwiki.objects.classes.DBListClass
DEFAULT_QUERY
 
Fields inherited from class com.xpn.xwiki.objects.classes.PropertyClass
cachedCustomDisplayer
 
Fields inherited from class com.xpn.xwiki.objects.BaseCollection
currentReferenceDocumentReferenceResolver, fields, fieldsToRemove, number, relativeEntityReferenceResolver
 
Fields inherited from class com.xpn.xwiki.objects.BaseElement
localEntityReferenceSerializer, referenceCache
 
Constructor Summary
DBTreeListClass()
           
DBTreeListClass(PropertyMetaClass wclass)
           
 
Method Summary
protected  void addToList(Map<String,List<ListItem>> map, String key, ListItem item)
           
protected  void addToSelect(select select, List<String> selectlist, Map<String,ListItem> map, Map<String,List<ListItem>> treemap, String parent, String level, XWikiContext context)
           
protected  void addToTreeList(List<ListItem> treelist, Map<String,List<ListItem>> treemap, Map<String,ListItem> map, String parent, XWikiContext context)
           
 void displayEdit(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context)
           
protected  void displayTreeSelectEdit(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context)
           
 void displayView(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context)
           
protected  List<ListItem> getCachedDBTreeList(XWikiContext context)
          Get the ordered list of tree nodes that is currently cached, if any.
 String getParentField()
           
 String getQuery(XWikiContext context)
           Computes the query corresponding to the current XProperty.
protected  List<ListItem> getTreeList(Map<String,List<ListItem>> treemap, Map<String,ListItem> map, XWikiContext context)
          Gets an ordered list of items in the tree.
 Map<String,List<ListItem>> getTreeMap(XWikiContext context)
           
protected  String renderItemsList(List<List<ListItem>> resList)
           
protected  void setCachedDBTreeList(List<ListItem> cachedDBTreeList, XWikiContext context)
          Store the ordered list of tree nodes in a cache.
 void setParentField(String parentField)
           
 
Methods inherited from class com.xpn.xwiki.objects.classes.DBListClass
flushCache, getCachedDBList, getClassname, getDBList, getIdField, getList, getMap, getSql, getValue, getValueField, makeList, returnCol, setCachedDBList, setClassname, setIdField, setSql, setValueField
 
Methods inherited from class com.xpn.xwiki.objects.classes.ListClass
displayHidden, displayRadioEdit, displaySelectEdit, fromString, fromStringArray, getDisplayType, getDisplayValue, getDisplayValue, getElementValue, getListFromString, getListFromString, getMapFromString, getSeparator, getSeparators, getSize, getSort, isCache, isMultiSelect, isPicker, isRelationalStorage, newProperty, newPropertyfromXML, setCache, setDisplayType, setMultiSelect, setPicker, setRelationalStorage, setSeparator, setSeparators, setSize, setSort
 
Methods inherited from class com.xpn.xwiki.objects.classes.PropertyClass
clone, compareTo, createReference, displayCustom, displayEdit, displayEdit, displayHidden, displayHidden, displayView, displayView, fromValue, fromXML, getCachedDefaultCustomDisplayer, getClassName, getClassType, getCustomDisplay, getDefaultCustomDisplayer, getFieldFullName, getFullQueryPropertyName, getId, getName, getNumber, getObject, getPrettyName, getPrettyName, getTooltip, getTooltip, getTranslatedPrettyName, getValidationMessage, getValidationRegExp, getXClass, getxWikiClass, initLazyCollections, isCustomDisplayed, isDisabled, isUnmodifiable, isValidColumnTypes, setClassType, setCustomDisplay, setDisabled, setId, setName, setNumber, setObject, setPrettyName, setTooltip, setUnmodifiable, setValidationMessage, setValidationRegExp, setxWikiClass, toFormString, toString, toXML, toXML, validateProperty
 
Methods inherited from class com.xpn.xwiki.objects.BaseCollection
addField, addPropertyForRemoval, apply, equals, get, getCustomMappingMap, getDateValue, getDiff, getDoubleValue, getField, getFieldList, getFieldsToRemove, getFloatValue, getIntValue, getIntValue, getLargeStringValue, getListValue, getLongValue, getProperties, getPropertyList, getPropertyNames, getRelativeXClassReference, getSetValue, getSortedIterator, getStringValue, getXClassReference, merge, merge, put, removeField, safeget, safeput, setClassName, setDateValue, setDBStringListValue, setDocumentReference, setDoubleValue, setFields, setFieldsToRemove, setFloatValue, setIntValue, setLargeStringValue, setLongValue, setSetValue, setStringListValue, setStringValue, setXClassReference, toString, toXMLString
 
Methods inherited from class com.xpn.xwiki.objects.BaseElement
getDocumentReference, getLocalKey, getLocalUidStringEntityReferenceSerializer, getReference, hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.xpn.xwiki.objects.ObjectInterface
get, put, safeget, safeput
 
Methods inherited from interface com.xpn.xwiki.objects.ElementInterface
apply, getDocumentReference, getReference, merge, setDocumentReference, toString
 

Constructor Detail

DBTreeListClass

public DBTreeListClass(PropertyMetaClass wclass)

DBTreeListClass

public DBTreeListClass()
Method Detail

getParentField

public String getParentField()

setParentField

public void setParentField(String parentField)

getCachedDBTreeList

protected List<ListItem> getCachedDBTreeList(XWikiContext context)
Get the ordered list of tree nodes that is currently cached, if any.

Parameters:
context - the current request context
Returns:
the cached list, or null if not already cached

setCachedDBTreeList

protected void setCachedDBTreeList(List<ListItem> cachedDBTreeList,
                                   XWikiContext context)
Store the ordered list of tree nodes in a cache.

Parameters:
cachedDBTreeList - the list to cache
context - the current request context

getTreeMap

public Map<String,List<ListItem>> getTreeMap(XWikiContext context)

getTreeList

protected List<ListItem> getTreeList(Map<String,List<ListItem>> treemap,
                                     Map<String,ListItem> map,
                                     XWikiContext context)
Gets an ordered list of items in the tree. This is necessary to make sure children are coming right after their parents.

Parameters:
treemap - the unordered list of tree nodes
map - the mapping between a node name and its corresponding tree node
context - the current request context
Returns:
ordered list of ListItem tree nodes

addToTreeList

protected void addToTreeList(List<ListItem> treelist,
                             Map<String,List<ListItem>> treemap,
                             Map<String,ListItem> map,
                             String parent,
                             XWikiContext context)

addToList

protected void addToList(Map<String,List<ListItem>> map,
                         String key,
                         ListItem item)

displayView

public void displayView(StringBuffer buffer,
                        String name,
                        String prefix,
                        BaseCollection object,
                        XWikiContext context)
Specified by:
displayView in interface PropertyClassInterface
Overrides:
displayView in class DBListClass

displayEdit

public void displayEdit(StringBuffer buffer,
                        String name,
                        String prefix,
                        BaseCollection object,
                        XWikiContext context)
Specified by:
displayEdit in interface PropertyClassInterface
Overrides:
displayEdit in class DBListClass

renderItemsList

protected String renderItemsList(List<List<ListItem>> resList)

addToSelect

protected void addToSelect(select select,
                           List<String> selectlist,
                           Map<String,ListItem> map,
                           Map<String,List<ListItem>> treemap,
                           String parent,
                           String level,
                           XWikiContext context)

displayTreeSelectEdit

protected void displayTreeSelectEdit(StringBuffer buffer,
                                     String name,
                                     String prefix,
                                     BaseCollection object,
                                     XWikiContext context)

getQuery

public String getQuery(XWikiContext context)

Computes the query corresponding to the current XProperty. The query is either manually specified by the XClass creator in the sql field, or, if the query field is blank, constructed using the classname, idField, valueField and parentField properties. The query is constructed according to the following rules:

The generated query always selects 3 columns, the first one is used as the stored value, the second one as the displayed value, and the third one defines the "parent" of the current value.

Overrides:
getQuery in class DBListClass
Parameters:
context - The current context.
Returns:
The HQL query corresponding to this property.