Re: Behaviour adding to Component body
On 7/30/07, Jan Kriesten [EMAIL PROTECTED] wrote: Hi Eelco, You can use onRendered and write directly to the response using Response response = component.getResponse(); not really. I tried that before, But that only writes the param after the close tag which isn't what is intended. :-) Result: object wicket:id=swf width=200 height=150 /object param name=movie value=res/mymovie.swf / The param belongs inside the object-tag. Hmmm, yeah. So it looks to me like you *do* need something like onComponentTagBody then. Any other devs have alternatives ideas? Looks like a valid use case to me, though this is a pretty specific case that could be solved without using behaviors. Eelco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Behaviour adding to Component body
On 7/30/07, Jan Kriesten [EMAIL PROTECTED] wrote: Hi Igor, i really dont think oncomponenttagbody() belongs in behaviors. this should be done without a behavior by subclassing the component and overriding oncomponenttagbody() there. that said you can still hack it by using AbstractTransformerBehavior and some string manipulation code. I don't think this should belong in a subclass. IMHO manipulating attributes for a certain type of object should be handled by simply adding a Behaviour. yes i agree 100%. but, you are not manipulating attributes, you are generating additional markup int component's body. SWF's are only one example. Other Objects (QuickTime, Real, WMV) have other Attributes and parameter needs which is where Behaviours do what they do best: manipulating them. The Problem is, that Objects aren't handled Browser independend. So it's enough for FF Co. to have a 'data'-Attribute for the SWF, whereas IE needs the param name=movie... and no 'data' to have the movie streamed. ATM it looks like this: WebMarkupContainer swf = new WebMarkupContainer( swf ); ResourceReference resRef = new ResourceReference( HeaderPanel.class, res/mymovie.swf ); swf.add( new FlashAttributes( urlFor( resRef ).toString(), 700, 70 ) ); add( swf ); It really looks messy if you subclass it and take into account the 20 other parameters you could add the Object... well the logic has to go somewhere so just do SwfObject object=new SwfObject(swf, resRef, 700, 70); instead of putting it into a behavior put it into a custom webmarkupcontainer subclass instead. -igor Best regards, --- Jan. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Behaviour adding to Component body
since I haven't overridden onComponentTagBody yet - what happens to child-Tags then, do I have to manage these, too? If that's an issue, it's better to follow Martijn's advice and make this component a panel with a list view for the parameters. Eelco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Behaviour adding to Component body
I thought I could just concentrate on the last aspect and apply only the needed changes... (i.e. move an attribute to a param name...). You should be able to pull that off if you use AbstractTransformerBehavior. Btw, if you ever get to it, a nice Flash component with a demo for wicket-examples would be very welcome! Eelco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Behaviour adding to Component body
Hi Eelco, You should be able to pull that off if you use AbstractTransformerBehavior. yes, tried that already. strangely, object gets an additional xmlns:wicket=http://wicket.apache.org-attribute?! but it doesn't seem to hurt. Btw, if you ever get to it, a nice Flash component with a demo for wicket-examples would be very welcome! Yep. :-) Best regards, --- Jan. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Behaviour adding to Component body
yes, tried that already. strangely, object gets an additional xmlns:wicket=http://wicket.apache.org-attribute?! but it doesn't seem to hurt. Yeah, that happens in onComponentTag: public void onComponentTag(final Component component, final ComponentTag tag) { tag.put(xmlns:wicket, http://wicket.apache.org;); What you could do is rather than extending that behavior directly, create one from scratch that does the same thing. Just look at the source for idea. Or we could make adding that attribute conditional (seems to be particular for XSLT). Or decide that it doesn't hurt :) Btw, if you ever get to it, a nice Flash component with a demo for wicket-examples would be very welcome! Yep. :-) That would be great! Eelco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]