Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Integrate smartGWT formItem with GWT UIBinder

    I would like to use smartGWT as a pure component library that is integrated with GWT so I can use benefits of GWT that are mainly:
    - UI binder those layout is easy to manage by designers and is recommend by GWT
    - GWT Editors with validators where we can directly use our POJOs

    I sucessfully integrated smartGWT widgets with UIBinder just have a problem with FormItem because they are not extending Widget (or Canvas) and only one way I see there is wrap each FormItem to DynamicForm that leads into multiple form elements in generated HTML that is not recommended.

    I want to have following:
    Code:
    <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
    <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
    	xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:editor="urn:import:nl.vwpfs.pos.mo.client.editor"
    	ui:generateFormat="com.google.gwt.i18n.rebind.format.PropertiesFormat"
    	ui:generateKeys="com.google.gwt.i18n.server.keygen.MD5KeyGenerator"
    	ui:generateLocales="nl">
    
    	<g:HTMLPanel>
    		<p>
    			THIS IS TEST FORM WITH SMARTGWT WIDGETS
    		</p>
    		<hr class="space" />
    		<div class="felements">
    			<!-- row -->
    			<div class="fspan-13">
    				<editor:TextItemEditor ui:field="name" />
    			</div>
    		</div>
    		<hr class="space" />
    	</g:HTMLPanel>
    </ui:UiBinder>
    and then I can use such widgets in following way:
    Code:
    SearchListWidget searchListWidget = new SearchListWidget();
    searchListEditorDriver.initialize(searchListWidget);
    TestDossier testDossier = new TestDossier();
    testDossier.setName("TEST NAME");
    searchListEditorDriver.edit(testDossier);
    so I have very nice and rich widget from smartGWT and still features of GWT.

    Is there any way how to wrap FormItems into Widget (the best is to wrap it into Div element)?

    Thanks,

    Michal

    #2
    These are both considered very bad practices for SmartGWT. Instead:

    1. use Component XML in place of UIBinder
    2. use SmartGWT data binding

    As far as #1, GWT has declined to make UIBinder extensible enough to allow third-party widget to participate cleanly - more detail here. Because of this and because it's not nearly as flexible (requires compiler to interpret XML) we don't recommend it. This is also not a supported approach with respect to your support contract.

    As far as data binding, you lose a huge number of client and server features and introduce a great deal of complexity going with GWT-based data binding. You will need to "reinvent the wheel" again and again and again. We can't emphasize enough how bad an idea this is.

    And here as well, just to provide fair warning, if it is awkward to work with POJOs or certain features won't work with POJOs, this will not be considered a bug.

    Comment


      #3
      thanks for quick reply and posted link - very useful.

      Do you have sample in showcase that demostrates Component XML or do you have documented this feature? I was looking for that but didnt see it there, only saw definition of DataSource in XML.

      About using SmartGWT with GWT:
      1. UIBinder - by my opinion UIBinder is more flexible, you can design there various html layouts and style it according to customer requirements. in SmartGWT I have to set properties of components and change standard theme that takes much more time as doing that in html layout

      2. GWT Editors - GWT Editors with RequestFactory and Validators offers me everything I want, I dont have to reinvent the wheel, everything is there, it has a lot of advantages - I can work with POJO (dont have to get attributes of javascript object), can change or mix any component widgets

      I am looking at widget as components that can be added to my html without any restrictions, like for example other GWT libraries (Bootstrap, GXT) or JavaScript libraries (JQuery UI).
      I want nice widget (and SmartGWT has very nice widgets) that generates necessary HTML and have API for interaction (setting values), everything other necessary in frontend is covered by GWT.

      thanks

      michal

      Comment


        #4
        Component XML overview.

        1. you really, really, really don't want to use HTML for layout, it is a forest of cross-browser bugs as well as bugs between different revisions and modes of the same browser. This is one of the main drawbacks of UIBinder, not a strength. Use our layout managers so you don't have such issues; they are cross-browser and cross-mode consistent.

        2. it is a completely absurd assertion to say that RequestFactory and Validators comes anywhere near SmartGWT's built-in data binding. There are so many things missing that it is nearly a list of every feature in the SmartGWT product, and committers to GWT have publicly commented that RequestFactory still has lots of serious bugs.

        You also really really don't want to mix UI components from multiple frameworks (such as JQuery UI). This has all the same problems as mixing GWT and SmartGWT components explained in the FAQ, only much worse since they aren't even GWT components.

        Again, from a cursory glance, some of these things might seem like a good idea, this is a set of really really terrible architectural decisions, and everyone we've seen go down similar paths fails utterly, every time.

        And again, if you head down this path, you will lose a lot of the value of having support. We will not troubleshoot anything that involves UIBinder or mixing UI components at all - these are just unsupported approaches.

        We will not troubleshoot any problem related to RequestFactory until we have a code sample that reproduces the problem without RequestFactory, because it's too complex and buggy for it to be credible that a problem in RequestFactory-based code is likely to be a bug in SGWT.

        If you refuse to take our advice on the face of it, we would recommend trying to replicate one of the more sophisticated Showcase examples based on RequestFactory - perhaps the Many-Many Transactional Drag and Drop sample. When that fails, reconsider the ideas above.

        Comment

        Working...
        X