Beispiel #1
0
  private void createPositionTable(StockPosition[] positions) {
    positionGrid = new Grid(positions.length + 1, POSITION_HEADERS.length);
    // Create table for stock Positions.
    Util.createGridHeader(positionGrid, POSITION_HEADERS);

    for (int i = 0; i < positions.length; i++) {
      Util.addPositionRow(positionGrid, positions[i], i + 1);
    }
  }
Beispiel #2
0
 private void populateRankTable(AccountInfo[] info) {
   Util.removeGridData(rankGrid);
   rankGrid.resizeRows(info.length + 1);
   for (int row = 1; row <= info.length; row++) {
     insertRankTableRow(row, info[row - 1]);
   }
 }
Beispiel #3
0
  private void createTransTable(DealLog[] logs) {
    transGrid = new Grid(logs.length + 1, TRANS_HISTORY_HEADERS.length);

    Util.createGridHeader(transGrid, TRANS_HISTORY_HEADERS, "tableList2");

    NumberFormat fmt = NumberFormat.getFormat("#,##0.00");
    for (int row = 1; row <= logs.length; row++) {
      final DealLog deal = logs[row - 1];
      transGrid.setWidget(row, 0, new Label(deal.getCode()));
      transGrid.getCellFormatter().addStyleName(row, 0, "textCell");
      transGrid.setWidget(row, 1, new Label(deal.getName()));
      transGrid.getCellFormatter().addStyleName(row, 1, "textCell");
      transGrid.setWidget(row, 2, new Label(deal.getBs()));
      transGrid.getCellFormatter().addStyleName(row, 2, "textCell");
      if ("买入".equals(deal.getBs())) {
        transGrid.getCellFormatter().removeStyleName(row, 2, "negativeChange");
        transGrid.getCellFormatter().addStyleName(row, 2, "positiveChange");
      } else {
        transGrid.getCellFormatter().removeStyleName(row, 2, "positiveChange");
        transGrid.getCellFormatter().addStyleName(row, 2, "negativeChange");
      }
      transGrid.setWidget(row, 3, new Label(fmt.format(deal.getPrice())));
      transGrid.getCellFormatter().addStyleName(row, 3, "numericCell");
      transGrid.setWidget(row, 4, new Label(fmt.format(deal.getAmount())));
      transGrid.getCellFormatter().addStyleName(row, 4, "numericCell");
      transGrid.setWidget(row, 5, new Label(fmt.format(deal.getCommission())));
      transGrid.getCellFormatter().addStyleName(row, 5, "numericCell");
      transGrid.setWidget(row, 6, new Label(deal.getCreated()));
      transGrid.getCellFormatter().addStyleName(row, 6, "textCell");
    }
  }
Beispiel #4
0
 public ManagePanel(StockServiceAsync stockSvc) {
   lastModified.addStyleName("small-label");
   hp.setWidth("100%");
   rankGrid = new Grid(1, HEADERS.length);
   setSpacing(4);
   this.stockSvc = stockSvc;
   hp.add(refreshBtn);
   this.add(hp);
   this.add(rankGrid);
   refreshBtn.addClickHandler(
       new ClickHandler() {
         public void onClick(ClickEvent event) {
           removeGrids();
           refreshBtn.setEnabled(false);
           loadData();
         }
       });
   Util.createGridHeader(rankGrid, HEADERS);
 }