Forcing Layout Recalculation

Hi everyone,
is there anyone who can suggest me a way to force layout recalculation automatically?
Like the button FL in debug mode…

Thanks a lot! :slight_smile:

Why do you need a forced layout recalculation?

Each component is responsible for informing the framework if it does anything that would require new layout calculations. If this doesn’t happen, it’s probably a bug in that component (or in some cases a bug in some of the component’s children or in its parent). The FL button in debug mode is mainly intended to help developers identify this kind of issue.

There are also some known cases where components included in the framework are not properly updated until FL is pressed, e.g.
these tickets

If you are doing some really fancy stuff that the framework has no chance of catching, e.g. dynamically modifying the CSS, I guess you could make a simple client side “component” that invokes ApplicationConnection.forceLayout() e.g. when receiving a triggering UIDL message from the server.

Basically i wanted to use a different font for my application, and i was using @font-face in css.

I know it’s not the best solution, but it’s actually the fastest to implement, so i have it a try. It works good on compatible browsers but, if i have a long text in a Label, what i think happens is that the label calculates its dimension on the standard font, and then the css changes the font representation, so that the content usually is usually longer than the label itself.

Could you point me to something to read for implementing the client-side component?

Thanks a lot!

The general introduction for making client side component can be found in
Book of Vaadin

Your component should probably be a dummy component without any visible UI although Vaadin 6 still forces you to have a GWT widget that is attached to the DOM. For a good example of how to construct such invisible components, you could have a look at how the Refresher add-on is

To detect when the font is loaded so the calculation is done, I guess you’d have to use the
event. To get this working from your GWT code, you will probably have to write some

Thanks a lot, i’ll give it a try! :slight_smile: