Wicket and SVG - are there any components?
The SVG DOM can be manipulated with JavaScript, so it can be AJAX enabled ... I wonder if there are any more SVG components for Wicket. And if Wicket can have a clean xml/svg
as output format.
A quick googling only shows the question in Code Ranch .
a source to share
I don't know if you need the wicket-svg library. But I started a project on github to provide wicket components to work with svg.
Follow this link: wicket-svg
a source to share
I don't know of composite components, but Wicket can definitely have xml/svg
both an output format, and it's pretty easy to make a page that displays the svg.
Simple sample code example:
public class Rectangle extends Page {
@Override
public String getMarkupType() {
return "xml/svg";
}
@Override
protected void onRender(MarkupStream markupStream) {
PrintWriter writer = new PrintWriter(getResponse().getOutputStream());
writer.write(makeRectangleSVG());
writer.flush();
writer.close();
}
private String makeRectangleSVG() {
return "<?xml version=\"1.0\" standalone=\"no\"?>\n" +
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n" +
"\"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n" +
"\n" +
"<svg width=\"100%\" height=\"100%\" version=\"1.1\"\n" +
"xmlns=\"http://www.w3.org/2000/svg\">\n" +
"\n" +
"<rect width=\"300\" height=\"100\"\n" +
"style=\"fill:rgb(0,0,255);stroke-width:1;\n" +
"stroke:rgb(0,0,0)\"/>\n" +
"\n" +
"</svg> ";
}
}
If you map this as a bookmarked page and call it, it displays a lovely blue rectangle according to the hardcoded svg (stolen from the w3schools example). And of course you can easily parameterize the page and generate the svg, not just send a constant ...
I suspect it would also be tricky to create a tag-based component object
so that the svg can appear as part of an html page and not be the whole page, but I haven't tried that yet.
a source to share