anqitong / LangageDessinVectoriel

1 stars 2 forks source link

New presentation - AWT #60

Closed starsasumi closed 8 years ago

starsasumi commented 9 years ago

50

Use java.awt to implement a second presentation.

Note: I remove PencilState and use a delegate to "draw" pencils because the original PencilState could not fit this presentation.

anqitong commented 9 years ago

You have AWT and CircleAWT. The names make me think that CircleAWT should extends AWT. But here obviously CircleAWT extends ShapeState so maybe you should change the name or make CircleAWT extend AWT

starsasumi commented 9 years ago

@anqitong What about AWT -> AWTFrame and CircleAWT -> AWTCircle?

anqitong commented 9 years ago

I think it is better. At least it won't make people think that there is an extension between those two classes.

starsasumi commented 9 years ago

Thx, I will work on it later

Thomas-dot-G commented 9 years ago

Ok, I don't mind

starsasumi commented 9 years ago

@anqitong Classes renamed

starsasumi commented 9 years ago

Because getDrawing in ShapeState is generic, but getDrawing(PencilState) is heavily related to svg and just can not fit the case of awt. Also, awt presentation need to pass the Graphics2D object around, which is also not related to svg. So these (get xml from pencil, get Graphics2D object) are presentation related details and should not be share between presentations

starsasumi commented 8 years ago

I fixed conflits. Can I merge?

starsasumi commented 8 years ago

@anqitong There's no different, since shape is an instance of Circle, there is nothing to convert (in the convertToCircle method we still need to cast itself to circle and return). In fact I prefer to remove this setShape method because a ShapeState is something too lightweight and we would just use an object one time and then throw it away. So we don't need to call the setShape method.

anqitong commented 8 years ago

Ok, then it's fine with me

Thomas-dot-G commented 8 years ago

I got very strange errors when running it: (eog:23372): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory. This indicates a bug in someone's code. You must ensure an error is NULL before it's set. The overwriting error message was: Error domain 1 code 73 on line 9 column 31 of file:///home/thomas/Documents/Programs/LangageDessinVectoriel/files/svgAndAwt.svg: Couldn't find end of Start Tag text

(And the drawing is a little strange^^)

starsasumi commented 8 years ago

@Thomas-dot-G The error is related to SVG? I have no error about the AWT, but I do get this in the SVG version output:

screen shot 2015-11-14 at 15 23 19

I think that's a bug in our xml implementation. For the other parts of codes, I do it now.

Thomas-dot-G commented 8 years ago

Yes exactly, but as you changed the xml also, it might come from that.

Thomas-dot-G commented 8 years ago

It should be compatible. And can you add some comments also in the main and a test (can be the same as the main)

starsasumi commented 8 years ago

@Thomas-dot-G I found the bug, there was an extract " in the TextXML codes. It should be fine now ;)

starsasumi commented 8 years ago

For adding a JUnit test, I tried it once, but Junit will kill all JFrame immediately after test codes are finished. Do you have any idea how we make Junit not to kill JFrames?

Thomas-dot-G commented 8 years ago

No, not for JFrames... You can just create the object, and then do some assert on the element inside the object to see if they are well here... (some small JUnits, not really on the display...) But, I don't know otherwise

Thomas-dot-G commented 8 years ago

Now xml works, but on the xml, I can't see the ellipse, and the hello world is not really readable... And the polyline is filled in the xml...

starsasumi commented 8 years ago

I made the DrawAwt now as a test. For xml, I confirm the problems. But I prefer to open another issue to fix the xml implementation (Since I have not work a lot on SVG and I didn't modify anything about xml outputs). Ok?

Thomas-dot-G commented 8 years ago

Ok, fine with me then