com.xpn.xwiki.objects.classes
Class DateClass

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.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: 0014bffb898929cac0a38205702179519e0feae1 $
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
localEntityReferenceSerializer, referenceCache
 
Constructor Summary
DateClass()
          Default constructor.
DateClass(PropertyMetaClass metaClass)
          Creates a new Date property that is described by the given meta class.
 
Method Summary
 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, 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

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 interface PropertyClassInterface
Overrides:
fromString in class PropertyClass

newProperty

public BaseProperty newProperty()
Specified by:
newProperty in interface PropertyClassInterface
Overrides:
newProperty in class PropertyClass

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 class PropertyClass


Copyright © 2004-2013 XWiki. All Rights Reserved.