Package com.xpn.xwiki.objects.classes
Class DateClass
- java.lang.Object
-
- com.xpn.xwiki.objects.BaseElement<R>
-
- com.xpn.xwiki.objects.BaseCollection<ClassPropertyReference>
-
- com.xpn.xwiki.objects.classes.PropertyClass
-
- com.xpn.xwiki.objects.classes.DateClass
-
- All Implemented Interfaces:
PropertyClassInterface
,ElementInterface
,ObjectInterface
,PropertyInterface
,Serializable
,Cloneable
,Comparable<PropertyClass>
public class DateClass extends PropertyClass
Defines an XClass property type whose value is a Date.- Version:
- $Id: 3f290006c91856892bbbd79960df56d7d5327510 $
- See Also:
- Serialized Form
-
-
Field Summary
-
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
documentReference, ownerDocument, referenceCache
-
-
Constructor Summary
Constructors Constructor Description DateClass()
Default constructor.DateClass(PropertyMetaClass metaClass)
Creates a new Date property that is described by the given meta class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BaseProperty
fromString(String value)
String
getDateFormat()
int
getEmptyIsToday()
int
getPicker()
int
getSize()
BaseProperty
newProperty()
BaseProperty
newPropertyfromXML(org.dom4j.Element element)
void
setDateFormat(String format)
Sets the date format.void
setEmptyIsToday(int emptyIsToday)
Sets whether an empty date value represents the current date or not.void
setPicker(int picker)
Sets whether to use a date picker or not to select the date in edit mode.void
setSize(int size)
Sets the size of the date input in edit mode.String
toFormString(BaseProperty property)
-
Methods inherited from class com.xpn.xwiki.objects.classes.PropertyClass
clone, compareTo, createReference, displayCustom, displayEdit, displayEdit, displayEdit, displayHidden, displayHidden, displayHidden, displayView, displayView, displayView, flushCache, fromStringArray, 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, mergeProperty, renderContentInContext, renderContentInContext, setClassType, setCustomDisplay, setDisabled, setHint, 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, 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
-
Methods inherited from class com.xpn.xwiki.objects.BaseElement
fromXML, getDocumentReference, getLocalEntityReferenceSerializer, getLocalization, getLocalKey, getLocalUidStringEntityReferenceSerializer, getMergeManager, getOwnerDocument, getReference, getXWikiContext, hashCode, localizePlain, localizePlainOrKey, merge, toString, toXMLString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.xpn.xwiki.objects.ElementInterface
apply, getDocumentReference, getReference, merge, merge, setDocumentReference, toString
-
Methods inherited from interface com.xpn.xwiki.objects.ObjectInterface
get, put, safeget, safeput
-
Methods inherited from interface com.xpn.xwiki.objects.classes.PropertyClassInterface
displayView
-
-
-
-
Constructor Detail
-
DateClass
public DateClass(PropertyMetaClass metaClass)
Creates a new Date property that is described by the given meta class.- Parameters:
metaClass
- the meta class that defines the list of meta properties associated with this property type
-
DateClass
public DateClass()
Default constructor.
-
-
Method Detail
-
getPicker
public int getPicker()
- Returns:
1
if a date picker should be used to choose the date,0
otherwise
-
setPicker
public void setPicker(int picker)
Sets whether to use a date picker or not to select the date in edit mode.- Parameters:
picker
-1
to use a date picker,0
otherwise
-
getSize
public int getSize()
- Returns:
- the size of the date input in edit mode
-
setSize
public void setSize(int size)
Sets the size of the date input in edit mode.- Parameters:
size
- the size of the date input in edit mode
-
getEmptyIsToday
public int getEmptyIsToday()
- Returns:
1
if an empty date value represents the current date,0
otherwise
-
setEmptyIsToday
public void setEmptyIsToday(int emptyIsToday)
Sets whether an empty date value represents the current date or not.- Parameters:
emptyIsToday
-1
if an empty date value should represent the current date,0
otherwise
-
getDateFormat
public String getDateFormat()
- Returns:
- the date format
-
setDateFormat
public void setDateFormat(String format)
Sets the date format.- Parameters:
format
- the new date format
-
fromString
public BaseProperty fromString(String value)
- Specified by:
fromString
in interfacePropertyClassInterface
- Overrides:
fromString
in classPropertyClass
-
newProperty
public BaseProperty newProperty()
- Specified by:
newProperty
in interfacePropertyClassInterface
- Overrides:
newProperty
in classPropertyClass
-
toFormString
public String toFormString(BaseProperty property)
- Parameters:
property
- a date property- Returns:
- the value of the given date property serialized using the
getDateFormat()
format
-
newPropertyfromXML
public BaseProperty newPropertyfromXML(org.dom4j.Element element)
We have to overwrite this method because the value of a date property is not serialized using the date format specified in the XClass nor the time stamp but a custom hard-coded date format.. Changing this now will break existing XARs..
- Overrides:
newPropertyfromXML
in classPropertyClass
-
-