Hi all,
Two days ago I created a new post with subject "Text along
path" (
http://groups.google.com/group/gwt-graphics/browse_thread/
thread/6e7fc961c622c4e6). GWT Graphics doesn't support such
functionality so I'm aiming at achieving it by DOM manipulation. While
this play I noticed a problem which is described below.
Here is the code which enables you to see the problem:
public class MySvgTest implements EntryPoint {
public void onModuleLoad() {
DrawingArea canvas = new DrawingArea(1000, 1000);
RootPanel.get().add(canvas);
Element path = DOM.createElement("path");
path.setAttribute("fill", "white");
path.setAttribute("fill-opacity", "1.0");
path.setAttribute("stroke", "black");
path.setAttribute("stroke-opacity", "1.0");
path.setAttribute("stroke-width", "1");
path.setAttribute("d", " M100 100 L200 50 z");
Document.get().getElementsByTagName("svg").getItem(0).appendChild(path);
}
}
As you can see above, I'm creating an element <path> manually via
DOM.createElement("path") and adding it to DOM. But after it the path
doesn't show up on the page! What's VERY interesting, if I see the
source of this page via the browser, copy the whole source (from
<html> to </html>), paste it to a new blank document in a text editor,
save it to the hard drive as HTML file and open it in the browser, the
path is displayed (the source is updated correctly).
Of course, if I create the path via GWT Graphics (Path path = new
Path(...)) and add it to DrawingArea canvas (canvas.add(path)),
everything is ok.
If I create, for example, a <text> element (instead of <path>) via
DOM.createElement("text") and add it to DOM, the text is displayed!
Can anyone solve this enigma? Maybe you, Henri? I would feel grateful.
Solving this problem would mean that adding <textpath> manually inside
<text> is also possible. But now it isn't (the text along path doesn't
show up; I presented an example with <path> to you because it's less
complicated than <textpath> inside <text>).
Thank you all in advance!