use of com.moneychanger.core.OpenTransactionAccount in project otapij by FellowTraveler.
the class Helpers method reloadOTDetails.
// OT Helpers
public static void reloadOTDetails(String accountID) {
Account account = new OpenTransactionAccount();
Object details = account.getAccountDetails(accountID);
OTDetails otDetails = (OTDetails) details;
populateOTDetails(otDetails);
JTable table = MainPage.getAccountTable();
((AccountTableModel) table.getModel()).setValueAt(otDetails.getBalance(), table.getSelectedRow(), 1);
}
use of com.moneychanger.core.OpenTransactionAccount in project otapij by FellowTraveler.
the class MainPage method jButton_RemoveAccountActionPerformed.
//GEN-LAST:event_jComboBox_AssetContractsActionPerformed
private void jButton_RemoveAccountActionPerformed(java.awt.event.ActionEvent evt) {
//GEN-FIRST:event_jButton_RemoveAccountActionPerformed
if (jTable_AccountTable.getSelectedRow() < 0) {
JOptionPane.showMessageDialog(this, "Please select account to delete", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
int userSelection = JOptionPane.showConfirmDialog(this, "Are you sure you want to delete account", "Delete Account", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
System.out.println("userSelection:" + userSelection);
String nymID = "ALL";
String assetID = "ALL";
String serverID = "ALL";
if (nymMap != null && nymMap.size() > 0 && jComboBox_Nyms.getSelectedIndex() > 0) {
nymID = ((String[]) nymMap.get((Integer) jComboBox_Nyms.getSelectedIndex() - 1))[1];
}
if (assetMap != null && assetMap.size() > 0 && jComboBox_AssetContracts.getSelectedIndex() > 0) {
assetID = ((String[]) assetMap.get((Integer) jComboBox_AssetContracts.getSelectedIndex() - 1))[1];
}
if (serverMap != null && serverMap.size() > 0 && jComboBoxServerContracts.getSelectedIndex() > 0) {
serverID = ((String[]) serverMap.get((Integer) jComboBoxServerContracts.getSelectedIndex() - 1))[1];
}
// pass serverID and nymID here
OpenTransactionAccount openTransaction = new OpenTransactionAccount(serverID, nymID);
try {
if (userSelection == 0) {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
boolean status = openTransaction.deleteAccount((String) jTable_AccountTable.getModel().getValueAt(jTable_AccountTable.getSelectedRow(), 3));
if (status) {
JOptionPane.showMessageDialog(this, "Account deleted successfully", "Account deletion", JOptionPane.INFORMATION_MESSAGE);
loadAccount(assetID, serverID, nymID);
clearDetailPage();
} else {
JOptionPane.showMessageDialog(this, "Account cannot be deleted", "Account deletion", JOptionPane.ERROR_MESSAGE);
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
setCursor(Cursor.getDefaultCursor());
}
}
Aggregations