0

我们在成功完成创建、保存、更新应用程序中的凭证后显示消息,我们使用 gwt 进行上述所有处理,并将通过使用 gwt-rpc 从服务器端获取成功消息,然后将该消息放入在 gwt 入口点中声明的面板。我们决定使用 gwt-query 来使应用程序有效,就像我们向用户显示消息后,它应该在一段时间(秒)后隐藏。

我们已经尝试过,但我们无法在 gwt 入口点中声明的面板或元素上应用 gquery。我们在html或jsp文件中申请元素。我们需要一些帮助。

代码片段

Public class myGwtEntryPoint implements EntryPoint {
VerticalPanel fiscalSettingPanel = new VerticalPanel();
  AbsolutePanel messagePanel = new AbsolutePanel();
  SimplePanel finishPanel = new SimplePanel();
  BaseCurrency baseCurrencyGlobal;
  ListBox monthListBox = new ListBox();

  @Override
  public void onModuleLoad() {
    // Removing loading image in Jsp before loading gwt module.
    if (RootPanel.get("accountingsetup-div").getElement().hasChildNodes())
      RootPanel.get("accountingsetup-div").getElement().getFirstChildElement().removeFromParent();

      // Here i am getting success message from server(gwt-rpc) and that to the  "messagePanel", that messagePanel to the 'fiscalSettingPanel '   
         fiscalSettingPanel .add("messagePanel");
 }

在上面的代码片段中,一旦显示消息,我想使用 gwt-query 使消息在 5 秒后消失

4

2 回答 2

0

您可以使用 gquery 选择元素和小部件并与之交互,您可以使用 css 选择器、元素和小部件作为参数,因此在您的情况下

1.-我将使用gquery以这种方式从你的jsp中删除加载图像,而不是处理大代码:

// Removing loading image in Jsp before loading gwt module.
$("#accountingsetup-div").empty();

2.-关于如何在一段时间后隐藏面板,我将使用效果队列,因此链接延迟和隐藏效果就足够了。

 // Here i am getting success message from server(gwt-rpc) and that to the  "messagePanel", that messagePanel to the 'fiscalSettingPanel '

 messagePanel.clear();
 messagePanel.add(new Label("Server message"));

 // First show the panel, and them enqueue an effect to hide it
 $(messagePanel).show().delay(4000).fadeOut();
于 2014-01-12T17:50:32.920 回答
0

像这样?

import com.google.gwt.user.client.Timer;

private Timer myTimer = new Timer()
{   
    @Override
    public void run()
    {
        /**
         * remove your Panel
         */
        fiscalSettingPanel.remove("messagePanel");
    }
};
myTimer.schedule(5000);
于 2013-12-10T08:15:51.990 回答