google-code-export / gwt-platform

Automatically exported from code.google.com/p/gwt-platform
1 stars 0 forks source link

Editor Framework won't display data on editorDriver.edit #422

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

THE MODEL:
----------
public class MyModel {
    private Long id;
    private String username;
    private String password;

    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
}

THE PRESENTER:
--------------
public class MyPresenter extends Presenter<MyPresenter.MyView, 
MyPresenter.MyProxy> implements MyUiHandlers {
    public interface MyView extends View, HasUiHandlers<MyUiHandlers>, Editor<MyModel> {}

    @ProxyStandard
    @NameToken(NameTokens.myPage)
    @NoGatekeeper
    public interface MyProxy extends ProxyPlace<MyPresenter> {}

    interface Driver extends SimpleBeanEditorDriver<MyModel, MyView> {}
    private Driver editorDriver;
    DispatchAsync dispatcher;

    @Inject
    public MyPresenter(EventBus eventBus, MyView view, MyProxy proxy, DispatchAsync dispatcher) {
        super(eventBus, view, proxy);
        getView().setUiHandlers(this);
        this.dispatcher = dispatcher;

        MyModel m = new MyModel();
        m.setId(1L);
        m.setUsername("username");
        m.setPassword("password");

        editorDriver = GWT.create(Driver.class);
        editorDriver.initialize(this.getView());
        editorDriver.edit(m);
    }

    ...
}

THE VIEW:
---------
public class MyViewPage extends ViewWithUiHandlers<MyUiHandlers> implements 
MyPresenter.MyView {
    private static MyViewPageUiBinder uiBinder = GWT.create(MyViewPageUiBinder.class);
    interface MyViewPageUiBinder extends UiBinder<Widget, MyViewPage> {}

    public final Widget widget;
    @UiField ValueBoxEditorDecorator<Long> id;
    @UiField ValueBoxEditorDecorator<String> username;
    @UiField ValueBoxEditorDecorator<String> password;

    public MyViewPage() {
        widget = uiBinder.createAndBindUi(this);
    }

    @Override
    public Widget asWidget() {
        return widget;
    }
}

THE UI.XML:
----------
<g:HTMLPanel>
    <e:ValueBoxEditorDecorator ui:field="id">
        <e:valuebox>
            <g:LongBox/>
        </e:valuebox>
    </e:ValueBoxEditorDecorator>

    <e:ValueBoxEditorDecorator ui:field="username">
        <e:valuebox>
            <g:TextBox/>
        </e:valuebox>
    </e:ValueBoxEditorDecorator>

    <e:ValueBoxEditorDecorator ui:field="password">
        <e:valuebox>
            <g:PasswordTextBox/>
        </e:valuebox>
    </e:ValueBoxEditorDecorator>
</g:HTMLPanel>

What is the expected output? What do you see instead?
EXPECTED:
3 Input-Boxes filled with the given data ("1", "username", "password")

WHAT I SEE INSTEAD:
3 Input-Boxes with no values

What version of the product are you using? On what operating system?
- Mac OS X 10.7.4 Lion
- Eclipse 3.7 Indigo Service Release 2
- Maven modelVersion 4.0.0
- GWT 2.4.0
- guice 3.0
- gin 1.5.0
- gwt-platform 0.7

Please provide any additional information below.

THE GWT.XML:
------------
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to="website">
    <inherits name="com.google.gwt.user.User" />

    <!-- GWT Platform MVP Framework & Dispatch Module -->
    <inherits name='com.gwtplatform.mvp.Mvp' />
    <inherits name='com.gwtplatform.dispatch.Dispatch' />

    <!-- GIN Dependency Injection Framework -->
    <define-configuration-property name="gin.ginjector" is-multi-valued="false" />
    <set-configuration-property name="gin.ginjector" value="website.client.gin.MyGinjector" />

    <!-- Twitter Bootstrap -->
    <inherits name="com.githu1b.gwtbootstrap.Bootstrap"/>
    <!-- Responsive Design für Bootstrap aktivieren -->
    <set-property name="bootstrap.responsiveDesign" value="true"/>

    <!-- Editor Framework -->
    <inherits name='com.google.gwt.editor.Editor' />

    <!-- Der Einstiegspunkt der Applikation -->
    <entry-point class="website.client.Website" />

    <source path="client" />
    <source path="shared" />
</module>

Original issue reported on code.google.com by hnsh...@googlemail.com on 21 May 2012 at 8:19

GoogleCodeExporter commented 9 years ago
If I do this inside my View the form get's filled. But this shouldn't be the 
way it's meant to be:

public class MyViewPage extends ViewWithUiHandlers<MyUiHandlers> implements 
MyPresenter.MyView {
    private static MyViewUiBinder uiBinder = GWT.create(MyViewUiBinder.class);
    interface MyViewUiBinder extends UiBinder<Widget, MyViewPage> {}

    public final Widget widget;

    @UiField ValueBoxEditorDecorator<Long> id;
    @UiField ValueBoxEditorDecorator<String> username;
    @UiField ValueBoxEditorDecorator<String> password;

    interface Driver extends SimpleBeanEditorDriver<MyModel, MyViewPage> {}
    private Driver editorDriver;

    public MyViewPage() {
        widget = uiBinder.createAndBindUi(this);

        MyModel m = new MyModel();
        m.setId(1L);
        m.setUsername("username");
        m.setPassword("password");

        editorDriver = GWT.create(Driver.class);
        editorDriver.initialize(this);
        editorDriver.edit(m);
    }

    @Override
    public Widget asWidget() {
        return widget;
    }
}

Original comment by hnsh...@googlemail.com on 21 May 2012 at 8:52

GoogleCodeExporter commented 9 years ago
This is not a GWTP problem. The editor framework won't work with an interface 
since it's using reflection at compile time to create the data binding 
accessors on the fields.

If your interface doesn't know about the fields, the editor framework won't 
know either.

Original comment by christia...@arcbees.com on 23 May 2012 at 2:18

GoogleCodeExporter commented 9 years ago

Original comment by goudreau...@gmail.com on 23 May 2012 at 2:19

GoogleCodeExporter commented 9 years ago
Take a look: 
https://github.com/gwtbootstrap/gwt-bootstrap/issues/82#issuecomment-5354194

Original comment by caarlos0 on 24 May 2012 at 8:59