You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mk...@apache.org on 2007/03/29 21:38:41 UTC
svn commit: r523813 -
/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/date/HtmlDateRenderer.java
Author: mkienenb
Date: Thu Mar 29 12:38:40 2007
New Revision: 523813
URL: http://svn.apache.org/viewvc?view=rev&rev=523813
Log:
Fix for TOMAHAWK-476 - Support for HtmlInputDate in HtmlFocus
Thanks to Rogério Pereira Araújo.
Required refactoring of day subcomponent clientid builder into a static method, which is probably a good idea anyway.
Modified:
myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/date/HtmlDateRenderer.java
Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/date/HtmlDateRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/date/HtmlDateRenderer.java?view=diff&rev=523813&r1=523812&r2=523813
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/date/HtmlDateRenderer.java (original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/date/HtmlDateRenderer.java Thu Mar 29 12:38:40 2007
@@ -55,7 +55,7 @@
*/
public static final String DATE_MESSAGE_ID = "org.apache.myfaces.Date.INVALID";
- private static final String ID_DAY_POSTFIX = ".day";
+ private static final String ID_DAY_POSTFIX = ".day";
private static final String ID_MONTH_POSTFIX = ".month";
private static final String ID_YEAR_POSTFIX = ".year";
private static final String ID_HOURS_POSTFIX = ".hours";
@@ -63,6 +63,11 @@
private static final String ID_SECONDS_POSTFIX = ".seconds";
private static final String ID_AMPM_POSTFIX = ".ampm";
+ static public String getClientIdForDaySubcomponent(String clientId)
+ {
+ return clientId + ID_DAY_POSTFIX;
+ }
+
protected boolean isDisabled(FacesContext facesContext, HtmlInputDate inputDate) {
if( !UserRoleUtils.isEnabledOnUserRole(inputDate) )
return false;
@@ -146,7 +151,7 @@
protected void encodeInputDay(UIComponent uiComponent, ResponseWriter writer, String clientId,
UserData userData, boolean disabled, boolean readonly) throws IOException {
- encodeInputField(uiComponent, writer, clientId + ID_DAY_POSTFIX, userData.getDay(), 2, disabled, readonly);
+ encodeInputField(uiComponent, writer, getClientIdForDaySubcomponent(clientId), userData.getDay(), 2, disabled, readonly);
}
protected void encodeInputMonth(UIComponent uiComponent, ResponseWriter writer, String clientId, UserData userData, Locale currentLocale,
@@ -335,7 +340,7 @@
Map requestMap = facesContext.getExternalContext().getRequestParameterMap();
if( ! (type.equals( "time" ) || type.equals( "short_time" )) ){
- userData.setDay( (String) requestMap.get(clientId + ID_DAY_POSTFIX) );
+ userData.setDay( (String) requestMap.get(getClientIdForDaySubcomponent(clientId)) );
userData.setMonth( (String) requestMap.get(clientId + ID_MONTH_POSTFIX) );
userData.setYear( (String) requestMap.get(clientId + ID_YEAR_POSTFIX) );
}