Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force a redraw/re-layout in Ext GWT (GXT)?

Tags:

gwt

gwt-ext

gxt

In GXT, I've got a control with an important panel added to the bottom component, basically like this:

public class SamplePanel extends ContentPanel {

ContentPanel panel = new ContentPanel();    

public SamplePanel() {
    setBottomComponent(panel);
}

public void setVisible(boolean isVisible) {
    panel.setVisible(isVisible);
}

The panel is being set as the "bottom component" because it needs to stay at the bottom of the widget and viewable at all times.

The problem is, while the visibility of the panel toggles correctly, the 'bottom component' area doesn't resize to become smaller and fit the new dimensions of the bottom area.

However, I've noticed that the bottom area does resize when I manually change the size of the widget with the mouse.

Is there any way to programatically force a redraw/repaint/re-layout... anything to have the bottom component change to reflect the new size of its contents?

I've tried all of these and they don't work:

public void setVisibility(boolean isVisible) {
        panel.setVisible(isVisible);
        doLayout(true);
        recalculate();
        repaint();
    }

Thanks

like image 837
Cuga Avatar asked Jan 24 '11 20:01

Cuga


1 Answers

In the last gxt you can do.

this.layout(true);

Otherwise you can fire an Events.Resize event.

like image 183
Jordi P.S. Avatar answered Oct 31 '22 07:10

Jordi P.S.