You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by ml...@apache.org on 2011/10/05 16:37:27 UTC
svn commit: r1179241 - in
/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5:
./ corelib/components/ grid/ services/
Author: mlusetti
Date: Wed Oct 5 14:37:26 2011
New Revision: 1179241
URL: http://svn.apache.org/viewvc?rev=1179241&view=rev
Log:
TAP5-1677 Grid's parameter defaults to Symbol values
Added:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ParameterConstants.java (with props)
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/GridColumns.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/GridPager.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/grid/GridConstants.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
Added: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ParameterConstants.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ParameterConstants.java?rev=1179241&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ParameterConstants.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ParameterConstants.java Wed Oct 5 14:37:26 2011
@@ -0,0 +1,59 @@
+package org.apache.tapestry5;
+
+/**
+ * Constants for core component parameters defined by {@link org.apache.tapestry5.ioc.annotations.Symbol}
+ *
+ * @since 5.3
+ */
+public class ParameterConstants
+{
+ /**
+ * The default number for how many rows to display in a
+ * {@link org.apache.tapestry5.corelib.components.Grid} page.
+ */
+ public static final String GRID_ROWS_PER_PAGE = "tapestry.components.grid_rows_per_page";
+
+ /**
+ * The default position of the {@link org.apache.tapestry5.corelib.components.Grid}
+ * pager.
+ */
+ public static final String GRID_PAGER_POSITION = "tapestry.components.grid_pager_position";
+
+ /**
+ * The default name of the {@link org.apache.tapestry5.Block} used to display an empty
+ * {@link org.apache.tapestry5.corelib.components.Grid}.
+ */
+ public static final String GRID_EMPTY_BLOCK = "tapestry.components.grid_empty_block";
+
+
+ /**
+ * The default name of the CSS class for the <table> element of the
+ * {@link org.apache.tapestry5.corelib.components.Grid} component.
+ */
+ public static final String GRID_TABLE_CSS_CLASS = "tapestry.components.grid_table_css_class";
+
+ /**
+ * The default number of page range to display in the
+ * {@link org.apache.tapestry5.corelib.components.GridPager} before and after the current page.
+ */
+ public static final String GRIDPAGER_PAGE_RANGE = "tapestry.components.gridpager_page_range";
+
+ /**
+ * The default {@link org.apache.tapestry5.Asset} to display in
+ * {@link org.apache.tapestry5.corelib.components.GridColumns} header for ascending sort action.
+ */
+ public static final String GRIDCOLUMNS_ASCENDING_ASSET = "tapestry.components.gridcolumns_ascending_asset";
+
+ /**
+ * The default {@link org.apache.tapestry5.Asset} to display in
+ * {@link org.apache.tapestry5.corelib.components.GridColumns} header for descending sort action.
+ */
+ public static final String GRIDCOLUMNS_DESCENDING_ASSET = "tapestry.components.gridcolumns_descending_asset";
+
+ /**
+ * The default {@link org.apache.tapestry5.Asset} to display in
+ * {@link org.apache.tapestry5.corelib.components.GridColumns} header for identifying a sortable column.
+ */
+ public static final String GRIDCOLUMNS_SORTABLE_ASSET = "tapestry.components.gridcolumns_sortable_asset";
+
+}
Propchange: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ParameterConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java?rev=1179241&r1=1179240&r2=1179241&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java Wed Oct 5 14:37:26 2011
@@ -18,14 +18,7 @@ import java.io.IOException;
import java.util.Collections;
import java.util.List;
-import org.apache.tapestry5.Binding;
-import org.apache.tapestry5.BindingConstants;
-import org.apache.tapestry5.Block;
-import org.apache.tapestry5.ComponentAction;
-import org.apache.tapestry5.ComponentResources;
-import org.apache.tapestry5.MarkupWriter;
-import org.apache.tapestry5.PropertyOverrides;
-import org.apache.tapestry5.ValueEncoder;
+import org.apache.tapestry5.*;
import org.apache.tapestry5.annotations.Component;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Parameter;
@@ -98,14 +91,15 @@ public class Grid implements GridModel
* the rows into "pages" and (normally) provide a pager to allow the user to navigate within the overall result
* set.
*/
- @Parameter("25")
+ @Parameter(BindingConstants.SYMBOL + ":" + ParameterConstants.GRID_ROWS_PER_PAGE)
private int rowsPerPage;
/**
* Defines where the pager (used to navigate within the "pages" of results) should be displayed: "top", "bottom",
* "both" or "none".
*/
- @Parameter(value = "top", defaultPrefix = BindingConstants.LITERAL)
+ @Parameter(value = BindingConstants.SYMBOL + ":" + ParameterConstants.GRID_PAGER_POSITION,
+ defaultPrefix = BindingConstants.LITERAL)
private GridPagerPosition pagerPosition;
/**
@@ -188,14 +182,16 @@ public class Grid implements GridModel
* "There is no data to display". This parameter is used to customize that message, possibly including components to
* allow the user to create new objects.
*/
- @Parameter(value = "block:empty", defaultPrefix = BindingConstants.LITERAL)
+ @Parameter(value = BindingConstants.SYMBOL + ":" + ParameterConstants.GRID_EMPTY_BLOCK,
+ defaultPrefix = BindingConstants.LITERAL)
private Block empty;
/**
* CSS class for the <table> element. In addition, informal parameters to the Grid are rendered in the table
* element.
*/
- @Parameter(name = "class", defaultPrefix = BindingConstants.LITERAL, value = "t-data-grid")
+ @Parameter(name = "class", defaultPrefix = BindingConstants.LITERAL,
+ value = BindingConstants.SYMBOL + ":" + ParameterConstants.GRID_TABLE_CSS_CLASS)
@Property(write = false)
private String tableClass;
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/GridColumns.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/GridColumns.java?rev=1179241&r1=1179240&r2=1179241&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/GridColumns.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/GridColumns.java Wed Oct 5 14:37:26 2011
@@ -14,10 +14,7 @@
package org.apache.tapestry5.corelib.components;
-import org.apache.tapestry5.Asset;
-import org.apache.tapestry5.Block;
-import org.apache.tapestry5.ComponentResources;
-import org.apache.tapestry5.PropertyOverrides;
+import org.apache.tapestry5.*;
import org.apache.tapestry5.annotations.*;
import org.apache.tapestry5.beaneditor.PropertyModel;
import org.apache.tapestry5.grid.ColumnSort;
@@ -75,15 +72,15 @@ public class GridColumns
private EventLink sort, sort2;
@Inject
- @Path("sort-asc.png")
+ @Path("${" + ParameterConstants.GRIDCOLUMNS_ASCENDING_ASSET + "}")
private Asset ascendingAsset;
@Inject
- @Path("sort-desc.png")
+ @Path("${" + ParameterConstants.GRIDCOLUMNS_DESCENDING_ASSET + "}")
private Asset descendingAsset;
@Inject
- @Path("sortable.png")
+ @Path("${" + ParameterConstants.GRIDCOLUMNS_SORTABLE_ASSET + "}")
private Asset sortableAsset;
@Inject
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/GridPager.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/GridPager.java?rev=1179241&r1=1179240&r2=1179241&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/GridPager.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/GridPager.java Wed Oct 5 14:37:26 2011
@@ -57,7 +57,7 @@ public class GridPager
* Number of pages before and after the current page in the range. The pager always displays links for 2 * range + 1
* pages, unless that's more than the total number of available pages.
*/
- @Parameter("5")
+ @Parameter(BindingConstants.SYMBOL + ":" + ParameterConstants.GRIDPAGER_PAGE_RANGE)
private int range;
/**
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/grid/GridConstants.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/grid/GridConstants.java?rev=1179241&r1=1179240&r2=1179241&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/grid/GridConstants.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/grid/GridConstants.java Wed Oct 5 14:37:26 2011
@@ -40,4 +40,45 @@ public class GridConstants
*/
public static final String SORT_DESCENDING_CLASS = "t-sort-column-descending";
+
+ /**
+ * Number of rows to diplay within each {@link org.apache.tapestry5.corelib.components.Grid} page.
+ */
+ public static final int ROWS_PER_PAGE = 25;
+
+ /**
+ * CSS class for the <table> element.
+ */
+ public static final String TABLE_CLASS = "t-data-grid";
+
+ /**
+ * Default pager position
+ */
+ public static final String PAGER_POSITION = "top";
+
+ /**
+ * Block name to display in place of an empty {@link org.apache.tapestry5.corelib.components.Grid}
+ */
+ public static final String EMPTY_BLOCK = "block:empty";
+
+ /**
+ * Default number of page to display before and after the current page in the
+ * {@link org.apache.tapestry5.corelib.components.GridPager}
+ */
+ public static final int PAGER_PAGE_RANGE = 5;
+
+ /**
+ * Default {@link org.apache.tapestry5.Asset} for ascending columns sort
+ */
+ public static final String COLUMNS_ASCENDING = "sort-asc.png";
+
+ /**
+ * Default {@link org.apache.tapestry5.Asset} for ascending columns sort
+ */
+ public static final String COLUMNS_DESCENDING = "sort-desc.png";
+
+ /**
+ * Default {@link org.apache.tapestry5.Asset} for sortable columns
+ */
+ public static final String COLUMNS_SORTABLE = "sortable.png";
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=1179241&r1=1179240&r2=1179241&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java Wed Oct 5 14:37:26 2011
@@ -22,6 +22,7 @@ import org.apache.tapestry5.annotations.
import org.apache.tapestry5.beaneditor.DataTypeConstants;
import org.apache.tapestry5.beaneditor.Validate;
import org.apache.tapestry5.corelib.ClientValidation;
+import org.apache.tapestry5.grid.GridConstants;
import org.apache.tapestry5.grid.GridDataSource;
import org.apache.tapestry5.internal.*;
import org.apache.tapestry5.internal.alerts.AlertManagerImpl;
@@ -2363,6 +2364,16 @@ public final class TapestryModule
configuration.add(SymbolConstants.UNKNOWN_COMPONENT_ID_CHECK_ENABLED, true);
configuration.add(SymbolConstants.APPLICATION_FOLDER, "");
+
+ // Components parameters default
+ configuration.add(ParameterConstants.GRID_ROWS_PER_PAGE, GridConstants.ROWS_PER_PAGE);
+ configuration.add(ParameterConstants.GRID_PAGER_POSITION, GridConstants.PAGER_POSITION);
+ configuration.add(ParameterConstants.GRID_EMPTY_BLOCK, GridConstants.EMPTY_BLOCK);
+ configuration.add(ParameterConstants.GRID_TABLE_CSS_CLASS, GridConstants.TABLE_CLASS);
+ configuration.add(ParameterConstants.GRIDPAGER_PAGE_RANGE, GridConstants.PAGER_PAGE_RANGE);
+ configuration.add(ParameterConstants.GRIDCOLUMNS_SORTABLE_ASSET, GridConstants.COLUMNS_SORTABLE);
+ configuration.add(ParameterConstants.GRIDCOLUMNS_ASCENDING_ASSET, GridConstants.COLUMNS_ASCENDING);
+ configuration.add(ParameterConstants.GRIDCOLUMNS_DESCENDING_ASSET, GridConstants.COLUMNS_DESCENDING);
}
/**