You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Selva <se...@yahoo.co.in> on 2006/04/28 10:25:53 UTC

updating TransformHistory problem

Hi All,

I have created my SVGApplication using SVGCanvas. Here i have added 
previousTransformAction and nextTransformAction actionmaps in 2 buttons. But 
after did some changes in displayed document, if tried to use previous and 
next transforms, it is not working. Also it is returning 
transformHistory.canGoForward() and transformHistory.canGoBack() values as 
false.

I have added the following code in gvtRenderingCompleted. But it is called 
only once while loading the SVG document. While doing some changes in 
document, it is not calling gvtRenderingCompleted. so it's not updating 
TransformHistory.

transformHistory.update(svgCanvas.getRenderingTransform());
previousTransformAction.update();
nextTransformAction.update();

I don't know where i am doing mistake. So Please clarify my problem.

Thanks,
Selva




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


Re: updating TransformHistory problem

Posted by Tonny Kohar <to...@kiyut.com>.
Hi,

On Mon, 2006-05-15 at 04:54 +0000, Selva wrote:
> svgCanvas.transformHistory.update(_svgCanvas.getRenderingTransform());
> _svgCanvas.previousTransformAction.update();
> _svgCanvas.nextTransformAction.update();
> 
> but when i perform previousTransformAction and nextTransformAction, it's not 
> updating the positions.

Rather than called update(), call actionPerformed(evt) instead.
If you look at the source code, update() is only setting whether the
action will be enabled or not. The real action in on actionPerformed,
since it is a subclass of standard Java Action.

Regards
Tonny Kohar
-- 
Sketsa 
SVG Graphics Editor
http://www.kiyut.com


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


Re: updating TransformHistory problem

Posted by Selva <se...@yahoo.co.in>.
Hi Thomas,

> > 1. want 'undo/redo' moves of your group with lines? 
> 
>     This requires a totally separate system to track this.  You
> will need to track this yourself.  Probably recording the original
> group transform on mouse down (or what ever starts the move
> operation).

Can you give bit more details on how to undo/redo the moves. because i have 
tried with "mouseup" action. But it's not updating the positions. whenever 
mouse released, i updated the transformHistory using following code.

svgCanvas.transformHistory.update(_svgCanvas.getRenderingTransform());
_svgCanvas.previousTransformAction.update();
_svgCanvas.nextTransformAction.update();

but when i perform previousTransformAction and nextTransformAction, it's not 
updating the positions.

Thanks,
Selva


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


Re: updating TransformHistory problem

Posted by th...@kodak.com.
Hi Selva,

news <ne...@sea.gmane.org> wrote on 05/04/2006 06:19:58 AM:

> Sorry for the mistake i have done in earlier mail thomas. Actually i 
want 
> both 'undo/redo' cases. 
> 
> 1. want 'undo/redo' moves of your group with lines? 

    This requires a totally separate system to track this.  You
will need to track this yourself.  Probably recording the original
group transform on mouse down (or what ever starts the move
operation).

> 2. want 'undo/redo' moves of the canvas (whole canvas pan)? 

    This should work fine with the code below.  However you will
need to come up with your own system for managing the group moves
and canvas moves together so they are undone and redone in the
correct order.

> To achieve this, i have added GVTTreeRendererListener for my SVGCanvas. 
While 
> doing zoom in,zoom out and moving group elements , it's not executing 
> RenderingTransform's gvtRenderingCompleted(). Why it's not executing 
> RenderingCompleted even GVTTreeRendererListener added??

    This works fine for me, so without a stand-alone example that shows 
your
problem I can't help you.


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


Re: updating TransformHistory problem

Posted by Selva <se...@yahoo.co.in>.
Hi Thomas,

Sorry for the mistake i have done in earlier mail thomas. Actually i want 
both 'undo/redo' cases. 

1. want 'undo/redo' moves of your group with lines? 
2. want 'undo/redo' moves of the canvas (whole canvas pan)? 

To achieve this, i have added GVTTreeRendererListener for my SVGCanvas. While 
doing zoom in,zoom out and moving group elements , it's not executing  
RenderingTransform's gvtRenderingCompleted(). Why it's not executing 
RenderingCompleted even GVTTreeRendererListener added??

svgCanvas.addGVTTreeRendererListener(new GVTTreeRendererAdapter() {

    public void gvtRenderingPrepare(GVTTreeRendererEvent e) {
       System.out.println("Renderer Started...");
    }
    public void gvtRenderingCompleted(GVTTreeRendererEvent e) {
       System.out.println("Renderer Completed...");

       transformHistory.update(svgCanvas.getRenderingTransform());
       previousTransformAction.update();
       nextTransformAction.update();
    }
});

Thanks,
Selva




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


Re: updating TransformHistory problem

Posted by th...@kodak.com.
Hi Selva,

    Please let me explain.
   Moves of the whole canvas are done using the Rendering Transform. 
Whenever the 
rendering transform changes a new gvt rendering is performed (not an 
update), so eventually
gvtRenderingCompleted will be called.

   So I don't know how to make sense of your statements.  It sounded like 
you wanted the
transform history updated during 'updates' i.e. when you modify the 
contents of the document
(like dragging a group) yet you are looking to only undo/redo moves of the 
canvas.

Selva <se...@yahoo.co.in> wrote on 05/03/2006 06:57:42 AM:

> 
> Hi Thomas,
> 
> > Do you want to 'undo/redo' moves of your group with lines? 
> 
> > Do you want to 'undo/redo' moves of the canvas (whole canvas pan)? 
> 
> My requirement is that i should be able to  'undo/redo' moves of the 
whole
> canvas.
> 
> > Can you give a complete example of user interaction and what you want 
> > the canvas to show? 
> 
> Actually my SVGCanvas will have SVG image elements with text elements. 
text
> element will be used to display the name of the image. my image elements 
are
> connected with lines. If user moves the image element, it should move 
along
> with connected lines.
> 
> Thanks,
> Selva
> 
> 
> --
> View this message in context: 
http://www.nabble.com/updating-TransformHistory-
> problem-t1523168.html#a4208054
> Sent from the Batik - Users forum at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


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


Re: updating TransformHistory problem

Posted by Selva <se...@yahoo.co.in>.
Hi Thomas,

>
Actually i have added GVTTreeRendererListener for my SVGCanvas. While doing 
zoom in,zoom out etc, it's not executing  RenderingTransform's 
gvtRenderingCompleted(). Why it's not executing RenderingCompleted even 
GVTTreeRendererListener added ??


svgCanvas.addGVTTreeRendererListener(new GVTTreeRendererAdapter() {
    
    public void gvtRenderingPrepare(GVTTreeRendererEvent e) {
       System.out.println("Renderer Started...");
    }
    public void gvtRenderingCompleted(GVTTreeRendererEvent e) {
       System.out.println("Renderer Completed...");

       transformHistory.update(svgCanvas.getRenderingTransform());
       previousTransformAction.update();
       nextTransformAction.update();
    }
});

> > Do you want to 'undo/redo' moves of the canvas (whole canvas pan)? 
> 
My requirement is that i should be able to  'undo/redo' moves of the whole
canvas.
> 
> > Can you give a complete example of user interaction and what you want 
> > the canvas to show? 
> 
Actually my SVGCanvas will have SVG image elements with text elements. text
element will be used to display the name of the image. my image elements are
connected with lines. If user moves the image element, it should move along
with connected lines.

Thanks,
Selva





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


Re: updating TransformHistory problem

Posted by Selva <se...@yahoo.co.in>.
Hi Thomas,

> Do you want to 'undo/redo' moves of your group with lines? 

> Do you want to 'undo/redo' moves of the canvas (whole canvas pan)? 

My requirement is that i should be able to  'undo/redo' moves of the whole
canvas.

> Can you give a complete example of user interaction and what you want 
> the canvas to show? 

Actually my SVGCanvas will have SVG image elements with text elements. text
element will be used to display the name of the image. my image elements are
connected with lines. If user moves the image element, it should move along
with connected lines.

Thanks,
Selva


--
View this message in context: http://www.nabble.com/updating-TransformHistory-problem-t1523168.html#a4208054
Sent from the Batik - Users forum at Nabble.com.


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


Re: updating TransformHistory problem

Posted by th...@kodak.com.
Hi Selva,

    Sorry, I don't get it.

    Do you want to 'undo/redo' moves of your group with lines?

   Do you want to 'undo/redo' moves of the canvas (whole canvas pan)?

   Can you give a complete example of user interaction and what you want
the canvas to show?

news <ne...@sea.gmane.org> wrote on 04/28/2006 08:18:10 AM:

> I think so, i have explained wrongly to you. Actually my requirement is 
that i 
> want Previous Transform and Next Transform options like in squiggle SVG 
> Browser. To achieve this i used PreviousTransformAction and 
> NextTransformAction in JSVGViewerFrame. But it's not updating the 
SVGCanvas 
> with previous and next transforms. But TransformHistory updated 
properly.
> 
> Since i will move 2 to 3 line elements along with my group elements, i 
prefers 
> to use PreviousTransformAction and NextTransformAction available in 
> JSVGViewerFrame. So can you please explain, record/restore the transform 

> manually is better? or using PreviousTransformAction and 
NextTransformAction 
> is better?
> 
> Thanks,
> Selva
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


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


Re: updating TransformHistory problem

Posted by Selva <se...@yahoo.co.in>.
Hi Thomas,

I think so, i have explained wrongly to you. Actually my requirement is that i 
want Previous Transform and Next Transform options like in squiggle SVG 
Browser. To achieve this i used PreviousTransformAction and 
NextTransformAction in JSVGViewerFrame. But it's not updating the SVGCanvas 
with previous and next transforms. But TransformHistory updated properly.

Since i will move 2 to 3 line elements along with my group elements, i prefers 
to use PreviousTransformAction and NextTransformAction available in 
JSVGViewerFrame. So can you please explain, record/restore the transform 
manually is better? or using PreviousTransformAction and NextTransformAction 
is better?
 
Thanks,
Selva


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


Re: updating TransformHistory problem

Posted by th...@kodak.com.
Hi Selva,

news <ne...@sea.gmane.org> wrote on 04/28/2006 06:29:20 AM:

> >    Since you have been sending questions about updating the transform
> > on a group I thought I would mention that the RenderingTransform
> > above has nothing to do with any transform you might have adjusted on
> > an individual element.
> 
> Actually i will always transform whole group element even tried to move 
> individual element. So i want to go to my previous and next transforms 
it has. 
> So please suggest me how to proceed this?

   Then you don't want to do anything with the rendering transform you
want to record/restore the transform on the group.  Personally I
wouldn't try and trap this in the UpdateCompleted callback I would
append these transforms when the user 'completes' the operation (mouseup).

   You will want to record the transform from the group to it's parent
(getTransformToElement).  You will likely need to record the group that
the transform needs to be applied to as well.

   As far as 'restoring' it.  There is a 'matrix' form of the transform
where you can just copy the values out of a SVGMatrix.


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


Re: updating TransformHistory problem

Posted by Selva <se...@yahoo.co.in>.
Hi Thomas,

>    gvtRenderingCompleted is more or less only called if the canvas's
> RenderingTransform changes.  This usually corresponds to panning
> or zooming in/out.  Most, 'interactive' changes are handled as 'updates'
> (they only rerender a portion of the visible canvas).  You can get 
> notified
> of updates being completed by registering an UpdateManagerListener on the
> canvas.

Now i have used updateCompleted to update TransformHistory. But now it's 
updating the TransformHistory. But while doing prevoius and next transform, 
it's not updating the previous and next transforms in SVGCanva even 
canGoForward() and canGoBack() returns as true.

>    Since you have been sending questions about updating the transform
> on a group I thought I would mention that the RenderingTransform
> above has nothing to do with any transform you might have adjusted on
> an individual element.

Actually i will always transform whole group element even tried to move 
individual element. So i want to go to my previous and next transforms it has. 
So please suggest me how to proceed this?

Thanks,
Selva



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


Re: updating TransformHistory problem

Posted by th...@kodak.com.
Hi Selva,

news <ne...@sea.gmane.org> wrote on 04/28/2006 04:25:53 AM:

> I have added the following code in gvtRenderingCompleted. But it is 
called 
> only once while loading the SVG document. While doing some changes in 
> document, it is not calling gvtRenderingCompleted. so it's not updating 
> TransformHistory.

   gvtRenderingCompleted is more or less only called if the canvas's
RenderingTransform changes.  This usually corresponds to panning
or zooming in/out.  Most, 'interactive' changes are handled as 'updates'
(they only rerender a portion of the visible canvas).  You can get 
notified
of updates being completed by registering an UpdateManagerListener on the
canvas.

> transformHistory.update(svgCanvas.getRenderingTransform());
> previousTransformAction.update();
> nextTransformAction.update();
> 
> I don't know where i am doing mistake. So Please clarify my problem.

   Since you have been sending questions about updating the transform
on a group I thought I would mention that the RenderingTransform
above has nothing to do with any transform you might have adjusted on
an individual element.


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