myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1335560 - in /myfaces/tobago/trunk: tobago-example/tobago-example-test/src/main/webapp/tc/popup/ tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/tc/popup/ tobago-extension/tobago-facelets/src/main/ja...
Date Tue, 08 May 2012 15:00:59 GMT
Author: lofwyr
Date: Tue May  8 15:00:58 2012
New Revision: 1335560

URL: http://svn.apache.org/viewvc?rev=1335560&view=rev
Log:
TOBAGO-1125: Possibility to set the id of the form of tx:date

Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/popup/popup-bug-tobago-1103.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/tc/popup/BugTobago1103SeleniumTest.java
    myfaces/tobago/trunk/tobago-extension/tobago-facelets/src/main/java/org/apache/myfaces/tobago/facelets/extension/DateExtensionHandler.java
    myfaces/tobago/trunk/tobago-extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/taglib/extension/DateExtensionTag.java

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/popup/popup-bug-tobago-1103.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/popup/popup-bug-tobago-1103.xhtml?rev=1335560&r1=1335559&r2=1335560&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/popup/popup-bug-tobago-1103.xhtml
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/tc/popup/popup-bug-tobago-1103.xhtml
Tue May  8 15:00:58 2012
@@ -57,7 +57,7 @@
                           <f:facet name="layout">
                             <tc:gridLayout rows="auto;auto"/>
                           </f:facet>
-                          <tx:date label="Date" id="txdate" fieldId="date" pickerId="picker">
+                          <tx:date label="Date" id="txdate" fieldId="date" pickerId="picker"
formId="form">
                             <f:convertDateTime pattern="dd/MM/yyyy"/>
                           </tx:date>
                           <tc:button label="Open Sub Popup (AJAX)" id="open-2">

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/tc/popup/BugTobago1103SeleniumTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/tc/popup/BugTobago1103SeleniumTest.java?rev=1335560&r1=1335559&r2=1335560&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/tc/popup/BugTobago1103SeleniumTest.java
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/tc/popup/BugTobago1103SeleniumTest.java
Tue May  8 15:00:58 2012
@@ -32,9 +32,6 @@ public class BugTobago1103SeleniumTest e
   @Test
   public void testWithoutModel() throws InterruptedException {
 
-    // XXX not nice: autogenerated id
-    final String extraId = isFacelet() ? "j_id13:" : "j_id_id31tx2:";
-
     // load page
     open("/tc/popup/popup-bug-tobago-1103.");
     getSelenium().waitForCondition(
@@ -49,19 +46,19 @@ public class BugTobago1103SeleniumTest e
     getSelenium().click("page:popup-1:open-1");
     getSelenium().waitForCondition(
         "selenium.browserbot.getCurrentWindow().document.getElementById("
-            + "'page:popup-1:popup-2:" + extraId + "picker') != null", "5000");
+            + "'page:popup-1:popup-2:form:picker') != null", "5000");
 
     // click on open date popup
-    getSelenium().click("page:popup-1:popup-2:" + extraId + "picker");
+    getSelenium().click("page:popup-1:popup-2:form:picker");
     getSelenium().waitForCondition(
         "selenium.browserbot.getCurrentWindow().document.getElementById("
-            + "'page:popup-1:popup-2:" + extraId + "pickerpopup:cancel') != null", "5000");
+            + "'page:popup-1:popup-2:form:pickerpopup:cancel') != null", "5000");
 
     // click on close date popup
-    getSelenium().click("page:popup-1:popup-2:" + extraId + "pickerpopup:cancel");
+    getSelenium().click("page:popup-1:popup-2:form:pickerpopup:cancel");
     getSelenium().waitForCondition(
         "selenium.browserbot.getCurrentWindow().document.getElementById("
-            + "'page:popup-1:popup-2:" + extraId + "pickerpopup:cancel') == null", "5000");
+            + "'page:popup-1:popup-2:form:pickerpopup:cancel') == null", "5000");
 
     // click on close 2nd popup
     getSelenium().click("page:popup-1:popup-2:close-2");
@@ -86,13 +83,13 @@ public class BugTobago1103SeleniumTest e
     getSelenium().click("page:popup-1:open-1");
     getSelenium().waitForCondition(
         "selenium.browserbot.getCurrentWindow().document.getElementById("
-            + "'page:popup-1:popup-2:" + extraId + "picker') != null", "5000");
+            + "'page:popup-1:popup-2:form:picker') != null", "5000");
 
     // click on open 3rd popup
     getSelenium().click("page:popup-1:popup-2:open-2");
     getSelenium().waitForCondition(
         "selenium.browserbot.getCurrentWindow().document.getElementById("
-            + "'page:popup-1:popup-2:popup-3') != null", "5000");
+            + "'page:popup-1:popup-2:popup-3:close-3') != null", "5000");
 
     // click on close date popup
     getSelenium().click("page:popup-1:popup-2:popup-3:close-3");

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=1335560&r1=1335559&r2=1335560&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
Tue May  8 15:00:58 2012
@@ -34,10 +34,12 @@ import javax.faces.component.UIViewRoot;
 public class DateExtensionHandler extends TobagoLabelExtensionHandler {
 
   private TagAttribute pickerIdAttribute;
-  
+  private TagAttribute formIdAttribute;
+
   public DateExtensionHandler(ComponentConfig config) {
     super(config);
     pickerIdAttribute = getAttribute("pickerId");
+    formIdAttribute = getAttribute("formId");
   }
 
   protected String getSubComponentType() {
@@ -56,20 +58,13 @@ public class DateExtensionHandler extend
 
       UIForm form = (UIForm) application.createComponent(UIForm.COMPONENT_TYPE);
       form.setRendererType(RendererTypes.FORM);
-      form.setId(root.createUniqueId());
+      form.setId(formIdAttribute != null ? formIdAttribute.getValue(faceletContext) : root.createUniqueId());
       panel.getChildren().add(form);
 
       UIDatePicker picker = (UIDatePicker) application.createComponent(UIDatePicker.COMPONENT_TYPE);
       picker.setRendererType(RendererTypes.DATE_PICKER);
       picker.setFor("@auto");
-      final String id;
-      if (pickerIdAttribute !=  null) {
-        id = pickerIdAttribute.getValue(faceletContext);
-      } else {
-        root = ComponentSupport.getViewRoot(faceletContext, parent);
-        id = root.createUniqueId();
-      }
-      picker.setId(id);
+      picker.setId(pickerIdAttribute != null ? pickerIdAttribute.getValue(faceletContext)
: root.createUniqueId());
       if (picker.getAttributes().get(OnComponentCreated.MARKER) == null) {
         picker.getAttributes().put(OnComponentCreated.MARKER, Boolean.TRUE);
         picker.onComponentCreated(faceletContext.getFacesContext(), panel);

Modified: myfaces/tobago/trunk/tobago-extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/taglib/extension/DateExtensionTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/taglib/extension/DateExtensionTag.java?rev=1335560&r1=1335559&r2=1335560&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/taglib/extension/DateExtensionTag.java
(original)
+++ myfaces/tobago/trunk/tobago-extension/tobago-taglib-extension/src/main/java-jsf-1.2/org/apache/myfaces/tobago/internal/taglib/extension/DateExtensionTag.java
Tue May  8 15:00:58 2012
@@ -76,6 +76,7 @@ public class DateExtensionTag extends To
   private javax.el.ValueExpression requiredMessage;  
   private String fieldId;
   private String pickerId;
+  private String formId;
 
   private javax.el.ValueExpression labelWidth;
   private LabelExtensionTag labelTag;
@@ -180,6 +181,9 @@ public class DateExtensionTag extends To
     FormTag formTag = new FormTag();
     formTag.setPageContext(pageContext);
     formTag.setParent(labelTag);
+    if (formId != null) {
+      formTag.setId(formId);
+    }
     formTag.setJspId(jspId + PREFIX + idSuffix++);
     formTag.doStartTag();
 
@@ -229,6 +233,7 @@ public class DateExtensionTag extends To
     requiredMessage = null;
     fieldId = null;
     pickerId = null;
+    formId = null;
   }
 
   /**
@@ -449,7 +454,7 @@ public class DateExtensionTag extends To
   }
 
   /**
-   * The component identifier for the input field component inside of the container.
+   * The component identifier for the automatically created picker component inside of the
container.
    * This value must be unique within the closest parent component that is a naming container.
    */
   @TagAttribute(rtexprvalue = true)
@@ -459,6 +464,16 @@ public class DateExtensionTag extends To
   }
 
   /**
+   * The component identifier for the automatically created form component inside of the
container.
+   * This value must be unique within the closest parent component that is a naming container.
+   */
+  @TagAttribute(rtexprvalue = true)
+  @UIComponentTagAttribute
+  public void setFormId(String formId) {
+    this.formId = formId;
+  }
+
+  /**
    * The component identifier for this component.
    * This value must be unique within the closest parent component that is a naming container.
    * For tx components the id will be set to the container (e. g. the panel).



Mime
View raw message