From 0ac5e88d9a35cabaa24736956e5bef76aa0cd911 Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Thu, 5 Jan 2006 09:36:34 +0000 Subject: [PATCH] Fix for Date Component issue identified in AWC-395 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2077 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../web/ui/common/renderer/DatePickerRenderer.java | 10 +++++++--- .../alfresco/web/ui/common/tag/InputDatePickerTag.java | 8 ++++---- .../ui/repo/component/UISearchCustomProperties.java | 6 ++---- source/web/jsp/dialog/advanced-search.jsp | 8 ++++---- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/source/java/org/alfresco/web/ui/common/renderer/DatePickerRenderer.java b/source/java/org/alfresco/web/ui/common/renderer/DatePickerRenderer.java index aea459e060..aa1edffa5a 100644 --- a/source/java/org/alfresco/web/ui/common/renderer/DatePickerRenderer.java +++ b/source/java/org/alfresco/web/ui/common/renderer/DatePickerRenderer.java @@ -141,14 +141,18 @@ public class DatePickerRenderer extends BaseRenderer } // get the attributes from the component we need for rendering - int nStartYear = 1990; + int nStartYear; Integer startYear = (Integer)component.getAttributes().get("startYear"); if (startYear != null) { nStartYear = startYear.intValue(); } + else + { + nStartYear = new Date().getYear() + 1900; + } - int nYearCount = 10; + int nYearCount = 25; Integer yearCount = (Integer)component.getAttributes().get("yearCount"); if (yearCount != null) { @@ -278,7 +282,7 @@ public class DatePickerRenderer extends BaseRenderer private List getYears(int startYear, int yearCount) { List years = new ArrayList(); - for (int i=startYear; istartYear - yearCount; i--) { Integer year = Integer.valueOf(i); years.add(new SelectItem(year, year.toString())); diff --git a/source/java/org/alfresco/web/ui/common/tag/InputDatePickerTag.java b/source/java/org/alfresco/web/ui/common/tag/InputDatePickerTag.java index 60b278a157..15e6cb5ffa 100644 --- a/source/java/org/alfresco/web/ui/common/tag/InputDatePickerTag.java +++ b/source/java/org/alfresco/web/ui/common/tag/InputDatePickerTag.java @@ -55,8 +55,8 @@ public class InputDatePickerTag extends HtmlComponentTag public void release() { super.release(); - this.startYear = "1990"; - this.yearCount = "10"; + this.startYear = null; + this.yearCount = null; this.value = null; this.showTime = null; this.disabled = null; @@ -127,8 +127,8 @@ public class InputDatePickerTag extends HtmlComponentTag this.disabled = disabled; } - private String startYear = "1990"; - private String yearCount = "10"; + private String startYear = null; + private String yearCount = null; private String value = null; private String showTime = null; private String disabled = null; diff --git a/source/java/org/alfresco/web/ui/repo/component/UISearchCustomProperties.java b/source/java/org/alfresco/web/ui/repo/component/UISearchCustomProperties.java index 047a0ce24d..50686d5c8c 100644 --- a/source/java/org/alfresco/web/ui/repo/component/UISearchCustomProperties.java +++ b/source/java/org/alfresco/web/ui/repo/component/UISearchCustomProperties.java @@ -291,8 +291,7 @@ public class UISearchCustomProperties extends SelfRenderingComponent implements UIInput inputFromDate = (UIInput)facesApp.createComponent(ComponentConstants.JAVAX_FACES_INPUT); inputFromDate.setId(context.getViewRoot().createUniqueId()); inputFromDate.setRendererType(RepoConstants.ALFRESCO_FACES_DATE_PICKER_RENDERER); - inputFromDate.getAttributes().put("startYear", new Integer(1970)); - inputFromDate.getAttributes().put("yearCount", new Integer(50)); + inputFromDate.getAttributes().put("yearCount", new Integer(30)); inputFromDate.getAttributes().put("showTime", showTime); ValueBinding vbFromDate = facesApp.createValueBinding( "#{" + beanBinding + "[\"" + PREFIX_DATE_FROM + propDef.getName().toString() + "\"]}"); @@ -310,8 +309,7 @@ public class UISearchCustomProperties extends SelfRenderingComponent implements UIInput inputToDate = (UIInput)facesApp.createComponent(ComponentConstants.JAVAX_FACES_INPUT); inputToDate.setId(context.getViewRoot().createUniqueId()); inputToDate.setRendererType(RepoConstants.ALFRESCO_FACES_DATE_PICKER_RENDERER); - inputToDate.getAttributes().put("startYear", new Integer(1970)); - inputToDate.getAttributes().put("yearCount", new Integer(50)); + inputToDate.getAttributes().put("yearCount", new Integer(30)); inputToDate.getAttributes().put("showTime", showTime); ValueBinding vbToDate = facesApp.createValueBinding( "#{" + beanBinding + "[\"" + PREFIX_DATE_TO + propDef.getName().toString() + "\"]}"); diff --git a/source/web/jsp/dialog/advanced-search.jsp b/source/web/jsp/dialog/advanced-search.jsp index 23007aa1f7..255f264ccf 100644 --- a/source/web/jsp/dialog/advanced-search.jsp +++ b/source/web/jsp/dialog/advanced-search.jsp @@ -243,20 +243,20 @@ : - : + : - : + : : - : + : - : + :