Monday, February 6, 2012 7:34

Smart GWT FAQ

Tagged with:
Posted by on Wednesday, November 25, 2009, 14:49
This news item was posted in Web MVC category and has 0 Comments so far.

http://forums.smartclient.com/showthread.php?t=8159

Client Coding

  • Can I mix Smart GWT and GWT widgets?

    Yes, with caveats.

    Smart GWT has interoperability support that allows a Smart GWT widget to be added to a GWT
    container and allows a GWT widget to be added to a Smart GWT container, and it’s appropriate to
    use this for:

    • incremental migration to Smart GWT, such as introducing singular, sophisticated Smart GWT
      components like the Calendar or CubeGrid to an existing GWT application
    • using sophisticated third-party GWT widgets within Smart GWT, where Smart GWT doesn’t have
      corresponding built-in functionality

    However it does not make sense to freely intermix Smart GWT and GWT (or other)
    components, that is, for example, you should not place GWT widgets within a Smart GWT container
    that is in turn within a GWT container. In general, don’t intermix widgets unless the need for
    a feature forces you to.

    The reason for this is that there are limits to the maximum degree that two Ajax widget kits
    (including GWT) can interoperate – there are no standards that allow interoperability in the
    areas of management of tab order, zIndex management, pixel-perfect layout, section 508
    accessibility and multi-level modality.

    Note that “bugs” reported when intermixing GWT and Smart GWT inappropriately (that is, in
    contradiction to these guidelines) are generally going to be marked WONTFIX, although we will
    revisit this in the future if core GWT begins to support APIs that would allow better
    interoperability.

  • How do I make a Smart GWT widget fill a basic HTML container or GWT container?

    Because Smart GWT’s pixel-perfect layout and auto-sizing support goes beyond the capabilities of
    simple CSS layout, components need to know the actual pixel width they have been allocated;
    they cannot “flow into” an HTML element of unspecified size.

    The issue here is that GWT’s containers do not provide an API similar to Smart GWT’s
    Canvas.getInnerWidth(), which in Smart GWT can be used by child components to find out
    the available space to draw themselves in, and hence recursively lay out out their own
    children. Nor do GWT containers they fire events when they are resized, or when the
    available width changes for various reasons (e.g. scrollbar(s) introduced, or CSS style
    changes add borders and hence reduce space).

    A lot of parent<->child coordination and signaling is required to really create an extensible
    pixel-perfect layout system. Smart GWT/SmartClient has implemented all the necessary hooks to
    allow a third-party widget to be embedded inside a Canvas and participate in a precise layout,
    but GWT is not there yet.

    If you absolutely must place a Smart GWT interface inside a GWT container and you want it to
    fill the container, the best approach is to listen for a window-level resize event and run
    your own layout calculations that ultimately call resizeTo() on your topmost Smart GWT
    widget. All Smart GWT widgets nested under that topmost widget will then handle layout normally.

    NOTE: Don’t bother trying to find a way to insert width:100% into Smart GWT’s rendered HTML,
    this won’t work.

Leave a Reply

You can leave a response, or trackback from your own site.