public class OwEditablePropertyDate extends OwEditablePropertyString
Base class for a single editable date property used in HTML forms.
You can either instantiate a control and use the render and setValue,
getValue methods
or alternatively
use the control only with the static methods insertEditHTML and updateField
without a instance.
Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.
For licensing information read the license.txt file or
go to: http://wiki.alfresco.com
Modifier and Type | Field and Description |
---|---|
protected OwMainAppContext |
m_context
reference to the app context
|
protected String |
m_sDateFormatString
string to use to format the date
|
static int |
TYPE_DATE
ENUM for the behavior, only date is shown
|
static int |
TYPE_EMPTY_DATE_POSSIBLE
ENUM for the behavior, the date value can be left empty
|
static int |
TYPE_TIME
ENUM for the behavior, only time is shown
|
m_strError, m_value
Constructor and Description |
---|
OwEditablePropertyDate(OwMainAppContext context_p)
construct a date property with context, use default date format
|
OwEditablePropertyDate(OwMainAppContext context_p,
String sDateFormat_p)
construct a date property with context
|
OwEditablePropertyDate(OwMainAppContext context_p,
String sDateFormat_p,
boolean ignoreTime) |
Modifier and Type | Method and Description |
---|---|
static String |
convertDateFormat(String javaSimpleDateFormat_p)
Java and ExtJS use different date format markup strings.
|
protected Object |
getValueFromRequest(Locale locale_p,
javax.servlet.http.HttpServletRequest request_p,
String strID_p)
overridable to apply changes on a submitted form
|
static void |
insertEditHTML(OwMainAppContext context_p,
Locale locale_p,
Writer w_p,
Date date_p,
String strID_p,
boolean fUseJS_Control_p,
boolean fEmptyDataPossible_p,
String sDateFormat_p)
render the date control with all sub controls
|
static void |
insertEditHTML(OwMainAppContext context_p,
Locale locale_p,
Writer w_p,
Date date_p,
String strID_p,
boolean fUseJS_Control_p,
boolean fEmptyDataPossible_p,
String sDateFormat_p,
String timeFormat)
render the date control with all sub controls
|
static void |
insertJSControl(OwMainAppContext context_p,
Locale locale_p,
Writer w_p,
Date date_p,
String strID_p,
boolean fEmptyDataPossible_p,
String sDateFormat_p)
Renders the JavaScript version of this control.
|
static void |
insertNonJSControl(OwMainAppContext context_p,
Locale locale_p,
Writer w_p,
Date date_p,
String strID_p,
boolean fEmptyDataPossible_p,
String timerFormat)
Renders the Non Javascript version of the DateTime control.
|
static boolean |
isPhpSpecialChar(char testChar_p)
Check if the character has a meaning as a PHP date format pattern.
|
void |
render(Locale locale_p,
Writer w_p)
overridable to insert a single value into a edit HTML form
|
static Date |
updateField(Locale locale_p,
javax.servlet.http.HttpServletRequest request_p,
String strID_p,
boolean fUseJS_Control_p,
Date oldDate_p,
boolean fEmptyDataPossible_p,
String sDateFormat_p)
update the date variable
|
static Date |
updateField(Locale locale_p,
javax.servlet.http.HttpServletRequest request_p,
String strID_p,
boolean fUseJS_Control_p,
Date oldDate_p,
boolean fEmptyDataPossible_p,
String sDateFormat_p,
String timeFormatString) |
getFormElementID, getSafePropertyError, getValue, render, setValue, update
public static final int TYPE_DATE
public static final int TYPE_TIME
public static final int TYPE_EMPTY_DATE_POSSIBLE
protected OwMainAppContext m_context
protected String m_sDateFormatString
public OwEditablePropertyDate(OwMainAppContext context_p)
context_p
- OwMainAppContextpublic OwEditablePropertyDate(OwMainAppContext context_p, String sDateFormat_p)
sDateFormat_p
- String with date format e.g.: dd.MM.yyyy HH:mmcontext_p
- OwMainAppContextpublic OwEditablePropertyDate(OwMainAppContext context_p, String sDateFormat_p, boolean ignoreTime)
context_p
- sDateFormat_p
- ignoreTime
- public static void insertEditHTML(OwMainAppContext context_p, Locale locale_p, Writer w_p, Date date_p, String strID_p, boolean fUseJS_Control_p, boolean fEmptyDataPossible_p, String sDateFormat_p) throws Exception
w_p
- Writer object to write HTML todate_p
- Date to displaystrID_p
- Id for the form elementfEmptyDataPossible_p
- true = date can be nullsDateFormat_p
- String with date format e.g.: dd.MM.yyyy HH:mmException
public static void insertEditHTML(OwMainAppContext context_p, Locale locale_p, Writer w_p, Date date_p, String strID_p, boolean fUseJS_Control_p, boolean fEmptyDataPossible_p, String sDateFormat_p, String timeFormat) throws Exception
w_p
- Writer object to write HTML todate_p
- Date to displaystrID_p
- Id for the form elementfEmptyDataPossible_p
- true = date can be nullsDateFormat_p
- String with date format e.g.: dd.MM.yyyy HH:mmtimeFormat
- String format for time. E.g. HH:mm. If null, the time field will be ignored.Exception
public static void insertJSControl(OwMainAppContext context_p, Locale locale_p, Writer w_p, Date date_p, String strID_p, boolean fEmptyDataPossible_p, String sDateFormat_p) throws IOException, Exception
context_p
- locale_p
- w_p
- date_p
- strID_p
- fEmptyDataPossible_p
- sDateFormat_p
- IOException
Exception
public static void insertNonJSControl(OwMainAppContext context_p, Locale locale_p, Writer w_p, Date date_p, String strID_p, boolean fEmptyDataPossible_p, String timerFormat) throws IOException, Exception
context_p
- locale_p
- w_p
- date_p
- fEmptyDataPossible_p
- timerFormat
- the time format to use for the time field. If null, the time part will be ignored.IOException
Exception
public static String convertDateFormat(String javaSimpleDateFormat_p)
javaSimpleDateFormat_p
- String to search and replacepublic static boolean isPhpSpecialChar(char testChar_p)
testChar_p
- char character to testpublic static Date updateField(Locale locale_p, javax.servlet.http.HttpServletRequest request_p, String strID_p, boolean fUseJS_Control_p, Date oldDate_p, boolean fEmptyDataPossible_p, String sDateFormat_p) throws Exception
request_p
- HttpServletRequeststrID_p
- Id for the form elementoldDate_p
- old datefEmptyDataPossible_p
- true = date can be nullsDateFormat_p
- String with date format e.g.: dd.MM.yyyy HH:mmException
public static Date updateField(Locale locale_p, javax.servlet.http.HttpServletRequest request_p, String strID_p, boolean fUseJS_Control_p, Date oldDate_p, boolean fEmptyDataPossible_p, String sDateFormat_p, String timeFormatString) throws OwException
locale_p
- request_p
- strID_p
- fUseJS_Control_p
- oldDate_p
- fEmptyDataPossible_p
- sDateFormat_p
- timeFormatString
- has to match the one used in the call to insertEditHTML(OwMainAppContext, Locale, Writer, Date, String, boolean, boolean, String, String)
.OwException
public void render(Locale locale_p, Writer w_p) throws Exception
w_p
- Writer to write HTML code toException
protected Object getValueFromRequest(Locale locale_p, javax.servlet.http.HttpServletRequest request_p, String strID_p) throws Exception
getValueFromRequest
in class OwEditablePropertyString
request_p
- HttpServletRequest with form data to update the propertystrID_p
- String the HTML form element id of the requested valueException
Copyright © 2014 Alfresco Business Solutions. All Rights Reserved.