In JET 5.1.0 we introduced a really exciting and useful addition to the component authors toolbox, that of templated-slots. Before I dive into the mechanics though, I’d like to discuss the kind of problems that they are designed to solve:
It’s All About Scope
If you have used normal slots, you will be aware that the intent is to allow the component author to leave placeholders in the component view for consumers to drop in their own content. The typical example of this being something like a toolbar component which supplies a certain set of pre-ordained buttons, but which supports a slot for consumers to add some of their own. So slot content is supplied by the consumer but "managed" from a layout perspective by the component.
This is all very good, however, there is one restriction that can limit the usefulness of slots and that is the matter of data scoping. Any components that you put into a slot may well end up as children of the custom component in UI / DOM terms, however, in data binding terms they are peers of the custom component. The slotted components cannot see the data that the CCA is managing internally and are effectively bound to the same parent viewModel as the custom component is. This makes it tricky for the custom component to manage data in the slotted children and often results in compromised component design just to enable such data sharing to take place.
The other big problem area with conventional slotting and the scoping rules surrounding it, is the creation of custom components that use stamping user interfaces to output sets of data. An example of such a component might be a customized list-view where the custom component is managing the communications with a REST endpoint that is providing the data, however, you, as the component author, want the consumer to have the ability to shape how each row should be rendered as it’s stamped out. With conventional slotting, this type of use case is really not possible without cheating1 and this is really why templated slots have been introduced. Read the complete article here.
For regular information become a member in the WebLogic Partner Community please visit: http://www.oracle.com/partners/goto/wls-emea ( OPN account required). If you need support with your account please contact the Oracle Partner Business Center.
Blog
Twitter
LinkedIn
Facebook
Meetups
Technorati Tags: PaaS,Cloud,Middleware Update,WebLogic, WebLogic Community,Oracle,OPN,Jürgen Kress