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 |
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 <[hidden email]> 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: [hidden email] Bonsai ERP, the all-inclusive ERP system http://www.bonsaierp.com.au/ |
In reply to this post by Wai
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 <[hidden email]>: > 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. > |
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 |
Administrator
|
In reply to this post by Adrian Crum-3
Thanks Adrian,
Good tip! Jacques From: <[hidden email]> > 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 <[hidden email]>: > >> 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. >> > > > |
Free forum by Nabble | Edit this page |