You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by ro...@apache.org on 2009/06/24 20:29:20 UTC

svn commit: r788114 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/corelib/mixins/ test/java/org/apache/tapestry5/integration/ test/java/org/apache/tapestry5/integration/app1/pages/ test/resources/org/apache/tapestry5/...

Author: robertdzeigler
Date: Wed Jun 24 18:29:20 2009
New Revision: 788114

URL: http://svn.apache.org/viewvc?rev=788114&view=rev
Log:
TAP5-680: Tapestry should provide a mixin for ensuring that the client id of a ClientElement is rendered

Added:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/RenderClientId.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/RenderClientIdDemo.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/RenderClientIdDemo.tml
Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java

Added: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/RenderClientId.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/RenderClientId.java?rev=788114&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/RenderClientId.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/mixins/RenderClientId.java Wed Jun 24 18:29:20 2009
@@ -0,0 +1,34 @@
+// Copyright 2007 The Apache Software Foundation
+//
+//  Licensed under the Apache License, Version 2.0 (the "License");
+//  you may not use this file except in compliance with the License.
+//  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+
+package org.apache.tapestry5.corelib.mixins;
+
+import org.apache.tapestry5.annotations.InjectContainer;
+import org.apache.tapestry5.annotations.AfterRender;
+import org.apache.tapestry5.ClientElement;
+
+/**
+ * Forces a client element to render its client id by ensuring that "getClientId" is called.
+ */
+public class RenderClientId
+{
+    @InjectContainer
+    private ClientElement element;
+
+    @AfterRender
+    void ensureId()
+    {
+        element.getClientId();
+    }
+}

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java?rev=788114&r1=788113&r2=788114&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java Wed Jun 24 18:29:20 2009
@@ -2958,4 +2958,12 @@
 
 
     }
+
+    @Test
+    public void renderclientid_mixin()
+    {
+        start("RenderClientId Mixin");
+
+        assertText("divwithid","Div Content");
+    }
 }
\ No newline at end of file

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java?rev=788114&r1=788113&r2=788114&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java Wed Jun 24 18:29:20 2009
@@ -351,7 +351,12 @@
 
             new Item("MessageConstraintGeneratorDemo",
                      "Validation Constraints From Messages",
-                     "Providing validators to apply from a properties file")
+                     "Providing validators to apply from a properties file"),
+
+            new Item("RenderClientIdDemo",
+                     "RenderClientId Mixin",
+                     "Force render of client-side id of a client element via the RenderClientId mixin")
+
     );
 
     static

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/RenderClientIdDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/RenderClientIdDemo.java?rev=788114&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/RenderClientIdDemo.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/RenderClientIdDemo.java Wed Jun 24 18:29:20 2009
@@ -0,0 +1,22 @@
+// Copyright 2007 The Apache Software Foundation
+//
+//  Licensed under the Apache License, Version 2.0 (the "License");
+//  you may not use this file except in compliance with the License.
+//  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+
+package org.apache.tapestry5.integration.app1.pages;
+
+/**
+ *
+ */
+public class RenderClientIdDemo
+{
+}

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/RenderClientIdDemo.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/RenderClientIdDemo.tml?rev=788114&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/RenderClientIdDemo.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/RenderClientIdDemo.tml Wed Jun 24 18:29:20 2009
@@ -0,0 +1,14 @@
+<html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
+
+<p>
+    This page demonstrates the forcing the rendering of the client id of a component via the RenderClientId mixin.
+</p>
+
+<p>
+    <div t:type="any" t:id="divwithid" t:mixins="RenderClientId">
+        Div Content
+    </div>
+
+</p>
+
+</html>