I dived into the gwt world a few months ago and am now trying to use the gwt request library. I followed this tutorial: http://code.google.com/p/gwtquery/wiki/GettingStarted
Since I work in Modle-View-Presenter, I tried to implement the above tutorial in my view (which is related to..View.ui .xml), but it seems to work.
I tried creating lable and then running the code:
List allGwtLabels = $ (". Gwt-Label"). widgets ();
but he doesn’t choose anything!
I think I need to somehow indicate where I want qwtQuery to look for widgets (point to my specific ui.xml file)
What am I doing wrong?
Thanks in advance. Below is my code for my Presenter + View + xml, which works with dosage:
public class QueryPresenter extends
Presenter<QueryPresenter.MyView, QueryPresenter.MyProxy> {
public interface MyView extends View {
}
@ProxyCodeSplit
@NameToken(NameTokens.query)
public interface MyProxy extends ProxyPlace<QueryPresenter> {
}
@Inject
public QueryPresenter(final EventBus eventBus, final MyView view,
final MyProxy proxy) {
super(eventBus, view, proxy);
}
@Override
protected void revealInParent() {
RevealRootContentEvent.fire(this, this);
}
@Override
protected void onBind() {
super.onBind();
}
}
public class QueryView extends ViewImpl implements QueryPresenter.MyView {
private final Widget widget;
public interface Binder extends UiBinder<Widget, QueryView> {
}
@Inject
public QueryView(final Binder binder) {
widget = binder.createAndBindUi(this);
List<Widget> allGwtLabels = $(".gwt-Label").widgets();
Label label = new Label("Click on me and I will disappear");
$(label).click(new Function() {
@Override
public void f(Widget w) {
$(w).fadeOut(1000);
}
});
_html.add(label);
}
@Override
public Widget asWidget() {
return widget;
}
@UiField Label _label;
@UiField HTMLPanel _html;
}
<!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'
ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
ui:generateKeys='com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator'
ui:generateLocales='default'>
<g:HTMLPanel ui:field="_html">
<script type="text/javascript" language="javascript" src="gquerytest/gquerytest.nocache.js"></script>
<g:Label text="hey" ui:field="_label"/>
</g:HTMLPanel>
</ui:UiBinder>