1. #1
    Sencha User
    Join Date
    Jan 2011
    Location
    Lima, Peru
    Posts
    43
    Answers
    5
    Vote Rating
    4
    poseidonjm is on a distinguished road

      0  

    Default Answered: (beta2) Editor extends Window doesn't work

    Answered: (beta2) Editor extends Window doesn't work


    When I try create a editor that extends Window i get the following error:
    [DEBUG] [examplerf] - Rebinding com.examplerf.client.ExampleRF.Driver
    [DEBUG] [examplerf] - Invoking generator com.google.web.bindery.requestfactory.gwt.rebind.RequestFactoryEditorDriverGenerator
    [DEBUG] [examplerf] - Creating Editor model for com.examplerf.client.ExampleRF.Driver
    [ERROR] [examplerf] - Could not find a getter for path getHideButton in proxy type com.examplerf.shared.proxy.ColaboradorProxy
    [ERROR] [examplerf] - Unable to create Editor model due to previous errors

    my editor is:
    Code:
    public class ColaboradorEditor extends Window implements Editor<ColaboradorProxy> {
        
        private static ColaboradorUiBinder uiBinder = GWT.create(ColaboradorUiBinder.class);
    
        interface ColaboradorUiBinder extends UiBinder<Widget, ColaboradorEditor> {
        }
        @UiField
        FramedPanel form;
        
        @UiField
        TextField nombres;
        
        @UiField
        TextField apellidos;
        
        @UiField(provided = true)
        NumberField<Integer> edad;
                
        public ColaboradorEditor() {
            
            edad = new NumberField<Integer>(new NumberPropertyEditor.IntegerPropertyEditor());
           
            setWidget(uiBinder.createAndBindUi(this));
            
            form.getHeader().setVisible(false);        
        }
    }
    my uibinder is:
    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:gxt="urn:import:com.sencha.gxt.widget.core.client"
        xmlns:form="urn:import:com.sencha.gxt.widget.core.client.form"
        xmlns:container="urn:import:com.sencha.gxt.widget.core.client.container"
        xmlns:button="urn:import:com.sencha.gxt.widget.core.client.button" >
        
        <ui:with type="com.examplerf.client.images.ExampleRFImages" field="images" />
        
        <ui:with type="com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData" field="verticalLayoutData">
            <ui:attributes width="1" height="-1" />
          </ui:with>
                
        <ui:style>
            .important {
                font-weight: bold;
            }
        </ui:style>
        
          <gxt:FramedPanel ui:field="form" headerVisible="false" buttonAlign="END" >
            <form:FieldSet ui:field="fieldSet" headingText="User Information" collapsible="false"  >
              <container:VerticalLayoutContainer>
                <container:child layoutData="{verticalLayoutData}">
                  <form:FieldLabel text="First Name">
                    <form:widget>
                      <form:TextField ui:field="nombres" allowBlank="false" />
                    </form:widget>
                  </form:FieldLabel>
                </container:child>
                <container:child layoutData="{verticalLayoutData}">
                  <form:FieldLabel text="Last Name">
                    <form:widget>
                      <form:TextField ui:field="apellidos" allowBlank="false" />
                    </form:widget>
                  </form:FieldLabel>              
                </container:child>
                <container:child layoutData="{verticalLayoutData}">
                  <form:FieldLabel text="Age">
                    <form:widget>
                      <form:NumberField ui:field="edad" />
                    </form:widget>
                  </form:FieldLabel>
                </container:child>
              </container:VerticalLayoutContainer>
            </form:FieldSet>
            
            <gxt:button>
              <button:TextButton text="Save" ui:field="save" icon="{images.save}" />
            </gxt:button>
            <gxt:button>
              <button:TextButton text="Cancel" ui:field="cancel" icon="{images.cancel}" />
            </gxt:button>
                    
          </gxt:FramedPanel>
    
    </ui:UiBinder>
    and my proxy
    Code:
    package com.examplerf.shared.proxy;
    
    import com.examplerf.server.domain.Colaborador;
    import com.examplerf.server.locator.ObjectifyLocator;
    import com.google.web.bindery.requestfactory.shared.EntityProxy;
    import com.google.web.bindery.requestfactory.shared.ProxyFor;
    
    @ProxyFor(value = Colaborador.class, locator = ObjectifyLocator.class)
    public interface ColaboradorProxy extends EntityProxy {
        String getNombres();
        void setNombres(String nombres);
        String getApellidos();
        void setApellidos(String apellidos);
        Integer getEdad();
        void setEdad(Integer edad);    
        Long getId();
        void setId(Long id);
    }
    any ideas?

  2. Because TextButton extends CellComponent, which implements Editor, the driver believes that the exposed getter for the button is meant to be bound to your model.

    Two ways to correct this that I can of. First, while still extending Window, override the getHideButton method, and decorate it with @Ignore, the GWT annotation used to indicate that while something implements Editor, it isn't to be used as an Editor in this situation.

    Second way: Don't extend Window. Favor composition over inheritance when designing a new UI element. In this case, you likely want to show the window only when you have an item to edit with it, so wrap up the editor driver, and expose a show(MyModel) (and maybe a hide()) method. You won't have to deal with any superclass editor instances, and you won't risk calling the wrong method when using this new type. Alternatively, leave the driver external, and just expose a way to show/hide the inner dialog.

    The UiBinder interface's first generic param refers to the root element in the .ui.xml file, which can let you use the result of the createAndBind call as a field.

    In this case I'd start with something like this
    Code:
    public class ColaboradorEditor implements Editor<ColaboradorProxy> {
        
        private static ColaboradorUiBinder uiBinder = GWT.create(ColaboradorUiBinder.class);
    
        // note that I changed the generics here, as Window is the root of the ui.xml
        interface ColaboradorUiBinder extends UiBinder<Window, ColaboradorEditor> {
        }
    
        Window root;
        // I removed the framedpanel, since the Window can hold buttons as well
        // Add it back to get that extra border
        
        @UiField
        TextField nombres;
        
        @UiField
        TextField apellidos;
        
        @UiField(provided = true)
        NumberField<Integer> edad;
                
        public ColaboradorEditor() {
            
            edad = new NumberField<Integer>(new NumberPropertyEditor.IntegerPropertyEditor());
           
            root = uiBinder.createAndBindUi(this);
            
            form.getHeader().setVisible(false);        
        }
    
        public void show() {
            root.show();
        }
        public void hide() {
            root.hide();
        }
    }
    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:gxt="urn:import:com.sencha.gxt.widget.core.client"
        xmlns:form="urn:import:com.sencha.gxt.widget.core.client.form"
        xmlns:container="urn:import:com.sencha.gxt.widget.core.client.container"
        xmlns:button="urn:import:com.sencha.gxt.widget.core.client.button" >
        
        <ui:with type="com.examplerf.client.images.ExampleRFImages" field="images" />
        
        <ui:with type="com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData" field="verticalLayoutData">
            <ui:attributes width="1" height="-1" />
          </ui:with>
                
        <ui:style>
            .important {
                font-weight: bold;
            }
        </ui:style>
        
          <gxt:Window buttonAlign="END" >
            <form:FieldSet ui:field="fieldSet" headingText="User Information" collapsible="false"  >
              <container:VerticalLayoutContainer>
                <container:child layoutData="{verticalLayoutData}">
                  <form:FieldLabel text="First Name">
                    <form:widget>
                      <form:TextField ui:field="nombres" allowBlank="false" />
                    </form:widget>
                  </form:FieldLabel>
                </container:child>
                <container:child layoutData="{verticalLayoutData}">
                  <form:FieldLabel text="Last Name">
                    <form:widget>
                      <form:TextField ui:field="apellidos" allowBlank="false" />
                    </form:widget>
                  </form:FieldLabel>              
                </container:child>
                <container:child layoutData="{verticalLayoutData}">
                  <form:FieldLabel text="Age">
                    <form:widget>
                      <form:NumberField ui:field="edad" />
                    </form:widget>
                  </form:FieldLabel>
                </container:child>
              </container:VerticalLayoutContainer>
            </form:FieldSet>
            
            <gxt:button>
              <button:TextButton text="Save" ui:field="save" icon="{images.save}" />
            </gxt:button>
            <gxt:button>
              <button:TextButton text="Cancel" ui:field="cancel" icon="{images.cancel}" />
            </gxt:button>
                    
          </gxt:Window>
    
    </ui:UiBinder>

  3. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,644
    Answers
    107
    Vote Rating
    80
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      1  

    Default


    Because TextButton extends CellComponent, which implements Editor, the driver believes that the exposed getter for the button is meant to be bound to your model.

    Two ways to correct this that I can of. First, while still extending Window, override the getHideButton method, and decorate it with @Ignore, the GWT annotation used to indicate that while something implements Editor, it isn't to be used as an Editor in this situation.

    Second way: Don't extend Window. Favor composition over inheritance when designing a new UI element. In this case, you likely want to show the window only when you have an item to edit with it, so wrap up the editor driver, and expose a show(MyModel) (and maybe a hide()) method. You won't have to deal with any superclass editor instances, and you won't risk calling the wrong method when using this new type. Alternatively, leave the driver external, and just expose a way to show/hide the inner dialog.

    The UiBinder interface's first generic param refers to the root element in the .ui.xml file, which can let you use the result of the createAndBind call as a field.

    In this case I'd start with something like this
    Code:
    public class ColaboradorEditor implements Editor<ColaboradorProxy> {
        
        private static ColaboradorUiBinder uiBinder = GWT.create(ColaboradorUiBinder.class);
    
        // note that I changed the generics here, as Window is the root of the ui.xml
        interface ColaboradorUiBinder extends UiBinder<Window, ColaboradorEditor> {
        }
    
        Window root;
        // I removed the framedpanel, since the Window can hold buttons as well
        // Add it back to get that extra border
        
        @UiField
        TextField nombres;
        
        @UiField
        TextField apellidos;
        
        @UiField(provided = true)
        NumberField<Integer> edad;
                
        public ColaboradorEditor() {
            
            edad = new NumberField<Integer>(new NumberPropertyEditor.IntegerPropertyEditor());
           
            root = uiBinder.createAndBindUi(this);
            
            form.getHeader().setVisible(false);        
        }
    
        public void show() {
            root.show();
        }
        public void hide() {
            root.hide();
        }
    }
    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:gxt="urn:import:com.sencha.gxt.widget.core.client"
        xmlns:form="urn:import:com.sencha.gxt.widget.core.client.form"
        xmlns:container="urn:import:com.sencha.gxt.widget.core.client.container"
        xmlns:button="urn:import:com.sencha.gxt.widget.core.client.button" >
        
        <ui:with type="com.examplerf.client.images.ExampleRFImages" field="images" />
        
        <ui:with type="com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData" field="verticalLayoutData">
            <ui:attributes width="1" height="-1" />
          </ui:with>
                
        <ui:style>
            .important {
                font-weight: bold;
            }
        </ui:style>
        
          <gxt:Window buttonAlign="END" >
            <form:FieldSet ui:field="fieldSet" headingText="User Information" collapsible="false"  >
              <container:VerticalLayoutContainer>
                <container:child layoutData="{verticalLayoutData}">
                  <form:FieldLabel text="First Name">
                    <form:widget>
                      <form:TextField ui:field="nombres" allowBlank="false" />
                    </form:widget>
                  </form:FieldLabel>
                </container:child>
                <container:child layoutData="{verticalLayoutData}">
                  <form:FieldLabel text="Last Name">
                    <form:widget>
                      <form:TextField ui:field="apellidos" allowBlank="false" />
                    </form:widget>
                  </form:FieldLabel>              
                </container:child>
                <container:child layoutData="{verticalLayoutData}">
                  <form:FieldLabel text="Age">
                    <form:widget>
                      <form:NumberField ui:field="edad" />
                    </form:widget>
                  </form:FieldLabel>
                </container:child>
              </container:VerticalLayoutContainer>
            </form:FieldSet>
            
            <gxt:button>
              <button:TextButton text="Save" ui:field="save" icon="{images.save}" />
            </gxt:button>
            <gxt:button>
              <button:TextButton text="Cancel" ui:field="cancel" icon="{images.cancel}" />
            </gxt:button>
                    
          </gxt:Window>
    
    </ui:UiBinder>

  4. #3
    Sencha User
    Join Date
    Jan 2011
    Location
    Lima, Peru
    Posts
    43
    Answers
    5
    Vote Rating
    4
    poseidonjm is on a distinguished road

      0  

    Default


    Thanks Colin that's cool
    I will use the second approach
    because does my code more clear.
    Code:
    Window root;    
        @UiField
        TextField nombres;
        
        @UiField
        TextField apellidos;
        
        @UiField(provided = true)
        NumberField<Integer> edad;    
        
        public ColaboradorEditor() {
            handlerManager = new HandlerManager(this);
            
            edad = new NumberField<Integer>(new NumberPropertyEditor.IntegerPropertyEditor());
            //edad.setAllowDecimals(false);
            root = (Window) uiBinder.createAndBindUi(this);    
        }

  5. #4
    Sencha User
    Join Date
    Jun 2011
    Posts
    12
    Vote Rating
    0
    Firelight is on a distinguished road

      0  

    Default


    Tried in gxt 3.0.1 release with gwt 2.5.1:

    overriding method doesn't work. It seems the single solution is to cease using Window class in conjuction with Editor one.
    Last edited by Firelight; 5 Jul 2013 at 1:15 AM. Reason: errata

  6. #5
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,644
    Answers
    107
    Vote Rating
    80
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    Firelight, what method are you talking about? Window works just fine with editor in 3.0.1, at least as far as I am able to tell - can you be more specific?

  7. #6
    Sencha User
    Join Date
    Jun 2011
    Posts
    12
    Vote Rating
    0
    Firelight is on a distinguished road

      0  

    Default


    Overriding and @Ignore annotation doesn't hide getHideButton() from Editor. It tries to handle it as real field.

  8. #7
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,644
    Answers
    107
    Vote Rating
    80
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    As a rule, it is better to not extend the window and insert content, but to wrap it up - i.e. use composition instead of inheritance. Extending it means that some you must have all fields and methods declared at a higher level than the current class, so the editor framework is going to try to use those methods.

    This could be interpreted as a bug in the editor framework - please consider filing a bug with a runnable test case in the GWT issue tracker so it can be fixed in a future release.

  9. #8
    Sencha User
    Join Date
    Aug 2013
    Posts
    1
    Vote Rating
    0
    vysserk3 is on a distinguished road

      0  

    Default Composite wrapping a Dialog

    Composite wrapping a Dialog


    Hello !

    In my case, when wrapping a Dialog (which extends Window) with a composite I've got the issue described here http://grokbase.com/t/gg/google-web-toolkit/1324yseme2/cannot-show-dialogbox-illegalstateexception


    I don't use UIBinder and my Dialog is not inside a FlowPanel. I just call show() on it (the one inherited from the Window class).
    It seems that calling show() eventually calls removefromParent() which raises the IllegalStateException...

    Any ideas ?

    Thanks

  10. #9
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,644
    Answers
    107
    Vote Rating
    80
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    vysserk3 - can you share a runnable code sample that demonstrates the issue? Your description sounds like you are getting a similar error message without doing the same thing at all, which really doesn't give us much to go on when helping you...

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar