Ejemplo n.º 1
0
  private void showPosition(final String username, final String displayName) {
    AsyncCallback<StockPosition[]> callback =
        new AsyncCallback<StockPosition[]>() {
          public void onFailure(Throwable caught) {
            // TODO: Do something with errors.
            GWT.log(caught.toString());
          }

          public void onSuccess(StockPosition[] positions) {
            if (positions == null) {
              Window.alert(MockStock.SESSION_TIMEOUT_MSG);
              return;
            }
            removeGrids();
            createPositionTable(positions);
            transUser = new Label("\"" + displayName + "\"持仓情况如下:");
            getItself().add(transUser);
            getItself().add(positionGrid);
          }
        };
    // Make the call to the stock price service.
    stockSvc.getStockPositions(username, callback);
  }