xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cameron McCormack <...@mcc.id.au>
Subject Re: Incorporating new events
Date Wed, 13 Sep 2006 01:25:57 GMT
Hi Yaroslav.

Yaroslav Bulatov:
> Hi, I'm trying to incorporate support for XForms events into a browser
> built around Batik, and I wonder what the recommended way of doing it
> is. I tried doing something like this
> 
> Event event = xformsEventFactory.createXFormsEvent(XformsEventFactory.READY)
> element.dispatch(event)
> 
> where "element" is an element in Batik's DOM hierarchy. However using
> this approach I get
> DOMException.NOT_SUPPORTED_ERR. What is the recommended way of getting
> those events dispatched?
> 
> org.apache.batik.dom.events.EventSupport.java:241
> 
>    } else if (e instanceof org.w3c.dom.events.CustomEvent) {
>      isCustom = true;
>      ce = new WrappedEvent((org.w3c.dom.events.CustomEvent) e);
>    } else if (e instanceof AbstractEvent) {
>      isCustom = false;
>      aevt = (AbstractEvent) e;
>    } else {
>      throw createEventException(DOMException.NOT_SUPPORTED_ERR,
>          "unsupported.event", new Object[] {});

You could make your event objects implement the CustomEvent interface
(http://www.w3.org/TR/DOM-Level-3-Events/events.html#Events-CustomEvent),
but that is really for use by ECMAScript custom event objects, where the
extra information is stored in that 'detail' attribute.  Or, you can
make your event objects extend Batik’s AbstractEvent class, then they
can be dispatched properly.

-- 
Cameron McCormack, http://mcc.id.au/
	xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message