Package io.jans.casa.ui
Class CustomDateConverter
java.lang.Object
io.jans.casa.ui.CustomDateConverter
- All Implemented Interfaces:
org.zkoss.bind.Converter
This class is a custom ZK converter employed to display dates appropriately according to user location.
It uses the time offset with respect to UTC time and a formatting pattern supplied to show dates. It does not implement
String to Date conversion.- Author:
- jgomer
-
Field Summary
Fields inherited from interface org.zkoss.bind.Converter
IGNORED_VALUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncoerceToBean(Object val, org.zkoss.zk.ui.Component comp, org.zkoss.bind.BindContext ctx) This method is called when convertingStringtoDate.coerceToUi(Object val, org.zkoss.zk.ui.Component comp, org.zkoss.bind.BindContext ctx) This method is called when conversion (DatetoString) is taking placing in.zultemplates.
-
Constructor Details
-
CustomDateConverter
public CustomDateConverter()
-
-
Method Details
-
coerceToUi
public Object coerceToUi(Object val, org.zkoss.zk.ui.Component comp, org.zkoss.bind.BindContext ctx) This method is called when conversion (DatetoString) is taking placing in.zultemplates.- Specified by:
coerceToUiin interfaceorg.zkoss.bind.Converter- Parameters:
val- An object representing a date, namely a java.util.Date or a long value (milliseconds from the epoch)comp- The UI component associated to this converstionctx- Binding context. It holds the conversion arguments: "format" and "offset" are used here- Returns:
- A string with the date properly formatted or null if val parameter is not a valid date
-
coerceToBean
public Object coerceToBean(Object val, org.zkoss.zk.ui.Component comp, org.zkoss.bind.BindContext ctx) This method is called when convertingStringtoDate.- Specified by:
coerceToBeanin interfaceorg.zkoss.bind.Converter- Parameters:
val- A date in string formcomp- Associated componentctx- Bind context for associate Binding and extra parameter (e.g. format)- Returns:
- null (conversion not implemented)
-