You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Wai <bz...@gmail.com> on 2011/10/05 19:10:33 UTC

one component includes a screen from another component--clarification

Hello,

I would like to get a clarification of the following:

I have 2 components.  ComponentA and componentB.

In componentA, I define a screen, ComponentAScreen.
In componentB, I defined a screen, ComponentBScreen.
ComponentBScreen uses decorators defined in CommonScreens.xml in
componentB's component directory.
ComponentAScreen includes ComponentBScreen.

The problem is that when I tried to display a page defined by
ComponentAScreen, I get an ScreenRenderer exception indicating that it
cannot find the decorator referenced by ComponentBScreen.  Further
investigation showed that the decorator screens in ComponentBScreen was
referenced using the directory path of componentA.

Could someone verify that this is how things are supposed to work???

Thanks,
Wai



--
View this message in context: http://ofbiz.135035.n4.nabble.com/one-component-includes-a-screen-from-another-component-clarification-tp3875463p3875463.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: one component includes a screen from another component--clarification

Posted by Wai <bz...@gmail.com>.
Given that componentA uses the screens of componentB and componentB makes use
of its own decorator screens.

After some analysis, I discovered that when componentB's screen uses its own
decorator screens specified with
location="${parameters.mainDecoratorLocation}", the value of 'location'
attribute actually refers to componentA's directory as specified in
componentA's web.xml.

Hence, I can solve the problem by, when referring to decorator screens,
replacing location="${parameters.mainDecoratorLocation}" to
location="component://componentB/widget/CommonScreens.xml#SomeDecoratorScreen".
Ie. hardcoding the location of componentB's decorator screen file.

Thanks all for helping out.
Wai

--
View this message in context: http://ofbiz.135035.n4.nabble.com/one-component-includes-a-screen-from-another-component-clarification-tp3875463p3878611.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Re: one component includes a screen from another component--clarification

Posted by Jacques Le Roux <ja...@les7arts.com>.
Thanks Adrian,

Good tip!

Jacques

From: <ad...@sandglass-software.com>
> Setting up screen decorators can be a little tricky, but you can get  
> things to work properly if you follow some simple rules:
> 
> 1. Keep the component screen decorator (main-decorator) in the  
> component's CommonScreens.xml file, but put all other decorators in  
> the same file as the screens they decorate. I call these other  
> decorators "sub-decorators" because they are decorated by the  
> component decorator.
> 
> 2. Do not include the location attribute when using the  
> sub-decorators. When the location attribute is left empty, the widget  
> renderer will look for the decorator in the current widget file. If  
> you want to have the ability to replace the sub-decorator when the  
> screen is reused, then put an expression in the location attribute  
> that evaluates to an empty string in the sub-decorator's component.  
> Other components that reuse screens decorated by sub-decorators can  
> then set up variables so the location expression evaluates to the  
> location of the replacement sub-decorator.
> 
> A good example of #2 can be found in  
> framework/common/widget/SecurityScreens.xml. Look at how the  
> SecurityDecorator sub-decorator is implemented.
> 
> -Adrian
> 
> Quoting Wai <bz...@gmail.com>:
> 
>> Hello,
>>
>> I would like to get a clarification of the following:
>>
>> I have 2 components.  ComponentA and componentB.
>>
>> In componentA, I define a screen, ComponentAScreen.
>> In componentB, I defined a screen, ComponentBScreen.
>> ComponentBScreen uses decorators defined in CommonScreens.xml in
>> componentB's component directory.
>> ComponentAScreen includes ComponentBScreen.
>>
>> The problem is that when I tried to display a page defined by
>> ComponentAScreen, I get an ScreenRenderer exception indicating that it
>> cannot find the decorator referenced by ComponentBScreen.  Further
>> investigation showed that the decorator screens in ComponentBScreen was
>> referenced using the directory path of componentA.
>>
>> Could someone verify that this is how things are supposed to work???
>>
>> Thanks,
>> Wai
>>
>>
>>
>> --
>> View this message in context:  
>> http://ofbiz.135035.n4.nabble.com/one-component-includes-a-screen-from-another-component-clarification-tp3875463p3875463.html
>> Sent from the OFBiz - User mailing list archive at Nabble.com.
>>
> 
> 
>

Re: one component includes a screen from another component--clarification

Posted by ad...@sandglass-software.com.
Setting up screen decorators can be a little tricky, but you can get  
things to work properly if you follow some simple rules:

1. Keep the component screen decorator (main-decorator) in the  
component's CommonScreens.xml file, but put all other decorators in  
the same file as the screens they decorate. I call these other  
decorators "sub-decorators" because they are decorated by the  
component decorator.

2. Do not include the location attribute when using the  
sub-decorators. When the location attribute is left empty, the widget  
renderer will look for the decorator in the current widget file. If  
you want to have the ability to replace the sub-decorator when the  
screen is reused, then put an expression in the location attribute  
that evaluates to an empty string in the sub-decorator's component.  
Other components that reuse screens decorated by sub-decorators can  
then set up variables so the location expression evaluates to the  
location of the replacement sub-decorator.

A good example of #2 can be found in  
framework/common/widget/SecurityScreens.xml. Look at how the  
SecurityDecorator sub-decorator is implemented.

-Adrian

Quoting Wai <bz...@gmail.com>:

> Hello,
>
> I would like to get a clarification of the following:
>
> I have 2 components.  ComponentA and componentB.
>
> In componentA, I define a screen, ComponentAScreen.
> In componentB, I defined a screen, ComponentBScreen.
> ComponentBScreen uses decorators defined in CommonScreens.xml in
> componentB's component directory.
> ComponentAScreen includes ComponentBScreen.
>
> The problem is that when I tried to display a page defined by
> ComponentAScreen, I get an ScreenRenderer exception indicating that it
> cannot find the decorator referenced by ComponentBScreen.  Further
> investigation showed that the decorator screens in ComponentBScreen was
> referenced using the directory path of componentA.
>
> Could someone verify that this is how things are supposed to work???
>
> Thanks,
> Wai
>
>
>
> --
> View this message in context:  
> http://ofbiz.135035.n4.nabble.com/one-component-includes-a-screen-from-another-component-clarification-tp3875463p3875463.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>




Re: one component includes a screen from another component--clarification

Posted by Anne <an...@cohsoft.com.au>.
If I understand you properly, what you are doing should work, provided
your references are all correct.

Wherever you need to specify a location, put in the fully qualified
version, such as

location="component://componentA/widget/ComponentScreens.xml"

When I've done that, and it hasn't worked, it's been because I
mistyped something.

Cheers,
Anne.

On 6 October 2011 04:10, Wai <bz...@gmail.com> wrote:
> Hello,
>
> I would like to get a clarification of the following:
>
> I have 2 components.  ComponentA and componentB.
>
> In componentA, I define a screen, ComponentAScreen.
> In componentB, I defined a screen, ComponentBScreen.
> ComponentBScreen uses decorators defined in CommonScreens.xml in
> componentB's component directory.
> ComponentAScreen includes ComponentBScreen.
>
> The problem is that when I tried to display a page defined by
> ComponentAScreen, I get an ScreenRenderer exception indicating that it
> cannot find the decorator referenced by ComponentBScreen.  Further
> investigation showed that the decorator screens in ComponentBScreen was
> referenced using the directory path of componentA.
>
> Could someone verify that this is how things are supposed to work???
>
> Thanks,
> Wai
>
>
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/one-component-includes-a-screen-from-another-component-clarification-tp3875463p3875463.html
> Sent from the OFBiz - User mailing list archive at Nabble.com.
>



-- 
Coherent Software Australia Pty Ltd
PO Box 2773
Cheltenham Vic 3192
Phone: (03) 9585 6788
Fax: (03) 9585 1086
Web: http://www.cohsoft.com.au/
Email: sales@cohsoft.com.au

Bonsai ERP, the all-inclusive ERP system
http://www.bonsaierp.com.au/