void init() {
    String staffId = sessionManager.getSession().getStaffId();
    dispatch.execute(
        new StaffIntegralRequest(staffId),
        new AsyncCallback<StaffIntegralResponse>() {

          @Override
          public void onFailure(Throwable t) {
            win.alert(t.getMessage());
          }

          @Override
          public void onSuccess(StaffIntegralResponse resp) {
            display
                .getHistoryIntegral()
                .setText(StringUtil.subZeroAndDot(resp.getHistoryIntegral()));
            display
                .getConsumptionIntegral()
                .setText(StringUtil.subZeroAndDot(resp.getConsumptionIntegral()));
            display
                .getBalanceIntegral()
                .setText(StringUtil.subZeroAndDot(resp.getBalanceIntegral()));
          }
        });

    shopWindowPresenter.initShopWindow(1, 3);
    shopWindowPresenter.bind();
    display.setShopWindow(shopWindowPresenter.getDisplay().asWidget());
  }
  private void init() {
    dispatch.execute(
        new DetailsOfGiftRequest(orderVo.getGiftId()),
        new AsyncCallback<DetailsOfGiftResponse>() {
          @Override
          public void onFailure(Throwable e) {
            errorHandler.alert(e.getMessage());
          }

          @Override
          public void onSuccess(final DetailsOfGiftResponse response) {

            display.setGiftName(response.getGiftName());
            display.setGiftNo(response.getGiftNo().substring(response.getGiftNo().length() - 5));
            display.setBrand(response.getBrand());
            display.setType(response.getType());
            display.setStock(response.getStock());
            display.setIntegral(response.getIntegral());
            display.setSummary(response.getSummary());
            display.setExplains(response.getExplains());
            display.setNotes(response.getNotes());
            display.setDispatchcycle(response.getDispatchcycle());
            display.setBusiness(response.getBusiness());
            display.setServicetell(response.getServicetell());
            display.setGiftPhoto(response.getGiftPhoto());

            display
                .getPhotoImage()
                .addClickHandler(
                    new ClickHandler() {

                      @Override
                      public void onClick(ClickEvent event) {
                        win.alertImageStaff(response.getGiftPhoto());
                      }
                    });
          }
        });
    display
        .getExchangeBtn()
        .addClickHandler(
            new ClickHandler() {

              @Override
              public void onClick(ClickEvent event) {
                Platform.getInstance()
                    .getEditorRegistry()
                    .openEditor(
                        OrderConfirmationConstants.EDITOR_ORDERCONFIRMATION_SEARCH,
                        "EDITOR_ORDERCONFIRMATION_SEARCH_DO_ID",
                        new OrderConfirmationClient(orderVo.getGiftId()));
              }
            });
    shopWindowPresenter.initShopWindow(1, 4);
    shopWindowPresenter.bind();
    display.setShopWindow(shopWindowPresenter.getDisplay().asWidget());
  }
  public void fetchData(final int start, final int length) {
    // if (!GWT.isScript()) {
    // List<StaffWinClient> list = new ArrayList<StaffWinClient>();
    // for (int i = start; i < start + length; i++) {
    // StaffWinClient item = new StaffWinClient();
    // item.setId("id" + i);
    // item.setName("rewards" + i);
    // //item.setStatus(StaffListStatus.TO_BE_ISSUE);
    // list.add(item);
    // }
    //
    // updateRowData(start, list);
    // updateRowCount(100, true);
    // } else {
    PaginationDetailClient pagination = new PaginationDetailClient();
    pagination.setStart(start);
    pagination.setLimit(length);
    getCriteria().setPagination(pagination);
    if (getSorting() != null) {
      getCriteria().setSorting(getSorting());
    }
    dispatch.execute(
        new StaffWinRequest(getCriteria()),
        new AsyncCallback<StaffWinResponse>() {
          @Override
          public void onFailure(Throwable e) {
            errorHandler.alert(e.getMessage());
          }

          @Override
          public void onSuccess(StaffWinResponse response) {
            updateRowData(start, response.getResult());
            updateRowCount(response.getTotal(), true);
            display.setDataCount(response.getTotal() + "");
          }
        });
    // }
  }
示例#4
0
  public void fetchData(final int start, final int length) {
    // if (!GWT.isScript()) {
    // List<DishesListClient> list = new ArrayList<DishesListClient>();
    // for (int i = start; i < start + length; i++) {
    // DishesListClient item = new DishesListClient();
    // item.setId("id" + i);
    // item.setName("rewards" + i);
    // //item.setStatus(OrdersDishesStatus.TO_BE_ISSUE);
    // list.add(item);
    // }
    //
    // updateRowData(start, list);
    // updateRowCount(100, true);
    // } else {
    PaginationDetailClient pagination = new PaginationDetailClient();
    pagination.setStart(start);
    pagination.setLimit(length);
    getCriteria().setPagination(pagination);
    if (getSorting() != null) {
      getCriteria().setSorting(getSorting());
    }
    dispatch.execute(
        new SearchDishesListRequest(getCriteria(), null),
        new AsyncCallback<SearchDishesListResponse>() {
          @Override
          public void onFailure(Throwable e) {
            errorHandler.alert(e.getMessage());
          }

          @Override
          public void onSuccess(SearchDishesListResponse response) {
            //	updateRowData(start, response.getResult());
            updateRowCount(response.getTotal(), true);

            List<DishesListClient> giftList = response.getResult();
            int index = 0;
            Grid grid = new Grid(3, 4);

            // Add images to the grid
            int numRows = grid.getRowCount();
            int numColumns = grid.getColumnCount();
            for (int row = 0; row < numRows; row++) {
              for (int col = 0; col < numColumns; col++) {
                if (index < giftList.size()) {
                  DishesListClient clint = giftList.get(index);
                  List<String> tasteLt = new ArrayList<String>();
                  if (!StringUtil.isEmpty(clint.getTaste())) {
                    String[] arrtasts = clint.getTaste().split(",");
                    for (int i = 0; i < arrtasts.length; i++) {
                      tasteLt.add(arrtasts[i]);
                    }
                  }

                  grid.setWidget(
                      row,
                      col,
                      new AwardShopLatticeWidget(
                              clint.getName(),
                              clint.getPrice() + "",
                              clint.getDescription(),
                              clint.getPhoto(),
                              clint.getId(),
                              display,
                              ordersDishesPresenter,
                              dishesDetailedDialogProvider,
                              tasteLt)
                          .asWidget());
                  index++;
                } else {
                  //				    		  grid.setWidget(row, col,new
                  // AwardShopLatticeWidget("","0","",null,null).asWidget());
                  break;
                }
              }
            }

            // Return the panel
            //    grid.ensureDebugId("cwGrid");

            display.getResultPanel().clear();
            display.getResultPanel().add(grid);
          }
        });
    // }
  }
示例#5
0
 public void sendMessage(String messageText) {
   dispatch.execute(
       new SendMessageAction(new ChatMessageImpl(messageText)),
       new RangeChangedCallback(getDisplay().getList()));
 }