nihad640 / smartgwt

Automatically exported from code.google.com/p/smartgwt
0 stars 0 forks source link

Error with smartgwt with gwt-presenter #753

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
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.GlobalDialogSubTabPr
esenter$MyProxy: Unable to create or inherit binding: No @Inject or default 
constructor found for 
com.gwtplatform.samples.tab.client.application.globaldialog.GlobalDialogSubTabPr
esenter$MyProxy
Path to required node:

com.gwtplatform.samples.tab.client.application.globaldialog.GlobalDialogSubTabPr
esenter$MyProxy 
[com.gwtplatform.mvp.client.gin.AbstractPresenterModule.bindPresenter(AbstractPr
esenterModule.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<?>>();
}

Original issue reported on code.google.com by sidjo...@gmail.com on 4 Aug 2014 at 1:02

GoogleCodeExporter commented 9 years ago
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/84
95829#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/Co
mponentXML.html

Original comment by smartgwt...@gmail.com on 4 Aug 2014 at 4:58