You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Jorge RodrÃguez Pedrianes (JIRA)" <de...@myfaces.apache.org> on 2006/05/17 19:19:07 UTC
[jira] Commented: (TOMAHAWK-213) inputDate in dataTable displays
the same value in each row
[ http://issues.apache.org/jira/browse/TOMAHAWK-213?page=comments#action_12412217 ]
Jorge RodrÃguez Pedrianes commented on TOMAHAWK-213:
----------------------------------------------------
Hello!!
The problem is due to use UserData to store the Date value, and this class (UserData) is saved/restored with the component.
Then when we iterate with the column the value of "_userData" is not refreshed, as the following code shows:
public UserData getUserData(Locale currentLocale){
if( _userData == null )
_userData = new UserData((Date) getValue(), currentLocale, getTimeZone());
return _userData;
}
I propose a simple solution:
1) "_userData" is always recalculated when the "getUserDate" method is called:
public UserData getUserData(Locale currentLocale){
/* if( _userData == null ) REMOVED!!!!!!!! */
_userData = new UserData((Date) getValue(), currentLocale, getTimeZone());
return _userData;
}
- 2) Dont Save/Restore "_userData" attribute:
public Object saveState(FacesContext context) {
Object values[] = new Object[9];
values[0] = super.saveState(context);
values[1] = _type;
values[2] = _popupCalendar;
values[3] = _userData; // TO DELETE
values[4] = _disabled;
values[5] = _readonly;
values[6] = _enabledOnUserRole;
values[7] = _visibleOnUserRole;
values[8] = _timeZone;
return values;
}
public void restoreState(FacesContext context, Object state) {
Object values[] = (Object[])state;
super.restoreState(context, values[0]);
_type = (String)values[1];
_popupCalendar = (Boolean)values[2];
_userData = (UserData)values[3]; // TO DELETE
_disabled = (Boolean)values[4];
_readonly = (Boolean)values[5];
_enabledOnUserRole = (String)values[6];
_visibleOnUserRole = (String)values[7];
_timeZone = (String)values[8];
}
*** This issue is related with other "TOMAHAWK-228" and the solution that i propose here will resolve both issues.
Thanks,
> inputDate in dataTable displays the same value in each row
> ----------------------------------------------------------
>
> Key: TOMAHAWK-213
> URL: http://issues.apache.org/jira/browse/TOMAHAWK-213
> Project: MyFaces Tomahawk
> Type: Bug
> Components: Date
> Versions: 1.1.1
> Environment: jboss-3.2.7
> java version "1.4.2_10"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_10-b03)
> Java HotSpot(TM) Client VM (build 1.4.2_10-b03, mixed mode)
> Reporter: Michal Borowiecki
> Attachments: inputDate.PNG
>
> inputDate placed in a dataTable displays the same value in each row. The value that should be displayed in the first row is displayed in every row.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira