Login | Register
My pages Projects Community openCollabNet

Discussions > dev > [gef-dev] New FigFactory class

gef
Discussion topic

Back to topic list

[gef-dev] New FigFactory class

Reply

Author Bob Tarling <bob dot tarling at ntlworld dot com>
Full name Bob Tarling <bob dot tarling at ntlworld dot com>
Date 2004-01-13 18:25:15 PST
Message I've added the FigFactory which helps to provide a better sizing algorithm for figs.

To see the improvement run the BasicApplication contained in GEF (not the one in the GEFDemo project).

This demo has two types of node, make sure that you have both types of node displayed. Play around with resizing both. One will soon go wrong with positioning and sizing of sub-figs. The other will resize cleanly. The latter is the one that I've amended to be created through the factory.

I won't be making this feature live for some time till I've done some more testing so don't rely on it in any applications for now. I need to find out what will happen if a child fig changes size causing resize of its parent FigGroup (such as typing a long class name in ArgoUML) I think this will break things and I need a workaround.

I have a couple of questions for Jason from my view of the product so far.


1. Why are child figs created at negative co-ordinates in the demos I've seen? Is there any relevance in this?

eg from SampleNode
obj1 = new FigRect(-25, -25, 50, 50, Color.black, Color.white);
obj2 = new FigCircle(-20, -20, 40, 40, Color.red, null);
obj3 = new FigCircle( -5, -30, 10, 10, Color.black, Color.blue);
obj4 = new FigCircle( -5, 20, 10, 10, Color.black, Color.blue);
obj5 = new FigRect(-30, -5, 10, 10, Color.black, Color.green);
obj6 = new FigRect( 20, -5, 10, 10, Color.black, Color.green);
obj7 = new FigText( -10, -10, 20, 20);


Because my new algorithm wants to know the x/y position of each child fig in reference to the left/top corner of its FigGroup the factory recalculates all these positions with the top left position being (0,0).

This doesn't seem to cause any problems. Can you for foresee any side effects that I might have missed?

It just seems odd to me to have specified negative co-ordinates so I can only think that there must be some reason behind it.


2. I was suprised to find that once placed on a diagram the coordinates of child Figs in a FigGroup are not based on the position within their parent but on the actual position the child fig will be drawn on the Layer.

Was there some reason for designing it this way?

It would seem all to easy a mistake to try and add a child fig at position (0,0) of an existing (and already displayed) FigGroup thinking it will appear in the top left hand corner of the group but only to find it appear completely outside. Particularly when Java coders are used to swing components which are positioned inside eachother relative to their parent.

All I can think of is that there was an issue with paint performance with the paint method having to calculate actual positions of figs. This seems at a cost to complicating algorithms elsewhere.


Regards

Bob.
Attachments

« Previous message in topic | 1 of 7 | Next message in topic »

Messages

Show all messages in topic

[gef-dev] New FigFactory class Bob Tarling <bob dot tarling at ntlworld dot com> Bob Tarling <bob dot tarling at ntlworld dot com> 2004-01-13 18:25:15 PST
     Re: [gef-dev] New FigFactory class Bob Tarling <bob dot tarling at ntlworld dot com> Bob Tarling <bob dot tarling at ntlworld dot com> 2004-01-18 03:47:13 PST
         Re: [gef-dev] New FigFactory class Bob Tarling <bob dot tarling at ntlworld dot com> Bob Tarling <bob dot tarling at ntlworld dot com> 2004-02-09 12:58:23 PST
             Re: [gef-dev] New FigFactory class alexb Alex Bagehot 2004-02-10 01:10:57 PST
                 [gef-dev] LayoutManagers (was New FigFactory class) Bob Tarling <bob dot tarling at ntlworld dot com> Bob Tarling <bob dot tarling at ntlworld dot com> 2004-02-10 01:28:21 PST
                     RE: [gef-dev] LayoutManagers (was New FigFactory class) gbarnes Greg Barnes 2004-02-18 17:15:24 PST
                         Re: [gef-dev] LayoutManagers Bob Tarling <bob dot tarling at ntlworld dot com> Bob Tarling <bob dot tarling at ntlworld dot com> 2004-02-22 10:18:49 PST
Messages per page: