pferraro 2005/08/26 12:40:11
Modified: framework/src/test-data/context10 Home.html
framework/src/test-data/context10/WEB-INF Home.page
framework/src/scripts TestLinkRenderers.xml
. status.xml
Added: contrib/src/java/org/apache/tapestry/contrib/link
ButtonLinkRenderer.java
Removed: framework/src/java/org/apache/tapestry/link
ButtonLinkRenderer.java
Log:
Refactored ButtonLinkRenderer to contrib
Revision Changes Path
1.6 +0 -12
jakarta-tapestry/framework/src/test-data/context10/Home.html
Index: Home.html
===================================================================
RCS file:
/home/cvs/jakarta-tapestry/framework/src/test-data/context10/Home.html,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Home.html 31 Jan 2005 20:35:47 -0000 1.5
+++ Home.html 26 Aug 2005 19:40:11 -0000 1.6
@@ -21,17 +21,5 @@
<a jwcid="[EMAIL PROTECTED]" target="_blank"
listener="listener:link">Fifth</a>
-<br/>
-
-<button jwcid="[EMAIL PROTECTED]" renderer="bean:buttonRenderer"
listener="listener:link">Sixth</button>
-
-<br/>
-
-<button jwcid="[EMAIL PROTECTED]" renderer="bean:buttonRenderer"
listener="listener:link" disabled="ognl:true">Seventh</button>
-
-<br/>
-
-<button jwcid="[EMAIL PROTECTED]" renderer="bean:buttonRenderer"
listener="listener:link" target="_blank">Eighth</button>
-
</body>
</html>
\ No newline at end of file
1.1
jakarta-tapestry/contrib/src/java/org/apache/tapestry/contrib/link/ButtonLinkRenderer.java
Index: ButtonLinkRenderer.java
===================================================================
// Copyright 2004, 2005 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.tapestry.contrib.link;
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.tapestry.IMarkupWriter;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.Tapestry;
import org.apache.tapestry.components.ILinkComponent;
import org.apache.tapestry.engine.ILink;
import org.apache.tapestry.link.ILinkRenderer;
/**
* An [EMAIL PROTECTED] ILinkRenderer} implementation that generates an HTML
button.
* This is particularly useful for implementing cancel buttons.
*
* @author Paul Ferraro
* @since 4.0
*/
public class ButtonLinkRenderer implements ILinkRenderer
{
public static final ILinkRenderer SHARED_INSTANCE = new
ButtonLinkRenderer();
/**
* @see
org.apache.tapestry.link.ILinkRenderer#renderLink(org.apache.tapestry.IMarkupWriter,
* org.apache.tapestry.IRequestCycle,
org.apache.tapestry.components.ILinkComponent)
*/
public void renderLink(IMarkupWriter writer, IRequestCycle cycle,
ILinkComponent component)
{
if (cycle.getAttribute(Tapestry.LINK_COMPONENT_ATTRIBUTE_NAME) !=
null)
{
String message =
Tapestry.getMessage("AbstractLinkComponent.no-nesting");
throw new ApplicationRuntimeException(message, component, null,
null);
}
cycle.setAttribute(Tapestry.LINK_COMPONENT_ATTRIBUTE_NAME, component);
ILink link = component.getLink(cycle);
writer.begin("button");
writer.attribute("type", "button");
if (component.isDisabled())
{
writer.attribute("disabled", "disabled");
}
String url = link.getURL(component.getAnchor(), true);
String target = component.getTarget();
String onclick = (target == null) ? getScript(url) : getScript(url,
target);
writer.attribute("onclick", onclick);
component.renderAdditionalAttributes(writer, cycle);
IMarkupWriter wrappedWriter = writer.getNestedWriter();
component.renderBody(wrappedWriter, cycle);
wrappedWriter.close();
writer.end();
cycle.removeAttribute(Tapestry.LINK_COMPONENT_ATTRIBUTE_NAME);
}
/**
* Generates the onclick event handler that opens the specified url in
the current window.
* @param url the url generated by this link
* @return a JavaScript onclick event handler
*/
protected String getScript(String url)
{
return "window.location='" + url + "'";
}
/**
* Generates the onclick event handler that opens the specified url in
the specified window or frame.
* @param url the url generated by this link
* @param target the name of the target window or frame
* @return a JavaScript onclick event handler
*/
protected String getScript(String url, String target)
{
return "window.open('" + url + "','" + target + "')";
}
}
1.4 +0 -2
jakarta-tapestry/framework/src/test-data/context10/WEB-INF/Home.page
Index: Home.page
===================================================================
RCS file:
/home/cvs/jakarta-tapestry/framework/src/test-data/context10/WEB-INF/Home.page,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Home.page 31 Jan 2005 20:35:47 -0000 1.3
+++ Home.page 26 Aug 2005 19:40:11 -0000 1.4
@@ -30,6 +30,4 @@
<set-property name="serverName"
expression=""myserver""/>
</bean>
- <bean name="buttonRenderer"
class="org.apache.tapestry.link.ButtonLinkRenderer" lifecycle="page"/>
-
</page-specification>
1.8 +0 -21
jakarta-tapestry/framework/src/scripts/TestLinkRenderers.xml
Index: TestLinkRenderers.xml
===================================================================
RCS file:
/home/cvs/jakarta-tapestry/framework/src/scripts/TestLinkRenderers.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- TestLinkRenderers.xml 9 Apr 2005 00:54:07 -0000 1.7
+++ TestLinkRenderers.xml 26 Aug 2005 19:40:11 -0000 1.8
@@ -61,27 +61,6 @@
]]>
</assert-output>
- <!-- Test button link -->
- <assert-output name="Sixth Link">
-<![CDATA[
-<button type="button"
onclick="window.location='/c10/app?component=sixth&page=Home&service=direct'">Sixth</button>
-]]>
- </assert-output>
-
- <!-- Test disabled button link -->
- <assert-output name="Seventh Link">
-<![CDATA[
-<button type="button" disabled="disabled"
onclick="window.location='/c10/app?component=seventh&page=Home&service=direct'">Seventh</button>
-]]>
- </assert-output>
-
- <!-- Test button link with target -->
- <assert-output name="Eighth Link">
-<![CDATA[
-<button type="button"
onclick="window.open('/c10/app?component=eighth&page=Home&service=direct','_blank')">Eighth</button>
-]]>
- </assert-output>
-
</request>
<request>
1.232 +1 -0 jakarta-tapestry/status.xml
Index: status.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/status.xml,v
retrieving revision 1.231
retrieving revision 1.232
diff -u -r1.231 -r1.232
--- status.xml 26 Aug 2005 10:54:38 -0000 1.231
+++ status.xml 26 Aug 2005 19:40:11 -0000 1.232
@@ -82,6 +82,7 @@
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-560">Poor reporting
of missing specification file</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-596">Form: have a
success listener that is invoked only when the form is submitted normally and
the delegate records no errors</action>
<action type="fix" dev="HLS" fixes-bug="TAPESTRY-589">Deprecated IPage
methods are not marked as such in AbstractPage</action>
+ <action type="update" dev="PF">Refactored ButtonLinkRenderer to the
contrib library</action>
</release>
<release version="4.0-beta-4" date="Aug 10 2005">
<action type="fix" dev="HLS">Add getComponent() method to
IComponent.</action>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]