Search in sources :

Example 21 with OpenTransactionAccount

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);
}
Also used : Account(com.moneychanger.core.Account) OpenTransactionAccount(com.moneychanger.core.OpenTransactionAccount) AccountTableModel(com.moneychanger.ui.model.AccountTableModel) JTable(javax.swing.JTable) OpenTransactionAccount(com.moneychanger.core.OpenTransactionAccount) OTDetails(com.moneychanger.core.dataobjects.OTDetails)

Example 22 with OpenTransactionAccount

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());
    }
}
Also used : OpenTransactionAccount(com.moneychanger.core.OpenTransactionAccount) Point(java.awt.Point) AWTException(java.awt.AWTException)

Aggregations

OpenTransactionAccount (com.moneychanger.core.OpenTransactionAccount)22 Account (com.moneychanger.core.Account)5 AWTException (java.awt.AWTException)5 Point (java.awt.Point)5 RippleAccount (com.moneychanger.core.RippleAccount)4 OTDetails (com.moneychanger.core.dataobjects.OTDetails)2 ComboObject (com.moneychanger.core.util.ComboObject)2 ExchangeBasketDialog (com.moneychanger.ui.dialogs.ExchangeBasketDialog)2 AccountTableModel (com.moneychanger.ui.model.AccountTableModel)2 OtherTabAccountModel (com.moneychanger.ui.model.OtherTabAccountModel)2 CardLayout (java.awt.CardLayout)2 JPanel (javax.swing.JPanel)2 ListSelectionEvent (javax.swing.event.ListSelectionEvent)2 ListSelectionListener (javax.swing.event.ListSelectionListener)2 Contract (com.moneychanger.core.Contract)1 NYM (com.moneychanger.core.NYM)1 BitcoinDetails (com.moneychanger.core.dataobjects.BitcoinDetails)1 CashPurseDetails (com.moneychanger.core.dataobjects.CashPurseDetails)1 DepositCashDialog (com.moneychanger.ui.dialogs.DepositCashDialog)1 BlankPanel (com.moneychanger.ui.panels.BlankPanel)1