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 Arne Lindow <li...@tzi.de> on 2005/05/23 12:48:38 UTC
SVG Generator: SVGGraphics2D Tutorial - Problem
Hi,
I tried to run the examples on the batik Homepage under
http://xml.apache.org/batik/svggen.html
In listing 2 of section 'Customizing the generated SVG style', I found
the lines
Element root = g2d.getRoot();
Element defs = root.getElementById(SVGSyntax.ID_PREFIX_GENERIC_DEFS);
but this line causes an error, because, Element does not support the
method getElementById. Someone out there, who has a working
implementation of the examples, given in the SVG Generator-Tutorial? I
think, there are some more little mistakes in there. (Is there a list
somewhere?)
Thank you for any help.
Best regards,
Arne
my environment:
java j2sdk1.4.2_03
batik: batik 1.6
eclipse 3.0.1
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: EventListener "SVGScroll" - Problem
Posted by Thomas DeWeese <Th...@Kodak.com>.
Maik Schürer wrote:
> > Is this the first time you
> > have tried to build Batik from Source?
> no, but I don't use ant
> in Batik 1.5.1 sources were no JaclInterpreter and PythonInterpreter...
No, I think your wrong. These source files have been in
Batik for several years now.
> ok, I renamed these classes and now it compiles
>
> btw, is switching from ant to maven planed anytime ?
It certainly isn't planed. Since I don't know anything
about Maven it's hard to know if it would make sense or
offer any real advantage.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: EventListener "SVGScroll" - Problem
Posted by Maik Schürer <Ma...@proveo.de>.
> Is this the first time you
> have tried to build Batik from Source?
no, but I don't use ant
in Batik 1.5.1 sources were no JaclInterpreter and PythonInterpreter...
ok, I renamed these classes and now it compiles
btw, is switching from ant to maven planed anytime ?
Maik
Thomas DeWeese schrieb:
> Maik Schürer wrote:
>
>> I tried to compile the current CVS version
>> but for JaclInterpreter.java I need some TCL stuff ... tcl.lang.*;
>> Is Jacl*.java new to Batik ?
>> where can I get it ?
>
>
> The ant script should skip this class if you don't
> have JACL on your classpath. Is this the first time you
> have tried to build Batik from Source?
>
> If you are using an IDE you should remoe the JACL and
> JPYTHON classes from the build manually.
>
>> Maik
>>
>>
>> Thomas DeWeese schrieb:
>>
>>> Hi Maik,
>>>
>>> There was a silly bug in the scroll event dispatch
>>> so it wouldn't notice an event needed to be
>>> dispatched if only the y translate changed.
>>>
>>> This is now fixed in CVS. Thanks for pointing
>>> it out.
>>>
>>> Maik Schürer wrote:
>>>
>>>> I added a scroll listener to my SVG
>>>> EventTarget t = (EventTarget)svgRoot;
>>>> t.addEventListener("SVGScroll", new OnScrollAction(), false);
>>>> but I can catch no events from cursor up/down keys.
>>>> Shifting with mouse and cursor right/left keys works fine.
>>>> Any ideas ?
>>>> Thanks in advance
>>>> Maik
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: EventListener "SVGScroll" - Problem
Posted by Thomas DeWeese <Th...@Kodak.com>.
Maik Schürer wrote:
> I tried to compile the current CVS version
> but for JaclInterpreter.java I need some TCL stuff ... tcl.lang.*;
> Is Jacl*.java new to Batik ?
> where can I get it ?
The ant script should skip this class if you don't
have JACL on your classpath. Is this the first time you
have tried to build Batik from Source?
If you are using an IDE you should remoe the JACL and
JPYTHON classes from the build manually.
> Maik
>
>
> Thomas DeWeese schrieb:
>
>> Hi Maik,
>>
>> There was a silly bug in the scroll event dispatch
>> so it wouldn't notice an event needed to be
>> dispatched if only the y translate changed.
>>
>> This is now fixed in CVS. Thanks for pointing
>> it out.
>>
>> Maik Schürer wrote:
>>
>>> I added a scroll listener to my SVG
>>> EventTarget t = (EventTarget)svgRoot;
>>> t.addEventListener("SVGScroll", new OnScrollAction(), false);
>>> but I can catch no events from cursor up/down keys.
>>> Shifting with mouse and cursor right/left keys works fine.
>>> Any ideas ?
>>> Thanks in advance
>>> Maik
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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: EventListener "SVGScroll" - Problem
Posted by Maik Schürer <Ma...@proveo.de>.
Hi Thomas,
I tried to compile the current CVS version
but for JaclInterpreter.java I need some TCL stuff ... tcl.lang.*;
Is Jacl*.java new to Batik ?
where can I get it ?
Maik
Thomas DeWeese schrieb:
> Hi Maik,
>
> There was a silly bug in the scroll event dispatch
> so it wouldn't notice an event needed to be
> dispatched if only the y translate changed.
>
> This is now fixed in CVS. Thanks for pointing
> it out.
>
> Maik Schürer wrote:
>
>> I added a scroll listener to my SVG
>> EventTarget t = (EventTarget)svgRoot;
>> t.addEventListener("SVGScroll", new OnScrollAction(), false);
>> but I can catch no events from cursor up/down keys.
>> Shifting with mouse and cursor right/left keys works fine.
>> Any ideas ?
>> Thanks in advance
>> Maik
>>
>> ---------------------------------------------------------------------
>> 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
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: EventListener "SVGScroll" - Problem
Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Maik,
There was a silly bug in the scroll event dispatch
so it wouldn't notice an event needed to be
dispatched if only the y translate changed.
This is now fixed in CVS. Thanks for pointing
it out.
Maik Schürer wrote:
> I added a scroll listener to my SVG
> EventTarget t = (EventTarget)svgRoot;
> t.addEventListener("SVGScroll", new OnScrollAction(), false);
> but I can catch no events from cursor up/down keys.
> Shifting with mouse and cursor right/left keys works fine.
> Any ideas ?
> Thanks in advance
> Maik
>
> ---------------------------------------------------------------------
> 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
EventListener "SVGScroll" - Problem
Posted by Maik Schürer <pr...@maik.schuerer.info>.
Hi all,
I added a scroll listener to my SVG
EventTarget t = (EventTarget)svgRoot;
t.addEventListener("SVGScroll", new OnScrollAction(), false);
but I can catch no events from cursor up/down keys.
Shifting with mouse and cursor right/left keys works fine.
Any ideas ?
Thanks in advance
Maik
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: SVG Generator: SVGGraphics2D Tutorial - Problem
Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Arne,
Thanks for reporting these. They are now fixed in CVS.
Arne Lindow wrote:
> thank you for your hint. Now this part compiles.
>
> As I told you, I found some other little mistakes in the tutorial (I
> think, everybody can repair this mistakes by himself, but if somebody
> just starts with batik (like me), little mistakes can result in
> struggling with the framework):
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: Detecting mouse events external to the JSVGCanvas
Posted by Andres Toussaint <an...@onemileup.com>.
I do not know if this is what you want to accomplish, but in order to
be aware of a DnD (Drag and Drop) situation, as you are explaining in
your example, both the initial and receiving components need to be able
to communicate with each other. In Java the DnD is accomplished by
enabling a DragListener in the initial component and a DropTarget in
the receiver. Since JSVGCanvas extends JComponent, you can set it up as
a DropTargetListener.
You may see java.awt.dnd.* and java.awt.datatransfer.* packages.
The way i have it is in a JTree that i have enabled as Dragable, when
it detects a drag operation, i create a StringTransferable (since SVG
is XML, and thus Text) with the SVG i want to drop in my canvas. The
JSVGCanvas implements DropTargetListener, and upon succesful drop (i.e.
the DataFlavor is accepted), I then get the drop location by converting
the Event.getLocation() coordinates to SVG coordinate namespace. And
then in the UpdateManager thread i add the SVG element to my DOM.
Andres.
references, in no specific order:
http://javaalmanac.com/egs/java.awt.dnd/pkg.html
http://www.rockhoppertech.com/java-drag-and-drop-faq.html
http://www.javaworld.com/javaworld/jw-03-1999/jw-03-dragndrop.html
http://java.sun.com/docs/books/tutorial/dnd/
On May 23, 2005, at 1:52 PM, Ted.Clement@apcc.com wrote:
> Hello,
>
> I noticed that when a mousedown event occurs "outside" the JSVGCanvas,
> and the cursor is dragged "into" the canvas, that the mouseup event is
> not
> detected by any of its event listeners. (Also mouseReleased() is not
> called.)
>
> To work around this, I tried to check if a mouse button was in a "down"
> state when
> it enters the canvas:
>
> public void mouseEntered(MouseEvent e) {
> int button = e.getButton();
> int modifier = e.getModifiers();
> int id = e.getID();
> System.out.println("Mouse entered: button=" +
> button + " modifier" + modifier + " id=" +id);
> }
>
> But the values are always the same whether the mouse button is down or
> up.
>
> Is there another way to detect that the user is dragging some new item
> onto
> the canvas?
> Is there another way to query the state of the mouse button at this
> time?
> Is there a "best practice" pattern for doing this?
>
> Thanks in advance!
> Ted
>
>
> ---------------------------------------------------------------------
> 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
Detecting mouse events external to the JSVGCanvas
Posted by Te...@apcc.com.
Hello,
I noticed that when a mousedown event occurs "outside" the JSVGCanvas,
and the cursor is dragged "into" the canvas, that the mouseup event is not
detected by any of its event listeners. (Also mouseReleased() is not
called.)
To work around this, I tried to check if a mouse button was in a "down"
state when
it enters the canvas:
public void mouseEntered(MouseEvent e) {
int button = e.getButton();
int modifier = e.getModifiers();
int id = e.getID();
System.out.println("Mouse entered: button=" +
button + " modifier" + modifier + " id=" +id);
}
But the values are always the same whether the mouse button is down or up.
Is there another way to detect that the user is dragging some new item onto
the canvas?
Is there another way to query the state of the mouse button at this time?
Is there a "best practice" pattern for doing this?
Thanks in advance!
Ted
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: SVG Generator: SVGGraphics2D Tutorial - Problem
Posted by Arne Lindow <li...@tzi.de>.
Hi Thomas,
thank you for your hint. Now this part compiles.
As I told you, I found some other little mistakes in the tutorial (I
think, everybody can repair this mistakes by himself, but if somebody
just starts with batik (like me), little mistakes can result in
struggling with the framework):
In the section 'Customizing the way images are stored' the 3rd line in
the class 'MySVGGenerator' may be:
private static GenericImageHandler ihandler =
and not just:
private static ImageHandler ihandler =
In the first listing of section 'Extending Paint object to SVG element
translation', where you set the SVG_ID_ATTRIBUTE (and in the return
statement of the handlePaint-Method):
grad.setAttributeNS(null, SVGSyntax.SVG_ID_ATTRIBUTE, ref);
I think you mean 'id' instead of 'ref', isn't it?
In the listing of section 'Customizing the generated SVG style', the
class StyleSheetStyleHandler implements StyleHandler. Perhaps you can
add this?
I thank anybody, who works at the batik-implementation. You do great
work. Also the people, who write the documentation, too.
Best regards,
Arne
Thomas DeWeese wrote:
> Hi Arne,
>
> Arne Lindow wrote:
> If you find them please report them here.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: SVG Generator: SVGGraphics2D Tutorial - Problem
Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Arne,
Arne Lindow wrote:
> I tried to run the examples on the batik Homepage under
> http://xml.apache.org/batik/svggen.html
> In listing 2 of section 'Customizing the generated SVG style', I found
> the lines
> Element root = g2d.getRoot();
> Element defs = root.getElementById(SVGSyntax.ID_PREFIX_GENERIC_DEFS);
> but this line causes an error, because, Element does not support the
> method getElementById.
Sorry this should be:
SVGSVGElement root = (SVGSVGElement)g2d.getRoot();
Element defs = root.getElementById(SVGSyntax.ID_PREFIX_GENERIC_DEFS);
> Someone out there, who has a working
> implementation of the examples, given in the SVG Generator-Tutorial? I
> think, there are some more little mistakes in there. (Is there a list
> somewhere?)
If you find them please report them here.
>
> Thank you for any help.
>
> Best regards,
> Arne
>
> my environment:
> java j2sdk1.4.2_03
> batik: batik 1.6
> eclipse 3.0.1
>
> ---------------------------------------------------------------------
> 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