[isabelle-dev] NEWS: Dockable window "Find"

Holger Gast gasth at in.tum.de
Wed Sep 4 16:14:35 CEST 2013


On 09/04/2013 01:29 PM, Makarius wrote:
> Yes, the layout of this (and some other dockables) is still not quite right:
> it is just basic FlowLayout.
>
> I was waiting for the hidden student project supervised by Fabian Immler,
> to see if alternatively layout ideas show up.
>
> In the meantime it is also possible for Swing layout experts to say
> what is best here.  (I do not even master GridBagLayout so far.)
After creating a similar layout in the Eclipse WindowBuilder
in a matter of minutes (a great tool, by the way!),
I was intrigued to see the odd behaviour already for very
small examples.

The reason for the odd behaviour is, indeed, somewhat intricate:

FlowLayouts invariably compute their preferred size
in one line. However, when later they are asked to
layout the children of their container, they break
them into lines and thus use up more vertical space
than advertised originally. As a result, components
in the later lines may be partly obscured when
re-sizing windows.

This behavior is, unfortunately, inherent in the
Swing/AWT layout mechanism, which proceeds once bottom-up
to compute the preferred sizes, and then once top-down to
decide on the sizes of the components. There is no way
of computing the preferred size using some form of
"size hint" propagated in the top-down phase
(unlike in the SWT framework).

The attached class RetriggeringFlowLayout fixes
this problem by caching the previous size decision
from the top-down phase and re-triggering the layout
if that decision has changed.

In my example layout, this gives the desired effect.
(It just uses the new class instead of plain FlowLayout.)
If it does not solve the problem in jEdit, I'm willing
to dig some deeper.

Cheers,

Holger
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RetriggeringFlowLayout.java
Type: text/x-java
Size: 4896 bytes
Desc: not available
URL: <https://mailman46.in.tum.de/pipermail/isabelle-dev/attachments/20130904/5938d66f/attachment-0004.java>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LayoutExample.java
Type: text/x-java
Size: 2347 bytes
Desc: not available
URL: <https://mailman46.in.tum.de/pipermail/isabelle-dev/attachments/20130904/5938d66f/attachment-0005.java>


More information about the isabelle-dev mailing list