You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2007/10/14 22:10:51 UTC

svn commit: r584596 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry/corelib/base/ main/java/org/apache/tapestry/corelib/components/ main/java/org/apache/tapestry/corelib/pages/ main/java/org/apache/tapestry/services/ mai...

Author: hlship
Date: Sun Oct 14 13:10:49 2007
New Revision: 584596

URL: http://svn.apache.org/viewvc?rev=584596&view=rev
Log:
TAPESTRY-1358: Create BeanDisplay component to display the content of a single bean

Added:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractPropertyOutput.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanDisplay.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PropertyDisplay.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PropertyOutputContext.java
      - copied, changed from r584409, tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PropertyDisplayContext.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/BeanDisplay.tml
    tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/pages/GridEnumDemo.properties
    tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/pages/GridFormDemo.properties
    tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/pages/ViewRegistration.properties
Removed:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PropertyDisplayContext.java
Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/GridCell.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/RenderObject.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/pages/PropertyDisplayBlocks.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/GridRows.tml
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/default.css
    tapestry/tapestry5/trunk/tapestry-core/src/site/apt/index.apt
    tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ViewRegistration.tml
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/BeanEditorDemo.java

Added: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractPropertyOutput.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractPropertyOutput.java?rev=584596&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractPropertyOutput.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/base/AbstractPropertyOutput.java Sun Oct 14 13:10:49 2007
@@ -0,0 +1,159 @@
+// Copyright 2007 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.corelib.base;
+
+import org.apache.tapestry.Block;
+import org.apache.tapestry.ComponentResources;
+import org.apache.tapestry.MarkupWriter;
+import org.apache.tapestry.annotations.Parameter;
+import org.apache.tapestry.beaneditor.PropertyModel;
+import org.apache.tapestry.ioc.Messages;
+import org.apache.tapestry.ioc.annotations.Inject;
+import org.apache.tapestry.services.BeanBlockSource;
+import org.apache.tapestry.services.Environment;
+import org.apache.tapestry.services.PropertyOutputContext;
+
+/**
+ * Base class for components that output a property value using a {@link PropertyModel}. There's a
+ * relationship between such a component and its container, as the container may provide messages in
+ * its message catalog needed by the {@link Block}s that render the values. In addition, the
+ * component may be passed Block parameters that are output overrides for specified properties.
+ * <p>
+ * Subclasses will implement a <code>beginRender()</code> method that invokes
+ * {@link #renderPropertyValue(MarkupWriter, String)}.
+ * 
+ * @see BeanBlockSource
+ */
+public class AbstractPropertyOutput
+{
+
+    /** Model for property displayed by the cell. */
+    @Parameter(required = true)
+    private PropertyModel _model;
+
+    /**
+     * Resources used to search for block parameter overrides (this is normally the enclosing Grid
+     * component's resources).
+     */
+    @Parameter(required = true)
+    private ComponentResources _overrides;
+
+    /**
+     * Identifies the object being rendered. The component will extract a property from the object
+     * and render its value (or delegate to a {@link Block} that will do so).
+     */
+    @Parameter(required = true)
+    private Object _object;
+
+    @Inject
+    private BeanBlockSource _beanBlockSource;
+
+    @Inject
+    private Environment _environment;
+
+    private boolean _mustPopEnvironment;
+
+    protected PropertyModel getPropertyModel()
+    {
+        return _model;
+    }
+
+    /**
+     * Invoked from subclasses to do the rendering. The subclass controls the naming convention for
+     * locating an overriding Block parameter (it is the name of the property possibly suffixed with
+     * a value).
+     */
+    protected Object renderPropertyValue(MarkupWriter writer, String overrideBlockId)
+    {
+        Block override = _overrides.getBlockParameter(overrideBlockId);
+
+        if (override != null) return override;
+
+        String datatype = _model.getDataType();
+
+        if (_beanBlockSource.hasDisplayBlock(datatype))
+        {
+            PropertyOutputContext context = new PropertyOutputContext()
+            {
+                public Messages getMessages()
+                {
+                    return getOverrideMessages();
+                }
+
+                public Object getPropertyValue()
+                {
+                    return readPropertyForObject();
+                }
+
+                public String getPropertyId()
+                {
+                    return _model.getId();
+                }
+
+                public String getPropertyName()
+                {
+                    return _model.getPropertyName();
+                }
+            };
+
+            _environment.push(PropertyOutputContext.class, context);
+            _mustPopEnvironment = true;
+
+            return _beanBlockSource.getDisplayBlock(datatype);
+        }
+
+        Object value = readPropertyForObject();
+
+        if (value == null)
+        {
+            writer.writeRaw("&nbsp;");
+            return false;
+        }
+
+        writer.write(value.toString());
+
+        // Don't render anything else
+
+        return false;
+    }
+
+    private Object readPropertyForObject()
+    {
+        return _model.getConduit().get(_object);
+    }
+
+    private Messages getOverrideMessages()
+    {
+        return _overrides.getContainerMessages();
+    }
+
+    /**
+     * Returns false; there's no template and this prevents the body from rendering.
+     */
+    boolean beforeRenderTemplate()
+    {
+        return false;
+    }
+
+    void afterRender()
+    {
+        if (_mustPopEnvironment)
+        {
+            _environment.pop(PropertyOutputContext.class);
+            _mustPopEnvironment = false;
+        }
+    }
+
+}

Added: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanDisplay.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanDisplay.java?rev=584596&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanDisplay.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/BeanDisplay.java Sun Oct 14 13:10:49 2007
@@ -0,0 +1,136 @@
+// Copyright 2007 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.corelib.components;
+
+import org.apache.tapestry.Binding;
+import org.apache.tapestry.ComponentResources;
+import org.apache.tapestry.annotations.Parameter;
+import org.apache.tapestry.annotations.SupportsInformalParameters;
+import org.apache.tapestry.beaneditor.BeanModel;
+import org.apache.tapestry.beaneditor.PropertyModel;
+import org.apache.tapestry.internal.beaneditor.BeanModelUtils;
+import org.apache.tapestry.ioc.annotations.Inject;
+import org.apache.tapestry.services.BeanModelSource;
+import org.apache.tapestry.services.ComponentDefaultProvider;
+
+/**
+ * Used to display the properties of a bean, using an underlying {@link BeanModel}. The output is a
+ * series of &lt;div&gt; elements for the property names and property values.
+ */
+@SupportsInformalParameters
+public class BeanDisplay
+{
+
+    /**
+     * The object to be rendered; if not explicitly bound, a default binding to a property whose
+     * name matches this component's id will be used.
+     */
+    @Parameter(required = true)
+    private Object _object;
+
+    /**
+     * The model that identifies the parameters to be displayed, their order, and every other
+     * aspect. If not specified, a default bean model will be created from the type of the object
+     * bound to the object parameter.
+     */
+    @Parameter
+    private BeanModel _model;
+
+    /**
+     * A comma-separated list of property names to be removed from the {@link BeanModel}. The names
+     * are case-insensitive.
+     */
+    @Parameter(defaultPrefix = "literal")
+    private String _remove;
+
+    /**
+     * A comma-separated list of property names indicating the order in which the properties should
+     * be presented. The names are case insensitive. Any properties not indicated in the list will
+     * be appended to the end of the display order.
+     */
+    @Parameter(defaultPrefix = "literal")
+    private String _reorder;
+
+    /**
+     * Where to search for local overrides of property display blocks as block parameters. Further,
+     * the container of the overrides is used as the source for overridden validation messages. This
+     * is normally the component itself, but when the component is used within a BeanEditForm, it
+     * will be the BeanEditForm's block parameter that will be searched.
+     */
+    @Parameter(value = "componentResources")
+    private ComponentResources _overrides;
+
+    @Inject
+    private ComponentDefaultProvider _defaultProvider;
+
+    @Inject
+    private ComponentResources _resources;
+
+    @Inject
+    private BeanModelSource _modelSource;
+
+    private String _propertyName;
+
+    /**
+     * Defaults the object parameter to a property of the container matching the BeanEditForm's id.
+     */
+    Binding defaultObject()
+    {
+        return _defaultProvider.defaultBinding("object", _resources);
+    }
+
+    public Object getObject()
+    {
+        return _object;
+    }
+
+    void setupRender()
+    {
+        if (_model == null)
+            _model = _modelSource.create(_object.getClass(), false, _overrides
+                    .getContainerResources());
+
+        if (_remove != null) BeanModelUtils.remove(_model, _remove);
+
+        if (_reorder != null) BeanModelUtils.reorder(_model, _reorder);
+    }
+
+    public BeanModel getModel()
+    {
+        return _model;
+    }
+
+    public String getPropertyName()
+    {
+        return _propertyName;
+    }
+
+    public void setPropertyName(String propertyName)
+    {
+        _propertyName = propertyName;
+    }
+
+    /** Returns the property model for the current property. */
+    public PropertyModel getPropertyModel()
+    {
+        return _model.get(_propertyName);
+    }
+
+    public ComponentResources getOverrides()
+    {
+        return _overrides;
+    }
+
+}

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/GridCell.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/GridCell.java?rev=584596&r1=584595&r2=584596&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/GridCell.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/GridCell.java Sun Oct 14 13:10:49 2007
@@ -14,135 +14,17 @@
 
 package org.apache.tapestry.corelib.components;
 
-import org.apache.tapestry.Block;
-import org.apache.tapestry.ComponentResources;
 import org.apache.tapestry.MarkupWriter;
-import org.apache.tapestry.annotations.Parameter;
-import org.apache.tapestry.beaneditor.PropertyModel;
-import org.apache.tapestry.ioc.Messages;
-import org.apache.tapestry.ioc.annotations.Inject;
-import org.apache.tapestry.services.BeanBlockSource;
-import org.apache.tapestry.services.Environment;
-import org.apache.tapestry.services.PropertyDisplayContext;
+import org.apache.tapestry.corelib.base.AbstractPropertyOutput;
 
 /**
- * Part of {@link Grid} that renders a single data cell. GridCell is used inside a pair of loops;
- * the outer loop for each row, the inner loop for each property of the row.
+ * Part of {@link Grid} that renders the markup inside a single data cell. GridCell is used inside a
+ * pair of loops; the outer loop for each row, the inner loop for each property of the row.
  */
-public class GridCell
+public class GridCell extends AbstractPropertyOutput
 {
-    /** Model for property displayed by the cell. */
-    @Parameter(required = true)
-    private PropertyModel _model;
-
-    /**
-     * Resources used to search for block parameter overrides (this is normally the enclosing Grid
-     * component's resources).
-     */
-    @Parameter(required = true)
-    private ComponentResources _resources;
-
-    /**
-     * Identifies the object being rendered. The GridCell will extract a property from the row and
-     * render its value (or delegate to a {@link Block} that will do so).
-     */
-    @Parameter(required = true)
-    private Object _row;
-
-    @Inject
-    private ComponentResources _gridCellResources;
-
-    @Inject
-    private BeanBlockSource _beanBlockSource;
-
-    @Inject
-    private Environment _environment;
-
-    private boolean _mustPopEnvironment;
-
     Object beginRender(MarkupWriter writer)
     {
-        Block override = _resources.getBlockParameter(_model.getId() + "Cell");
-
-        if (override != null) return override;
-
-        String datatype = _model.getDataType();
-
-        if (_beanBlockSource.hasDisplayBlock(datatype))
-        {
-            PropertyDisplayContext context = new PropertyDisplayContext()
-            {
-                public Messages getContainerMessages()
-                {
-                    return GridCell.this.getContainerMessages();
-                }
-
-                public Object getPropertyValue()
-                {
-                    return readPropertyForRow();
-                }
-
-                public String getPropertyId()
-                {
-                    return _model.getId();
-                }
-
-                public String getPropertyName()
-                {
-                    return _model.getPropertyName();
-                }
-            };
-
-            _environment.push(PropertyDisplayContext.class, context);
-            _mustPopEnvironment = true;
-
-            return _beanBlockSource.getDisplayBlock(datatype);
-        }
-
-        Block block = _gridCellResources.findBlock(datatype);
-
-        if (block != null) return block;
-
-        Object value = _model.getConduit().get(_row);
-
-        if (value == null)
-        {
-            writer.writeRaw("&nbsp;");
-            return false;
-        }
-
-        writer.write(value.toString());
-
-        // Don't render anything else
-
-        return false;
-    }
-
-    private Object readPropertyForRow()
-    {
-        return _model.getConduit().get(_row);
-    }
-
-    private Messages getContainerMessages()
-    {
-        return _resources.getMessages();
-    }
-
-    /*
-     * When rendering a Block instead of a literal value, the template will start to render but its
-     * is effectively just some whitespace and we want to skip it entirely.
-     */
-    boolean beforeRenderTemplate()
-    {
-        return false;
-    }
-
-    void afterRender()
-    {
-        if (_mustPopEnvironment)
-        {
-            _environment.pop(PropertyDisplayContext.class);
-            _mustPopEnvironment = false;
-        }
+        return renderPropertyValue(writer, getPropertyModel().getId() + "Cell");
     }
 }

Added: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PropertyDisplay.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PropertyDisplay.java?rev=584596&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PropertyDisplay.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/PropertyDisplay.java Sun Oct 14 13:10:49 2007
@@ -0,0 +1,32 @@
+// Copyright 2007 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.corelib.components;
+
+import org.apache.tapestry.MarkupWriter;
+import org.apache.tapestry.beaneditor.PropertyModel;
+import org.apache.tapestry.corelib.base.AbstractPropertyOutput;
+
+/**
+ * Outputs a single property value. Overrides for individual properties come from block parameters
+ * whose name matches the {@linkplain PropertyModel#getId() property id}. This component is rarely
+ * used on its own, but is a critical piece of the {@link BeanDisplay} component.
+ */
+public class PropertyDisplay extends AbstractPropertyOutput
+{
+    Object beginRender(MarkupWriter writer)
+    {
+        return renderPropertyValue(writer, getPropertyModel().getId());
+    }
+}

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/RenderObject.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/RenderObject.java?rev=584596&r1=584595&r2=584596&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/RenderObject.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/components/RenderObject.java Sun Oct 14 13:10:49 2007
@@ -22,7 +22,9 @@
 
 /**
  * Renders out an object using the {@link ObjectRenderer} service. Used primarily on the
- * {@link ExceptionReport} page.
+ * {@link ExceptionReport} page. This is focused on objects that have a specific
+ * {@link ObjectRenderer} strategy. The {@link BeanDisplay} component is used for displaying the
+ * contents of arbitrary objects in terms of a series of property names and values.
  */
 public class RenderObject
 {

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/pages/PropertyDisplayBlocks.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/pages/PropertyDisplayBlocks.java?rev=584596&r1=584595&r2=584596&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/pages/PropertyDisplayBlocks.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/corelib/pages/PropertyDisplayBlocks.java Sun Oct 14 13:10:49 2007
@@ -16,12 +16,12 @@
 
 import org.apache.tapestry.annotations.Environmental;
 import org.apache.tapestry.internal.TapestryInternalUtils;
-import org.apache.tapestry.services.PropertyDisplayContext;
+import org.apache.tapestry.services.PropertyOutputContext;
 
 public class PropertyDisplayBlocks
 {
     @Environmental
-    private PropertyDisplayContext _context;
+    private PropertyOutputContext _context;
 
     public String getConvertedEnumValue()
     {
@@ -29,6 +29,6 @@
 
         if (value == null) return null;
 
-        return TapestryInternalUtils.getLabelForEnum(_context.getContainerMessages(), value);
+        return TapestryInternalUtils.getLabelForEnum(_context.getMessages(), value);
     }
 }

Copied: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PropertyOutputContext.java (from r584409, tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PropertyDisplayContext.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PropertyOutputContext.java?p2=tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PropertyOutputContext.java&p1=tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PropertyDisplayContext.java&r1=584409&r2=584596&rev=584596&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PropertyDisplayContext.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PropertyOutputContext.java Sun Oct 14 13:10:49 2007
@@ -15,14 +15,13 @@
 package org.apache.tapestry.services;
 
 import org.apache.tapestry.corelib.components.Grid;
-import org.apache.tapestry.corelib.components.GridCell;
 import org.apache.tapestry.ioc.Messages;
 
 /**
- * Provides context information needed when displaying a value in the context of a {@link Grid}
- * component (or, really, the {@link GridCell} component).
+ * Provides context information needed when displaying a value. This interface is an integral part
+ * of the {@link Grid} and similar output components.
  */
-public interface PropertyDisplayContext
+public interface PropertyOutputContext
 {
     /**
      * Returns the value of the property (the object being displayed is encapsulated by the
@@ -32,9 +31,10 @@
 
     /**
      * Returns the message catalog appropriate for use. In practice, this is the message catalog of
-     * the container of the {@link Grid} component.
+     * the container of the {@link Grid} component. This is used, for example, to locate labels for
+     * fields, or to locate string representations of Enums.
      */
-    Messages getContainerMessages();
+    Messages getMessages();
 
     /**
      * Returns a string that identifies the property, usually the property name. This is used as the

Added: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/BeanDisplay.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/BeanDisplay.tml?rev=584596&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/BeanDisplay.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/BeanDisplay.tml Sun Oct 14 13:10:49 2007
@@ -0,0 +1,18 @@
+<div class="t-beandisplay" 
+  xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+  
+
+  <div 
+    class="t-beandisplay-row" t:type="loop" t:source="model.propertyNames"
+    t:volatile="true" t:value="propertyName">
+    
+    <div class="t-beandisplay-label">${propertyModel.label}:</div>
+
+    <div class="t-beandisplay-value">
+      <t:propertydisplay model="propertyModel" overrides="overrides" object="object"/>
+    </div>
+    
+    </div>
+
+</div>
+

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/GridRows.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/GridRows.tml?rev=584596&r1=584595&r2=584596&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/GridRows.tml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/corelib/components/GridRows.tml Sun Oct 14 13:10:49 2007
@@ -1,7 +1,7 @@
 <tr class="${rowClass}" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
     <t:loop source="propertyNames" value="propertyName" volatile="inherit:volatile">
         <td class="${cellClass}">
-             <t:gridcell model="columnModel" row="row" resources="componentResources.containerResources"/>
+             <t:gridcell model="columnModel" object="row" overrides="componentResources.containerResources"/>
         </td>        
     </t:loop>
 </tr>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/default.css
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/default.css?rev=584596&r1=584595&r2=584596&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/default.css (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/default.css Sun Oct 14 13:10:49 2007
@@ -93,13 +93,18 @@
   border: 1px solid silver;
   margin: 0px;
 }
-DIV.t-beaneditor {
+DIV.t-beaneditor, DIV.t-beandisplay {
   display: block;
   background: #ffc;
   border: 2px solid silver;
   padding: 2px;
   font-family: "Trebuchet MS", Arial, sans-serif;
 }
+
+DIV.t-beandisplay {
+  background: #c0c0c0;
+}
+
 FORM.t-beaneditor LABEL:after {
   content: ":";
 }
@@ -107,17 +112,22 @@
   padding: 4px 0px 2px 0px;
 }
 DIV.t-beaneditor LABEL:after {
-  vertical-align: middle;
   content: ":";
 }
-DIV.t-beaneditor LABEL {
+DIV.t-beaneditor LABEL, DIV.t-beandisplay DIV.t-beandisplay-label {
   width: 10%;
   display: block;
   float: left;
   text-align: right;
   clear: left;
   padding-right: 3px;
+  vertical-align: middle;  
+}
+
+DIV.t-beandisplay DIV.t-beandisplay-label {
+  padding-right: 5px;
 }
+
 TABLE.t-data-grid THEAD TR {
   color: white;
   background-color: #809FFF;

Modified: tapestry/tapestry5/trunk/tapestry-core/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/site/apt/index.apt?rev=584596&r1=584595&r2=584596&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/site/apt/index.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/site/apt/index.apt Sun Oct 14 13:10:49 2007
@@ -22,7 +22,7 @@
   * Some of the annotations that aren't used specifically with component classes have been split off into the new
     {{{../tapestry-annotations/}tapestry-annotations}} module.
   
-  * Validator constraint values may now be specified in the component message catalog, rather than in the @Validation annotation (or validation compnent parameter). 
+  * Validator constraint values may now be specified in the component message catalog, rather than in the @Validation annotation (or validate component parameter). 
   
   * A new validator, regexp, has been added.
   
@@ -127,7 +127,7 @@
   
   * Automatic reloading of templates and even <Java classes>
   
-  * Super-duper Ajax integration built on {{{http://dojotoolkit.org} Dojo}}
+  * Super-duper Ajax integration built in (<that's still very much in progress>)
   
   * Easy & fast unit testing of individual pages or components
     
@@ -163,17 +163,13 @@
   @Component
   private Form _form;
   
-  @InjectPage
-  private Start _startPage;
-  
   @Inject
   private LoginAuthenticator _authenticator;
   
-  @OnEvent("submit")
-  private Object doLogin()
+  private Object onSubmit()
   {
     if (_authenticator.isValidLogin(_userId, _password))
-      return _startPage;
+      return Start.class;
       
     // Stay on this page:
   
@@ -193,11 +189,11 @@
 +----+
 
   This short snippet demonstrates a bit about how Tapestry operates.  Pages and services
-  within the application are injected with the @Inject annotation. The @OnEvent
-  annotation identifies, to Tapestry, when the method is to be invoked
+  within the application are injected with the @Inject annotation. The method name, onSubmit(),
+  informs Tapestry about when the method is to be invoked
   (when a form component contained by the page emits a "submit" event). The method's 
-  return value directs Tapestry on what to do: jump to another page within the application
-  (by returning the injected Start page), or stay on the same page to display the
+  return value directs Tapestry on what to do next: jump to another page within the application
+  (here identified as the class for the page, but other options exist), or stay on the same page to display the
   error message.
   
   This also represents a distinct change from Tapestry 4. In earlier versions of Tapestry, 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ViewRegistration.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ViewRegistration.tml?rev=584596&r1=584595&r2=584596&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ViewRegistration.tml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/ViewRegistration.tml Sun Oct 14 13:10:49 2007
@@ -1,14 +1,14 @@
 <html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
     <h1>BeanEdit Component Demo</h1>
     
-First Name: [${registrationData.firstName}]
-<br/>
-Last Name: [${registrationData.lastName}]
-<br/>
-Birth year: [${registrationData.birthYear}]
-<br/>
-Sex: [${registrationData.sex}]
-<br/>
-U.S. Citizen: [${registrationData.citizen}]
+<t:beandisplay t:id="registrationdata">
+  <t:parameter name="citizen">
+    <t:if test="registrationdata.citizen">U.S. Citizen
+      <t:parameter name="else">
+        Resident Alien
+      </t:parameter>
+    </t:if>
+  </t:parameter>
+</t:beandisplay>
     
 </html>

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?rev=584596&r1=584595&r2=584596&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java Sun Oct 14 13:10:49 2007
@@ -561,7 +561,10 @@
 
         clickAndWait(submitButton);
 
-        assertTextPresent("[Howard]", "[Lewis Ship]", "[1966]", "[MARTIAN]", "[true]");
+        // The XPath support is too week for //div[@class='t-beandisplay-value'][%d], so we
+        // just look for the text itself.
+
+        assertTextPresent("Howard", "Lewis Ship", "1966", "Martian", "U. S. Citizen");
     }
 
     @Test
@@ -577,7 +580,7 @@
 
         clickAndWait("//input[@type=\'submit\']");
 
-        assertTextPresent("[Howard]", "[Lewis Ship]", "[0]", "[MAIL]", "[false]");
+        assertTextPresent("Howard", "Lewis Ship", "0", "100% He-Man", "U. S. Citizen");
     }
 
     @Test
@@ -705,7 +708,7 @@
         start("Grid Enum Demo", "reset");
 
         assertTextSeries("//tr[1]/td[%d]", 1, "End World Hunger", "Medium");
-        assertTextSeries("//tr[2]/td[%d]", 1, "Develop Faster-Than-Light Travel", "High");
+        assertTextSeries("//tr[2]/td[%d]", 1, "Develop Faster-Than-Light Travel", "Ultra Important");
         assertTextSeries("//tr[3]/td[%d]", 1, "Cure Common Cold", "Low");
     }
 
@@ -815,7 +818,7 @@
 
         clickAndWait("//input[@type='submit']");
 
-        assertTextPresent("First Name: [Howard]");
+        assertTextPresent("Howard", "Lewis Ship", "1966", "U. S. Citizen");
     }
 
     @Test
@@ -1102,7 +1105,7 @@
         assertFieldValueSeries("title_%d", 0, "ToDo # 7", "ToDo # 8", "ToDo # 9", "ToDo # 10");
 
         type("title_0", "Cure Cancer");
-        select("urgency_0", "High");
+        select("urgency_0", "Top Priority");
 
         type("title_1", "Pay Phone Bill");
         select("urgency_1", "Low");

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/BeanEditorDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/BeanEditorDemo.java?rev=584596&r1=584595&r2=584596&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/BeanEditorDemo.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/pages/BeanEditorDemo.java Sun Oct 14 13:10:49 2007
@@ -33,9 +33,9 @@
         return _data;
     }
 
-    String onSuccess()
+    Object onSuccess()
     {
-        return "ViewRegistration";
+        return ViewRegistration.class;
     }
 
     void onActionFromClear()

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/pages/GridEnumDemo.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/pages/GridEnumDemo.properties?rev=584596&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/pages/GridEnumDemo.properties (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/pages/GridEnumDemo.properties Sun Oct 14 13:10:49 2007
@@ -0,0 +1,15 @@
+# Copyright 2007 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.
+
+high=Ultra Important

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/pages/GridFormDemo.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/pages/GridFormDemo.properties?rev=584596&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/pages/GridFormDemo.properties (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/pages/GridFormDemo.properties Sun Oct 14 13:10:49 2007
@@ -0,0 +1,15 @@
+# Copyright 2007 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.
+
+high=Top Priority

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/pages/ViewRegistration.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/pages/ViewRegistration.properties?rev=584596&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/pages/ViewRegistration.properties (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/pages/ViewRegistration.properties Sun Oct 14 13:10:49 2007
@@ -0,0 +1,16 @@
+# Copyright 2007 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.
+
+citizen-label=Citizenship
+male=100% He-Man