Announcement Announcement Module
No announcement yet.
Map object FormModel Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Map object FormModel


    I've a dynamic domain object stored in a map, is there any way to use in a FormModel ???


  • #2
    What you could do is write a binder/binding which creates a panel in which all elements of the map are shown beneath eachother. For the individual element you can rely on the simple binders to create the controls (or provide a resolving system inside your binder which maps property types to binders)
    How you'll handle the labels of those components is totally up to you. Since you don't know in advance which elements will be stored in the map, it's not so straightforward to put those labels in the standard i18n system of Spring RCP (unless you know in advance all possible items in the map, in that case you might be able to pull that off).

    Just my .02




    • #3
      You will have to provide your own PropertyAccessStrategy implementation and construct a FormModel instance using it.

      Try lookup up BeanPropertyAccessStrategy code as an example on how to achieve this.




      • #4
        If you want to show specific items in the map based on the key, you'll need to do that. But then you will also have to handle the situation when that element isn't there at runtime (a map doesn't inforce a contract...).

        Say you put the property myMap[someKey] on your form. What do you want to happen when someKey isn't in the map? By default, the behaviour should be the same as a normal property: fail fast. But with a map, you'll probably don't want to see that property. Hence the map binder.