[OFBiz] Dev - How can I pass an uiLabelMap to a form widget
created in a bsh form?
David E. Jones
jonesde at ofbiz.org
Tue Apr 12 20:31:34 EDT 2005
Jacopo,
Thanks for bringing that up, I had actually messed up a couple of pages
in the catalog manager and didn't even notice... And, as usual, it is a
bit more complex than expected...
There is now a solution in place. To use it, just change all
"renderFormString()" calls to "renderFormString(context)". I have done
this for EditProductionRun to make sure it works.
BTW, to all listening in: the "context" variable in any MapStack, and
including in the screen widget and anything called from a screen
widget, is now a self-reference for the context... In other words, it
is the MapStack that represents the context. This was already being
done in BSH files, but now it is true everywhere.
-David
On Apr 12, 2005, at 3:17 AM, Jacopo Cappellato wrote:
> David,
>
> unfortunately this doesn't work. If I remove the prep code in the
> screen and I don't explicitly put the map in the form context the form
> is displayed with empty labels.
> Maybe the problem is the way the form's fields are defined? That is:
>
> <field name="quantity"
> title="${uiLabelMap.ManufacturingQuantity}"><text size="10"/></field>
>
> Jacopo
>
>>
>> Jacopo,
>>
>> I just saw your commit and this message. What exactly was happening?
>>
>> You shouldn't have to explicitly put the uiLabelMap in the context
>> when
>> going through the screen widget... All of these references should be
>> removable and it should still work just fine, ie remove the uiLabelMap
>> prep lines in each screen def AND the lines in the bsh files that put
>> it in the form context...
>>
>> Let me know if it doesn't.... I'm doing this very things in other
>> places and it is working fine...
>>
>> -David
>>
>>
>> On Apr 12, 2005, at 12:59 AM, Jacopo Cappellato wrote:
>>
>>> Thanks Adrian, thanks David.
>>>
>>> What Adrian described was exactly what I was doing... the problem was
>>> that the uiLabelMap variable was put in context by the
>>> manufacturing's
>>> "main-decorator" that is run AFTER the bsh of a given screen.
>>> As a temp fix I've set up the uiLabelMap in the action tag of the
>>> pages that run a bsh script that intantiates a form widget.
>>>
>>> Thanks for your valuable help.
>>>
>>> Jacopo
>>>
>>>
>>>>
>>>> Thanks Adrian, that is the proper way to do it.
>>>>
>>>> There is one shortcut in place that I thought I'd mention... Because
>>>> we
>>>> use the "uiLabelMap" variable so much the HtmlFormWrapper
>>>> constructor
>>>> will look for that in a request attribute. So, as long as the
>>>> uiLabelMap is in a request attribute you shouldn't have to do
>>>> anything
>>>> else. The envsetup.bsh scripts should already do this for code going
>>>> through JPublish.
>>>>
>>>> For things going through the Screen Widget, those will be setup by
>>>> actions in the decorator, so generally you won't have to do anything
>>>> (as long as the decorator actions run BEFORE the bsh script that
>>>> sets
>>>> up the form).
>>>>
>>>> -David
>>>>
>>>>
>>>> On Apr 11, 2005, at 10:20 AM, Adrian Crum wrote:
>>>>
>>>>> I'm sorry I didn't give more detail.
>>>>>
>>>>> Use the code from envsetup.bsh to create the uiLabelMap object,
>>>>> then
>>>>> put it in the HtmlFormWrapper's context using
>>>>> HtmlFormWrapper.putInContext().
>>>>>
>>>>> Example:
>>>>>
>>>>> locale = UtilHttp.getLocale(request);
>>>>> uiLabelMap =
>>>>> UtilProperties.getResourceBundleMap("MyComponentUiLabels", locale);
>>>>> uiLabelMap.addBottomResourceBundle("CommonUiLabels", locale);
>>>>> myFormWrapper = new HtmlFormWrapper();
>>>>> myFormWrapper.putInContext("uiLabelMap", uiLabelMap);
>>>>>
>>>>>
>>>>> Jacopo Cappellato wrote:
>>>>>
>>>>>> Adrian,
>>>>>> in the envsetup.bsh file, I cannot find anything about form
>>>>>> widgets... am I missing something?
>>>>>> Kind regards,
>>>>>> Jacopo
>>>>>>
>>>>>>> Look in Party Manager envsetup.bsh.
>>>>>>>
>>>>>>>
>>>>>>> Jacopo Cappellato wrote:
>>>>>>>
>>>>>>>> Hi all,
>>>>>>>>
>>>>>>>> how can I pass an uiLabelMap to a form widget created in a bsh
>>>>>>>> form?
>>>>>>>>
>>>>>>>> I've noticed that uiLabelMap can be referenced from within a
>>>>>>>> form
>>>>>>>> definition if the form is included using the include directive
>>>>>>>> of
>>>>>>>> the screen definition.
>>>>>>>>
>>>>>>>> On the other hand, if the form is created directly in the bsh
>>>>>>>> script (thru the "new HtmlFormWrapper(...)" constructor), the
>>>>>>>> uiLabelMap is missing and the follwing definition returns an
>>>>>>>> empty
>>>>>>>> title:
>>>>>>>>
>>>>>>>> <field name="notAvailableQuantity"
>>>>>>>> title="${uiLabelMap.ProductNotAvailable}"><display/></field>
>>>>>>>>
>>>>>>>> Any hints?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> Jacopo
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ____________________________________________________________
>>>>>>>> 6X velocizzare la tua navigazione a 56k? 6X Web Accelerator di
>>>>>>>> Libero!
>>>>>>>> Scaricalo su INTERNET GRATIS 6X http://www.libero.it
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Dev mailing list
>>>>>>>> Dev at lists.ofbiz.org
>>>>>>>> http://lists.ofbiz.org/mailman/listinfo/dev
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Dev mailing list
>>>>>>> Dev at lists.ofbiz.org
>>>>>>> http://lists.ofbiz.org/mailman/listinfo/dev
>>>>>>>
>>>>>> ____________________________________________________________
>>>>>> Navighi a 4 MEGA e i primi 3 mesi sono GRATIS. Scegli Libero Adsl
>>>>>> Flat senza limiti su http://www.libero.it
>>>>>> _______________________________________________
>>>>>> Dev mailing list
>>>>>> Dev at lists.ofbiz.org
>>>>>> http://lists.ofbiz.org/mailman/listinfo/dev
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> Dev at lists.ofbiz.org
>>>>> http://lists.ofbiz.org/mailman/listinfo/dev
>>>>
>>>
>>>
>>>
>>> ____________________________________________________________
>>> 6X velocizzare la tua navigazione a 56k? 6X Web Accelerator di
>>> Libero!
>>> Scaricalo su INTERNET GRATIS 6X http://www.libero.it
>>>
>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> Dev at lists.ofbiz.org
>>> http://lists.ofbiz.org/mailman/listinfo/dev
>>
>
>
>
> ____________________________________________________________
> 6X velocizzare la tua navigazione a 56k? 6X Web Accelerator di Libero!
> Scaricalo su INTERNET GRATIS 6X http://www.libero.it
>
>
>
> _______________________________________________
> Dev mailing list
> Dev at lists.ofbiz.org
> http://lists.ofbiz.org/mailman/listinfo/dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2363 bytes
Desc: not available
Url : http://lists.ofbiz.org/pipermail/dev/attachments/20050412/c4a95e80/smime.bin
More information about the Dev
mailing list