Click
  1. Click
  2. CLK-528

Let FormTable use Column#setProperty(...) to support setting properties on complex valueobjects

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1.0
    • Component/s: core
    • Labels:
      None

      Description

      The onProcess method of FormTable uses Column#getProperty() to get the property of a particular valueobject, but uses reflection to set that property.

      Add a Column#setProperty(Object, Field) method, so developers can override that method if refelection doesn't work for their VO's.

        Activity

        Hide
        Bob Schellink added a comment -

        To keep things consistent with getProperty signature we should rather have setProperty(Object row, Object value). Is there a need to get hold of the actual Field instance?

        Show
        Bob Schellink added a comment - To keep things consistent with getProperty signature we should rather have setProperty(Object row, Object value). Is there a need to get hold of the actual Field instance?
        Hide
        WarnerJan Veldhuis added a comment -

        Not really, value will do fine as far as I can tell.

        Show
        WarnerJan Veldhuis added a comment - Not really, value will do fine as far as I can tell.
        Hide
        Bob Schellink added a comment -

        Actually one can grab the Field from the column when overriding it:

        public void setProperty(...)

        { Field f = getField(); }

        Now I'm thinking the signature should be:

        setProperty(Object row, String propertyName, Object value)

        where propertyName is the column name. So propertyName will be "firstName" instead of "firstName_12", which is more useful I think. Again one can access the Field directly if one needs the name as "firstName_12".

        Show
        Bob Schellink added a comment - Actually one can grab the Field from the column when overriding it: public void setProperty(...) { Field f = getField(); } Now I'm thinking the signature should be: setProperty(Object row, String propertyName, Object value) where propertyName is the column name. So propertyName will be "firstName" instead of "firstName_12", which is more useful I think. Again one can access the Field directly if one needs the name as "firstName_12".
        Hide
        Bob Schellink added a comment -

        Thanks WarnerJan, fixed in trunk.

        Show
        Bob Schellink added a comment - Thanks WarnerJan, fixed in trunk.
        Hide
        WarnerJan Veldhuis added a comment -

        It looks like you don't need the propertyname, since that will be the columnname itself. Only the name of the field is postfixed with the rownumber, not the columnname.

        Show
        WarnerJan Veldhuis added a comment - It looks like you don't need the propertyname, since that will be the columnname itself. Only the name of the field is postfixed with the rownumber, not the columnname.
        Hide
        Bob Schellink added a comment -

        Yep, its more about consistency with Column getProperty though:

        public Object getProperty(String name, Object row)
        public void setProperty(Object row, String name, Object value)

        Show
        Bob Schellink added a comment - Yep, its more about consistency with Column getProperty though: public Object getProperty(String name, Object row) public void setProperty(Object row, String name, Object value)

          People

          • Assignee:
            Bob Schellink
            Reporter:
            WarnerJan Veldhuis
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development