You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2007/02/22 21:43:15 UTC
svn commit: r510646 - in /tapestry/tapestry5/tapestry-core/trunk/src:
main/java/org/apache/tapestry/corelib/components/
main/java/org/apache/tapestry/internal/ main/resources/org/apache/tapestry/
main/resources/org/apache/tapestry/corelib/components/ t...
Author: hlship
Date: Thu Feb 22 12:43:11 2007
New Revision: 510646
URL: http://svn.apache.org/viewvc?view=rev&rev=510646
Log:
Fix default BeanModel property ordering to work with interfaces as well as ordinary classes.
Tweak the L&F of the Grid component.
Output for null cells inside the Grid.
Added:
tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/SimpleTrackGridDemo.html
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/data/SimpleTrack.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/SimpleTrackGridDemo.java
Modified:
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/GridCell.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/TapestryUtils.java
tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/GridColumns.html
tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/default.css
tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/Start.html
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/data/Track.java
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/GridCell.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/GridCell.java?view=diff&rev=510646&r1=510645&r2=510646
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/GridCell.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/GridCell.java Thu Feb 22 12:43:11 2007
@@ -64,7 +64,10 @@
Object value = _model.getConduit().get(_row);
if (value == null)
+ {
+ writer.writeRaw(" ");
return false;
+ }
writer.write(value.toString());
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/TapestryUtils.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/TapestryUtils.java?view=diff&rev=510646&r1=510645&r2=510646
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/TapestryUtils.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/TapestryUtils.java Thu Feb 22 12:43:11 2007
@@ -374,7 +374,10 @@
{
int depth = 0;
Class c = method.getDeclaringClass();
- while (c != Object.class)
+
+ // When the method originates in an interface, the parent may be null, not Object.
+
+ while (c != null && c != Object.class)
{
depth++;
c = c.getSuperclass();
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/GridColumns.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/GridColumns.html?view=diff&rev=510646&r1=510645&r2=510646
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/GridColumns.html (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/corelib/components/GridColumns.html Thu Feb 22 12:43:11 2007
@@ -4,7 +4,7 @@
<a t:id="sort">${columnModel.label}</a>
<t:comp type="If" test="activeSortColumn">
<a t:id="sort2">
- <img t:type="Img" src="icon" alt="prop:iconLabel"/>
+ <img t:type="Img" src="icon" class="t-sort-icon" alt="prop:iconLabel"/>
</a>
</t:comp>
</th>
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/default.css
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/default.css?view=diff&rev=510646&r1=510645&r2=510646
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/default.css (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/default.css Thu Feb 22 12:43:11 2007
@@ -160,13 +160,16 @@
TABLE.t-data-grid THEAD TR
{
color: white;
- background-color: black;
+ background-color: #809FFF;
}
TABLE.t-data-grid THEAD TR TH
{
+ text-align: left;
padding: 3px;
white-space: nowrap;
+ border-right: 1px solid silver;
+ border-bottom: 1px solid silver;
}
TABLE.t-data-grid
@@ -209,8 +212,7 @@
DIV.t-data-grid-pager SPAN.current
{
color: white;
- background-color: black;
- border: 1px solid black;
+ background-color: #809FFF;
}
TABLE.t-data-grid TR TH A
Added: tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/SimpleTrackGridDemo.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/SimpleTrackGridDemo.html?view=auto&rev=510646
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/SimpleTrackGridDemo.html (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/SimpleTrackGridDemo.html Thu Feb 22 12:43:11 2007
@@ -0,0 +1,11 @@
+<html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+
+ <h1>Grid Demo</h1>
+
+ <table t:type="Grid" source="tracks" row="track" model="simpleTrackModel">
+ <t:parameter name="ratingcell">
+ <t:comp type="OutputRating" rating="track.rating"/>
+ </t:parameter>
+ </table>
+
+</html>
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/Start.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/Start.html?view=diff&rev=510646&r1=510645&r2=510646
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/Start.html (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/app1/WEB-INF/Start.html Thu Feb 22 12:43:11 2007
@@ -113,6 +113,10 @@
<li>
<a t:type="PageLink" page="kicker">Kicker</a> -- demos complex page and component context in links
</li>
+ <li>
+ <a t:type="PageLink" page="simpletrackgriddemo">SimpleTrack Grid Demo</a> -- customizing the model for a Grid around
+ an interface
+ </li>
</ul>
</td>
</tr>
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?view=diff&rev=510646&r1=510645&r2=510646
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java Thu Feb 22 12:43:11 2007
@@ -841,6 +841,17 @@
}
@Test
+ public void grid_from_explicit_interface_model()
+ {
+ _selenium.open(BASE_URL);
+ clickAndWait("link=SimpleTrack Grid Demo");
+
+ assertTextSeries("//th[%d]", 1, "Title", "Album", "Rating");
+
+ assertTextSeries("//tr[1]/td[%d]", 1, "Bug Juice", "Late Lounge (2 of 2)", "-");
+ }
+
+ @Test
public void grid_enum_display()
{
_selenium.open(BASE_URL);
Added: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/data/SimpleTrack.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/data/SimpleTrack.java?view=auto&rev=510646
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/data/SimpleTrack.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/data/SimpleTrack.java Thu Feb 22 12:43:11 2007
@@ -0,0 +1,29 @@
+// 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.integration.app1.data;
+
+import org.apache.tapestry.beaneditor.Order;
+
+public interface SimpleTrack
+{
+ @Order(100)
+ String getTitle();
+
+ @Order(200)
+ String getAlbum();
+
+ @Order(300)
+ int getRating();
+}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/data/Track.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/data/Track.java?view=diff&rev=510646&r1=510645&r2=510646
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/data/Track.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/data/Track.java Thu Feb 22 12:43:11 2007
@@ -15,7 +15,7 @@
package org.apache.tapestry.integration.app1.data;
/** One track from a music library. */
-public class Track
+public class Track implements SimpleTrack
{
private String _album;
Added: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/SimpleTrackGridDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/SimpleTrackGridDemo.java?view=auto&rev=510646
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/SimpleTrackGridDemo.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/SimpleTrackGridDemo.java Thu Feb 22 12:43:11 2007
@@ -0,0 +1,59 @@
+// 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.integration.app1.pages;
+
+import java.util.List;
+
+import org.apache.tapestry.ComponentResources;
+import org.apache.tapestry.annotations.Inject;
+import org.apache.tapestry.beaneditor.BeanModel;
+import org.apache.tapestry.integration.app1.data.SimpleTrack;
+import org.apache.tapestry.integration.app1.data.Track;
+import org.apache.tapestry.integration.app1.services.MusicLibrary;
+import org.apache.tapestry.services.BeanModelSource;
+
+public class SimpleTrackGridDemo
+{
+ @Inject
+ private MusicLibrary _library;
+
+ @Inject
+ private BeanModelSource _beanModelSource;
+
+ @Inject
+ private ComponentResources _resources;
+
+ private SimpleTrack _track;
+
+ public SimpleTrack getTrack()
+ {
+ return _track;
+ }
+
+ public void setTrack(SimpleTrack track)
+ {
+ _track = track;
+ }
+
+ public List<Track> getTracks()
+ {
+ return _library.getTracks();
+ }
+
+ public BeanModel getSimpleTrackModel()
+ {
+ return _beanModelSource.create(SimpleTrack.class, false, _resources);
+ }
+}