Tapestry 5
  1. Tapestry 5
  2. TAP5-1677

Use Symbols for Default Component Parameter Values

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.3
    • Fix Version/s: 5.3
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      For example, the Grid component has the following:

      @Parameter("25")
      private int rowsPerPage;

      meaning if I wish for a pagination of 50 rows, I have to find all instances of the Grid component in my application and manually add a "rowsPerPage" parameter.

      But if the parameter was defined as:

      @Parameter("symbol:tapestry.grid.rowsPerPage")
      private int rowsPerPage;

      then all I would need to do is override the symbol contribution and voilà, it changes throughout the whole application.

      Other specific component defaults that would be nice are, the "update" parameter for Zone et al (because the classic "yellow fade" doesn't work for everyone!) and a date format for DateField.

        Activity

        Hide
        Massimo Lusetti added a comment -

        The date format would be nice but a common (mean common sense) value isn't so easy to choose.
        Now is obtained from DateFormat.getInstance() as the DateFormat.MEDIUM format for the current Locale, so the default is the one from the JDK.

        I think is not so easy to find the right way to do this despite leaving it to the JDK.

        Show
        Massimo Lusetti added a comment - The date format would be nice but a common (mean common sense) value isn't so easy to choose. Now is obtained from DateFormat.getInstance() as the DateFormat.MEDIUM format for the current Locale, so the default is the one from the JDK. I think is not so easy to find the right way to do this despite leaving it to the JDK.
        Hide
        Hudson added a comment -

        Integrated in tapestry-trunk-freestyle #559 (See https://builds.apache.org/job/tapestry-trunk-freestyle/559/)
        TAP5-1677 Copyright notice
        TAP5-1677 ParamterConstants -> ComponentsParamtersConstants
        TAP5-1677 Integration test for Grid's default parameters Symbol value
        TAP5-1677 Grid's parameter defaults to Symbol values

        mlusetti : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1179260
        Files :

        • /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ComponentsParametersConstants.java

        mlusetti : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1179258
        Files :

        • /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ComponentsParametersConstants.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ParameterConstants.java
        • /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/services/TapestryModule.java

        mlusetti : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1179242
        Files :

        • /tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/GridSymbolDemoTests.groovy
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/components
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/components/Layout.groovy
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/pages
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/pages/GridSymbol.groovy
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/pages/Index.groovy
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services/AppModule.groovy
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services/Number.groovy
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/components
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/components/Layout.tml
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/pages
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/pages/GridSymbol.tml
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/pages/Index.tml
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF/app.properties
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF/web.xml

        mlusetti : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1179241
        Files :

        • /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ParameterConstants.java
        • /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
        Show
        Hudson added a comment - Integrated in tapestry-trunk-freestyle #559 (See https://builds.apache.org/job/tapestry-trunk-freestyle/559/ ) TAP5-1677 Copyright notice TAP5-1677 ParamterConstants -> ComponentsParamtersConstants TAP5-1677 Integration test for Grid's default parameters Symbol value TAP5-1677 Grid's parameter defaults to Symbol values mlusetti : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1179260 Files : /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ComponentsParametersConstants.java mlusetti : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1179258 Files : /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ComponentsParametersConstants.java /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ParameterConstants.java /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/services/TapestryModule.java mlusetti : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1179242 Files : /tapestry/tapestry5/trunk/tapestry-core/src/test/conf/testng.xml /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/GridSymbolDemoTests.groovy /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/components /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/components/Layout.groovy /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/pages /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/pages/GridSymbol.groovy /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/pages/Index.groovy /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services/AppModule.groovy /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services/Number.groovy /tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam /tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/components /tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/components/Layout.tml /tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/pages /tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/pages/GridSymbol.tml /tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry5/integration/symbolparam/pages/Index.tml /tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam /tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF /tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF/app.properties /tapestry/tapestry5/trunk/tapestry-core/src/test/symbolparam/WEB-INF/web.xml mlusetti : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1179241 Files : /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/ParameterConstants.java /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
        Hide
        Hudson added a comment -

        Integrated in tapestry-trunk-freestyle #560 (See https://builds.apache.org/job/tapestry-trunk-freestyle/560/)
        TAP5-1677 Intellij didnt catch the groovy file from refactor

        mlusetti : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1179265
        Files :

        • /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services/AppModule.groovy
        Show
        Hudson added a comment - Integrated in tapestry-trunk-freestyle #560 (See https://builds.apache.org/job/tapestry-trunk-freestyle/560/ ) TAP5-1677 Intellij didnt catch the groovy file from refactor mlusetti : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1179265 Files : /tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/symbolparam/services/AppModule.groovy
        Hide
        Hudson added a comment -

        Integrated in tapestry-trunk-freestyle #561 (See https://builds.apache.org/job/tapestry-trunk-freestyle/561/)
        TAP5-1677 Palette parameters default
        TAP5-1677 Let the test complete successfully while waiting for discussion on @dev

        mlusetti : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1179560
        Files :

        • /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/PaletteConstants.java

        mlusetti : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1179559
        Files :

        • /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
        Show
        Hudson added a comment - Integrated in tapestry-trunk-freestyle #561 (See https://builds.apache.org/job/tapestry-trunk-freestyle/561/ ) TAP5-1677 Palette parameters default TAP5-1677 Let the test complete successfully while waiting for discussion on @dev mlusetti : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1179560 Files : /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/PaletteConstants.java mlusetti : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1179559 Files : /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
        Hide
        Massimo Lusetti added a comment -

        For now the components which could be defaulted to Symbol values are in others need some changes in the framework which are being discussed at the moment.

        Show
        Massimo Lusetti added a comment - For now the components which could be defaulted to Symbol values are in others need some changes in the framework which are being discussed at the moment.
        Hide
        Steve Eynon added a comment -

        Just to say I like what's been done and the dev discussion is quite interesting...

        ...besides that am I allowed to say you missed one?

        [T5.3-beta-24]

        org.apache.tapestry5.corelib.components.Errors.java

        @Parameter(name = "class")
        private String className = CSSClassConstants.ERROR;

        And I guess other parameter usages from CSSClassConstants should be converted too.

        My use-case: I'm skinning an app with the Twitter Bootstrap CSS framework which dictates which CSS names I can use. Being able to specify the class names for the Errors (and others) in one place would be of great use.

        Show
        Steve Eynon added a comment - Just to say I like what's been done and the dev discussion is quite interesting... ...besides that am I allowed to say you missed one? [T5.3-beta-24] org.apache.tapestry5.corelib.components.Errors.java @Parameter(name = "class") private String className = CSSClassConstants.ERROR; And I guess other parameter usages from CSSClassConstants should be converted too. My use-case: I'm skinning an app with the Twitter Bootstrap CSS framework which dictates which CSS names I can use. Being able to specify the class names for the Errors (and others) in one place would be of great use.
        Hide
        Massimo Lusetti added a comment -

        Couldn't you just override the defaults css setting for that specific css class?

        Show
        Massimo Lusetti added a comment - Couldn't you just override the defaults css setting for that specific css class?
        Hide
        Steve Eynon added a comment -

        There are a number of ways I could set a global style (including the way I have done!) but from a client perspective I believe the easiest and most consistent way would be to override the default component parameter.

        But I'm also aware this would set precedence to turn all T5 CSS names into symbol contributions, which would need to be referenced by component code and templates alike. As this is quite a bit of work (for arguably minor gain) I'm happy to let this one lie.

        Show
        Steve Eynon added a comment - There are a number of ways I could set a global style (including the way I have done!) but from a client perspective I believe the easiest and most consistent way would be to override the default component parameter. But I'm also aware this would set precedence to turn all T5 CSS names into symbol contributions, which would need to be referenced by component code and templates alike. As this is quite a bit of work (for arguably minor gain) I'm happy to let this one lie.

          People

          • Assignee:
            Massimo Lusetti
            Reporter:
            Steve Eynon
          • Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development