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

  • Attributes

    Is there a way to define attributes about your POJOs so that the views know how to display them?

    For example, we use a MessageSource when you want to associate a label to some text and that association is defined in an external “message.properties” file.

    However, where do you define maximum width, display width, etc which is necessary for editing and table views? I don't want to define that information in each view, and then need to redefine the information when we deploy the same application to a new client with a different back-end.

    Thanks,
    smv

  • #2
    See PetClinicValidationRulesSource for example - it be better that this informations exist in external (xml or properties) file, too

    regards

    Comment


    • #3
      Thanks for replying, snpe!

      I looked at the example you suggested and found the mapping in the richclient-application-context.xml file, but the mapping is never referenced anywhere. The form is created from code, but the form model does not know anything about the ruleSource. Additionally, FormModel doesn't have an accessor to RulesSource, so even if the form were defined by a bean, it still wouldn't have the mapping to the rulesSource.

      If the rulesSource were being used by the example, I still doin't see how the constraints would be applied to a view since an AbstractView doesn't have an accessor for RulesSource. In addition to knowing the maximum length for an editable field, I would like to tell or have the BeanTableModel also know the preferred width for the column for displaying in a JTable.

      I am converting code from an in-house developed framework to Spring-RCP. One of the features of this framework was to have the domain objects (ie: Community) publish it's metadata, including: label, max width, preferred width, class, table, column name, etc. The framework would map the metadata to the proper attribute in the class (ie: name, province, postalCode) through field models.

      Spring takes care of the label through MessageSource, which is fine for changing locales. For the remainder of the metadata, it would appear that I need to redefine it in views and forms instead of defining it in one location. Is this the correct implementation strategy?

      Thanks!

      Comment


      • #4
        RCP remember every usage bean Owner for rule - if Owner is used with spring context

        It is defined once for Owner bean

        regards

        Comment


        • #5
          Actually, ValidatingFormModel does have a member for an associated RuleSource, that can be set or retrieved via lookup (for accessing a shared instance configured in the application context, as PetClinic does). This is how form fields get attached validation policies.

          With that said, I completely agree with you: we need to support more metadata, metadata driven control selection and formatting is a big thing. We should support various means of metadata specification: e.g programatically, configuration file, jdk 1.5 attribute, etc.

          Good suggestions...I hope we can offer solutions here soon. I invite you to take a look at the existing PropertyAccessStrategy code and PropertyMetadataAccessStrategy code in the binding packages: that's likely the area we want to develop/enhance, in addition to the form framework. I'd be very interested in your ideas/contributions.

          Comment

          Working...
          X