我如何从 RequestFactoryEditorDriver 获取编辑后的代理

发布于 2024-11-14 13:43:50 字数 966 浏览 3 评论 0原文

使用编辑器进行更改后,我不知道如何更新我的单元格表。如果我可以获得编辑后的代理,那么我可以使用数据提供程序来更新我的单元格表。

public void saveCampaign() {
  driver.flush();
  // the problem. proxy at this point should have the new values?....
  context.persist().using(proxy).fire(new Receiver<Void>() {
    @Override
    public void onSuccess(Void response) {
      showListView();
    }
  });
}

.using(proxy) 中的代理不包含在编辑器上所做的更改。但是,服务器上的 persist 方法会获取更新的值。如果我从服务器重新加载数据,我会在单元格表中获得正确的值。

public void editCampaign(CampaignProxy proxy) {
  this.proxy = proxy;
  if (proxy != null) {
    context = AEHOME.requestFactory.campaignRequest();
    showEditView();
  }
}

private void showEditView() {
  driver.initialize(eventBus, AEHOME.requestFactory, editView);
  driver.edit(proxy, context);
  deckPanel.showWidget(deckPanel.getWidgetIndex(editView));
}

在列表视图中设置代理:configurationPageView.proxy = SelectionModel.getSelectedObject();

任何建议将不胜感激。谢谢。

I can't figure out how to update my celltable after changes have been made using an editor. If I could get the edited proxy then I can use the dataprovider to update my celltable.

public void saveCampaign() {
  driver.flush();
  // the problem. proxy at this point should have the new values?....
  context.persist().using(proxy).fire(new Receiver<Void>() {
    @Override
    public void onSuccess(Void response) {
      showListView();
    }
  });
}

The proxy in .using(proxy) does not contain the changes made on the editor. However the persist method on the server gets the updated values. If I reload the data from the server I get the correct values to the celltable.

public void editCampaign(CampaignProxy proxy) {
  this.proxy = proxy;
  if (proxy != null) {
    context = AEHOME.requestFactory.campaignRequest();
    showEditView();
  }
}

private void showEditView() {
  driver.initialize(eventBus, AEHOME.requestFactory, editView);
  driver.edit(proxy, context);
  deckPanel.showWidget(deckPanel.getWidgetIndex(editView));
}

Proxy is set in the list view: configurationPageView.proxy = selectionModel.getSelectedObject();

Any advice would be greatly appreciated. Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

幸福丶如此 2024-11-21 13:43:50

您可以通过执行以下操作来更改请求的构建方式:

private void showEditView() {
  driver.initialize(eventBus, AEHOME.requestFactory, editView);
  driver.edit(proxy, context);
  // Set up method invocation and callback in advance
  context.persist().using(proxy).to(new Receiver<Void>() {
    @Override
    public void onSuccess(Void response) {
      showListView();
    }
  }););
  deckPanel.showWidget(deckPanel.getWidgetIndex(editView));
}

public void saveCampaign() {
  driver.flush().fire();
}

在 GWT 2.4 中,可以保留当前的代码组织并使用 RequestContext.append()

public void saveCampaign() {
  // Returns the context passed to edit()
  RequestContext ctx = driver.flush();
  // append() is generic and returns the type returned by myProxyContext();
  ctx.append(requestFactory.myProxyContext()).persist().using(proxy).fire(....);
}

You can change how the request is built by doing the following:

private void showEditView() {
  driver.initialize(eventBus, AEHOME.requestFactory, editView);
  driver.edit(proxy, context);
  // Set up method invocation and callback in advance
  context.persist().using(proxy).to(new Receiver<Void>() {
    @Override
    public void onSuccess(Void response) {
      showListView();
    }
  }););
  deckPanel.showWidget(deckPanel.getWidgetIndex(editView));
}

public void saveCampaign() {
  driver.flush().fire();
}

In GWT 2.4 it will be possible to keep your current code organization and use RequestContext.append():

public void saveCampaign() {
  // Returns the context passed to edit()
  RequestContext ctx = driver.flush();
  // append() is generic and returns the type returned by myProxyContext();
  ctx.append(requestFactory.myProxyContext()).persist().using(proxy).fire(....);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文