Ejemplo n.º 1
0
    public int compare(MakeOrderAccount left, MakeOrderAccount right) {
      int leftHasClose = left.isOpen() ? 1 : 0;
      int rightHasClose = right.isOpen() ? 1 : 0;
      int result = leftHasClose - rightHasClose;
      if (result != 0) return result;

      BigDecimal leftLot = left._isBuyForCurrent ? left._buyLot : left._sellLot;
      BigDecimal rightLot = right._isBuyForCurrent ? right._buyLot : right._sellLot;

      result = leftLot.compareTo(rightLot);
      if (result != 0) return -result;

      return left._account.get_Code().compareTo(right._account.get_Code());
    }
Ejemplo n.º 2
0
 public static MakeOrderAccount create(
     TradingConsole tradingConsole,
     SettingsManager settingsManager,
     Account account,
     Instrument instrument,
     boolean isForDelivery) {
   return MakeOrderAccount.create(
       tradingConsole, settingsManager, account.get_Id(), instrument.get_Id(), isForDelivery);
 }
Ejemplo n.º 3
0
  public static void initialize(
      DataGrid grid,
      String dataSourceKey,
      Collection dataSource,
      tradingConsole.ui.grid.BindingSource bindingSource,
      boolean isAllowEditIsBuy,
      int dQMaxMove,
      int stepSize) {
    grid.setShowVerticalLines(false);
    grid.setBackground(GridFixedBackColor.account);
    grid.setForeground(GridBackColor.account);
    // grid.setSelectionBackground(SelectionBackground.account);

    TradingConsole.bindingManager.bind(
        dataSourceKey,
        dataSource,
        bindingSource,
        MakeOrderAccount.getPropertyDescriptors(isAllowEditIsBuy, dQMaxMove, stepSize));
    grid.setModel(bindingSource);
    TradingConsole.bindingManager.setHeader(
        dataSourceKey,
        SwingConstants.CENTER,
        25,
        GridFixedForeColor.account,
        Color.white,
        HeaderFont.account);
    TradingConsole.bindingManager.setGrid(
        dataSourceKey,
        18,
        Color.black,
        Color.lightGray,
        Color.blue,
        true,
        true,
        GridFont.account,
        false,
        true,
        true);

    if (isAllowEditIsBuy) {
      String[] listStrings = new String[] {Language.Buy, Language.Sell};
      ListComboBoxCellEditor listComboBoxCellEditor = new ListComboBoxCellEditor(listStrings);
      int column = bindingSource.getColumnByName(MakeOrderAccountGridColKey.IsBuyForCombo);
      grid.getColumnModel().getColumn(column).setCellEditor(listComboBoxCellEditor);
    }
  }