Results 1 to 8 of 8

Thread: Need help with forms POJOs and messages properties

  1. #1
    Join Date
    Dec 2004
    Location
    Buenos Aires, Argentina
    Posts
    73

    Default Need help with forms POJOs and messages properties

    Hi all,

    Newbie here.
    I have two pojos, class theater, class dog. Both have property called "id".
    When displaying the form built with TableFormBuilder (after added the property id with formbuilder.add method) RCP renders the label.id for both classes with the same text.

    I need a way to have different values for same name properties of different classes.

    Thanks in advance,
    Gustavo.

  2. #2
    Join Date
    Aug 2004
    Posts
    203

    Default

    You can set id dog and theater for formModel and label are :

    dog.label.id
    theater.label.id

    regards

  3. #3
    Join Date
    Sep 2004
    Location
    Ghent, Belgium
    Posts
    224

    Default

    The framework searches for labels in this order:

    formId.label.property
    label.property
    property


    So if you have two different forms containing the same business object property, you still can have different labels per form.

    Hope this helps,

    Peter

  4. #4
    Join Date
    Aug 2004
    Posts
    203

    Default

    Peter,
    Framework need search nested proeprty like this

    formId.label.propertyname
    formId.nestedpropertyname.label.restofpropertyname
    ...
    label.lastpartofproeprtyname
    lastpartofpropertyname

    We can then define proeprty name one and use in anotherr bean (when it is nested)

    regards

  5. #5
    Join Date
    Aug 2005
    Location
    London (the English one!)
    Posts
    378

    Default Has this changed since Dec04?

    Hi

    I am following the explanation in this note and... it does not seem to work.

    The hierarchy in messages.properties as described on the Wiki entry http://opensource.atlassian.com/conf...=true#comments
    formId.label.property
    label.property
    property

    does not seem to work anymore... I have to add:
    property.label=xxxx

    for the form to display xxxx for my property.

    But how could I specify different labels on different forms?
    I tried multiple things:
    formId.label.property
    formId.property.label
    property.label.formId
    property.formId.label

    So you see that my brain is about to explode....

    Anyone got that right with the latest code (Aug 05)?

    Thanks
    Regards from London!

    Benoit.

  6. #6
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    335

    Default

    See MessageSourceFormPropertyFaceDescriptorSource JavaDoc. I'd paste it here but I don't have access to sourceforge at the moment.

    Ollie

  7. #7
    Join Date
    Aug 2005
    Location
    London (the English one!)
    Posts
    378

    Default The JavaDoc and a comment

    Hi Ollie,

    Many thanks for your post. The JavaDoc is as follows:

    An implementation of FormPropertyFaceDescriptorSource that resolves the FormPropertyFaceDescriptor from the MessageSourceAccessor provided to the setMessageSourceAccessor method or from the ApplicationServices singleton if none is provided.

    The various properties of the FormPropertyFaceDescriptor are resolved from the message source using message keys in the following order:
    • {formModelId}.{formPropertyPath}.{faceDescriptorPr operty}

    • {formPropertyPath}.{faceDescriptorProperty}


    Where
    • {formModelId} is the id of the form model

    • {formPropertyPath} is the form property path being resolved

    • and {faceDescriptorProperty} is one of displayName, caption, description or label.


    If required the strategy for generating these key can be overridden be providing an alternative implementation of the getMessageKeys method.


    You were absolutely right, it didn't dawn on me that I had to put the formModelId rather than the "form page" Id (also called formId in AbstractForm). But in a way... I still wonder if it may be valid to define the messages on a per form 'page' basis rather than a model... not sure...

    Finally, the PetClinic example uses this way to create the model
    Code:
    FormModel myModel= FormModelHelper.createFormModel(myObject);
    which creates it ok but with a formId being null. This can be rectified like this:
    Code:
    FormModel myModel= FormModelHelper.createFormModel(myObject,"MyModelId");
    And the messages.properties can use:
    MyModelId.property.label=My greate label!

    Once again, thanks for your post.

    Best regards from London!

    Benoit

    PS: wrt CVS issue, does this mean that development/fixes of SpringRC are 'on hold' until SourceForge fixes it?

  8. #8
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    335

    Default

    PS: wrt CVS issue, does this mean that development/fixes of SpringRC are 'on hold' until SourceForge fixes it?
    No, it just means it's a pain in the ass. I do most of the devlopment at work so now I have to transfer the code to my home computer and then commit to SF.

    If you want to make some noise to hurry them up feel free ;-)

    Ollie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •