Beispiel #1
0
 private void edPercentageFocusLost(
     java.awt.event.FocusEvent evt) { // GEN-FIRST:event_edPercentageFocusLost
   Integer percent = Integer.parseInt(edPercentage.getText());
   for (int i = 0; i < childOrders.size(); i++) {
     ClientOrder order = childOrders.get(i);
     tbOrders.setValueAt(order.getQuantity() * percent / 100, i, 4);
   }
   // loadOrders();
 } // GEN-LAST:event_edPercentageFocusLost
Beispiel #2
0
 private void loadOrders() {
   DefaultTableModel model = (DefaultTableModel) tbOrders.getModel();
   model.setRowCount(0);
   for (ClientOrder order : childOrders) {
     model.addRow(
         new Object[] {
           order.getClientOrderID(),
           order.getCode(),
           ClientOrder.sideToString(order.getSide(), order.isShortSell()),
           order.getPrice(),
           order.getQuantity()
         });
   }
 }
Beispiel #3
0
  private void btOKActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btOKActionPerformed
    ok = true;
    for (int i = 0; i < childOrders.size(); i++) {
      ClientOrder order = childOrders.get(i);
      order.setPrice((Double) tbOrders.getValueAt(i, 3));
      Integer qty = (Integer) tbOrders.getValueAt(i, 4);
      if (qty > order.getQuantity()) {
        JOptionPane.showMessageDialog(this, "Row " + i + " exceeds allowed quantity");
        return;
      }
      order.setQuantity(qty);

      log.info("Price: " + order.getPrice() + ", Quantity: " + order.getQuantity());
    }
    this.setVisible(false);
  } // GEN-LAST:event_btOKActionPerformed