javabuilders icon indicating copy to clipboard operation
javabuilders copied to clipboard

Support for absolute layout and java.awt.Point

Open luca-domenichini opened this issue 8 years ago • 5 comments

I see that support for absolute layout is missing in the project. In my case I would find it very useful in order to provide customers with a simple embedded swing editor in my application, oriented to only particular components (like SCADAs).

I think it would be enough to support a syntax for the Component#setLocation(Point p) or Component#setLocation(int x, int y) methods. All other stuffs are already working.. (more generally speaking, as you already support a special syntax for Dimension (like 800x600), a similar syntax should be fine for Point as well..). In addition, Container#setLayout(null) must be called somewhere.. something like this:

JFrame(name=frame, title=frame.title, size=800x600, defaultCloseOperation=exitOnClose):
    - AbsoluteLayout()
    - JButton(name=button, text=button.acton, location=100;50)

(I don't know which char to use to separate x from y in location... ; should fit be maybe..)

what do you think about that?

luca-domenichini avatar Nov 03 '15 13:11 luca-domenichini

Visit my fork at https://github.com/mimmoz81/javabuilders to get what i've done...

Also, I introduced the RectangleAsValueHandler class to handle type Rectangle (as of method Component#setBounds(Rectangle))

I was not able to pull a request to you.. I'm new to github so maybe I don't get all the mechanics..

luca-domenichini avatar Nov 03 '15 15:11 luca-domenichini

Actually it does need for AbsoluteLayout tag to be placed at the end of the yml file.. i need to check more... I'll update when improved.

luca-domenichini avatar Nov 03 '15 15:11 luca-domenichini

It seems that the layoutmanager must be always the last tag to be declared in yml.

Is that true? If this is correct, my commit is already done and absolute layout is working properly..

luca-domenichini avatar Nov 03 '15 15:11 luca-domenichini

Yes, if I recall correctly. It's been many years since I coded it :-)

I think it is covered in the PDF explicitly if memory serves me right.

On Tue, Nov 3, 2015 at 9:41 AM, mimmoz81 [email protected] wrote:

It seems that the layoutmanager must be always the last tag to be declared in yml.

Is that true? If this is correct, my commit is already done and absolute layout is working properly..

— Reply to this email directly or view it on GitHub https://github.com/jacek99/javabuilders/issues/5#issuecomment-153393005.

jacek99 avatar Nov 03 '15 15:11 jacek99

Ok, so if you have time to spend, take a look at my fork and tell me what you think.. many thanks

luca-domenichini avatar Nov 03 '15 15:11 luca-domenichini