コード例 #1
0
 /**
  * Method isCellEditable.
  *
  * @param row int
  * @param column int
  * @return boolean
  * @see javax.swing.table.TableModel#isCellEditable(int, int)
  */
 public boolean isCellEditable(int row, int column) {
   OrderStatus orderStatus = (OrderStatus) this.getValueAt(row, 8);
   if (null != orderStatus) {
     if (OrderStatus.CANCELLED.equals(orderStatus.getCode())
         || OrderStatus.FILLED.equals(orderStatus.getCode())
         || OrderStatus.INACTIVE.equals(orderStatus.getCode())) {
       return false;
     }
   }
   if ((columnNames[column] == SYMBOL)
       || (columnNames[column] == ORDER_KEY)
       || (columnNames[column] == STATUS)
       || (columnNames[column] == AVG_PRICE)
       || (columnNames[column] == FILLED_DATE)
       || (columnNames[column] == FILLED_QTY)
       || (columnNames[column] == STOP_PRICE)) {
     return false;
   }
   return true;
 }
コード例 #2
0
  /**
   * Method getNewRow.
   *
   * @param newRow Vector<Object>
   * @param element TradeOrder
   */
  public void getNewRow(Vector<Object> newRow, TradeOrder element) {

    newRow.addElement(element.getTradestrategy().getContract().getSymbol());
    newRow.addElement(new Quantity(element.getOrderKey()));
    if (null == element.getAction()) {
      newRow.addElement(new Action());
    } else {
      newRow.addElement(Action.newInstance(element.getAction()));
    }
    if (null == element.getOrderType()) {
      newRow.addElement(new OrderType());
    } else {
      newRow.addElement(OrderType.newInstance(element.getOrderType()));
    }

    newRow.addElement(new Quantity(element.getQuantity()));
    newRow.addElement(new Money(element.getLimitPrice()));
    newRow.addElement(new Money(element.getAuxPrice()));
    newRow.addElement(YesNo.newInstance(element.getTransmit()));
    if (null == element.getStatus()) {
      newRow.addElement(new OrderStatus());
    } else {
      newRow.addElement(OrderStatus.newInstance(element.getStatus()));
    }
    if (null == element.getOcaGroupName()) {
      newRow.addElement("");
    } else {
      newRow.addElement(element.getOcaGroupName());
    }
    if (null == element.getAverageFilledPrice()) {
      newRow.addElement(new Decimal(3));
    } else {
      newRow.addElement(new Decimal(element.getAverageFilledPrice(), 3));
    }
    if (null == element.getFilledDate()) {
      newRow.addElement(new Date());
    } else {
      newRow.addElement(new Date(element.getFilledDate()));
    }
    newRow.addElement(new Quantity(element.getFilledQuantity()));
    newRow.addElement(new Money(element.getStopPrice()));
    TradeOrder tradeOrder = new TradeOrder();
    tradeOrder.setIdTradeOrder(1);
    if (null == element.getFAProfile()) {
      newRow.addElement(tradeOrder);
    } else {
      tradeOrder.setFAProfile(element.getFAProfile());
      tradeOrder.setFAGroup(element.getFAGroup());
      tradeOrder.setFAMethod(element.getFAMethod());
      tradeOrder.setFAPercent(element.getFAPercent());
      newRow.addElement(tradeOrder);
    }
  }