gwt using jquery effect possible?

血红的双手。 提交于 2019-12-20 17:28:12

问题


in my gwt, i have a button that fire like below to create new widget

 @UiHandler("buttonfire")
  void addNewWidget(ClickEvent event) {


     htmlPanelHolder.add(new MyCustomWidget(),"placeholder");

 }

how to use jquery so that when the MyCustomWidget() show on screen it is using jquery "fadein" effect

i already tried putting jsni to call jquery inside new MyCustomWidget() onload() but doesnt work. can guide me on this?


回答1:


It's also possible to create a fade in effect without using jQuery. If you want to do that, just write an Animation class like this:

public class FadeInAnimation extends Animation {
    private final UIObject uiObject;

    FadeInAnimation(final UIObject uiObject) {
      this.uiObject = uiObject;
    }

    @Override
    protected void onUpdate(final double progress) {
      uiObject.getElement().getStyle().setOpacity(progress);
    }
}

Then you can use it on any widget:

new FadeInAnimation(myWidget).run(5000);

Note: The call to getStyle().setOpacity(..) even takes care of the special case IE6/7, where it sets style.filter = 'alpha(opacity=' + (value * 100) + ')';




回答2:


You can also try with the GQuery library: http://code.google.com/p/gwtquery/




回答3:


use the fadeIn effect of GwtQuery



来源:https://stackoverflow.com/questions/4256218/gwt-using-jquery-effect-possible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!