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 <[email protected]>:
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.