Is there an "AcceptsOneWidget" that is also a "ProvidesResze" (except for the `ScrollPanel`)?

I have a composite that expands ResizeCompositeand has as root DockLayoutPanel. I can paste it right in RootLayoutPanel, and it works because DockLayoutPanel ProvidesResize.

However, I want to use MVP objects in GWT 2.2, and RootLayoutPanelcannot be passed in ActivityManager#setDiplay(AcceptsOneWidget)(since this is a container with multiple widgets).

At first glance ScrollPanel, it appears to be responsible dual requirements of implementation AcceptsOneWidgetand how ProvidesResize, and so RequiresResize.

But I find that when I put my widget in ScrollPanel, it is “zero size” and I need to manually change it to see it, and I have trouble understanding what size to give it. I would prefer a panel that didn't necessarily scroll.

+3
source share
2 answers

You can add ProvidesResizeto any widget by executing it yourself, which is relatively simple - you just send all the resizing notifications that you receive for each child that RequiresResize.

Alternatively, if you just want your panel to occupy all the free space, you can try setting the width and height to ScrollPanelon "100%".

, LayoutPanel, AcceptsOneWidget:

public class PanelForView extends LayoutPanel implements AcceptsOneWidget
{
    IsWidget myWidget = null;

    @Override
    public void setWidget(IsWidget w)
    {
        if (myWidget != w)
        {
            if (myWidget != null)
            {
                remove(myWidget);
            }

            if (w != null)
            {
                add(w);
            }

            myWidget = w;
        }
    }

}

- , . .

+2

GWT 2.3 SimpleLayoutPanel, :

A simple panel that {@link ProvidesResize} to its one child.

+3

Source: https://habr.com/ru/post/1795236/


All Articles