Announcement

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

    Smart GWT with GWT-Presenter

    I am trying to use smart gwt components in GWT-P project. I am able to compile it and getting the url.

    Bug during runtime I am getting the error::
    [ERROR] [sampletab] - Error injecting com.gwtplatform.samples.tab.client.application.globaldialog.GlobalDialogSubTabPresenter$MyProxy: Unable to create or inherit binding: No @Inject or default constructor found for com.gwtplatform.samples.tab.client.application.globaldialog.GlobalDialogSubTabPresenter$MyProxy
    Path to required node:

    com.gwtplatform.samples.tab.client.application.globaldialog.GlobalDialogSubTabPresenter$MyProxy [com.gwtplatform.mvp.client.gin.AbstractPresenterModule.bindPresenter(AbstractPresenterModule.java:124)]


    GWT version 2.6.1
    Jars in build path: gin-2.1.2.jar, guice-3.0.jar, guice-assistedinject-3.0.jar, guice-servlet-3.0.jar, javax.inject.jar, gwtp-mvp-client-1.2.1.jar, gwtp-mvp-shared-1.2.1.jar, gwtp-clients-common-1.2.1.jar, gwtp-all-1.2.1.jar, uibinding-smartgwt-1.0.11-SMARTGWT-4.1p.jar.

    Browser: IE11.


    UI.xml file:
    <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
    xmlns:smt="urn:import:org.synthful.smartgwt.client.widgets"
    xmlns:g="urn:import:com.google.gwt.user.client.ui">
    <g:HTMLPanel addStyleNames="{style.panel}">
    <smt:UIVLayout ui:field="container" height="100%" width="100%" >
    <smt:UIVLayout ui:field="okLayout" width="100%" visible="true" membersMargin="20" layoutLeftMargin="10" layoutTopMargin="4">
    <smt:UIHLayout width="100%" layoutHAlign="CENTER">
    <smt:UIButton ui:field="okButton" styleName="err_hdr" visible="true" text="OK Button" />
    </smt:UIHLayout>
    </smt:UIVLayout>
    </smt:UIVLayout>
    </g:HTMLPanel>
    </ui:UiBinder>



    View.java::

    public class GlobalDialogSubTabView extends ViewWithUiHandlers<GlobalDialogSubTabUiHandlers> implements
    GlobalDialogSubTabPresenter.MyView {
    interface Binder extends UiBinder<Widget, GlobalDialogSubTabView> {
    }

    @UiField
    UIVLayout container;

    @UiField
    UIVLayout okLayout;

    @UiField
    UIButton okButton;
    public final Widget widget;

    private static Binder uiBinder = GWT.create(Binder.class);

    @Inject
    GlobalDialogSubTabView(Binder uiBinder2) {
    super();
    widget = uiBinder.createAndBindUi(this);
    //initWidget(uiBinder.createAndBindUi(this));
    }

    @UiHandler("globalDialog")
    void onGlobalClicked(ClickEvent event) {
    getUiHandlers().showGlobalDialog();
    }

    @UiHandler("popupLink")
    void onPopupLinkClicked(MouseDownEvent event) {
    getUiHandlers().showInfoPopup(event.getClientX(), event.getClientY());
    }
    @Override
    public void showSlot(Object slot) {
    okLayout.setVisible(slot == GlobalDialogSubTabPresenter.TYPE_OK);

    }
    public UIVLayout getContainer() {
    return container;
    }

    @Override
    public HasClickHandlers getOkButton() {
    return okButton;
    }
    }


    Presenter.java::
    public class GlobalDialogSubTabPresenter extends
    Presenter<GlobalDialogSubTabPresenter.MyView, GlobalDialogSubTabPresenter.MyProxy> implements
    GlobalDialogSubTabUiHandlers {

    @Inject
    GlobalDialogSubTabPresenter(EventBus eventBus,
    MyView view,
    MyProxy proxy,
    GlobalDialogPresenterWidget globalDialog,
    InfoPopupPresenterWidget infoPopup) {
    super(eventBus, view, proxy, DialogSamplePresenter.SLOT_SetTabContent);

    this.globalDialog = globalDialog;
    this.infoPopup = infoPopup;

    getView().setUiHandlers(this);
    }

    @ProxyCodeSplit
    @NameToken(NameTokens.globalDialogSamplePage)
    @TabInfo(container = DialogSamplePresenter.class, label = "Global", priority = 0)
    public interface MyProxy extends TabContentProxyPlace<GlobalDialogSubTabPresenter> {
    }

    public interface MyView extends View, HasUiHandlers<GlobalDialogSubTabUiHandlers> {
    void showSlot(Object slot);
    HasClickHandlers getOkButton();
    }

    private final GlobalDialogPresenterWidget globalDialog;
    private final InfoPopupPresenterWidget infoPopup;

    public void showGlobalDialog() {
    RevealRootPopupContentEvent.fire(this, globalDialog);
    }

    @Override
    public void showInfoPopup(int mousePosX, int mousePosY) {
    addToPopupSlot(infoPopup, false);
    PopupView popupView = infoPopup.getView();
    popupView.setPosition(mousePosX + 15, mousePosY);
    }
    @ContentSlot
    public static final Type<RevealContentHandler<?>> TYPE_OK = new Type<RevealContentHandler<?>>();
    }
    Last edited by sidjoshy; 4 Aug 2014, 05:01.

    #2
    Don't try to use GWTP with SmartGWT, it's redundant and will simply produce huge amounts of unnecessary code:

    http://stackoverflow.com/questions/8484747/gwt-mvp-and-smartgwt-compatibility/8495829#8495829

    UIBinder can't support an advanced widget library like SmartGWT:

    https://code.google.com/p/smartgwt/issues/detail?id=485

    SmartGWT has a built-in solution that is more flexible and faster (doesn't require compilation), called Component XML:

    http://www.smartclient.com/smartgwtee-latest/javadoc/com/smartgwt/client/docs/ComponentXML.html

    Comment

    Working...
    X