Files
openide/images
Sergei Tachenov 16be8ae189 IDEA-332388 Properly layout ImageEditorUI
This regression was caused by some ancient (2005) layout hack
that overrode the invalidate() method and used it to center the image.
However, Swing doesn't always call invalidate() when validating.
Sometimes it just calls validate(), for example, if the parent component
was invalidated. This made laying out the image editor UI very fragile
and dependent on the specific moment when validation / invalidation / revalidation
happens.

When the slow op fix was applied, the image started to load with some delay,
as it would be now loaded in background and only then displayed. This broke
the mentioned hack because when the image is updated, revalidate() is called
on the parent container, not on the image container itself, which would cause
Swing to skip the invalidate() method containing the hack.

Fix by removing the hack and replacing it with a very simple custom layout
manager instead. Now validation happens the way it's intended by Swing,
and the new layout manager is called whenever needed, and it does the same
thing as the hack did: center the image.

GitOrigin-RevId: cb6965a0535ee365326dce59bd015d689b541943
2023-09-26 09:01:23 +00:00
..