Dev - Screen widget actions: order of execution

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Dev - Screen widget actions: order of execution

Leon Torres-2
I need to set some context variables in a <script> or <set> that is visible to
all scripts later on. For example, uiLabelMaps. Presently, I cannot do the
following,

<screen name="root">
   <actions>
     <property-map resource="CommonUiLabels"
                   map-name="uiLabelMap" global="true"/>
     <script location="..."/>  <!-- sets a variable "bar" -->
   </actions>
</screen>

<screen name="child">
   <actions>
     <set field="label" value="${uiLabelMap.CommonLabel}" /> <!-- won't work! -->
     <set field="valueOfBar" value="${bar}" /> <!-- neither will this -->
   </actions>
   <decorator-screen name="root">
     ...
     <label>${uiLabelMap.CommonLabel}, ${bar}</label> <!-- but this works -->
   </decorator-screen>
</screen>


At the very least I need some way to set the uiLabelMap and the "bar" variable
somewhere where all "child" <actions> section can access it.

Note that I found a workaround for uiLabelMaps,

   <set field="label" value="CommonLabel" /> <!-- use: uiLabelMap.get(label)) -->

but that's not generic. I now need to set "bar".

Thanks,

- Leon
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Dev - Screen widget actions: order of execution

Leon Torres-2
My question, if it wasn't clear, was how to accomplish setting a variable that
all <actions> sections can see, including the ones that are invoked from
<decorator-screen-name> and <include-screen>? I want to make certain things
available to all <script> and <set> fields within a <screen> tree.

- Leon


Leon Torres wrote:

> I need to set some context variables in a <script> or <set> that is visible to
> all scripts later on. For example, uiLabelMaps. Presently, I cannot do the
> following,
>
> <screen name="root">
>    <actions>
>      <property-map resource="CommonUiLabels"
>                    map-name="uiLabelMap" global="true"/>
>      <script location="..."/>  <!-- sets a variable "bar" -->
>    </actions>
> </screen>
>
> <screen name="child">
>    <actions>
>      <set field="label" value="${uiLabelMap.CommonLabel}" /> <!-- won't work! -->
>      <set field="valueOfBar" value="${bar}" /> <!-- neither will this -->
>    </actions>
>    <decorator-screen name="root">
>      ...
>      <label>${uiLabelMap.CommonLabel}, ${bar}</label> <!-- but this works -->
>    </decorator-screen>
> </screen>
>
>
> At the very least I need some way to set the uiLabelMap and the "bar" variable
> somewhere where all "child" <actions> section can access it.
>
> Note that I found a workaround for uiLabelMaps,
>
>    <set field="label" value="CommonLabel" /> <!-- use: uiLabelMap.get(label)) -->
>
> but that's not generic. I now need to set "bar".
>
> Thanks,
>
> - Leon
>  
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
>
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Dev - Screen widget actions: order of execution

Adrian Crum
Try this:

<screen name="child">
    <section>
       <decorator-screen name="root">
          <actions>
            <set field="label" value="${uiLabelMap.CommonLabel}" /> <!-- won't
work! -->
            <set field="valueOfBar" value="${bar}" /> <!-- neither will this -->
          </actions>
          ...
          <label>${uiLabelMap.CommonLabel}, ${bar}</label> <!-- but this works -->
       </decorator-screen>
    </section>
</screen>




Leon Torres wrote:

> My question, if it wasn't clear, was how to accomplish setting a variable that
> all <actions> sections can see, including the ones that are invoked from
> <decorator-screen-name> and <include-screen>? I want to make certain things
> available to all <script> and <set> fields within a <screen> tree.
>
> - Leon
>
>
> Leon Torres wrote:
>
>>I need to set some context variables in a <script> or <set> that is visible to
>>all scripts later on. For example, uiLabelMaps. Presently, I cannot do the
>>following,
>>
>><screen name="root">
>>   <actions>
>>     <property-map resource="CommonUiLabels"
>>                   map-name="uiLabelMap" global="true"/>
>>     <script location="..."/>  <!-- sets a variable "bar" -->
>>   </actions>
>></screen>
>>
>><screen name="child">
>>   <actions>
>>     <set field="label" value="${uiLabelMap.CommonLabel}" /> <!-- won't work! -->
>>     <set field="valueOfBar" value="${bar}" /> <!-- neither will this -->
>>   </actions>
>>   <decorator-screen name="root">
>>     ...
>>     <label>${uiLabelMap.CommonLabel}, ${bar}</label> <!-- but this works -->
>>   </decorator-screen>
>></screen>
>>
>>
>>At the very least I need some way to set the uiLabelMap and the "bar" variable
>>somewhere where all "child" <actions> section can access it.
>>
>>Note that I found a workaround for uiLabelMaps,
>>
>>   <set field="label" value="CommonLabel" /> <!-- use: uiLabelMap.get(label)) -->
>>
>>but that's not generic. I now need to set "bar".
>>
>>Thanks,
>>
>>- Leon
>>
>>_______________________________________________
>>Dev mailing list
>>[hidden email]
>>http://lists.ofbiz.org/mailman/listinfo/dev
>>
>
>  
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
>
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Dev - Screen widget actions: order of execution

David E. Jones
In reply to this post by Leon Torres-2

Leon,

Note that decorator-screen and include-screen do slightly different things. Are you saying you want to set a value in a script called from the decorator screen and have the values available where the decorator-section-include tag is? In other words, you are looking for something in bsh that is similar to global="true"?

For this and all variables available in screens by default (note that some vary between screens rendered through a service versus through a servlet request) see the ScreenRenderer.java file and the populate* methods there.

The one you are looking for, in this case, is "globalContext" instead of "context".

-David


Leon Torres wrote:

> My question, if it wasn't clear, was how to accomplish setting a variable that
> all <actions> sections can see, including the ones that are invoked from
> <decorator-screen-name> and <include-screen>? I want to make certain things
> available to all <script> and <set> fields within a <screen> tree.
>
> - Leon
>
>
> Leon Torres wrote:
>> I need to set some context variables in a <script> or <set> that is visible to
>> all scripts later on. For example, uiLabelMaps. Presently, I cannot do the
>> following,
>>
>> <screen name="root">
>>    <actions>
>>      <property-map resource="CommonUiLabels"
>>                    map-name="uiLabelMap" global="true"/>
>>      <script location="..."/>  <!-- sets a variable "bar" -->
>>    </actions>
>> </screen>
>>
>> <screen name="child">
>>    <actions>
>>      <set field="label" value="${uiLabelMap.CommonLabel}" /> <!-- won't work! -->
>>      <set field="valueOfBar" value="${bar}" /> <!-- neither will this -->
>>    </actions>
>>    <decorator-screen name="root">
>>      ...
>>      <label>${uiLabelMap.CommonLabel}, ${bar}</label> <!-- but this works -->
>>    </decorator-screen>
>> </screen>
>>
>>
>> At the very least I need some way to set the uiLabelMap and the "bar" variable
>> somewhere where all "child" <actions> section can access it.
>>
>> Note that I found a workaround for uiLabelMaps,
>>
>>    <set field="label" value="CommonLabel" /> <!-- use: uiLabelMap.get(label)) -->
>>
>> but that's not generic. I now need to set "bar".
>>
>> Thanks,
>>
>> - Leon
>>  
>> _______________________________________________
>> Dev mailing list
>> [hidden email]
>> http://lists.ofbiz.org/mailman/listinfo/dev
>>
>  
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Dev - Screen widget actions: order of execution

Leon Torres-2
Hi David,

Thanks for the tip.  I'm implementing the ViewPreferences Si outlined and I'm
thinking it should join the UserLogin, Person, and Visit values already in the
globalContext.  It seems like the only way for all scripts, screens and forms to
know about them.

Do you think adding a list of GenericValues to the globalContext is such a good
idea?  It will of course be limited to the set of preferences that is pertinent
to the given application and screen.

- Leon




David E Jones wrote:

> Leon,
>
> Note that decorator-screen and include-screen do slightly different things. Are you saying you want to set a value in a script called from the decorator screen and have the values available where the decorator-section-include tag is? In other words, you are looking for something in bsh that is similar to global="true"?
>
> For this and all variables available in screens by default (note that some vary between screens rendered through a service versus through a servlet request) see the ScreenRenderer.java file and the populate* methods there.
>
> The one you are looking for, in this case, is "globalContext" instead of "context".
>
> -David
>
>
> Leon Torres wrote:
>> My question, if it wasn't clear, was how to accomplish setting a variable that
>> all <actions> sections can see, including the ones that are invoked from
>> <decorator-screen-name> and <include-screen>? I want to make certain things
>> available to all <script> and <set> fields within a <screen> tree.
>>
>> - Leon
>>
>>
>> Leon Torres wrote:
>>> I need to set some context variables in a <script> or <set> that is visible to
>>> all scripts later on. For example, uiLabelMaps. Presently, I cannot do the
>>> following,
>>>
>>> <screen name="root">
>>>    <actions>
>>>      <property-map resource="CommonUiLabels"
>>>                    map-name="uiLabelMap" global="true"/>
>>>      <script location="..."/>  <!-- sets a variable "bar" -->
>>>    </actions>
>>> </screen>
>>>
>>> <screen name="child">
>>>    <actions>
>>>      <set field="label" value="${uiLabelMap.CommonLabel}" /> <!-- won't work! -->
>>>      <set field="valueOfBar" value="${bar}" /> <!-- neither will this -->
>>>    </actions>
>>>    <decorator-screen name="root">
>>>      ...
>>>      <label>${uiLabelMap.CommonLabel}, ${bar}</label> <!-- but this works -->
>>>    </decorator-screen>
>>> </screen>
>>>
>>>
>>> At the very least I need some way to set the uiLabelMap and the "bar" variable
>>> somewhere where all "child" <actions> section can access it.
>>>
>>> Note that I found a workaround for uiLabelMaps,
>>>
>>>    <set field="label" value="CommonLabel" /> <!-- use: uiLabelMap.get(label)) -->
>>>
>>> but that's not generic. I now need to set "bar".
>>>
>>> Thanks,
>>>
>>> - Leon
>>>  
>>> _______________________________________________
>>> Dev mailing list
>>> [hidden email]
>>> http://lists.ofbiz.org/mailman/listinfo/dev
>>>
>>  
>> _______________________________________________
>> Dev mailing list
>> [hidden email]
>> http://lists.ofbiz.org/mailman/listinfo/dev
>  
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
>
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Dev - Screen widget actions: order of execution

Adrian Crum
Leon,

I know you were directing your question to David, but I will respond too - since
I've already implemented what you're working on.

The user-selected UI theme code I developed does exactly what you're describing.
An action (bsh script) in the Global Decorator gets the user's UI preferences
and stores them in the layoutSettings map. Doing it this way makes the settings
available to all the screens. As long as a screen uses the Global Decorator it
will have the user's UI preferences in the context.

On a side note, I would like to suggest keeping the user's UI preferences - in
whatever data type you decide on - in the layoutSettings map. That seems to be
the standard that's developing. It would be nice to have other developer's
opinions on this.

-Adrian



Leon Torres wrote:

> Hi David,
>
> Thanks for the tip.  I'm implementing the ViewPreferences Si outlined and I'm
> thinking it should join the UserLogin, Person, and Visit values already in the
> globalContext.  It seems like the only way for all scripts, screens and forms to
> know about them.
>
> Do you think adding a list of GenericValues to the globalContext is such a good
> idea?  It will of course be limited to the set of preferences that is pertinent
> to the given application and screen.
>
> - Leon
>
>
>
>
> David E Jones wrote:
>
>>Leon,
>>
>>Note that decorator-screen and include-screen do slightly different things. Are you saying you want to set a value in a script called from the decorator screen and have the values available where the decorator-section-include tag is? In other words, you are looking for something in bsh that is similar to global="true"?
>>
>>For this and all variables available in screens by default (note that some vary between screens rendered through a service versus through a servlet request) see the ScreenRenderer.java file and the populate* methods there.
>>
>>The one you are looking for, in this case, is "globalContext" instead of "context".
>>
>>-David
>>
>>
>>Leon Torres wrote:
>>
>>>My question, if it wasn't clear, was how to accomplish setting a variable that
>>>all <actions> sections can see, including the ones that are invoked from
>>><decorator-screen-name> and <include-screen>? I want to make certain things
>>>available to all <script> and <set> fields within a <screen> tree.
>>>
>>>- Leon
>>>
>>>
>>>Leon Torres wrote:
>>>
>>>>I need to set some context variables in a <script> or <set> that is visible to
>>>>all scripts later on. For example, uiLabelMaps. Presently, I cannot do the
>>>>following,
>>>>
>>>><screen name="root">
>>>>   <actions>
>>>>     <property-map resource="CommonUiLabels"
>>>>                   map-name="uiLabelMap" global="true"/>
>>>>     <script location="..."/>  <!-- sets a variable "bar" -->
>>>>   </actions>
>>>></screen>
>>>>
>>>><screen name="child">
>>>>   <actions>
>>>>     <set field="label" value="${uiLabelMap.CommonLabel}" /> <!-- won't work! -->
>>>>     <set field="valueOfBar" value="${bar}" /> <!-- neither will this -->
>>>>   </actions>
>>>>   <decorator-screen name="root">
>>>>     ...
>>>>     <label>${uiLabelMap.CommonLabel}, ${bar}</label> <!-- but this works -->
>>>>   </decorator-screen>
>>>></screen>
>>>>
>>>>
>>>>At the very least I need some way to set the uiLabelMap and the "bar" variable
>>>>somewhere where all "child" <actions> section can access it.
>>>>
>>>>Note that I found a workaround for uiLabelMaps,
>>>>
>>>>   <set field="label" value="CommonLabel" /> <!-- use: uiLabelMap.get(label)) -->
>>>>
>>>>but that's not generic. I now need to set "bar".
>>>>
>>>>Thanks,
>>>>
>>>>- Leon
>>>>
>>>>_______________________________________________
>>>>Dev mailing list
>>>>[hidden email]
>>>>http://lists.ofbiz.org/mailman/listinfo/dev
>>>>
>>>
>>>
>>>_______________________________________________
>>>Dev mailing list
>>>[hidden email]
>>>http://lists.ofbiz.org/mailman/listinfo/dev
>>
>>
>>_______________________________________________
>>Dev mailing list
>>[hidden email]
>>http://lists.ofbiz.org/mailman/listinfo/dev
>>
>
>  
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
>
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Dev - Screen widget actions: order of execution

Adrian Crum
I put the script I use in http://jira.undersunconsulting.com/browse/OFBIZ-880 .

Maybe that will help.

Adrian Crum wrote:

> Leon,
>
> I know you were directing your question to David, but I will respond too - since
> I've already implemented what you're working on.
>
> The user-selected UI theme code I developed does exactly what you're describing.
> An action (bsh script) in the Global Decorator gets the user's UI preferences
> and stores them in the layoutSettings map. Doing it this way makes the settings
> available to all the screens. As long as a screen uses the Global Decorator it
> will have the user's UI preferences in the context.
>
> On a side note, I would like to suggest keeping the user's UI preferences - in
> whatever data type you decide on - in the layoutSettings map. That seems to be
> the standard that's developing. It would be nice to have other developer's
> opinions on this.
>
> -Adrian
>
>
>
> Leon Torres wrote:
>
>>Hi David,
>>
>>Thanks for the tip.  I'm implementing the ViewPreferences Si outlined and I'm
>>thinking it should join the UserLogin, Person, and Visit values already in the
>>globalContext.  It seems like the only way for all scripts, screens and forms to
>>know about them.
>>
>>Do you think adding a list of GenericValues to the globalContext is such a good
>>idea?  It will of course be limited to the set of preferences that is pertinent
>>to the given application and screen.
>>
>>- Leon
>>
>>
>>
>>
>>David E Jones wrote:
>>
>>
>>>Leon,
>>>
>>>Note that decorator-screen and include-screen do slightly different things. Are you saying you want to set a value in a script called from the decorator screen and have the values available where the decorator-section-include tag is? In other words, you are looking for something in bsh that is similar to global="true"?
>>>
>>>For this and all variables available in screens by default (note that some vary between screens rendered through a service versus through a servlet request) see the ScreenRenderer.java file and the populate* methods there.
>>>
>>>The one you are looking for, in this case, is "globalContext" instead of "context".
>>>
>>>-David
>>>
>>>
>>>Leon Torres wrote:
>>>
>>>
>>>>My question, if it wasn't clear, was how to accomplish setting a variable that
>>>>all <actions> sections can see, including the ones that are invoked from
>>>><decorator-screen-name> and <include-screen>? I want to make certain things
>>>>available to all <script> and <set> fields within a <screen> tree.
>>>>
>>>>- Leon
>>>>
>>>>
>>>>Leon Torres wrote:
>>>>
>>>>
>>>>>I need to set some context variables in a <script> or <set> that is visible to
>>>>>all scripts later on. For example, uiLabelMaps. Presently, I cannot do the
>>>>>following,
>>>>>
>>>>><screen name="root">
>>>>>  <actions>
>>>>>    <property-map resource="CommonUiLabels"
>>>>>                  map-name="uiLabelMap" global="true"/>
>>>>>    <script location="..."/>  <!-- sets a variable "bar" -->
>>>>>  </actions>
>>>>></screen>
>>>>>
>>>>><screen name="child">
>>>>>  <actions>
>>>>>    <set field="label" value="${uiLabelMap.CommonLabel}" /> <!-- won't work! -->
>>>>>    <set field="valueOfBar" value="${bar}" /> <!-- neither will this -->
>>>>>  </actions>
>>>>>  <decorator-screen name="root">
>>>>>    ...
>>>>>    <label>${uiLabelMap.CommonLabel}, ${bar}</label> <!-- but this works -->
>>>>>  </decorator-screen>
>>>>></screen>
>>>>>
>>>>>
>>>>>At the very least I need some way to set the uiLabelMap and the "bar" variable
>>>>>somewhere where all "child" <actions> section can access it.
>>>>>
>>>>>Note that I found a workaround for uiLabelMaps,
>>>>>
>>>>>  <set field="label" value="CommonLabel" /> <!-- use: uiLabelMap.get(label)) -->
>>>>>
>>>>>but that's not generic. I now need to set "bar".
>>>>>
>>>>>Thanks,
>>>>>
>>>>>- Leon
>>>>>
>>>>>_______________________________________________
>>>>>Dev mailing list
>>>>>[hidden email]
>>>>>http://lists.ofbiz.org/mailman/listinfo/dev
>>>>>
>>>>
>>>>
>>>>_______________________________________________
>>>>Dev mailing list
>>>>[hidden email]
>>>>http://lists.ofbiz.org/mailman/listinfo/dev
>>>
>>>
>>>_______________________________________________
>>>Dev mailing list
>>>[hidden email]
>>>http://lists.ofbiz.org/mailman/listinfo/dev
>>>
>>
>>
>>_______________________________________________
>>Dev mailing list
>>[hidden email]
>>http://lists.ofbiz.org/mailman/listinfo/dev
>>
>
>  
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
>
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Dev - Screen widget actions: order of execution

Leon Torres-2
In reply to this post by Adrian Crum
Hi Adrian,

Thanks for that pointer. I couldn't find out where layoutSettings was being set,
probably because my ofbiz's GlobalDecorator does not call envsetup.bsh?

However, if envsetup.bsh is intended to be called from within GlobalDecorator's
<actions>, it won't solve my main problem, which is accessing layoutSettings
from within an <actions> block that is executed _before_ GlobalDecorator's
<actions>.

This is a more general problem with the "order of execution" of <actions> which
I was hoping to avoid.  Essentially, I want to set a value that can be seen by
all scripts invoked by <script> from all <actions> blocks in the entire <screen>
tree that is being called.  I cannot set it in the GlobalDecorator's <actions>
because it is executed _after_ the <actions> block of the screen that is first
read.  The global variable concept in the screen widget is only relevant to the
contents of <widgets>, not to the contents of <actions>.

So did you find a way to do this?  I'd sure like to know. :-)

- Leon




Adrian Crum wrote:

> Leon,
>
> I know you were directing your question to David, but I will respond too - since
> I've already implemented what you're working on.
>
> The user-selected UI theme code I developed does exactly what you're describing.
> An action (bsh script) in the Global Decorator gets the user's UI preferences
> and stores them in the layoutSettings map. Doing it this way makes the settings
> available to all the screens. As long as a screen uses the Global Decorator it
> will have the user's UI preferences in the context.
>
> On a side note, I would like to suggest keeping the user's UI preferences - in
> whatever data type you decide on - in the layoutSettings map. That seems to be
> the standard that's developing. It would be nice to have other developer's
> opinions on this.
>
> -Adrian
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Dev - Screen widget actions: order of execution

Adrian Crum
Then just make the value Global - global="true" in your action section.


Leon Torres wrote:

> Hi Adrian,
>
> Thanks for that pointer. I couldn't find out where layoutSettings was being set,
> probably because my ofbiz's GlobalDecorator does not call envsetup.bsh?
>
> However, if envsetup.bsh is intended to be called from within GlobalDecorator's
> <actions>, it won't solve my main problem, which is accessing layoutSettings
> from within an <actions> block that is executed _before_ GlobalDecorator's
> <actions>.
>
> This is a more general problem with the "order of execution" of <actions> which
> I was hoping to avoid.  Essentially, I want to set a value that can be seen by
> all scripts invoked by <script> from all <actions> blocks in the entire <screen>
> tree that is being called.  I cannot set it in the GlobalDecorator's <actions>
> because it is executed _after_ the <actions> block of the screen that is first
> read.  The global variable concept in the screen widget is only relevant to the
> contents of <widgets>, not to the contents of <actions>.
>
> So did you find a way to do this?  I'd sure like to know. :-)
>
> - Leon
>
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Dev - Screen widget actions: order of execution

Adrian Crum
Look at Party Manager's CommonScreens.xml file - the main decorator. Use that as
a guide.

Adrian Crum wrote:

> Then just make the value Global - global="true" in your action section.
>
>
> Leon Torres wrote:
>
>>Hi Adrian,
>>
>>Thanks for that pointer. I couldn't find out where layoutSettings was being set,
>>probably because my ofbiz's GlobalDecorator does not call envsetup.bsh?
>>
>>However, if envsetup.bsh is intended to be called from within GlobalDecorator's
>><actions>, it won't solve my main problem, which is accessing layoutSettings
>>from within an <actions> block that is executed _before_ GlobalDecorator's
>><actions>.
>>
>>This is a more general problem with the "order of execution" of <actions> which
>>I was hoping to avoid.  Essentially, I want to set a value that can be seen by
>>all scripts invoked by <script> from all <actions> blocks in the entire <screen>
>>tree that is being called.  I cannot set it in the GlobalDecorator's <actions>
>>because it is executed _after_ the <actions> block of the screen that is first
>>read.  The global variable concept in the screen widget is only relevant to the
>>contents of <widgets>, not to the contents of <actions>.
>>
>>So did you find a way to do this?  I'd sure like to know. :-)
>>
>>- Leon
>>
>
>  
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
>
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Dev - Screen widget actions: order of execution

David E. Jones
In reply to this post by Adrian Crum

I'm not sure if the layoutSettings Map is the best place for these. That variable isn't too great, but it is mostly information from the ProductStore configuration and such.

Putting it somewhere in the globalContext is necessary if you want to set something up in a decorator that will be used in the stuff it decorates (because the decorator itself has a protected context just like any included screen).

So, for user-specific options putting them in a special Map for this purpose is probably best (separate from the layoutSettings Map).

-David


Adrian Crum wrote:

> Leon,
>
> I know you were directing your question to David, but I will respond too - since
> I've already implemented what you're working on.
>
> The user-selected UI theme code I developed does exactly what you're describing.
> An action (bsh script) in the Global Decorator gets the user's UI preferences
> and stores them in the layoutSettings map. Doing it this way makes the settings
> available to all the screens. As long as a screen uses the Global Decorator it
> will have the user's UI preferences in the context.
>
> On a side note, I would like to suggest keeping the user's UI preferences - in
> whatever data type you decide on - in the layoutSettings map. That seems to be
> the standard that's developing. It would be nice to have other developer's
> opinions on this.
>
> -Adrian
>
>
>
> Leon Torres wrote:
>> Hi David,
>>
>> Thanks for the tip.  I'm implementing the ViewPreferences Si outlined and I'm
>> thinking it should join the UserLogin, Person, and Visit values already in the
>> globalContext.  It seems like the only way for all scripts, screens and forms to
>> know about them.
>>
>> Do you think adding a list of GenericValues to the globalContext is such a good
>> idea?  It will of course be limited to the set of preferences that is pertinent
>> to the given application and screen.
>>
>> - Leon
>>
>>
>>
>>
>> David E Jones wrote:
>>
>>> Leon,
>>>
>>> Note that decorator-screen and include-screen do slightly different things. Are you saying you want to set a value in a script called from the decorator screen and have the values available where the decorator-section-include tag is? In other words, you are looking for something in bsh that is similar to global="true"?
>>>
>>> For this and all variables available in screens by default (note that some vary between screens rendered through a service versus through a servlet request) see the ScreenRenderer.java file and the populate* methods there.
>>>
>>> The one you are looking for, in this case, is "globalContext" instead of "context".
>>>
>>> -David
>>>
>>>
>>> Leon Torres wrote:
>>>
>>>> My question, if it wasn't clear, was how to accomplish setting a variable that
>>>> all <actions> sections can see, including the ones that are invoked from
>>>> <decorator-screen-name> and <include-screen>? I want to make certain things
>>>> available to all <script> and <set> fields within a <screen> tree.
>>>>
>>>> - Leon
>>>>
>>>>
>>>> Leon Torres wrote:
>>>>
>>>>> I need to set some context variables in a <script> or <set> that is visible to
>>>>> all scripts later on. For example, uiLabelMaps. Presently, I cannot do the
>>>>> following,
>>>>>
>>>>> <screen name="root">
>>>>>   <actions>
>>>>>     <property-map resource="CommonUiLabels"
>>>>>                   map-name="uiLabelMap" global="true"/>
>>>>>     <script location="..."/>  <!-- sets a variable "bar" -->
>>>>>   </actions>
>>>>> </screen>
>>>>>
>>>>> <screen name="child">
>>>>>   <actions>
>>>>>     <set field="label" value="${uiLabelMap.CommonLabel}" /> <!-- won't work! -->
>>>>>     <set field="valueOfBar" value="${bar}" /> <!-- neither will this -->
>>>>>   </actions>
>>>>>   <decorator-screen name="root">
>>>>>     ...
>>>>>     <label>${uiLabelMap.CommonLabel}, ${bar}</label> <!-- but this works -->
>>>>>   </decorator-screen>
>>>>> </screen>
>>>>>
>>>>>
>>>>> At the very least I need some way to set the uiLabelMap and the "bar" variable
>>>>> somewhere where all "child" <actions> section can access it.
>>>>>
>>>>> Note that I found a workaround for uiLabelMaps,
>>>>>
>>>>>   <set field="label" value="CommonLabel" /> <!-- use: uiLabelMap.get(label)) -->
>>>>>
>>>>> but that's not generic. I now need to set "bar".
>>>>>
>>>>> Thanks,
>>>>>
>>>>> - Leon
>>>>>
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> [hidden email]
>>>>> http://lists.ofbiz.org/mailman/listinfo/dev
>>>>>
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> [hidden email]
>>>> http://lists.ofbiz.org/mailman/listinfo/dev
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [hidden email]
>>> http://lists.ofbiz.org/mailman/listinfo/dev
>>>
>>  
>> _______________________________________________
>> Dev mailing list
>> [hidden email]
>> http://lists.ofbiz.org/mailman/listinfo/dev
>>
>  
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Dev - Screen widget actions: order of execution

David E. Jones
In reply to this post by Leon Torres-2

To do this the actions must be inside the decorator section (ie decorator-section -> section -> actions), rather than in the actions for the main screen section outside of the decorator.

Just be careful! The isolated contexts are there for a reason and help about a LOT of problems that we had in the past with JSPs and with JPublish. So, use global values when needed, but don't try to make everything global...

-David


Leon Torres wrote:

> Hi Adrian,
>
> Thanks for that pointer. I couldn't find out where layoutSettings was being set,
> probably because my ofbiz's GlobalDecorator does not call envsetup.bsh?
>
> However, if envsetup.bsh is intended to be called from within GlobalDecorator's
> <actions>, it won't solve my main problem, which is accessing layoutSettings
> from within an <actions> block that is executed _before_ GlobalDecorator's
> <actions>.
>
> This is a more general problem with the "order of execution" of <actions> which
> I was hoping to avoid.  Essentially, I want to set a value that can be seen by
> all scripts invoked by <script> from all <actions> blocks in the entire <screen>
> tree that is being called.  I cannot set it in the GlobalDecorator's <actions>
> because it is executed _after_ the <actions> block of the screen that is first
> read.  The global variable concept in the screen widget is only relevant to the
> contents of <widgets>, not to the contents of <actions>.
>
> So did you find a way to do this?  I'd sure like to know. :-)
>
> - Leon
>
>
>
>
> Adrian Crum wrote:
>> Leon,
>>
>> I know you were directing your question to David, but I will respond too - since
>> I've already implemented what you're working on.
>>
>> The user-selected UI theme code I developed does exactly what you're describing.
>> An action (bsh script) in the Global Decorator gets the user's UI preferences
>> and stores them in the layoutSettings map. Doing it this way makes the settings
>> available to all the screens. As long as a screen uses the Global Decorator it
>> will have the user's UI preferences in the context.
>>
>> On a side note, I would like to suggest keeping the user's UI preferences - in
>> whatever data type you decide on - in the layoutSettings map. That seems to be
>> the standard that's developing. It would be nice to have other developer's
>> opinions on this.
>>
>> -Adrian
>  
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Dev - Screen widget actions: order of execution

Adrian Crum
In reply to this post by David E. Jones
David,

Thanks for your input!

I'm a little puzzled by your comments on the layoutSettings map. It seems to be
used in every component's main-decorator, not just the Product Store. Plus, it
contains a number of page layout elements. So, it seemed logical to use it.


David E Jones wrote:

> I'm not sure if the layoutSettings Map is the best place for these. That variable isn't too great, but it is mostly information from the ProductStore configuration and such.
>
> Putting it somewhere in the globalContext is necessary if you want to set something up in a decorator that will be used in the stuff it decorates (because the decorator itself has a protected context just like any included screen).
>
> So, for user-specific options putting them in a special Map for this purpose is probably best (separate from the layoutSettings Map).
>
> -David
>
>
> Adrian Crum wrote:
>
>>Leon,
>>
>>I know you were directing your question to David, but I will respond too - since
>>I've already implemented what you're working on.
>>
>>The user-selected UI theme code I developed does exactly what you're describing.
>>An action (bsh script) in the Global Decorator gets the user's UI preferences
>>and stores them in the layoutSettings map. Doing it this way makes the settings
>>available to all the screens. As long as a screen uses the Global Decorator it
>>will have the user's UI preferences in the context.
>>
>>On a side note, I would like to suggest keeping the user's UI preferences - in
>>whatever data type you decide on - in the layoutSettings map. That seems to be
>>the standard that's developing. It would be nice to have other developer's
>>opinions on this.
>>
>>-Adrian
>>
>>
>>
>>Leon Torres wrote:
>>
>>>Hi David,
>>>
>>>Thanks for the tip.  I'm implementing the ViewPreferences Si outlined and I'm
>>>thinking it should join the UserLogin, Person, and Visit values already in the
>>>globalContext.  It seems like the only way for all scripts, screens and forms to
>>>know about them.
>>>
>>>Do you think adding a list of GenericValues to the globalContext is such a good
>>>idea?  It will of course be limited to the set of preferences that is pertinent
>>>to the given application and screen.
>>>
>>>- Leon
>>>
>>>
>>>
>>>
>>>David E Jones wrote:
>>>
>>>
>>>>Leon,
>>>>
>>>>Note that decorator-screen and include-screen do slightly different things. Are you saying you want to set a value in a script called from the decorator screen and have the values available where the decorator-section-include tag is? In other words, you are looking for something in bsh that is similar to global="true"?
>>>>
>>>>For this and all variables available in screens by default (note that some vary between screens rendered through a service versus through a servlet request) see the ScreenRenderer.java file and the populate* methods there.
>>>>
>>>>The one you are looking for, in this case, is "globalContext" instead of "context".
>>>>
>>>>-David
>>>>
>>>>
>>>>Leon Torres wrote:
>>>>
>>>>
>>>>>My question, if it wasn't clear, was how to accomplish setting a variable that
>>>>>all <actions> sections can see, including the ones that are invoked from
>>>>><decorator-screen-name> and <include-screen>? I want to make certain things
>>>>>available to all <script> and <set> fields within a <screen> tree.
>>>>>
>>>>>- Leon
>>>>>
>>>>>
>>>>>Leon Torres wrote:
>>>>>
>>>>>
>>>>>>I need to set some context variables in a <script> or <set> that is visible to
>>>>>>all scripts later on. For example, uiLabelMaps. Presently, I cannot do the
>>>>>>following,
>>>>>>
>>>>>><screen name="root">
>>>>>>  <actions>
>>>>>>    <property-map resource="CommonUiLabels"
>>>>>>                  map-name="uiLabelMap" global="true"/>
>>>>>>    <script location="..."/>  <!-- sets a variable "bar" -->
>>>>>>  </actions>
>>>>>></screen>
>>>>>>
>>>>>><screen name="child">
>>>>>>  <actions>
>>>>>>    <set field="label" value="${uiLabelMap.CommonLabel}" /> <!-- won't work! -->
>>>>>>    <set field="valueOfBar" value="${bar}" /> <!-- neither will this -->
>>>>>>  </actions>
>>>>>>  <decorator-screen name="root">
>>>>>>    ...
>>>>>>    <label>${uiLabelMap.CommonLabel}, ${bar}</label> <!-- but this works -->
>>>>>>  </decorator-screen>
>>>>>></screen>
>>>>>>
>>>>>>
>>>>>>At the very least I need some way to set the uiLabelMap and the "bar" variable
>>>>>>somewhere where all "child" <actions> section can access it.
>>>>>>
>>>>>>Note that I found a workaround for uiLabelMaps,
>>>>>>
>>>>>>  <set field="label" value="CommonLabel" /> <!-- use: uiLabelMap.get(label)) -->
>>>>>>
>>>>>>but that's not generic. I now need to set "bar".
>>>>>>
>>>>>>Thanks,
>>>>>>
>>>>>>- Leon
>>>>>>
>>>>>>_______________________________________________
>>>>>>Dev mailing list
>>>>>>[hidden email]
>>>>>>http://lists.ofbiz.org/mailman/listinfo/dev
>>>>>>
>>>>>
>>>>>_______________________________________________
>>>>>Dev mailing list
>>>>>[hidden email]
>>>>>http://lists.ofbiz.org/mailman/listinfo/dev
>>>>
>>>>_______________________________________________
>>>>Dev mailing list
>>>>[hidden email]
>>>>http://lists.ofbiz.org/mailman/listinfo/dev
>>>>
>>>
>>>
>>>_______________________________________________
>>>Dev mailing list
>>>[hidden email]
>>>http://lists.ofbiz.org/mailman/listinfo/dev
>>>
>>
>>
>>_______________________________________________
>>Dev mailing list
>>[hidden email]
>>http://lists.ofbiz.org/mailman/listinfo/dev
>
>  
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev
>
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Dev - Screen widget actions: order of execution

Leon Torres-2
In reply to this post by David E. Jones
Yes, this makes perfect sense. I'll try to find a way to do this with your tips.

-  Leon


David E Jones wrote:
> To do this the actions must be inside the decorator section (ie decorator-section -> section -> actions), rather than in the actions for the main screen section outside of the decorator.
>
> Just be careful! The isolated contexts are there for a reason and help about a LOT of problems that we had in the past with JSPs and with JPublish. So, use global values when needed, but don't try to make everything global...
>
> -David
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Dev - Screen widget actions: order of execution

Florin T.PATRASCU (work)
In reply to this post by David E. Jones
Hi there,

The UI support in OFBiz is a hot topic for my team too and we are
following with great interest these threads. David, without trying to
steal the main focus of this thread, if you could spare few more minutes
on the "contexts" story?! So, what kind of problems you encountered with
JPublish in the past, regarding this issue? As a JPublish committer, I
am interested in seeing how can I improve it and learn from past
mistakes, who knows maybe the next version of JPublish can add some
value to OFBiz too:)

I am not asking about JSP because JSP is a problem by itself ;)

Thank you,
-florin


David E Jones wrote:

> To do this the actions must be inside the decorator section (ie decorator-section -> section -> actions), rather than in the actions for the main screen section outside of the decorator.
>
> Just be careful! The isolated contexts are there for a reason and help about a LOT of problems that we had in the past with JSPs and with JPublish. So, use global values when needed, but don't try to make everything global...
>
> -David
>
>
> Leon Torres wrote:
>  
>> Hi Adrian,
>>
>> Thanks for that pointer. I couldn't find out where layoutSettings was being set,
>> probably because my ofbiz's GlobalDecorator does not call envsetup.bsh?
>>
>> However, if envsetup.bsh is intended to be called from within GlobalDecorator's
>> <actions>, it won't solve my main problem, which is accessing layoutSettings
>> from within an <actions> block that is executed _before_ GlobalDecorator's
>> <actions>.
>>
>> This is a more general problem with the "order of execution" of <actions> which
>> I was hoping to avoid.  Essentially, I want to set a value that can be seen by
>> all scripts invoked by <script> from all <actions> blocks in the entire <screen>
>> tree that is being called.  I cannot set it in the GlobalDecorator's <actions>
>> because it is executed _after_ the <actions> block of the screen that is first
>> read.  The global variable concept in the screen widget is only relevant to the
>> contents of <widgets>, not to the contents of <actions>.
>>
>> So did you find a way to do this?  I'd sure like to know. :-)
>>
>> - Leon
>>
>>
>>
>>
>> Adrian Crum wrote:
>>    
>>> Leon,
>>>
>>> I know you were directing your question to David, but I will respond too - since
>>> I've already implemented what you're working on.
>>>
>>> The user-selected UI theme code I developed does exactly what you're describing.
>>> An action (bsh script) in the Global Decorator gets the user's UI preferences
>>> and stores them in the layoutSettings map. Doing it this way makes the settings
>>> available to all the screens. As long as a screen uses the Global Decorator it
>>> will have the user's UI preferences in the context.
>>>
>>> On a side note, I would like to suggest keeping the user's UI preferences - in
>>> whatever data type you decide on - in the layoutSettings map. That seems to be
>>> the standard that's developing. It would be nice to have other developer's
>>> opinions on this.
>>>
>>>
>>>      
>  

 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Dev - plugin.jar missing ?

Jacques Le Roux
Administrator
In reply to this post by Adrian Crum
Hi,

I can't understand why, but it seems that plugin.jar is missing in /base/lib.
Without it I can't compile OFBiz with last svn (rev 7626). I get :
______________________________________________
...
init:

clean-lib:
   [delete] Deleting directory
D:\WorkspaceNew\ofbiz\applications\product\build\lib

prepare:
    [mkdir] Created dir: D:\WorkspaceNew\ofbiz\applications\product\build\lib

classpath:

classes:
    [javac] Compiling 1 source file to
D:\WorkspaceNew\ofbiz\applications\product\build\classes
    [javac]
D:\WorkspaceNew\ofbiz\applications\product\src\ShipmentScaleApplet.java:42:
package netscape.javascript does not exist
    [javac] import netscape.javascript.JSObject;
    [javac]                            ^
    [javac]
D:\WorkspaceNew\ofbiz\applications\product\src\ShipmentScaleApplet.java:215:
cannot resolve symbol
    [javac] symbol  : class JSObject
    [javac] location: class ShipmentScaleApplet
    [javac]         JSObject win = JSObject.getWindow(this);
    [javac]         ^
    [javac]
D:\WorkspaceNew\ofbiz\applications\product\src\ShipmentScaleApplet.java:215:
cannot resolve symbol
    [javac] symbol  : variable JSObject
    [javac] location: class ShipmentScaleApplet
    [javac]         JSObject win = JSObject.getWindow(this);
    [javac]                        ^
    [javac] 3 errors

BUILD FAILED
D:\WorkspaceNew\ofbiz\build.xml:152: The following error occurred while
executing this line:
D:\WorkspaceNew\ofbiz\applications\product\build.xml:104: Compile failed; see
the compiler error output for details.
______________________________________________

Whis it in base/lib, it's OK (either on Linux or Windows)

Jacques

 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev