Author: apetrelli
Date: Sun Mar 16 04:48:16 2008
New Revision: 637579
URL: http://svn.apache.org/viewvc?rev=637579&view=rev
Log:
TILES-264
Fixed preparer call.
Added Selenium test.
Added:
tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/preparer/AttributeViewPreparer.java
(with props)
tiles/framework/trunk/tiles-test/src/main/webapp/layout_preparer.jsp
(with props)
tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_attribute_preparer.jsp
(with props)
tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionAttributePreparerTest.html
(with props)
Modified:
tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertAttributeTag.java
tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml
tiles/framework/trunk/tiles-test/src/main/webapp/index.jsp
tiles/framework/trunk/tiles-test/src/test/selenium/TestSuite.html
Modified:
tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertAttributeTag.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertAttributeTag.java?rev=637579&r1=637578&r2=637579&view=diff
==============================================================================
---
tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertAttributeTag.java
(original)
+++
tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertAttributeTag.java
Sun Mar 16 04:48:16 2008
@@ -123,6 +123,10 @@
/** [EMAIL PROTECTED] */
@Override
protected void startContext(PageContext context) {
+ if (preparer != null) {
+ container.prepare(preparer, context);
+ }
+
attribute = (Attribute) value;
if (attribute == null) {
Added:
tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/preparer/AttributeViewPreparer.java
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/preparer/AttributeViewPreparer.java?rev=637579&view=auto
==============================================================================
---
tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/preparer/AttributeViewPreparer.java
(added)
+++
tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/preparer/AttributeViewPreparer.java
Sun Mar 16 04:48:16 2008
@@ -0,0 +1,43 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.tiles.test.preparer;
+
+import org.apache.tiles.preparer.PreparerException;
+import org.apache.tiles.preparer.ViewPreparer;
+import org.apache.tiles.context.TilesRequestContext;
+import org.apache.tiles.AttributeContext;
+import org.apache.tiles.Attribute;
+
+/**
+ * A <code>ViewPreparer</code> that stores an attribute
+ *
+ * @version $Rev$ $Date$
+ */
+public class AttributeViewPreparer implements ViewPreparer {
+
+ /** [EMAIL PROTECTED] */
+ public void execute(TilesRequestContext tilesContext, AttributeContext
attributeContext)
+ throws PreparerException {
+ attributeContext.putAttribute(
+ "body",
+ new Attribute("This is the value added by the
AttributeViewPreparer"));
+ }
+}
Propchange:
tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/preparer/AttributeViewPreparer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tiles/framework/trunk/tiles-test/src/main/java/org/apache/tiles/test/preparer/AttributeViewPreparer.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified:
tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml?rev=637579&r1=637578&r2=637579&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml
(original)
+++ tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml Sun
Mar 16 04:48:16 2008
@@ -203,4 +203,9 @@
<put-attribute name="header" value="/header.jsp"/>
<put-attribute name="body" value="${requestScope.body}"/>
</definition>
+
+ <definition name="test.definition.attribute.preparer"
template="/layout_preparer.jsp">
+ <put-attribute name="title" value="This is the title."/>
+ <put-attribute name="header" value="/header.jsp"/>
+ </definition>
</tiles-definitions>
Modified: tiles/framework/trunk/tiles-test/src/main/webapp/index.jsp
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/webapp/index.jsp?rev=637579&r1=637578&r2=637579&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/webapp/index.jsp (original)
+++ tiles/framework/trunk/tiles-test/src/main/webapp/index.jsp Sun Mar 16
04:48:16 2008
@@ -52,6 +52,7 @@
<a href="testinsertdefinition_cascaded_list.jsp">Test Insert Configured
Cascaded Definition with List</a><br/>
<a href="testinsertdefinition_reversed.jsp">Test Insert Configured
Definition with Reversed Attribute</a><br/>
<a href="testinsertdefinition_reversed_explicit.jsp">Test Insert
Configured Definition with Reversed Explicit Attribute</a><br/>
+ <a href="testinsertdefinition_attribute_preparer.jsp">Test Insert
Configured Definition with Attribute Preparer</a><br/>
<a href="testinsertnesteddefinition.jsp">Test Insert Nested
Definition</a><br/>
<a href="testinsertnesteddefinition_tags.jsp">Test Insert Nested
Definition only using JSP tags</a><br/>
<a href="testinsertnestedlistdefinition.jsp">Test Insert Nested List
Definition</a><br/>
Added: tiles/framework/trunk/tiles-test/src/main/webapp/layout_preparer.jsp
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/webapp/layout_preparer.jsp?rev=637579&view=auto
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/webapp/layout_preparer.jsp (added)
+++ tiles/framework/trunk/tiles-test/src/main/webapp/layout_preparer.jsp Sun
Mar 16 04:48:16 2008
@@ -0,0 +1,38 @@
+<%@ page session="false" %>
+<%--
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+ */
+--%>
+<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
+
+<table border="2" width="300" bordercolor="Gray">
+ <tr>
+ <td bgcolor="Blue"><strong><tiles:getAsString name="title"/></strong></td>
+ </tr>
+ <tr>
+ <td><tiles:insertAttribute name="header"/></td>
+ </tr>
+ <tr>
+ <td><tiles:insertAttribute name="body"
+ preparer="org.apache.tiles.test.preparer.AttributeViewPreparer"/></td>
+ </tr>
+</table>
\ No newline at end of file
Propchange: tiles/framework/trunk/tiles-test/src/main/webapp/layout_preparer.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tiles/framework/trunk/tiles-test/src/main/webapp/layout_preparer.jsp
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added:
tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_attribute_preparer.jsp
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_attribute_preparer.jsp?rev=637579&view=auto
==============================================================================
---
tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_attribute_preparer.jsp
(added)
+++
tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_attribute_preparer.jsp
Sun Mar 16 04:48:16 2008
@@ -0,0 +1,27 @@
+<%@ page session="false" %>
+<%--
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+ */
+--%>
+<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
+
+<tiles:insertDefinition name="test.definition.attribute.preparer" />
Propchange:
tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_attribute_preparer.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_attribute_preparer.jsp
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Added:
tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionAttributePreparerTest.html
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionAttributePreparerTest.html?rev=637579&view=auto
==============================================================================
---
tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionAttributePreparerTest.html
(added)
+++
tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionAttributePreparerTest.html
Sun Mar 16 04:48:16 2008
@@ -0,0 +1,61 @@
+<!--
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+-->
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Configured Definition Attribute Preparer Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">Configured Definition Attribute Preparer
Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/tiles-test/index.jsp</td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>link=Test Insert Configured Definition with Attribute Preparer</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTextPresent</td>
+ <td>This is the title.</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTextPresent</td>
+ <td>This is the header</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTextPresent</td>
+ <td>This is the value added by the AttributeViewPreparer</td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
Propchange:
tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionAttributePreparerTest.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionAttributePreparerTest.html
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Modified: tiles/framework/trunk/tiles-test/src/test/selenium/TestSuite.html
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/test/selenium/TestSuite.html?rev=637579&r1=637578&r2=637579&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-test/src/test/selenium/TestSuite.html (original)
+++ tiles/framework/trunk/tiles-test/src/test/selenium/TestSuite.html Sun Mar
16 04:48:16 2008
@@ -88,6 +88,9 @@
<td><a href="ConfiguredDefinitionReversedExplicitTest.html">Configured
Definition Reversed Explicit Test</a></td>
</tr>
<tr>
+ <td><a
href="ConfiguredDefinitionAttributePreparerTest.html">Configured Definition
Attribute Preparer Test</a></td>
+ </tr>
+ <tr>
<td><a href="ConfiguredNestedDefinitionTest.html">Configured Nested
Definition Test</a></td>
</tr>
<tr>