Monday, January 31, 2011

Re: Spring ROO GWT with GIN injection on widgets created by ui:binder.

I'm not sure which MVP framework I'm using, I'm basically using whatever framework is being generated by Spring ROO after using the "gwt setup" command and since this is my first time using GWT since pre version 1.5, I'm pretty lost.

That would probably work under normal gwt, but the component needs to be added via ui:binder, so can't do that fancy footwork of manually creating it and then adding it to RootPanel unless there is a way of doing it the ui:binder way?

In ScaffoldDesktopShell.ui.xml I'm inserting the component via xml:

[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:s='urn:import:com.ig.client.scaffold.ui'
             xmlns:ig='urn:import:com.ig.client.scaffold.ui.widget'>


    <ui:style>
        @def contentWidth 850px;
        ....
    </ui:style>

    <g:DockLayoutPanel unit='EM'>
        ...
        <ig:RorView  />
        ....
    </g:DockLayoutPanel>
</ui:UiBinder>
[/code]

The ScaffoldDesktopShell itself looks like this:

[code]
public class ScaffoldDesktopShell extends Composite {
    interface Binder extends UiBinder<Widget, ScaffoldDesktopShell> {
    }

    private static final Binder BINDER = GWT.create(Binder.class);

    @UiField SimplePanel details;
    @UiField DivElement error;
    @UiField LoginWidget loginWidget;
    @UiField SimplePanel master;
    @UiField NotificationMole mole;
    @UiField(provided = true)
    ValuePicker<ProxyListPlace> placesBox = new ValuePicker<ProxyListPlace>(new ApplicationListPlaceRenderer());

    public ScaffoldDesktopShell() {
        initWidget(BINDER.createAndBindUi(this));
    }
    public SimplePanel getDetailsPanel() {
        return details;
    }
    public LoginWidget getLoginWidget() {
        return loginWidget;
    }
    public SimplePanel getMasterPanel() {
        return master;
    }
    public NotificationMole getMole() {
        return mole;
    }
    public HasConstrainedValue<ProxyListPlace> getPlacesBox() {
        return placesBox;
    }
    public void setError(String string) {
        error.setInnerText(string);
    }
}
[/code]

PS, will attached code be displayed?


--
Jan Vladimir Mostert
BEngSci

Mail: jan@mycee.com
MyCee Technologies


On Mon, Jan 31, 2011 at 8:10 PM, Jeff Larsen <larsenje@gmail.com> wrote:
What framework are you using to do your MVP stuff? this looks a lot like gwt-presenter or gwtp.


Ignoring GIN for a second, because this is easier to illustrate without DI, 

add the method 

public Widget getView() {
 return display.asWidget();
}

RorPresenter presenter = new RorPresenter(new RorView(), eventBus);
presenter.bind();
RootPanel.get().add(presenter.getView());


This should get you your button clicks to give you your Window.alerts. 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment