use of com.moneychanger.ui.dialogs.CashPurseExportDetails in project otapij by FellowTraveler.
the class CashPurseAccountBottomPanel method jButton_ExchangeActionPerformed1.
//GEN-LAST:event_jButton_ExportActionPerformed
private void jButton_ExchangeActionPerformed1(java.awt.event.ActionEvent evt) {
try {
if (true) {
JOptionPane.showMessageDialog(null, "Exchange is currently not supported", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
CashPurseAccount cashPurseAccount = new CashPurseAccount();
ArrayList selectedIndices = new ArrayList();
for (int i = 0; i < jTable5.getRowCount(); i++) {
String id = (String) jTable5.getModel().getValueAt(i, 3);
if ((Boolean) jTable5.getModel().getValueAt(i, 5)) {
selectedIndices.add(id);
}
}
System.out.println("selectedIndices:" + selectedIndices);
if (selectedIndices.isEmpty()) {
int selected = JOptionPane.showConfirmDialog(this, "This will exchange all of the tokens in the purse", "Warning", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (selected == 2)
return;
}
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
boolean isSuccess = cashPurseAccount.exchangeCashPurse(details.getServerID(), details.getAssetID(), details.getNymID(), details.getPurse(), selectedIndices);
if (isSuccess) {
JOptionPane.showMessageDialog(this, "Cash exchanged successfully", "Exchange Success", JOptionPane.INFORMATION_MESSAGE);
CashPurseDetails cashDetails = new CashPurseAccount().getCashPurseDetails(details.getServerID() + ":" + details.getAssetID() + ":" + details.getNymID());
CashPurseAccountBottomPanel.populateCashPurseDetails(cashDetails);
CashPurseAccountTopPanel.populateCashPurseDetails(cashDetails, cashDetails.getBalance());
MainPage.reLoadAccount();
//((CashPurseTableModel) jTable5.getModel()).setValue(cashPurseAccount.refreshGridData(details.getServerID(), details.getAssetID(), details.getNymID()), jTable5);
} else {
if (Helpers.getObj() != null) {
new CashPurseExportDetails(null, true, (String) Helpers.getObj(), false).setVisible(true);
} else
JOptionPane.showMessageDialog(this, "Error in cash purse exchange", "Server Error", JOptionPane.ERROR_MESSAGE);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
setCursor(Cursor.getDefaultCursor());
}
}
Aggregations