Hey Gary, Yeah I thought about using the shapeValidator, but I want to make this as unobtrusive as possible. What I mean by that is that I don't want to have to add a special component to every page to take care of this. I like using chain to do it, but I would need a hook like preprocess chain in shale-core. I guess shale-core tries to find the preprocess chain and if it does then executes it. I would need something like this within the addComponent chain.
Ryan On 11/16/05, Gary VanMatre <[EMAIL PROTECTED]> wrote: > > Okay, the override Clay class idea won't work. > > > > My last alternative is to use Clay's chain integration. I noticed > > that in the clay-chain.config I can plug a Filter command into the > > addComponent chain that would do the trick. I read up on Chain and it > > seems that I can't just plug a command into an existing chain. I > > tried just adding my own chain-config.xml and putting the command into > > the appropriate catalog/chain. Unfortunately, Clay then finds my > > partial chain instead of aggregating. Is there any way have the chain > > parser aggregate chains or is this just not supported? My workaround > > was to copy the entire shale-clay-config.xml into mine and then add > > the Filter command. This works but obviously is not the best > > approach. > > > > > > There is not an extension "hook" into the Clay chains yet. I've thought > about doing that but no one has asked yet. It would be handy for specialized > setup for a component. > > You might also be able to use the shapeValidator Clay component event. It is > called when forming the subtree. The "clayOut" binds to the ClayAmalgam > managed bean. It would have to be the last component on the page in order to > take inventory of the full tree. > > I think the common ValidatorScript component takes a similar approach > (http://svn.apache.org/viewcvs.cgi/struts/shale/trunk/core-library/src/java/org/apache/shale/component/ValidatorScript.java?view=markup). > Check out he findCommonsValidators() method. > > I think that the IBM JSF has some kind of script component that adds custom > javascript. It also has a prerender and postrender action binding method. > It's been some time so I might be off on the names. The Shale Subview also > has a hook to call back to the ViewControllers preprocess method. We could > do something similar in Clay? > > > > Gary > > > > > > > > On 11/16/05, Ryan Wynn <[EMAIL PROTECTED]> wrote: > > > Actually, the more I look at this I think I can may be able to achieve > > > the same thing by extending the Clay class. Does anyone know if you > > > can override the component class associated with a component-type in > > > faces-config.xml? > > > > > > I could add > > > > > > <component> > > > <component-type>org.apache.shale.clay.component.Clay</component-type> > > > <component-class>foo.bar.MyClayExtension</component-class> > > > </component> > > > > > > If you can override component classes like renderer classes then I > > > might be in luck. > > > I can add what I was trying to do in encodeEnd. > > > > > > > > > > > > > > > On 11/16/05, Ryan Wynn <[EMAIL PROTECTED]> wrote: > > > > From my experience using clay I think it would be nice if the > > > > ClayViewHandler accepted listeners that get invoked after the clay > > > > component has been created but before rendering to the outputstream. > > > > > > > > This is the case that I have. I have a render phase listener that > > > > adds javascript, stylesheets, etc before the render phase. I would > > > > like this listener to know about the faces tree so that I can add > > > > certain javascript only if the tree contains certain components. The > > > > phase listener doesn't work because it only gives me hooks into before > > > > render and after render. Before render the tree has not been created > > > > yet, and after render it has already been commited to the stream. So > > > > in ClayViewHandler I would need something like > > > > > > > > UIComponent component = view.findComponent(CLAY_VIEW_ID); > > > > if (component == null) { > > > > // create clay > > > > } > > > > > > > > // start new > > > > Iterator i = getClayListeners().iterator(); > > > > while (i.hasNext()) { > > > > ClayListener next = (ClayListener) i.next(); > > > > next.afterClayCreated(context); > > > > } > > > > // end new > > > > > > > > ServletResponse response = ... > > > > > > > > This would allow me to inspect the tree and add the appropriate > > > > javascript to the view. > > > > > > > > Thanks, > > > > Ryan > > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >