Hi Aldo,

another approach is not to use a SimplePanel at all. But rather to
implement something like a SimpleLayoutPanel yourself.
It will work fine with xxxLayout components embedded within it. (I
really think it is something Google missed to include in GWT 2.1.)

Please see below for one implementation that has worked fine for me.

regards
Per

-------------
package se.perper.util;

import com.google.gwt.user.client.ui.HasOneWidget;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.Widget;

public class SimpleLayoutPanel extends LayoutPanel implements
HasOneWidget {

        Widget widget;

        @Override
        public void setWidget(IsWidget w) {
                setWidget(asWidgetOrNull(w));
        }

        @Override
        public Widget getWidget() {
                return widget.asWidget();
        }

        @Override
        public void setWidget(Widget w) {
                // Validate
            if (w == widget) {
              return;
            }

            // Detach new child.
            if (w != null) {
              w.removeFromParent();
            }

            // Remove old child.
            if (widget != null) {
              remove(widget);
            }

            // Logical attach.
            widget = w;

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


-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to