mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
updates to date time pickers
- make them behave better as inline elements for hgroup support - respect minInclusive, maxInclusive, minExclusive and maxExclusive restrictions for date types. no support in dojo to support the same with the TimePicker. addresses feature request WCM-379. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5574 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -25,6 +25,8 @@ package org.alfresco.web.forms.xforms;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import javax.xml.transform.*;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
@@ -2442,6 +2444,63 @@ public class Schema2XForms
|
||||
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXLENGTH));
|
||||
}
|
||||
}
|
||||
if (SchemaUtil.getBuiltInType(controlType) == XSConstants.DATE_DT)
|
||||
{
|
||||
String minInclusive = null;
|
||||
String maxInclusive = null;
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
final Calendar calendar = Calendar.getInstance();
|
||||
if (controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_MAXEXCLUSIVE))
|
||||
{
|
||||
minInclusive = controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MINEXCLUSIVE);
|
||||
try
|
||||
{
|
||||
final Date d = sdf.parse(minInclusive);
|
||||
calendar.setTime(d);
|
||||
}
|
||||
catch (ParseException pe)
|
||||
{
|
||||
LOGGER.error(pe);
|
||||
}
|
||||
calendar.roll(Calendar.DATE, true);
|
||||
minInclusive = sdf.format(calendar.getTime());
|
||||
}
|
||||
else if (controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_MININCLUSIVE))
|
||||
{
|
||||
minInclusive = controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MININCLUSIVE);
|
||||
}
|
||||
if (controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_MAXEXCLUSIVE))
|
||||
{
|
||||
maxInclusive = controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXEXCLUSIVE);
|
||||
try
|
||||
{
|
||||
final Date d = sdf.parse(maxInclusive);
|
||||
calendar.setTime(d);
|
||||
}
|
||||
catch (ParseException pe)
|
||||
{
|
||||
LOGGER.error(pe);
|
||||
}
|
||||
calendar.roll(Calendar.DATE, false);
|
||||
maxInclusive = sdf.format(calendar.getTime());
|
||||
}
|
||||
else if (controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_MAXINCLUSIVE))
|
||||
{
|
||||
maxInclusive = controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXINCLUSIVE);
|
||||
}
|
||||
if (minInclusive != null)
|
||||
{
|
||||
result.setAttributeNS(NamespaceService.ALFRESCO_URI,
|
||||
NamespaceService.ALFRESCO_PREFIX + ":minInclusive",
|
||||
minInclusive);
|
||||
}
|
||||
if (maxInclusive != null)
|
||||
{
|
||||
result.setAttributeNS(NamespaceService.ALFRESCO_URI,
|
||||
NamespaceService.ALFRESCO_PREFIX + ":maxInclusive",
|
||||
maxInclusive);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setXFormsId(result);
|
||||
result.appendChild(this.createLabel(xformsDocument, caption));
|
||||
|
Reference in New Issue
Block a user