gwtQuery的好处 [英] benefits of gwtQuery

查看:156
本文介绍了gwtQuery的好处的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我使用gwt query的好处吗?只是为了css效果。以及我们如何使用它来创建像gwt这样的UI元素。

我的理解是在项目中使用像标签,文本框,按钮等gwt组件,然后gwt查询只是对组件给出一些效果,是这样吗? ?

如果是css效果,那么我们也可以在gwt中做同样的事情,那么为什么我会使用Gwtquery而不是gwt。可以有人帮助我..



感谢,

解决方案

远不止于此。例如,您可以快速轻松地导航到de DOM(例如jQuery)!



看,今天早上我以这种方式使用它:

 元素p = DOM.createElement(p); 
p.addClassName(KV);
p.setInnerText(newBody);
$(cellList +#__ idx = \+ position +\p .KV)。replaceWith(p);

如果您查看最后一行,您会看到:
相关的DOM对于小部件 cellList (来自MGWT的CellList),搜索具有id __ idx的元素,然后选择元素 p 并从它们中获得具有类KV的元素。



你有没有想过正常gwt中的代码呢?



其他可以使用的真正有用的东西是Promise模式。
如果B正确完成,则做A,如果C正确完成,则做B。我们正在使用它在我们的应用程序中进行oAuth身份验证。相信如果你在一行中处理Facebook OAuth,你可以确定所有东西都没有问题。



如果你不使用GQuery,你可能需要创建4个Callbacks和它的onSuccess和失败方法(Spaguetti代码)。



还有更多的东西......



而Opensource社区就在这个项目之下,这是一个好兆头。

Can somebody tell me what are the benefits of using gwt query .Is it just for css effects. and how we can use it to create ui elemnts like gwt.

What I understand is just use the gwt components like label,textbox,buton in project and then gwt query is just to give some effects to that components , is it like that?

If it is for css effects then same thing we can do it in gwt also, then why I will use Gwtquery instead of gwt. can somebody help me ..

Thanks,

解决方案

GQuery is much more than that. You can navigate into de DOM fast and easy (like jQuery), for example!

Look, this morning I used it in that way:

Element p = DOM.createElement("p");
p.addClassName("KV");
p.setInnerText(newBody);
$(cellList + " #__idx=\""+position+"\" p .KV").replaceWith(p);

If you take a look into the last line you´ll see: The related DOM for the widget cellList (CellList from MGWT), search the element that has the id "__idx" then select elements p and from them the elements that have the class "KV".

Have you thought the code in normal gwt for this?

Other really useful thing that you can use is the Promise pattern. Something like do A if B has finished correctly, and do B if C has finished correctly. We are using this for oAuth authentication in our app. Believe if you deal with Facebook OAuth in one line you can be sure everythings is fine.

If you are not using GQuery, you probably need to create 4 Callbacks with its onSuccess and onFailure methods (Spaguetti code).

And many more things...

Also important people from Google and Opensource community is under that project, and this is a good sign.

这篇关于gwtQuery的好处的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆