Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[gef-dev] Inconsistency in FlowLayout - major and minor spacing

Hi team,

I have started a refactoring of FlowLayout and ToolbarLayout, in which I introduced a common superclass, namely OrderedLayout, to get rid of all the duplicate code, and to provide the basis for coming up with a ToolbarLayoutEditPolicy (pulling common things up from FlowLayoutEditPolicy into OrderedLayoutEditPolicy), see https://bugs.eclipse.org/bugs/show_bug.cgi?id=88884 for details. My intention was to also provide a possibility within ToolbarLayout to allow stretching within the major axis.

While starting the refactoring of the layouts (I have already introduced OrderedLayout as a superclass and pulled common methods up) I investigated that FlowLayout actually seems to mix up the major and minor spacing. That is, while the javadoc states that the major spacing affects the "the spacing in pixels to be used between children in the direction parallel to the layout's orientation.", which would be - as I see it - the intuitive understanding of it, the value set for the major spacing actually affects the spacing perpendicular to the layout orientation, and vice versa. You may easily reproduce this using the FlowLayoutExample snippet of the Draw2d examples. 

I think this is a misery and getting out of this is not easy, because we could either change the javadoc to correspond to our existing different implementation, or we could change the implementation to correspond to what the javadoc states and what would be the intuitive meaning, thereby breaking existing clients. Even worse: ToolbarLayout currently only refers to "spacing", which is used in the sense of a major spacing according to above quoted javadoc. When trying to align this with FlowLayout (to allow to pull things up to OrderedLayout) I would have to introduce the same inconsistency there, or make the two layouts behave differently (which is not better). The alternative would be to deprecate the current methods in FlowLayout and to introduce new ones referring to the spacing in the correct meaning, but how to name them? What to do?

Cheers
Alexander

--  
Dr. Alexander Nyßen
Dipl.-Inform.
Software-Engineer

Telefon: +49 (0) 231 / 98 60-210
Telefax: +49 (0) 231 / 98 60-211
Mobil: +49 (0) 151 /  17396743


itemis AG
Am Brambusch 15-24
44536 Lünen

Rechtlicher Hinweis:

Amtsgericht Dortmund, HRB 20621

Vorstand: Jens Wagener (Vors.), Wolfgang Neuhaus, Dr. Georg Pietrek, Jens Trompeter, Sebastian Neus

Aufsichtsrat: Dr. Burkhard Igel (Vors.), Stephan Grollmann, Michael Neuhaus


Back to the top