tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r544524 - in /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components: ActionLink.java PageLink.java
Date Tue, 05 Jun 2007 15:57:49 GMT
Author: hlship
Date: Tue Jun  5 08:57:48 2007
New Revision: 544524

URL: http://svn.apache.org/viewvc?view=rev&rev=544524
Log:
TAPESTRY-1481: ActionLink and PageLink render an id attribute, but don't provide a clientId
property, making it impossible to reference them in JavaScript

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/ActionLink.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PageLink.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/ActionLink.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/ActionLink.java?view=diff&rev=544524&r1=544523&r2=544524
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/ActionLink.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/ActionLink.java
Tue Jun  5 08:57:48 2007
@@ -18,22 +18,21 @@
 
 import java.util.List;
 
+import org.apache.tapestry.ClientElement;
 import org.apache.tapestry.ComponentResources;
 import org.apache.tapestry.Link;
 import org.apache.tapestry.MarkupWriter;
 import org.apache.tapestry.PageRenderSupport;
 import org.apache.tapestry.annotations.Environmental;
 import org.apache.tapestry.annotations.Inject;
-import org.apache.tapestry.annotations.Mixin;
 import org.apache.tapestry.annotations.Parameter;
 import org.apache.tapestry.annotations.SupportsInformalParameters;
-import org.apache.tapestry.corelib.mixins.RenderInformals;
 
 /**
  * Component that triggers an action on the server with a subsequent full page refresh.
  */
 @SupportsInformalParameters
-public class ActionLink
+public class ActionLink implements ClientElement
 {
     /**
      * The context for the link (optional parameter). This list of values will be converted
into
@@ -46,10 +45,6 @@
     @Inject
     private ComponentResources _resources;
 
-    @SuppressWarnings("unused")
-    @Mixin
-    private RenderInformals _renderInformals;
-
     @Environmental
     private PageRenderSupport _support;
 
@@ -60,17 +55,19 @@
     @Parameter("false")
     private boolean _disabled;
 
+    private String _clientId;
+
     void beginRender(MarkupWriter writer)
     {
         if (_disabled) return;
 
-        String clientId = _support.allocateClientId(_resources.getId());
+        _clientId = _support.allocateClientId(_resources.getId());
 
         Object[] contextArray = _context == null ? new Object[0] : _context.toArray();
 
         Link link = _resources.createActionLink(ACTION_EVENT, false, contextArray);
 
-        writer.element("a", "href", link, "id", clientId);
+        writer.element("a", "href", link, "id", _clientId);
 
         _resources.renderInformalParameters(writer);
     }
@@ -80,5 +77,10 @@
         if (_disabled) return;
 
         writer.end(); // <a>
+    }
+
+    public String getClientId()
+    {
+        return _clientId;
     }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PageLink.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PageLink.java?view=diff&rev=544524&r1=544523&r2=544524
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PageLink.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PageLink.java
Tue Jun  5 08:57:48 2007
@@ -16,6 +16,7 @@
 
 import java.util.List;
 
+import org.apache.tapestry.ClientElement;
 import org.apache.tapestry.ComponentResources;
 import org.apache.tapestry.Link;
 import org.apache.tapestry.MarkupWriter;
@@ -36,7 +37,7 @@
  * manipulated by the page.
  */
 @SupportsInformalParameters
-public class PageLink
+public class PageLink implements ClientElement
 {
     /** The logical name of the page to link to. */
     @Parameter(required = true, defaultPrefix = "literal")
@@ -48,6 +49,8 @@
     @Environmental
     private PageRenderSupport _support;
 
+    private String _clientId;
+
     /**
      * If provided, this is the activation context for the target page (the information will
be
      * encoded into the URL). If not provided, then the target page will provide its own
activation
@@ -60,13 +63,13 @@
 
     void beginRender(MarkupWriter writer)
     {
-        String clientId = _support.allocateClientId(_resources.getId());
+        _clientId = _support.allocateClientId(_resources.getId());
 
         Object[] activationContext = _context != null ? _context.toArray() : _emptyContext;
 
         Link link = _resources.createPageLink(_page, activationContext);
 
-        writer.element("a", "href", link, "id", clientId);
+        writer.element("a", "href", link, "id", _clientId);
 
         _resources.renderInformalParameters(writer);
     }
@@ -75,4 +78,10 @@
     {
         writer.end(); // <a>
     }
+
+    public String getClientId()
+    {
+        return _clientId;
+    }
+
 }



Mime
View raw message