-----Original Message----- From: Thomas DeWeese [mailto:[EMAIL PROTECTED] Sent: Monday, January 26, 2004 3:01 PM To: Batik Users; [EMAIL PROTECTED] Subject: Re: scripting on custom audio and video tags
Gurleen Randhawa wrote:
I have created an audio and a video tag.
Actually I want to implement SMIL/SVG 1.2 for my audio and video tags.
I extended PrefixableStylableExtensionElement to create the tags . I have the bridge and the dom extensions set up for the tags also. Now I want to handle the events that I mentioned ( like begin , end etc).I want to know how to add support for begin/end events to Batik.
Actually it appears that this support is mostly there already. If you look at batik.bridge.ScriptingEnvironment line 473 there is a check if the element is a 'set' element if it is it checks for the onbegin/end/repeat attributes and if so registers event listeners on the element. So updating the check to allow for your element tags will get listeners registered (BTW I know this is ugly because you need to modify Batik code - this interfaces is 95% of the way to being pluggable but is isn't there yet - someone with an itch might want to look at how to make it fully pluggable!).
The other half of the equation is how to call the DOM listeners when you decide it is appropriate. This is very simple because the DOM provides methods to do this:
MouseEvent mouseEvt = (MouseEvent)d.createEvent("MouseEvents"); mouseEvt.initMouseEvent(eventType, [...]); ((EventTarget)targetElement).dispatchEvent(mouseEvt);
You will probably want to introduce a new Event factory in the SVG Document for SMIL events (I am assuming there is such a thing). You can see an example of this in:
batik.dom.svg.SVGDOMImplementation.createDocumentEventSupport();
######################################### xml:base %URI; #IMPLIED onbegin %Script; #IMPLIED onend %Script; #IMPLIED onrepeat %Script; #IMPLIED xmlns:xlink CDATA #FIXED 'http://www.w3.org/1999/xlink' xlink:type (simple) #FIXED 'simple' xlink:role %URI; #IMPLIED xlink:arcrole %URI; #IMPLIED xlink:title CDATA #IMPLIED xlink:show (other) 'other' xlink:actuate (onLoad) #FIXED 'onLoad' xlink:href %URI; #IMPLIED begin CDATA #IMPLIED dur CDATA #IMPLIED end CDATA #IMPLIED restart (always | never | whenNotActive) 'always' repeatCount CDATA #IMPLIED ............. ############################################################
What do you mean by 'created'. Do you mean that you implemented them from the SMIL/SVG 1.2 spec? Or do you mean that you added these tags to a document?
Now I want to use scripting and handle various events associated with these tags like begin , end .. etc .
How can I implement these in Batik so that I can view the results in JSVGCanvas.
> Once again do you mean how do add support for begin/end events
to Batik, or assuming that Batik supports these tags how do you capture the events?
Yes I want to know how to add support for begin/end events to Batik.
> Just so it is clear, Batik does not (out of the box) support the
audio or video tags proposed for SVG 1.2. If you want information on how you might implement them (or finish your implementation) we can discuss this on batik-dev.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]