Thomas,

I already came up with a partial solution. I derived a class from
JSVGScrollPane which provides a public override of the resizeScrollBars()
method. I call this from within the override of setMySize(). 

This all works and we get the scroll bars. However they appear to be setup
just to allow for the size of the scrollbars themselves taken away from the
original window size. By this I mean that there is a very small gap at the
ends of both scrollbars (representing the width of the scrollbar itself).

When you first click anywhere in the scrollbars they appear to get
re-processed and from then appear as they should appear (i.e. if the image
is twice as wide as the window then the horizontal scroll bar button is half
the size of the scroll bar width.

I've tried calling the promising looking methods on
JSVGScrollPane.horizontal/vertical such as validate(), updateUI() and/or
revalidate() from the gvtRenderingCompleted() event handler but nothing
seems to happen.

Finally I called the overridden resizeScrollBars() from within the
gvtRenderingCompleted() event handler instead and this appears to work ;-)

Thanks for all your help. I think I solved all my problems which I wouldn't
have done on my own...

Rob

-----Original Message-----
From: Thomas DeWeese [mailto:[EMAIL PROTECTED] 
Sent: 22 January 2004 16:59
To: [EMAIL PROTECTED]
Subject: Re: Displaying Java objects on top of JSVGCanvas objects

Wilkins, Rob wrote:

> Thomas,
> 
> Thanks again - I feel we're nearly there now...
> 
> I added the following code to our JSVGCanvas derived object:
> 
>    public void setMySize(Dimension sz)
>    {
>       setSize(sz);
>       setPreferredSize(sz);
>    }
> 
> I now get the SVG drawn at (I guess) its natural size in a window that is
> bigger than the physical window within the JSVGScrollPane. However I get
no
> scroll bars until I do something to pan the SVG or resize the window.
> 
> Is there a nice method I can call that will refresh the JSVGScrollPane
given
> the JSVGCanvas is now bigger than the 'viewport' on the JSVGScrollPane
such
> that the scroll bars will be displayed?

    Hmm, this is a problem in the logic of the ScrollPane.
What you want to call is 'resizeScrollBars' but this is protected.
I would be really tempted to remove the check on 'isReady' for
the componentResized callback of ScrollListener, or move the
decision to be 'ready' up to the GVTBuildCompleted callback.

> 
> Thanks again,
> 
> Rob
> 
> -----Original Message-----
> From: Thomas DeWeese [mailto:[EMAIL PROTECTED] 
> Sent: 22 January 2004 13:16
> To: [EMAIL PROTECTED]
> Subject: Re: Displaying Java objects on top of JSVGCanvas objects
> 
> Wilkins, Rob wrote:
> 
> 
>>Thomas,
>>
>>I'm now using Batik 1.5.1rc2. I've placed out JSVGCanvas derived object
> 
> into
> 
>>a JSVGScrollPane object. This appears to all work and provides a much
> 
> nicer
> 
>>interface for the user to the panning etc. (as you suggested).
>>
>>I have one minor problem in that I need really need to control the initial
>>resolution that the SVG is displayed at (so that I can ensure that the
>>overlaid objects always load from the backend server and get displayed in
>>the correct place relative to the SVG).
> 
> 
>>When I was placing the JSVGCanvas object in a JScrollPane I could do this
>>through an implementation of the Scrollable interface. When I move to
>>JSVGScrollPane the methods of this interface in my object are no longer
>>called. As a result the SVG just gets rendered to fill the opening size of
>>the JSVGCanvas window.
> 
> 
>     The JSVGCanvas calls a method 'setMySize(Dimension sz)' when a
> document is loaded to request the desired size.  You should be able to
> override this method to do what ever you want to setup the document.
> 
> 
>>Is there away that I can enforce the size of the JSVGCanvas window before
>>the SVG is loaded (so that it is rendered to a size I control)? If I could
>>do this then I think all my current problems will be resolved.
> 
> 
>     I think the above does this.
> 
> 
>>Thanks,
>>
>>Rob
>>
>>-----Original Message-----
>>From: Thomas DeWeese [mailto:[EMAIL PROTECTED] 
>>Sent: 20 January 2004 14:19
>>To: [EMAIL PROTECTED]
>>Subject: Re: Displaying Java objects on top of JSVGCanvas objects
>>
>>Hi Rob,
>>
>>Wilkins, Rob wrote:
>>
>>
>>
>>>I spent the last two days re-working our code that overlays objects on
the
>>>SVG. Using your suggestion of overriding setRenderingTransform() method.
>>>
>>>The good news is I have got almost all of the shape updates (in response
>>
>>to
>>
>>
>>>changes in the SVG rendering transform) working. It also allowed me to
>>>remove many lines of the existing code and utilise the features of the
>>>JSVGCanvas component in the correct manner.
>>
>>
>>    Great!
>>
>>
>>
>>>I should point out that I have also dispensed with the scrolled panel 
>>>that I was using in favour of the panning support built in to the 
>>>JSVGCanvas component.
>>
>>
>>    This is fine if you like the 'built in' panning.  However I
>>strong suspect that the way you are doing things the JSVGScrollPane
>>from the 1.5.1rc2 release will just work (all it does it set and
>>listen to the rendering transform).
>>
>>
>>
>>>However I have hit the following problem. If I resize the window that
>>
>>holds
>>
>>
>>>the JSVGCanvas component I do not get a call to setRenderingTransform().
>>
>>So
>>
>>
>>>I get no chance to scale the overlaid components.
>>
>>
>>    This is handled in updateRenderingTransform, this is called when
>>the canvas changes size.  The reason this is 'different' is that when
>>the canvas changes size the normal behavior is to 'refit' the
>>SVG document's viewBox to the Canvas - thus it is not the Canvas's
>>transform that changes but the SVG's 'viewing' transform that
>>changes (this distinction is important to implement the SVG 'getCTM'
>>method correctly).
>>
>>     If you are working with the 1.5.1rc2 release you
>>can avoid this behavior by calling 'setRecenterOnResize(false)'.
>>In this case the viewing transform will never change once the
>>document is loaded.
>>
>>
>>
>>>The strange thing is that the SVG is clearly re-rendered as the
>>>GVTTreeRendererAdapter::gvtRenderingStarted()/gvtRenderingCompleted() are
>>>called. Calls to getRenderingTransform() in these methods return the
>>>identity transform.
>>>
>>>What method should I override in order to get hold of the transform that
>>
>>is
>>
>>
>>>applied once the window has been resized thus allowing me to scale my
>>>overlaid components and align them with the scaled SVG in the resized
>>>window?
>>
>>
>>    The combined rendering and viewbox transform is available from
>>the JSVGCanvas.getViewBoxTransform().  It is my belief that this can
>>only change in the updateRenderingTransform call so overriding that
>>and using the getViewBoxTransform method should let you deal with
>>this issue.
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
> 
>
****************************************************************************
> *******
> 
>>This email, its content and any attachments is PRIVATE AND
>>CONFIDENTIAL to TANDBERG Television. If received in error please
>>notify the sender and destroy the original message and attachments.
>>
>>www.tandbergtv.com
>>
> 
>
****************************************************************************
> *******
> 
>>
>>---------------------------------------------------------------------
>>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]
> 




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


***********************************************************************************
This email, its content and any attachments is PRIVATE AND
CONFIDENTIAL to TANDBERG Television. If received in error please
notify the sender and destroy the original message and attachments.

www.tandbergtv.com
***********************************************************************************


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

Reply via email to