Question

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

Was it helpful?

Solution

In the last gxt you can do.

this.layout(true);

Otherwise you can fire an Events.Resize event.

OTHER TIPS

I don't know about GXT, but in GWT I would use one of the force() or forceLayout() methods on my panel. Perhaps there is a similar API for doing that!

HTH.

Have you tried using the setLayoutOnChange() method of the ConentPanel?

I would suggest looking at this: http://davidmaddison.blogspot.com/2008/12/gwt-rendering-process.html

What you can try to do is addListeners to the Panel and try calling panel.layout() there

This post claims that the top and bottom components to not participate in layout once the panel has been rendered and suggests a manual workaround (using RowLayout) or manually setting the size of the panel.

Consider finding the sizes from the parent and calling onResize(width, height)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top