myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1333368 - /myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java
Date Thu, 03 May 2012 09:03:37 GMT
Author: lofwyr
Date: Thu May  3 09:03:36 2012
New Revision: 1333368

URL: http://svn.apache.org/viewvc?rev=1333368&view=rev
Log:
TOBAGO-1118: Facelet version of tx:date should also use a UIForm

Modified:
    myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java

Modified: myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java?rev=1333368&r1=1333367&r2=1333368&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java
(original)
+++ myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java
Thu May  3 09:03:36 2012
@@ -25,6 +25,7 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.component.RendererTypes;
 import org.apache.myfaces.tobago.component.UIDate;
 import org.apache.myfaces.tobago.component.UIDatePicker;
+import org.apache.myfaces.tobago.component.UIForm;
 
 import javax.faces.application.Application;
 import javax.faces.component.UIComponent;
@@ -51,6 +52,12 @@ public class DateExtensionHandler extend
     super.onComponentPopulated(faceletContext, panel, parent);
     if (panel.getChildCount() == 2) {
       Application application = faceletContext.getFacesContext().getApplication();
+      UIViewRoot root = ComponentSupport.getViewRoot(faceletContext, parent);
+
+      UIForm form = (UIForm) application.createComponent(UIForm.COMPONENT_TYPE);
+      form.setId(root.createUniqueId());
+      panel.getChildren().add(form);
+
       UIDatePicker picker = (UIDatePicker) application.createComponent(UIDatePicker.COMPONENT_TYPE);
       picker.setRendererType(RendererTypes.DATE_PICKER);
       picker.setFor("@auto");
@@ -58,7 +65,7 @@ public class DateExtensionHandler extend
       if (pickerIdAttribute !=  null) {
         id = pickerIdAttribute.getValue(faceletContext);
       } else {
-        UIViewRoot root = ComponentSupport.getViewRoot(faceletContext, parent);
+        root = ComponentSupport.getViewRoot(faceletContext, parent);
         id = root.createUniqueId();
       }
       picker.setId(id);
@@ -66,7 +73,7 @@ public class DateExtensionHandler extend
         picker.getAttributes().put(OnComponentCreated.MARKER, Boolean.TRUE);
         picker.onComponentCreated(faceletContext.getFacesContext(), panel);
       }
-      panel.getChildren().add(picker);
+      form.getChildren().add(picker);
     }
   }
 



Mime
View raw message