SVG Field in Swing and in SWT [message #1041558] |
Mon, 15 April 2013 08:48 |
|
Hi all,
I'm here again to mark a strange thing happens to me using a field SVG.
I use a SVG field to represent a set of points that indicate my form; I pass the following XML string to the SVG field:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"><circle cx="114.488188975" cy="76.692913385" r="1" stroke="red" stroke-width="1" /><circle cx="211.6352088927718" cy="59.563272678074185" r="1" stroke="black" stroke-width="1" /><circle cx="209.3157529735557" cy="42.17850270155239" r="1" stroke="black" stroke-width="1" /><circle cx="191.0802939762989" cy="32.472440944700004" r="1" stroke="black" stroke-width="1" /><circle cx="174.4206109176706" cy="26.403640237343986" r="1" stroke="black" stroke-width="1" /><circle cx="159.6756518033286" cy="22.840592219122065" r="1" stroke="black" stroke-width="1" /><circle cx="147.18110236035" cy="20.067126354125172" r="1" stroke="black" stroke-width="1" /><circle cx="135.68805171689291" cy="18.446769206111867" r="1" stroke="black" stroke-width="1" /><circle cx="124.98911814399666" cy="17.13918469977591" r="1" stroke="black" stroke-width="1" /><circle cx="114.488188975" cy="17.354330708700004" r="1" stroke="black" stroke-width="1" /><circle cx="103.98725980600334" cy="17.13918469977591" r="1" stroke="black" stroke-width="1" /><circle cx="93.02979132162059" cy="17.736450374662" r="1" stroke="black" stroke-width="1" /><circle cx="81.03937007785001" cy="18.757859601966217" r="1" stroke="black" stroke-width="1" /><circle cx="67.843066055435" cy="21.103420568609884" r="1" stroke="black" stroke-width="1" /><circle cx="52.23953816497982" cy="24.460093449028754" r="1" stroke="black" stroke-width="1" /><circle cx="34.95023378134344" cy="30.771653543150002" r="1" stroke="black" stroke-width="1" /><circle cx="20.015784392169238" cy="42.30777015729562" r="1" stroke="black" stroke-width="1" /><circle cx="17.71337986151086" cy="59.62890348538038" r="1" stroke="black" stroke-width="1" /><circle cx="18.48818897640001" cy="76.69291338499998" r="1" stroke="black" stroke-width="1" /><circle cx="21.063277100054705" cy="93.16624601886353" r="1" stroke="black" stroke-width="1" /><circle cx="25.34317562804314" cy="109.13904477655561" r="1" stroke="black" stroke-width="1" /><circle cx="36.58681722154216" cy="121.6692913371" r="1" stroke="black" stroke-width="1" /><circle cx="53.976709815492" cy="127.46807322973481" r="1" stroke="black" stroke-width="1" /><circle cx="68.8148394495926" cy="131.1242917677153" r="1" stroke="black" stroke-width="1" /><circle cx="81.79527558964998" cy="133.31870041587482" r="1" stroke="black" stroke-width="1" /><circle cx="93.28832623310704" cy="134.93905756388813" r="1" stroke="black" stroke-width="1" /><circle cx="104.05289061330957" cy="135.87443126594144" r="1" stroke="black" stroke-width="1" /><circle cx="114.48818897499999" cy="136.4094488172" r="1" stroke="black" stroke-width="1" /><circle cx="124.98911814399665" cy="136.24664207022408" r="1" stroke="black" stroke-width="1" /><circle cx="135.68805171689291" cy="134.93905756388813" r="1" stroke="black" stroke-width="1" /><circle cx="146.9921259824" cy="132.99138372783509" r="1" stroke="black" stroke-width="1" /><circle cx="159.18976510624978" cy="129.96617733404054" r="1" stroke="black" stroke-width="1" /><circle cx="172.6834392671584" cy="125.52452644141964" r="1" stroke="black" stroke-width="1" /><circle cx="184.20664352746437" cy="116.94488188835004" r="1" stroke="black" stroke-width="1" /><circle cx="192.97841985020898" cy="105.26102110425819" r="1" stroke="black" stroke-width="1" /><circle cx="200.09667396000964" cy="91.7879990654327" r="1" stroke="black" stroke-width="1" /><circle cx="205.9527559028" cy="76.69291338500003" r="1" stroke="black" stroke-width="1" /><circle cx="371.496062987" cy="76.692913385" r="1" stroke="red" stroke-width="1" /><circle cx="468.27087210048916" cy="59.62890348538042" r="1" stroke="black" stroke-width="1" /><circle cx="465.96846756983075" cy="42.30777015729563" r="1" stroke="black" stroke-width="1" /><circle cx="451.0340181806566" cy="30.771653543150002" r="1" stroke="black" stroke-width="1" /><circle cx="433.7447137970202" cy="24.46009344902877" r="1" stroke="black" stroke-width="1" /><circle cx="418.141185906565" cy="21.103420568609884" r="1" stroke="black" stroke-width="1" /><circle cx="404.94488188415005" cy="18.757859601966224" r="1" stroke="black" stroke-width="1" /><circle cx="392.95446064037947" cy="17.736450374662" r="1" stroke="black" stroke-width="1" /><circle cx="381.9969921559967" cy="17.13918469977591" r="1" stroke="black" stroke-width="1" /><circle cx="371.496062987" cy="17.354330708700004" r="1" stroke="black" stroke-width="1" /><circle cx="360.99513381800335" cy="17.13918469977591" r="1" stroke="black" stroke-width="1" /><circle cx="350.2962002451071" cy="18.44676920611186" r="1" stroke="black" stroke-width="1" /><circle cx="338.80314960165003" cy="20.067126354125165" r="1" stroke="black" stroke-width="1" /><circle cx="326.3086001586714" cy="22.840592219122065" r="1" stroke="black" stroke-width="1" /><circle cx="311.5636410443294" cy="26.403640237343964" r="1" stroke="black" stroke-width="1" /><circle cx="294.90395798570114" cy="32.472440944700004" r="1" stroke="black" stroke-width="1" /><circle cx="276.6684989884443" cy="42.178502701552375" r="1" stroke="black" stroke-width="1" /><circle cx="274.34904306922823" cy="59.56327267807415" r="1" stroke="black" stroke-width="1" /><circle cx="280.03149605920004" cy="76.69291338499998" r="1" stroke="black" stroke-width="1" /><circle cx="285.8875780019904" cy="91.78799906543271" r="1" stroke="black" stroke-width="1" /><circle cx="293.005832111791" cy="105.26102110425813" r="1" stroke="black" stroke-width="1" /><circle cx="301.77760843453564" cy="116.94488188835001" r="1" stroke="black" stroke-width="1" /><circle cx="313.3008126948416" cy="125.52452644141961" r="1" stroke="black" stroke-width="1" /><circle cx="326.7944868557502" cy="129.9661773340405" r="1" stroke="black" stroke-width="1" /><circle cx="338.9921259796" cy="132.99138372783506" r="1" stroke="black" stroke-width="1" /><circle cx="350.29620024510706" cy="134.93905756388813" r="1" stroke="black" stroke-width="1" /><circle cx="360.99513381800335" cy="136.24664207022408" r="1" stroke="black" stroke-width="1" /><circle cx="371.496062987" cy="136.4094488172" r="1" stroke="black" stroke-width="1" /><circle cx="381.9313613486904" cy="135.87443126594144" r="1" stroke="black" stroke-width="1" /><circle cx="392.6959257288929" cy="134.93905756388813" r="1" stroke="black" stroke-width="1" /><circle cx="404.18897637235" cy="133.31870041587482" r="1" stroke="black" stroke-width="1" /><circle cx="417.1694125124074" cy="131.12429176771533" r="1" stroke="black" stroke-width="1" /><circle cx="432.007542146508" cy="127.46807322973484" r="1" stroke="black" stroke-width="1" /><circle cx="449.3974347404578" cy="121.66929133710003" r="1" stroke="black" stroke-width="1" /><circle cx="460.64107633395685" cy="109.13904477655569" r="1" stroke="black" stroke-width="1" /><circle cx="464.9209748619453" cy="93.16624601886352" r="1" stroke="black" stroke-width="1" /><circle cx="467.4960629856" cy="76.69291338500003" r="1" stroke="black" stroke-width="1" /></svg>
the code that use is as follows:
String xmlSVG = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +
"<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">" + xmlSVGR.trim() + xmlSVGL.trim() + "</svg>";
try {
SVGDocument doc = SVGUtility.readSVGDocument(new ByteArrayInputStream(xmlSVG.getBytes()));
getShapeRField().setSvgDocument(doc);
}
catch (ProcessingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
the result that I obtain in Swing is:
the result that I obtain in SWT is:
Can anyone help me to understand where is the problem or my mistake?
Thanks in advance for your help
-
Attachment: img_Swing.png
(Size: 4.66KB, Downloaded 741 times) -
Attachment: img_SWT.png
(Size: 1.81KB, Downloaded 768 times)
|
|
|
|
Re: SVG Field in Swing and in SWT [message #1053048 is a reply to message #1052912] |
Thu, 02 May 2013 08:09 |
|
Hi Matthias,
I followed the guidelines in this tutorial to develop my code. I use it in a private method where I obtained the data from an xml file.
The problem that I would draw attention is, against the same code, the user interface Swing and SWT have different results as I reported in my first post.
|
|
|
Re: SVG Field in Swing and in SWT [message #1053065 is a reply to message #1053048] |
Thu, 02 May 2013 10:13 |
Jeremie Bresson Messages: 1252 Registered: October 2011 |
Senior Member |
|
|
It is difficult to reproduce the case...
From the current screenshot I cannot tell if your SVG Field is cut in SWT (Layout problem) or if the content is not displayed correctly.
Can you try to set a background color on the field?
getShapeRField().setBackgroundColor("FF0000");
... and make screenshots (from Swing and SWT).
[Updated on: Thu, 02 May 2013 10:13] Report message to a moderator
|
|
|
Re: SVG Field in Swing and in SWT [message #1053075 is a reply to message #1053065] |
Thu, 02 May 2013 10:41 |
|
Hi Jeremie,
I make a test with your suggestion and this is the result:
String xmlSVG = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +
"<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">" + xmlSVGR.trim() + xmlSVGL.trim() + "</svg>";
try {
SVGDocument doc = SVGUtility.readSVGDocument(new ByteArrayInputStream(xmlSVG.getBytes()));
[b]getShapeRField().setBackgroundColor("FF0000");[/b]
getShapeRField().setSvgDocument(doc);
getShapeRField().setVisible(true);
getNoShapeField().setVisible(false);
}
catch (ProcessingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
getShapeRField().setVisible(false);
getNoShapeField().setVisible(true);
}
here I report to you the properties of this field:
this is the result in Swing user interface:
this is the result in SWT user interface:
|
|
|
|
|
|
Re: SVG Field in Swing and in SWT [message #1053238 is a reply to message #1053135] |
Fri, 03 May 2013 10:19 |
|
Hi Urs,
I followed your suggestion and after changing the values according to my needs, I got more or less the same result on Swing and SWT user interface.
However, the result is improved, at least the design is seen complete in both cases.
Thank you for your help
|
|
|
|
Powered by
FUDForum. Page generated in 0.04195 seconds