コード例 #1
0
  private boolean initializeOutstanding2(
      DataGrid grid,
      boolean ascend,
      boolean caseOn,
      BuySellType buySellType,
      BuySellType editOutstandingOrderBuySellType,
      IOpenCloseRelationSite openCloseRelationSite,
      Order mapOrder) {
    Boolean isSpot =
        openCloseRelationSite.getOrderType() == null
            ? null
            : openCloseRelationSite.getOrderType().isSpot();
    this.setOutstandingOrders(
        buySellType,
        mapOrder,
        isSpot,
        openCloseRelationSite.isMakeLimitOrder(),
        openCloseRelationSite.isDelivery());
    HashMap<Guid, RelationOrder> editOutstandingOrders =
        this.getEditOutstandingOrders(editOutstandingOrderBuySellType, mapOrder);
    boolean hasChange = this.hasChange(grid, editOutstandingOrders);

    if (hasChange) {
      this.unbindOutstanding();
      this._outstandingKey = Guid.newGuid().toString();
      this._bindingSourceForOutstanding = new tradingConsole.ui.grid.BindingSource();

      boolean isMakeOrder2 =
          this._settingsManager.get_Customer().get_SingleAccountOrderType() == 2
              || this._settingsManager.get_Customer().get_MultiAccountsOrderType() == 2;

      RelationOrder.initialize(
          isMakeOrder2,
          grid,
          this._outstandingKey,
          editOutstandingOrders.values(),
          this._bindingSourceForOutstanding,
          openCloseRelationSite,
          editOutstandingOrderBuySellType);

      int column = this._bindingSourceForOutstanding.getColumnByName(OutstandingOrderColKey.IsBuy);
      if (column != -1) {
        grid.sortColumn(column, false, ascend);
        TableColumnChooser.hideColumn(grid, column);
      }
    } else {
      this._outstandingKey = grid.get_BindingSource().get_DataSourceKey();
      this._outstandingOrders.clear();
      for (int row = 0; row < grid.getRowCount(); row++) {
        RelationOrder relationOrder = (RelationOrder) (grid.getObject(row));
        this._outstandingOrders.put(relationOrder.get_OpenOrderId(), relationOrder);
      }
    }

    return hasChange;
  }