Hi.

As part of my main project I'm making a Batik extension, as you might
know.  I want to make available a new element which acts similarly to a
tref element.  This element, tval, will generate text content as a
result of evaluating an expression.

While implementing this extension I like to modify the core Batik
classes as little as possible, so I could eventually just distribute the
extension classes and not a whole modified version of Batik.  Taking the
path of least resistance, I derive a bridge class from
SVGTextElementBridge and install this as the Bridge class for the
standard text element.  This derived class then overrides only those
methods that do something with a child text element (like tref).  For
each of these methods, I just copy the method from SVGTextElementBridge
and then modify it slightly to handle my tval element.

I have come across one problem, however, and that is that
fillAttributedStringBuffer needs to call storeEventListener on the
BridgeContext when it handles an a element.  This method is protected in
BridgeContext, and only accessible to SVGTextElementBridge by virtue of
it being in the same package.  Since the class I wrote that derives from
SVGTextElementBridge does not live in the org.apache.batik.bridge
package, it can't access storeEventListener.

Poking around the flow text extensions, I notice that
SVGFlowTextElementBridge also derives from SVGTextElementBridge, but
luckily doesn't have to access any protected methods from the
BridgeContext.

So I think in general that extensions should be allowed to access
storeEventListener in particular, since they may set up event handlers
and want the BridgeContext to remove them again later on.  I guess the
way to allow this would be to add a protected method to
AbstractGraphicsNodeBridge called storeEventListenerInBridgeContext or
something less wordy which just delgates the call to the BridgeContext.

It is a simple enough modification, but I just like to run these sorts
of architectural things by you (the other committers), especially since
it comes up only because of my project.

On a similar note, there is another modification I have been working
with for a while.  I added a method isDynamicElement to
org.apache.batik.bridge.BridgeExtension which is called by
BaseScriptingEnvironment.isDynamicElement, so that one can write an
extension element that causes a document to be dynamic.

Anything wrong with these two proposed changes?

Thanks,

Cameron

-- 
Cameron McCormack
|  Web: http://mcc.id.au/
|  ICQ: 26955922

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to