You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by jk...@apache.org on 2008/01/21 21:10:16 UTC
svn commit: r613995 - in /tapestry/tapestry4/trunk: ./ tapestry-contrib/
tapestry-contrib/src/java/org/apache/tapestry/contrib/inspector/
tapestry-contrib/src/java/org/apache/tapestry/contrib/link/
tapestry-contrib/src/site/ tapestry-contrib/src/site/a...
Author: jkuhnert
Date: Mon Jan 21 12:10:15 2008
New Revision: 613995
URL: http://svn.apache.org/viewvc?rev=613995&view=rev
Log:
Fixes TAPESTRY-2068. Document PopupLinkRenderer usage.
Added:
tapestry/tapestry4/trunk/tapestry-contrib/src/site/apt/
tapestry/tapestry4/trunk/tapestry-contrib/src/site/apt/links/
tapestry/tapestry4/trunk/tapestry-contrib/src/site/apt/links/index.apt
Modified:
tapestry/tapestry4/trunk/pom.xml
tapestry/tapestry4/trunk/tapestry-contrib/pom.xml
tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/inspector/InspectorButton.jwc
tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/link/FormLinkRenderer.java
tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/link/PopupLinkRenderer.java
tapestry/tapestry4/trunk/tapestry-contrib/src/site/site.xml
tapestry/tapestry4/trunk/tapestry-framework/pom.xml
Modified: tapestry/tapestry4/trunk/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/pom.xml?rev=613995&r1=613994&r2=613995&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/pom.xml (original)
+++ tapestry/tapestry4/trunk/pom.xml Mon Jan 21 12:10:15 2008
@@ -295,13 +295,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
- <version>2.1.1</version>
<inherited>true</inherited>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
- <version>2.0-beta-5</version>
+ <version>2.0-beta-6</version>
<inherited>true</inherited>
</plugin>
<plugin>
@@ -335,7 +334,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
- <version>2.0.1</version>
<inherited>true</inherited>
<reportSets>
<reportSet>
@@ -358,7 +356,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
- <version>2.2</version>
+ <version>2.3</version>
<configuration>
<linksource>true</linksource>
<aggregate>true</aggregate>
@@ -387,7 +385,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
- <version>2.0-beta-5</version>
+ <version>2.0-beta-6</version>
<inherited>true</inherited>
</plugin>
</plugins>
Modified: tapestry/tapestry4/trunk/tapestry-contrib/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/pom.xml?rev=613995&r1=613994&r2=613995&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/pom.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-contrib/pom.xml Mon Jan 21 12:10:15 2008
@@ -122,6 +122,12 @@
</goals>
</execution>
</executions>
+ <configuration>
+ <archive>
+ <compress>true</compress>
+ <index>true</index>
+ </archive>
+ </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Modified: tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/inspector/InspectorButton.jwc
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/inspector/InspectorButton.jwc?rev=613995&r1=613994&r2=613995&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/inspector/InspectorButton.jwc (original)
+++ tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/inspector/InspectorButton.jwc Mon Jan 21 12:10:15 2008
@@ -16,53 +16,53 @@
-->
<!DOCTYPE component-specification PUBLIC
- "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
- "http://tapestry.apache.org/dtd/Tapestry_4_0.dtd">
+ "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
+ "http://tapestry.apache.org/dtd/Tapestry_4_0.dtd">
-<component-specification class="org.apache.tapestry.contrib.inspector.InspectorButton"
- allow-body="no"
- allow-informal-parameters="no">
+<component-specification class="org.apache.tapestry.contrib.inspector.InspectorButton"
+ allow-body="no"
+ allow-informal-parameters="no">
<description>
-<![CDATA[
+ <![CDATA[
Includes the Inspector button on the page (which dynamically positions itself in the
lower right corner). Clicking the button raises the Tapestry Inspector in a pop-up
window.
]]>
</description>
- <parameter name="disabled">
- <description>
- If true, then the InspectorButton will not be displayed (this saves the
- trouble of wrapping the InspectorButton in a conditional, as
- it generally should only be displayed when developing an application,
- not in deployment).
- </description>
- </parameter>
+ <parameter name="disabled">
+ <description>
+ If true, then the InspectorButton will not be displayed (this saves the
+ trouble of wrapping the InspectorButton in a conditional, as
+ it generally should only be displayed when developing an application,
+ not in deployment).
+ </description>
+ </parameter>
+
+ <component id="ifNotDisabled" type="If">
+ <binding name="condition" value="! disabled"/>
+ </component>
- <component id="ifNotDisabled" type="If">
- <binding name="condition" value="! disabled"/>
- </component>
-
<bean name="renderer" class="org.apache.tapestry.contrib.link.PopupLinkRenderer">
- <set name="windowName" value="literal:TapestryInspector"/>
- <set name="features">
- 'titlebar,resizable,scrollbars,width=700,height=600'
- </set>
+ <set name="windowName" value="literal:TapestryInspector"/>
+ <set name="features">
+ 'titlebar,resizable,scrollbars,width=700,height=600'
+ </set>
</bean>
-
+
<component id="link" type="DirectLink">
- <binding name="listener" value="listener:trigger"/>
- <binding name="stateful" value="false"/>
- <binding name="renderer" value="bean:renderer"/>
+ <binding name="listener" value="listener:trigger"/>
+ <binding name="stateful" value="false"/>
+ <binding name="renderer" value="bean:renderer"/>
</component>
<component id="rollover" type="Rollover">
- <binding name="image" value="asset:logo"/>
- <binding name="mouseOver" value="asset:inspector"/>
+ <binding name="image" value="asset:logo"/>
+ <binding name="mouseOver" value="asset:inspector"/>
</component>
<asset name="logo" path="tapestry-logo.gif"/>
<asset name="inspector" path="inspector-rollover.gif"/>
-
+
</component-specification>
Modified: tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/link/FormLinkRenderer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/link/FormLinkRenderer.java?rev=613995&r1=613994&r2=613995&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/link/FormLinkRenderer.java (original)
+++ tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/link/FormLinkRenderer.java Mon Jan 21 12:10:15 2008
@@ -15,11 +15,7 @@
package org.apache.tapestry.contrib.link;
import org.apache.hivemind.ApplicationRuntimeException;
-import org.apache.tapestry.IMarkupWriter;
-import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.PageRenderSupport;
-import org.apache.tapestry.Tapestry;
-import org.apache.tapestry.TapestryUtils;
+import org.apache.tapestry.*;
import org.apache.tapestry.components.ILinkComponent;
import org.apache.tapestry.engine.ILink;
import org.apache.tapestry.link.DefaultLinkRenderer;
@@ -38,11 +34,11 @@
* <p>
* In short, simply add the following parameter to your <code>DirectLink</code>,
* <code>ExternalLink</code>, or other such link components:
- *
+ *
* <pre>
* renderer = "ognl: @org.apache.tapestry.contrib.link.FormLinkRenderer@RENDERER"
* </pre>
- *
+ *
* and they will automatically start using POST rather than GET requests. Their
* parameters will no longer be limited in size.
* @author mb
@@ -60,53 +56,53 @@
public static final ILinkRenderer RENDERER = new FormLinkRenderer();
public void renderLink(IMarkupWriter writer, IRequestCycle cycle,
- ILinkComponent linkComponent)
+ ILinkComponent linkComponent)
{
IMarkupWriter wrappedWriter = null;
if (cycle.getAttribute(Tapestry.LINK_COMPONENT_ATTRIBUTE_NAME) != null)
- throw new ApplicationRuntimeException(Tapestry
- .getMessage("AbstractLinkComponent.no-nesting"),
- linkComponent, null, null);
+ throw new ApplicationRuntimeException(Tapestry.getMessage("AbstractLinkComponent.no-nesting"),
+ linkComponent, null, null);
cycle.setAttribute(Tapestry.LINK_COMPONENT_ATTRIBUTE_NAME,
- linkComponent);
-
+ linkComponent);
+
String formName = cycle.getUniqueId("LinkForm");
-
- boolean hasBody = getHasBody();
+ boolean hasBody = getHasBody();
boolean disabled = linkComponent.isDisabled();
if (!disabled && !cycle.isRewinding())
{
ILink l = linkComponent.getLink(cycle);
String anchor = linkComponent.getAnchor();
-
+
PageRenderSupport prs = TapestryUtils.getPageRenderSupport(cycle, linkComponent);
-
+
String function = generateFormFunction(formName, l, anchor);
prs.addBodyScript(linkComponent, function);
-
+
if (hasBody)
writer.begin(getElement());
- else
+ else
writer.beginEmpty(getElement());
-
+
writer.attribute(getUrlAttribute(), "javascript: document."
- + formName + ".submit();");
-
+ + formName + ".submit();");
+
beforeBodyRender(writer, cycle, linkComponent);
-
+
// Allow the wrapped components a chance to render.
// Along the way, they may interact with this component
// and cause the name variable to get set.
wrappedWriter = writer.getNestedWriter();
}
- else wrappedWriter = writer;
+ else
+ wrappedWriter = writer;
- if (hasBody) linkComponent.renderBody(wrappedWriter, cycle);
+ if (hasBody)
+ linkComponent.renderBody(wrappedWriter, cycle);
if (!disabled && !cycle.isRewinding())
{
@@ -126,11 +122,10 @@
}
cycle.removeAttribute(Tapestry.LINK_COMPONENT_ATTRIBUTE_NAME);
-
}
private String generateFormFunction(String formName, ILink link,
- String anchor)
+ String anchor)
{
String[] parameterNames = link.getParameterNames();
@@ -142,13 +137,13 @@
String url = link.getURL(anchor, false);
buf.append(" html += \"<form name='" + formName
- + "' method='post' action='" + url + "'>\";\n");
+ + "' method='post' action='" + url + "'>\";\n");
for(int i = 0; i < parameterNames.length; i++)
{
String parameter = parameterNames[i];
String[] values = link.getParameterValues(parameter);
- if (values != null) {
+ if (values != null) {
for (int j = 0; j < values.length; j++) {
String value = values[j];
buf.append(" html += \"<input type='hidden' name='" + parameter + "' value='" + value + "'/>\";\n");
Modified: tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/link/PopupLinkRenderer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/link/PopupLinkRenderer.java?rev=613995&r1=613994&r2=613995&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/link/PopupLinkRenderer.java (original)
+++ tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/link/PopupLinkRenderer.java Mon Jan 21 12:10:15 2008
@@ -59,7 +59,8 @@
*/
protected String constructURL(ILinkComponent component, IRequestCycle cycle)
{
- if (cycle.isRewinding()) {
+ if (cycle.isRewinding())
+ {
return null;
}
Added: tapestry/tapestry4/trunk/tapestry-contrib/src/site/apt/links/index.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/site/apt/links/index.apt?rev=613995&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/src/site/apt/links/index.apt (added)
+++ tapestry/tapestry4/trunk/tapestry-contrib/src/site/apt/links/index.apt Mon Jan 21 12:10:15 2008
@@ -0,0 +1,37 @@
+ ------
+Contrib Library - Links
+ ------
+Jesse Kuhnert
+ ------
+21 Jan 2008
+ ------
+
+Link Renderers and ILink Components
+
+ Previous version of Tapestry <({{{http://tapestry.apache.org/tapestry3/doc/ComponentReference/contrib.PopupLink.html}specifically T3}})> included
+ a PopupLink component that was used to create new windows with content.
+
+ This logic has since been refactored in to a new <<<renderer>>> parameter that is supported by the majority of
+ {{{../../components/link/index.html}standard link components}} found in the core Tapestry framework library. The below snippets
+ will provide some small examples of using this new parameter.
+
+* DirectLink using {{{../../tapestry-contrib/apidocs/org/apache/tapestry/contrib/link/PopupLinkRenderer.html}PopupLinkRenderer}}
+
+ A very simple example of using the {{{../../tapestry-contrib/apidocs/org/apache/tapestry/contrib/link/PopupLinkRenderer.html}PopupLinkRenderer}} in
+ conjunction with the {{{../../components/link/directlink.html}DirectLink}} component:
+
++-----------------------------------------------------------
+<bean name="renderer" class="org.apache.tapestry.contrib.link.PopupLinkRenderer">
+ <set name="windowName" value="literal:TapestryInspector"/>
+ <set name="features">
+ 'titlebar,resizable,scrollbars,width=700,height=600'
+ </set>
+</bean>
+
+<component id="link" type="DirectLink">
+ <binding name="listener" value="listener:trigger"/>
+ <binding name="stateful" value="false"/>
+ <binding name="renderer" value="bean:renderer"/>
+</component>
++-----------------------------------------------------------
+
\ No newline at end of file
Modified: tapestry/tapestry4/trunk/tapestry-contrib/src/site/site.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/site/site.xml?rev=613995&r1=613994&r2=613995&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/src/site/site.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-contrib/src/site/site.xml Mon Jan 21 12:10:15 2008
@@ -38,7 +38,7 @@
<menu name="Documentation">
<item name="Overview" href="/index.html" />
-
+
<item name="Components" href="/componentreference/index.html" collapse="false">
<item name="AjaxStatus" href="/componentreference/ajaxstatus.html" />
<item name="CheckboxGroup" href="/componentreference/checkboxgroup.html" />
@@ -62,7 +62,8 @@
<item name="Timeout" href="/componentreference/timeout.html" />
<item name="XTile" href="/componentreference/xtile.html" />
</item>
-
+
+ <item name="Link Renderers" href="/links/index.html" />
<item name="Hivedoc" href="/hivedoc/index.html" />
</menu>
Modified: tapestry/tapestry4/trunk/tapestry-framework/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/pom.xml?rev=613995&r1=613994&r2=613995&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/pom.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/pom.xml Mon Jan 21 12:10:15 2008
@@ -213,6 +213,12 @@
</goals>
</execution>
</executions>
+ <configuration>
+ <archive>
+ <compress>true</compress>
+ <index>true</index>
+ </archive>
+ </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>