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
This commit is contained in:
Kevin Roast
2006-01-05 09:36:34 +00:00
parent 3f86a5ad94
commit 0ac5e88d9a
4 changed files with 17 additions and 15 deletions

View File

@@ -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<SelectItem> years = new ArrayList<SelectItem>();
for (int i=startYear; i<startYear + yearCount; i++)
for (int i=startYear; i>startYear - yearCount; i--)
{
Integer year = Integer.valueOf(i);
years.add(new SelectItem(year, year.toString()));

View File

@@ -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;

View File

@@ -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() + "\"]}");