Пример #1
0
  private FlowPanel createRandomNamePanel(String priceDesc) {
    final FlowPanel randomName = new FlowPanel();
    AsyncCallback callback =
        new AsyncCallback() {
          public void onFailure(Throwable caught) {
            GWT.log("Problem while getting random name", caught);
          }

          public void onSuccess(Object result) {
            randomName.add(new Label((String) result));
            LightBox lightBox = new LightBox(new WinnerPopup((String) result));
            lightBox.show();
          }
        };
    RaffleServiceGwtRemoteAsync service = RaffleServiceGwtRemote.App.getInstance();
    service.getRandomName(priceDesc, callback);
    return randomName;
  }
Пример #2
0
  private ScrollPanel createWinners() {
    final ScrollPanel listNames = new ScrollPanel();
    AsyncCallback callback =
        new AsyncCallback() {
          public void onFailure(Throwable caught) {
            GWT.log("Problem while getting random name", caught);
          }

          public void onSuccess(Object result) {
            ArrayList names = (ArrayList) result;
            String resultString = "";
            for (Iterator iter = names.iterator(); iter.hasNext(); ) {
              resultString += (String) iter.next() + "\n";
            }
            listNames.add(new Label(resultString));
          }
        };
    RaffleServiceGwtRemoteAsync service = RaffleServiceGwtRemote.App.getInstance();
    service.getAllWinners(callback);
    return listNames;
  }