On Wed, Aug 12, 2009 at 2:36 PM, ggeorg <[email protected]>wrote:

> About adding extra layout constrains to a widget, I am not sure if
> Layout.attachChild() helps, since that is used internally by
> LayoutPanel. For the demo my workaround was to make the
> DockLayoutManager class abstract and the EntryPoint class looks not
> very good, see: http://pastebin.com/m244ef110


I was thinking that new panels that needed to use the widgets' or layers'
"extra" data fields would simply use the Layout class directly, rather than
wrapping LayoutPanel. That would give you free reign to use these fields
however you need to.

For layout constraints I could use Element.setPropertyObject

("layoutData", ...)


> Based on that, this is a StackLayoutPanel implementation with a

VBoxLayout manager:


> http://69.20.122.77:8880/gwt-layout4/


> The EntryPoint class is: http://pastebin.com/m66abdf1d


> Code: http://69.20.122.77:8880/gwt-layout4/org.gwt20.mosaic.demo.tbz2


> How do you handle not visible widgets (display: none) added to

LayoutPanel? In my demo I use:


>  public void setVisible(Widget w, boolean visible) {

   final Element containerElement = ((Layout.Layer) w.getLayoutData

()).getContainerElement();

   if (visible) {

     containerElement.getStyle().setProperty("display", "");

   } else {

     containerElement.getStyle().setProperty("display", "none");

   }

   w.setVisible(visible);

 }


This is kind of a tricky question, and I haven't built a good solution yet.
I started to write a method called setWidgetVisible(Widget, boolean) into
LayoutPanel, which did exactly what you describe above, but it just didn't
feel right. However, the current situation leads you to believe you can just
use Widget.setVisible() which leads to surprising behavior like events
getting eaten by the container element. I'm quite open to any ideas on how
this could be solved more cleanly!

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to