use of com.moneychanger.core.util.ComboObject in project otapij by FellowTraveler.
the class MainPage method initMainTab.
private void initMainTab() {
jPanel_TopPanel.setLayout(new CardLayout());
jPanel_BottomPanel.setLayout(new CardLayout());
jTable_AccountTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
System.out.println("valueChanged Action Listener :" + jTable_AccountTable.getSelectedRow() + "e:" + e.getSource());
if (jTable_AccountTable.getSelectedRow() >= 0) {
try {
jPanel_TopPanel.setVisible(true);
jPanel_BottomPanel.setVisible(true);
CardLayout topLayout = (CardLayout) (jPanel_TopPanel.getLayout());
CardLayout bottomlayout = (CardLayout) (jPanel_BottomPanel.getLayout());
String type = null;
String accountID = null;
type = (String) jTable_AccountTable.getModel().getValueAt(jTable_AccountTable.getSelectedRow(), 2);
accountID = (String) jTable_AccountTable.getModel().getValueAt(jTable_AccountTable.getSelectedRow(), 3);
System.out.println("Type:" + type);
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
for (int i = 0; i < Account.allAccounts.length; i++) {
if (Account.allAccounts[i].equalsIgnoreCase(type)) {
try {
topLayout.show(jPanel_TopPanel, type + "TopPanel");
bottomlayout.show(jPanel_BottomPanel, type + "BottomPanel");
Class obj = Class.forName("com.moneychanger.core." + type);
Account account = (Account) obj.newInstance();
Object details = account.getAccountDetails(accountID);
if (details == null) {
JOptionPane.showMessageDialog(null, "Error loading details", "Details Error", JOptionPane.ERROR_MESSAGE);
break;
}
if ("OpenTransactionAccount".equalsIgnoreCase(type)) {
OTDetails otDetails = (OTDetails) details;
Helpers.populateOTDetails(otDetails);
((AccountTableModel) jTable_AccountTable.getModel()).setValueAt(otDetails.getBalance(), jTable_AccountTable.getSelectedRow(), 1);
} else if ("CashPurseAccount".equalsIgnoreCase(type)) {
CashPurseDetails cashDetails = (CashPurseDetails) details;
populateCashPurseDetails(cashDetails, cashDetails.getBalance());
}
break;
} catch (InstantiationException ex) {
Logger.getLogger(MainPage.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
Logger.getLogger(MainPage.class.getName()).log(Level.SEVERE, null, ex);
} catch (ClassNotFoundException ex) {
Logger.getLogger(MainPage.class.getName()).log(Level.SEVERE, null, ex);
}
repaint();
}
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
setCursor(Cursor.getDefaultCursor());
}
}
}
});
nymMap = new NYM().loadNYM();
jComboBox_Nyms.addItem(new ComboObject("ALL"));
jComboBoxServerContracts.addItem(new ComboObject("ALL"));
jComboBox_AssetContracts.addItem(new ComboObject("ALL"));
Helpers.populateCombo(nymMap, jComboBox_Nyms);
Contract contract = new Contract();
serverMap = contract.loadServerContract();
Helpers.populateCombo(serverMap, jComboBoxServerContracts);
assetMap = contract.loadAssetContract();
Helpers.populateCombo(assetMap, jComboBox_AssetContracts);
Account account = null;
for (int i = 0; i < Account.allAccounts.length; i++) {
try {
if ("OpenTransactionAccount".equals(Account.allAccounts[i]) || "CashPurseAccount".equals(Account.allAccounts[i])) {
Class obj = Class.forName("com.moneychanger.core." + Account.allAccounts[i]);
account = (Account) obj.newInstance();
try {
account.loadAccount("ALL", "ALL", "ALL");
} catch (Exception ex) {
Logger.getLogger(MainPage.class.getName()).log(Level.SEVERE, null, ex);
}
Class obj1 = Class.forName("com.moneychanger.ui.panels." + Account.allAccounts[i] + "TopPanel");
JPanel topPanel = (JPanel) obj1.newInstance();
jPanel_TopPanel.add(topPanel, Account.allAccounts[i] + "TopPanel");
Class obj2 = Class.forName("com.moneychanger.ui.panels." + Account.allAccounts[i] + "BottomPanel");
JPanel bottomPanel = (JPanel) obj2.newInstance();
jPanel_BottomPanel.add(bottomPanel, Account.allAccounts[i] + "BottomPanel");
}
} catch (InstantiationException ex) {
//Logger.getLogger(MainPage.class.getName()).log(Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
///Logger.getLogger(MainPage.class.getName()).log(Level.SEVERE, null, ex);
} catch (ClassNotFoundException ex) {
//Logger.getLogger(MainPage.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
use of com.moneychanger.core.util.ComboObject in project otapij by FellowTraveler.
the class AccountAdditionDialog method initValues.
// End of variables declaration//GEN-END:variables
private void initValues(String type) {
if ("OT".equalsIgnoreCase(type))
jComboBox_Type.addItem(new ComboObject("Open Transaction"));
else {
jComboBox_Type.addItem(new ComboObject("Bitcoin"));
jComboBox_Type.addItem(new ComboObject("Loom"));
jComboBox_Type.addItem(new ComboObject("Ripple"));
jComboBox_Type.addItem(new ComboObject("PKTP"));
jComboBox_Type.addItem(new ComboObject("Truledger"));
}
}
Aggregations