Announcement

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

    GWT 2.0 UIBinder

    Hi,

    Is there any idea to integrate UIBinder in SmartGWT. There is a great scope for it.

    Infact SmartGWT widgets works fine when not nested in within other widgets. I hope resolving this is not too complex.

    The main use will be,
    1. The widget presentation logic will be removed from application logic (java code) which will be more readable.
    2. Hugely helps in autogeneration of presentation logic.

    Thanks

    #2
    Try using search next time.

    Regarding those needs, SmartGWT already supports a declarative XML syntax for UI components that does not have any of the drawbacks of UIBinder. It's not covered adequately in the SmartGWT documentation yet, but the SmartClient documentation covers it and the usage is the same.

    Comment


      #3
      Hi,
      Thanks for the reply.

      Yes, we can use the declarative XML syntax for UI components. But there is one inherit advantage of using UIBinder
      i.e, for example a UIBinder
      Code:
              <gwt:VerticalPanel>
                      <gwt:HorizontalPanel>
                              <gwt:Label text="Login" />
                              <gwt:TextBox ui:field="loginBox" />
                              <gwt:Label ui:field="completionLabel1" />
                      </gwt:HorizontalPanel>
                      <gwt:HorizontalPanel>
                              <gwt:Label text="Password" />
                              <gwt:TextBox ui:field="passwordBox" />
                              <gwt:Label ui:field="completionLabel2" />
                      </gwt:HorizontalPanel>
                      <gwt:Button ui:field="buttonSubmit" text="Submit" />    
              </gwt:VerticalPanel>
      can be bound with the Java class as
      
      @UiField
      TextBox loginBox;
      
      @UiField
      TextBox passwordBox;
      
      @UiHandler("buttonSubmit")
          void doClickSubmit(ClickEvent event) {
          ..... // 100 lines of code
          }
      ...
      The event handlers are separated from display logic which is more convinient for
      firstly, to write in Java code with IDE support (syntax highlighting, debugger support, autocomplete, etc.)
      second, to minimize the code in display logic.

      Ex in SmartClient it be would as
      Code:
       <ListGrid>
           <recordClick><![CDATA[
               if (record.status != null && record.age > 65){
                   // 100 lines of code here
               }
           ]]></recordClick>
       </ListGrid>
      where the logic for "recordClick" event expands to 100 lines then,
      layout xml would be more difficult to interpret.
      The syntax for event handlers and parameters should be referred each time.

      Comment


        #4
        Remember you're looking at SmartClient docs as a temporary resource. You wouldn't use inline handlers in JavaScript in SmartGWT, instead, use Canvas.getById() to obtain the component and use the event handler registration APIs - same UI/event handling separation.

        Comment


          #5
          UIBinder compatibility

          I don't know why you invent another mechanism when there is one.
          We use UIBinder ourselves and we will use SmartGWT.
          I would appriciate, if we could send you patches our even if we could directly participate to the smartgwt code.

          We don't use Html, CSS or Javascript directly. But using UIBinder with the annotations makes programmers life easy.

          Comment


            #6
            Our declarative XML syntax has been in existence for 7 years before Google attempted a similar concept. And it requires less code.

            Comment


              #7
              Hello, I'm new on Smart...

              I seen this message about UIBinder and XML syntax of Smart, but I don't understand if it's possible in Smart XML to bind the object in the view <button id="btn"> to a backing component?.... Like you can with UIBinder.

              Thank you.

              Comment

              Working...
              X