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 2006/10/06 04:09:13 UTC
svn commit: r453463 - in /tapestry/tapestry4/trunk:
src/site/xdoc/components/ tapestry-examples/TimeTracker/
tapestry-examples/TimeTracker/src/context/
tapestry-examples/TimeTracker/src/context/WEB-INF/
tapestry-examples/TimeTracker/src/context/css/ ta...
Author: jkuhnert
Date: Thu Oct 5 19:09:12 2006
New Revision: 453463
URL: http://svn.apache.org/viewvc?view=rev&rev=453463
Log:
-) Cleaned up TimeTracker demo some.
-) Removed two methods from Tapestry static class that had previously been marked for removal in 4.1.
-) Added new getTemplateTagName() method to IComponent, as well as implementation in AbstractComponent.
-) Added new renderTag parameter to If/Else components to support more intuitive tag rendering.
Deprecated old "element" parameter in both of these components.
Removed:
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/WEB-INF/TestScript.script
tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/widget/DropdownDateTimePicker.js
tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/widget/DropdownTimePicker.js
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/TestTapestryGetClassName.java
Modified:
tapestry/tapestry4/trunk/src/site/xdoc/components/Else.xml
tapestry/tapestry4/trunk/src/site/xdoc/components/If.xml
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/pom.xml
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/Home.html
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/css/timetracker.css
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IComponent.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/Tapestry.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/TapestryStrings.properties
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/TapestryStrings2.properties
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/Else.jwc
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/ElseBean.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/If.jwc
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/IfBean.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/DropdownTimePicker.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/TemplateSource.java
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ComponentTemplateLoaderLogic.java
tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/namespace.js
tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/form/test_datetime.js
tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_AlertDialog.html
tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_TimePicker.html
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/components/TestIfElse.java
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/MockForm.java
tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/parse/TestTemplateParser.java
Modified: tapestry/tapestry4/trunk/src/site/xdoc/components/Else.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/xdoc/components/Else.xml?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/src/site/xdoc/components/Else.xml (original)
+++ tapestry/tapestry4/trunk/src/site/xdoc/components/Else.xml Thu Oct 5 19:09:12 2006
@@ -46,7 +46,6 @@
<tr>
<th>Name</th>
<th>Type</th>
- <th>Direction</th>
<th>Required</th>
<th>Default</th>
@@ -54,9 +53,21 @@
</tr>
<tr>
+ <td>renderTag</td>
+ <td>boolean</td>
+ <td>no</td>
+ <td>true</td>
+
+ <td>
+ Specifies whether or not to render the html tag name used to reference this
+ component. This logic also deprecates the <code>element</code> parameter in
+ that tag names are already captured from the html temlpate read in, so you
+ only need to tell the component to render or not render whatever tag you used.
+ </td>
+ </tr>
+ <tr>
<td>element</td>
<td>String</td>
- <td>in</td>
<td>no</td>
<td></td>
@@ -64,7 +75,11 @@
The element to emulate. If specified, then the component acts like an
<a href="Any.html">Any</a>
, emitting an open and close tag. Informal parameters are applied to the
- tag. If no element is specified, informal parameters are ignored.
+ tag.
+ <br/>
+ This parameter is now <em>deprecated</em> in favor of the new renderTag
+ parameter, the element tag to render is implied by the html used to reference
+ the component now.
</td>
</tr>
</table>
Modified: tapestry/tapestry4/trunk/src/site/xdoc/components/If.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/src/site/xdoc/components/If.xml?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/src/site/xdoc/components/If.xml (original)
+++ tapestry/tapestry4/trunk/src/site/xdoc/components/If.xml Thu Oct 5 19:09:12 2006
@@ -46,7 +46,6 @@
<tr>
<th>Name</th>
<th>Type</th>
- <th>Direction</th>
<th>Required</th>
<th>Default</th>
@@ -56,7 +55,6 @@
<tr>
<td>condition</td>
<td>boolean</td>
- <td>in</td>
<td>yes</td>
<td></td>
@@ -65,7 +63,6 @@
<tr>
<td>conditionValue</td>
<td>boolean</td>
- <td>in</td>
<td>no</td>
<td></td>
@@ -82,7 +79,6 @@
IActionListener
</a>
</td>
- <td>in</td>
<td>no</td>
<td></td>
@@ -92,9 +88,21 @@
</td>
</tr>
<tr>
+ <td>renderTag</td>
+ <td>boolean</td>
+ <td>no</td>
+ <td>true</td>
+
+ <td>
+ Specifies whether or not to render the html tag name used to reference this
+ component. This logic also deprecates the <code>element</code> parameter in
+ that tag names are already captured from the html temlpate read in, so you
+ only need to tell the component to render or not render whatever tag you used.
+ </td>
+ </tr>
+ <tr>
<td>element</td>
<td>String</td>
- <td>in</td>
<td>no</td>
<td></td>
@@ -102,13 +110,16 @@
The element to emulate. If specified, then the component acts like an
<a href="Any.html">Any</a>
, emitting an open and close tag. Informal parameters are applied to the
- tag. If no element is specified, informal parameters are ignored.
+ tag.
+ <br/>
+ This parameter is now <em>deprecated</em> in favor of the new renderTag
+ parameter, the element tag to render is implied by the html used to reference
+ the component now.
</td>
</tr>
<tr>
<td>volatile</td>
<td>boolean</td>
- <td>in</td>
<td>no</td>
<td>false</td>
Modified: tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/pom.xml?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/pom.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/pom.xml Thu Oct 5 19:09:12 2006
@@ -92,11 +92,12 @@
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty6-plugin</artifactId>
- <version>6.0.0beta17</version>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <version>6.1-SNAPSHOT</version>
<configuration>
<webAppSourceDirectory>${basedir}/src/context</webAppSourceDirectory>
<scanIntervalSeconds>10</scanIntervalSeconds>
+ <contextPath>/</contextPath>
</configuration>
<dependencies>
<dependency>
Modified: tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/Home.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/Home.html?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/Home.html (original)
+++ tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/Home.html Thu Oct 5 19:09:12 2006
@@ -49,39 +49,13 @@
</tr>
</table>
-
- <div jwcid="feedbackBlock@Any">
- <span jwcid="@If" condition="ognl:selectedProject">
- <label jwcid="@FieldLabel" field="component:feedbackField" />
- <input jwcid="feedbackField@TextField" displayName="message:feedback"
- value="ognl:feedback" validators="validators:required,minLength=6" />
- </span>
- </div>
-
</fieldset>
</form>
-<p>
-Click this link to manually update the project description.
- <a jwcid="@DirectLink" listener="listener:linkUpdateClicked"
- updateComponents="projectDescription" async="true" >Update</a>
-</p>
-
<div jwcid="projectDescription@Any" >
- <span jwcid="@If" condition="ognl:selectedProject">
- <h2 style="clear:left" ><span jwcid="@Insert" value="ognl:selectedProject.name" /></h2>
- <a jwcid="@DirectLink" listener="listener:linkUpdateClicked"
- async="true" updateComponents="projectDescription">Another link!</a>
- </span>
-</div>
-
-<div jwcid="textListen@Any">This is some text at the bottom of the screen.</div>
-
-<div jwcid="refresh@Any">
- <span jwcid="@If" condition="ognl:eventReceived">
- <p>I must have been refreshed!</p>
- <span jwcid="@Script" script="TestScript.script" />
- </span>
+ <h2 jwcid="@If" condition="ognl:selectedProject" style="clear:left" >
+ <span jwcid="@Insert" value="ognl:selectedProject.name" />
+ </h2>
</div>
-</span>
\ No newline at end of file
+</span>
Modified: tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/css/timetracker.css
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/css/timetracker.css?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/css/timetracker.css (original)
+++ tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/css/timetracker.css Thu Oct 5 19:09:12 2006
@@ -10,7 +10,7 @@
body, td, th {
font-family: Lucida Grande, Tahoma, Verdana, Arial, sans-serif;
- font-size: 9pt;
+ font-size: 11pt;
color: #292929;
margin-left: 3%;
}
Modified: tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java (original)
+++ tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/TaskEntryPage.java Thu Oct 5 19:09:12 2006
@@ -18,7 +18,6 @@
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.annotations.Component;
import org.apache.tapestry.annotations.EventListener;
-import org.apache.tapestry.annotations.InitialValue;
import org.apache.tapestry.annotations.InjectObject;
import org.apache.tapestry.annotations.Persist;
import org.apache.tapestry.dojo.form.Autocompleter;
@@ -80,13 +79,6 @@
@InjectObject("service:timetracker.dao.TaskDao")
public abstract TaskDao getTaskDao();
- public abstract String getFeedback();
-
- @InitialValue("ognl:false")
- public abstract boolean isEventReceived();
-
- public abstract void setEventReceived(boolean value);
-
/**
* Selection model for projects.
* @return
@@ -100,28 +92,11 @@
* Invoked when an item is selected from the project
* selection list.
*/
- @EventListener(events = "selectOption", targets = "projectChoose", submitForm = "taskForm")
+ @EventListener(events = "selectOption", targets = "projectChoose",
+ submitForm = "taskForm")
public void projectSelected(IRequestCycle cycle, BrowserEvent event)
{
cycle.getResponseBuilder().updateComponent("projectDescription");
- cycle.getResponseBuilder().updateComponent("feedbackBlock");
- }
-
- @EventListener(events = "onblur", targets = "descriptionField", submitForm = "taskForm")
- public void descriptionChanged(IRequestCycle cycle)
- {
- cycle.getResponseBuilder().updateComponent("taskForm");
- }
-
- public void linkUpdateClicked()
- {
- }
-
- @EventListener(events = "onclick", elements = "textListen")
- public void textSelected(IRequestCycle cycle)
- {
- setEventReceived(true);
- cycle.getResponseBuilder().updateComponent("refresh");
}
/**
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java Thu Oct 5 19:09:12 2006
@@ -75,15 +75,19 @@
*/
private String _id;
-
+
/**
* The fully qualified id of this component. This is calculated the first time it is needed,
* then cached for later.
*/
-
private String _idPath;
/**
+ * The html tag name that was used to reference the component.
+ */
+ private String _templateTagName;
+
+ /**
* A {@link Map}of all bindings (for which there isn't a corresponding JavaBeans property); the
* keys are the names of formal and informal parameters.
*/
@@ -467,6 +471,23 @@
return id.getObject().toString();
}
+ public String getTemplateTagName()
+ {
+ return _templateTagName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setTemplateTagName(String tag)
+ {
+ if (_templateTagName != null)
+ throw new ApplicationRuntimeException(Tapestry
+ .getMessage("AbstractComponent.attempt-to-change-template-tag"));
+
+ _templateTagName = tag;
+ }
+
public IPage getPage()
{
return _page;
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IComponent.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IComponent.java?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IComponent.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IComponent.java Thu Oct 5 19:09:12 2006
@@ -185,6 +185,42 @@
String getClientId();
/**
+ * Though most component implementations ignore the specific html tag used
+ * to reference a component, this value may be used for those components that
+ * do wish to use the same tag that was provided when rendering a component.
+ *
+ * <p>Example:<br/>
+ * <pre>
+ * <fieldset jwcid="@If" condition="true" >
+ * <input type="text" />
+ * </fieldset>
+ * </pre>
+ * </p>
+ *
+ * <p>
+ * In the example above, the value of the template tag would be "fieldset" for
+ * the If component.
+ * </p>
+ *
+ * @return The html element tag name originally specified when referencing
+ * the component.
+ * @since 4.1
+ */
+ String getTemplateTagName();
+
+ /**
+ * Sets the template tag name used to reference this component.
+ *
+ * <p>
+ * Set by the component template loader automatically, people shouldn't
+ * normally have any reason to try setting this.
+ * </p>
+ *
+ * @param tag The tag name to set.
+ */
+ void setTemplateTagName(String tag);
+
+ /**
* Returns the page which ultimately contains the receiver. A page will return itself.
*/
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/Tapestry.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/Tapestry.java?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/Tapestry.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/Tapestry.java Thu Oct 5 19:09:12 2006
@@ -29,12 +29,9 @@
import java.util.Set;
import org.apache.hivemind.ApplicationRuntimeException;
-import org.apache.hivemind.HiveMind;
import org.apache.hivemind.Location;
-import org.apache.hivemind.service.ClassFabUtils;
import org.apache.tapestry.event.ChangeObserver;
import org.apache.tapestry.event.ObservedChangeEvent;
-import org.apache.tapestry.services.ServiceConstants;
import org.apache.tapestry.spec.IComponentSpecification;
import org.apache.tapestry.util.StringSplitter;
@@ -134,31 +131,7 @@
*/
public static final String RESET_SERVICE = "reset";
-
- /**
- * Query parameter that identfies the service for the request.
- *
- * @since 1.0.3
- * @deprecated To be removed in 4.1. Use
- * {@link org.apache.tapestry.services.ServiceConstants#SERVICE} instead.
- */
-
- public static final String SERVICE_QUERY_PARAMETER_NAME = ServiceConstants.SERVICE;
-
- /**
- * The query parameter for application specific parameters to the service (this is used with the
- * direct service). Each of these values is encoded with
- * {@link java.net.URLEncoder#encode(String)} before being added to the URL. Multiple values are
- * handle by repeatedly establishing key/value pairs (this is a change from behavior in 2.1 and
- * earlier).
- *
- * @since 1.0.3
- * @deprecated To be removed in 4.1. Use
- * {@link org.apache.tapestry.services.ServiceConstants#PARAMETER} instead.
- */
-
- public static final String PARAMETERS_QUERY_PARAMETER_NAME = ServiceConstants.PARAMETER;
-
+
/**
* Property name used to get the extension used for templates. This may be set in the page or
* component specification, or in the page (or component's) immediate container (library or
@@ -611,20 +584,7 @@
return result;
}
-
- /**
- * Given a Class, creates a presentable name for the class, even if the class is a scalar type
- * or Array type.
- *
- * @since 3.0
- * @deprecated To be removed in 4.1.
- */
-
- public static String getClassName(Class subject)
- {
- return ClassFabUtils.getJavaClassName(subject);
- }
-
+
/**
* Creates an exception indicating the binding value is null.
*
@@ -746,34 +706,5 @@
ObservedChangeEvent event = new ObservedChangeEvent(component, propertyName, newValue);
observer.observeChange(event);
- }
-
- /**
- * Returns true if the input is null or contains only whitespace.
- * <p>
- * Note: Yes, you'd think we'd use <code>StringUtils</code>, but with the change in names and
- * behavior between releases, it is smarter to just implement our own little method!
- *
- * @since 3.0
- * @deprecated To be removed in Tapestry 4.1. Use {@link HiveMind#isBlank(java.lang.String)}
- * instead.
- */
-
- public static boolean isBlank(String input)
- {
- return HiveMind.isBlank(input);
- }
-
- /**
- * Returns true if the input is not null and not empty (or only whitespace).
- *
- * @since 3.0
- * @deprecated To be removed in Tapestry 4.1. Use {@link HiveMind#isNonBlank(java.lang.String)}
- * instead.
- */
-
- public static boolean isNonBlank(String input)
- {
- return HiveMind.isNonBlank(input);
}
}
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/TapestryStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/TapestryStrings.properties?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/TapestryStrings.properties (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/TapestryStrings.properties Thu Oct 5 19:09:12 2006
@@ -41,6 +41,7 @@
AbstractComponent.null-container={0} container is null.
AbstractComponent.attempt-to-change-page=Attempt to change existing containing page.
AbstractComponent.attempt-to-change-spec=Attempt to change existing component specification.
+AbstractComponent.attempt-to-change-template-tag=Attempt to change existing templateTagName.
AbstractPage.attempt-to-change-locale=Attempt to change existing locale for a page.
AbstractPage.attempt-to-change-name=Attempt to change existing name for a page.
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/TapestryStrings2.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/TapestryStrings2.properties?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/TapestryStrings2.properties (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/TapestryStrings2.properties Thu Oct 5 19:09:12 2006
@@ -23,3 +23,4 @@
attempt-to-change-contained-component=Attempt to change containedComponent property of component {0}, which is not allowed.
attempt-to-change-event-invoker=Attempt to change eventInvoker property of component {0}, which is not allowed.
component-wrong-type=Component {0} is not assignable to type {1}.
+
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/Else.jwc
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/Else.jwc?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/Else.jwc (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/Else.jwc Thu Oct 5 19:09:12 2006
@@ -26,9 +26,12 @@
if the condition of the previous If component evaluates to false.
</description>
- <parameter name="element">
+ <parameter name="renderTag" default-value="true" />
+
+ <parameter name="element" deprecated="yes" >
<description>
- The element to emulate.
+ The element to emulate. Usage deprecated, please use the renderTag parameter to control
+ whether or not to render the tag.
</description>
</parameter>
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/ElseBean.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/ElseBean.java?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/ElseBean.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/ElseBean.java Thu Oct 5 19:09:12 2006
@@ -26,15 +26,17 @@
{
public abstract String getElement();
+ public abstract boolean getRenderTag();
+
protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
{
Object conditionObject = cycle.getAttribute(IfBean.IF_VALUE_ATTRIBUTE);
if (conditionObject instanceof Boolean && !((Boolean) conditionObject).booleanValue())
{
- String element = getElement();
+ String element = HiveMind.isNonBlank(getElement()) ? getElement() : getTemplateTagName();
- boolean render = !cycle.isRewinding() && HiveMind.isNonBlank(element);
+ boolean render = !cycle.isRewinding() && getRenderTag();
if (render)
{
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/If.jwc
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/If.jwc?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/If.jwc (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/If.jwc Thu Oct 5 19:09:12 2006
@@ -41,9 +41,12 @@
<parameter name="listener"/>
- <parameter name="element">
+ <parameter name="renderTag" default-value="true" />
+
+ <parameter name="element" deprecated="yes" >
<description>
- The element to emulate.
+ The element to emulate. Usage deprecated, please use the renderTag parameter to control
+ whether or not to render the tag.
</description>
</parameter>
@@ -60,5 +63,5 @@
<inject property="dataSqueezer" object="service:tapestry.data.DataSqueezer"/>
<inject property="listenerInvoker" object="infrastructure:listenerInvoker"/>
-
+
</component-specification>
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/IfBean.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/IfBean.java?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/IfBean.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/components/IfBean.java Thu Oct 5 19:09:12 2006
@@ -33,7 +33,7 @@
public abstract class IfBean extends AbstractFormComponent
{
public static final String IF_VALUE_ATTRIBUTE = "org.mb.tapestry.base.IfValue";
-
+
private boolean _rendering = false;
private boolean _conditionValue;
@@ -45,7 +45,9 @@
public abstract boolean getVolatile();
public abstract String getElement();
-
+
+ public abstract boolean getRenderTag();
+
public abstract IActionListener getListener();
protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle)
@@ -59,7 +61,7 @@
// then do nothing (don't even render the body).
if (cycleRewinding && form != null && !form.isRewinding())
return;
-
+
// get the condition. work with a hidden field if necessary
_conditionValue = evaluateCondition(cycle, form, cycleRewinding);
_rendering = true;
@@ -77,10 +79,10 @@
// now render if condition is true
if (_conditionValue)
{
- String element = getElement();
-
- boolean render = !cycleRewinding && HiveMind.isNonBlank(element);
-
+ String element = HiveMind.isNonBlank(getElement()) ? getElement() : getTemplateTagName();
+
+ boolean render = !cycleRewinding && getRenderTag();
+
if (render)
{
writer.begin(element);
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/DropdownTimePicker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/DropdownTimePicker.java?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/DropdownTimePicker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/form/DropdownTimePicker.java Thu Oct 5 19:09:12 2006
@@ -13,7 +13,6 @@
// limitations under the License.
package org.apache.tapestry.dojo.form;
-import java.text.DateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -84,8 +83,7 @@
json.put("timeFormat", Strftime.convertToPosixFormat(translator.getPattern()));
if (getValue() != null) {
- json.put("time", DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL,
- getPage().getLocale()).format(getValue()));
+ json.put("storedtime", getTranslatedFieldSupport().format(this, getValue()));
}
Map parms = new HashMap();
@@ -105,7 +103,7 @@
try
{
Date date = (Date) getTranslatedFieldSupport().parse(this, value);
-
+
getValidatableFieldSupport().validate(this, writer, cycle, date);
setValue(date);
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/TemplateSource.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/TemplateSource.java?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/TemplateSource.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/TemplateSource.java Thu Oct 5 19:09:12 2006
@@ -51,7 +51,8 @@
* AbstractComponent, not BaseComponent), then this parameter is bound to null.
*
* @since 3.0
- *
+ * @deprecated To be removed in 4.2. Use the new {@link IComponent#getTemplateTagName()} method
+ * instead.
*/
String TEMPLATE_TAG_PARAMETER_NAME = "templateTag";
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ComponentTemplateLoaderLogic.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ComponentTemplateLoaderLogic.java?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ComponentTemplateLoaderLogic.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/ComponentTemplateLoaderLogic.java Thu Oct 5 19:09:12 2006
@@ -262,6 +262,10 @@
void addTemplateBindings(IComponent component, OpenToken token)
{
+ // sets the html tag name used to specify the component
+
+ component.setTemplateTagName(token.getTag());
+
IComponentSpecification spec = component.getSpecification();
Map attributes = token.getAttributesMap();
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/namespace.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/namespace.js?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/namespace.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/namespace.js Thu Oct 5 19:09:12 2006
@@ -7,9 +7,7 @@
var map = {
html: {
"alertdialog": "tapestry.widget.AlertDialog",
- "dropdowndatetimepicker" : "tapestry.widget.DropdownDateTimePicker",
- "dropdowntimepicker" : "tapestry.widget.DropdownTimePicker",
- "timepicker" : "tapestry.widget.TimePicker"
+ "timepicker": "tapestry.widget.TimePicker"
}
};
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/form/test_datetime.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/form/test_datetime.js?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/form/test_datetime.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/form/test_datetime.js Thu Oct 5 19:09:12 2006
@@ -6,6 +6,8 @@
dojo.require("tapestry.form");
dojo.require("tapestry.form.datetime");
+dojo.require("dojo.widget.TimePicker");
+
function test_datetime_validDate(){
var value = "08/15/1999";
// jum.assertFalse(value, tapestry.form.datetime.isValidDate(value, {}));
@@ -54,7 +56,7 @@
{strict:true,min:minValue, datePattern:"MM/dd/yyyy",selector:"dateOnly"}));
}
-/*
+
function test_datetime_LongFormat(){
var value = "18 Aug 2006";
@@ -63,4 +65,3 @@
jum.assertTrue(value, tapestry.form.datetime.isValidDate(value,
{strict:true,max:"19 Aug 2006",datePattern:"dd MMM yyyy",selector:"dateOnly"}));
}
-*/
\ No newline at end of file
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_AlertDialog.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_AlertDialog.html?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_AlertDialog.html (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_AlertDialog.html Thu Oct 5 19:09:12 2006
@@ -34,7 +34,7 @@
</style>
<script type="text/javascript">
- dojo.require("tapestry.widget.AlertDialog");
+ dojo.require("tapestry.namespace");
dojo.addOnLoad(function() {
dojo.widget.byId("alertDialog").show();
@@ -45,7 +45,7 @@
<p> la ? lalale..... </p>
<p>
-<div dojoType="AlertDialog" widgetId="alertDialog" ></div>
+<div dojoType="tapestry:AlertDialog" widgetId="alertDialog" ></div>
</p>
</body>
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_TimePicker.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_TimePicker.html?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_TimePicker.html (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tests/widget/test_TimePicker.html Thu Oct 5 19:09:12 2006
@@ -20,7 +20,6 @@
<body>
<script type="text/javascript">
- dojo.require("tapestry.widget.*");
dojo.require("tapestry.widget.TimePicker");
dojo.addOnLoad(function() {
@@ -29,7 +28,7 @@
</script>
<p>
-<div dojoType="TimePicker" widgetId="picker" ></div>
+<div dojoType="tapestry:TimePicker" widgetId="picker" ></div>
</p>
</body>
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/components/TestIfElse.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/components/TestIfElse.java?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/components/TestIfElse.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/components/TestIfElse.java Thu Oct 5 19:09:12 2006
@@ -343,7 +343,7 @@
verify();
}
- public void testElement()
+ public void test_Render_Tag()
{
IMarkupWriter writer = newWriter();
@@ -356,7 +356,8 @@
new Object[] {
"condition", Boolean.TRUE,
"element", "div",
- "specification", spec
+ "specification", spec,
+ "renderTag", Boolean.TRUE
});
expect(cycle.renderStackPush(conditional)).andReturn(conditional);
@@ -371,7 +372,7 @@
writer.attribute("informal", "informal-value");
writer.end("div");
-
+
trainResponseBuilder(cycle, writer);
cycle.setAttribute(IfBean.IF_VALUE_ATTRIBUTE, Boolean.TRUE);
@@ -382,9 +383,46 @@
conditional.addBody(body);
conditional.setBinding("informal", informal);
-
+
conditional.render(writer, cycle);
+
+ verify();
+ }
+
+ public void test_Render_Tag_False()
+ {
+ IMarkupWriter writer = newWriter();
+ IComponentSpecification spec = newSpec();
+ IRequestCycle cycle = newCycle();
+ IfBean conditional = newInstance(TestIfBean.class,
+ new Object[] {
+ "condition", Boolean.TRUE,
+ "specification", spec,
+ "renderTag", Boolean.FALSE,
+ "templateTagName", "fieldset"
+ });
+
+ expect(cycle.renderStackPush(conditional)).andReturn(conditional);
+
+ expect(cycle.isRewinding()).andReturn(false);
+
+ expect(cycle.getAttribute(TapestryUtils.FORM_ATTRIBUTE)).andReturn(null);
+
+ trainResponseBuilder(cycle, writer);
+
+ IRender body = newRender(writer, cycle);
+
+ cycle.setAttribute(IfBean.IF_VALUE_ATTRIBUTE, Boolean.TRUE);
+
+ expect(cycle.renderStackPop()).andReturn(conditional);
+
+ replay();
+
+ conditional.addBody(body);
+
+ conditional.render(writer, cycle);
+
verify();
}
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/MockForm.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/MockForm.java?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/MockForm.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/MockForm.java Thu Oct 5 19:09:12 2006
@@ -465,5 +465,16 @@
public void trigger(IRequestCycle cycle)
{
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getTemplateTagName()
+ {
+ return "form";
+ }
+ public void setTemplateTagName(String tag)
+ {
+ }
}
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/parse/TestTemplateParser.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/parse/TestTemplateParser.java?view=diff&rev=453463&r1=453462&r2=453463
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/parse/TestTemplateParser.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/junit/parse/TestTemplateParser.java Thu Oct 5 19:09:12 2006
@@ -676,4 +676,4 @@
assertEquals("baz", token2.getId());
assertEquals("biff/bop/Boop", token2.getComponentType());
}
-}
\ No newline at end of file
+}
Re: svn commit: r453463 - in /tapestry/tapestry4/trunk: src/site/xdoc/components/
tapestry-examples/TimeTracker/ tapestry-examples/TimeTracker/src/context/
tapestry-examples/TimeTracker/src/context/WEB-INF/ tapestry-examples/TimeTracker/src/context/css/
ta...
Posted by andyhot <an...@di.uoa.gr>.
jkuhnert@apache.org wrote:
> Author: jkuhnert
> Date: Thu Oct 5 19:09:12 2006
> New Revision: 453463
>
> -) Added new getTemplateTagName() method to IComponent, as well as implementation in AbstractComponent.
>
If a component specifies a templateTag parameter, the framework fills it
in with the tag name...
So, those additions aren't really needed in order to implement the
If/Else enhancements
> -) Added new renderTag parameter to If/Else components to support more intuitive tag rendering.
> Deprecated old "element" parameter in both of these components.
>
>
--
Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / J2EE Consulting
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org