0

I'm trying a simple experiment with ResizableComposite by logging width & height of the widget, but I'm not getting any response.

ResizableFlowPanel

public class ResizableFlowPanel extends FlowPanel implements RequiresResize, ProvidesResize {

    public ResizableFlowPanel() {
    super();
    }

    @Override
    public void onResize() {
    GWT.log(this.getOffsetHeight() +","+this.getOffsetWidth());
    }

}

AppBody.java

public class AppBody extends ResizeComposite implements RequiresResize,
    ProvidesResize {
    private static AppBodyUiBinder uiBinder = GWT.create(AppBodyUiBinder.class);

    public AppBody() {
    initWidget(uiBinder.createAndBindUi(this));
    }

    @Override
    public void onResize() {
    GWT.log(this.getOffsetHeight() + "," + this.getOffsetWidth());
    super.onResize();
    }

    interface AppBodyUiBinder extends UiBinder<Widget, AppBody> {
    }

}

AppBody.ui.xml

<ui:UiBinder ...>
    <e:ResizableFlowPanel styleName="{bundle.appBodyStyle.app_body}">

    </e:ResizableFlowPanel>
</ui:UiBinder> 

When I resize the browser, I'm not getting any log messages.

hba
  • 7,406
  • 10
  • 63
  • 105
  • FlowPanel does resize according to its parent. I do not think you need to write "ResizableFlowPanel extends FlowPanel implements RequiresResize" – appbootup Jan 15 '13 at 04:44
  • `RequiresResize` will only make a difference if you add the widget to a parent that implements `ProvidesResize` - so what are you adding AppBody to? And why isn't AppBody fulfilling `ProvidesResize` and invoking `onResize()` on any child that implements `RequresResize` (a.k.a. the `ResizableFlowPanel`)? – Colin Alworth Jan 15 '13 at 04:58
  • Colin, I'm adding it to a HtmlPanel; so that's probably why it is not working. Is there a way I can track the size of a panel without having everything from RootPanel onwards implementing the two interfaces? – hba Jan 15 '13 at 06:59

0 Answers0