use of com.moneychanger.core.NYM in project otapij by FellowTraveler.
the class MainPage method jButton_RemoveAccount1ActionPerformed.
//GEN-LAST:event_jButton_EditAccount1ActionPerformed
private void jButton_RemoveAccount1ActionPerformed(java.awt.event.ActionEvent evt) {
//GEN-FIRST:event_jButton_RemoveAccount1ActionPerformed
if (jTable_NymsList.getSelectedRow() < 0) {
JOptionPane.showMessageDialog(this, "Please select NYM to delete", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
String nymID = (String) jTable_NymsList.getModel().getValueAt(jTable_NymsList.getSelectedRow(), 1);
int userSelection = JOptionPane.showConfirmDialog(this, "Are you sure you want to delete NYM", "NYM Deletion", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
System.out.println("userSelection:" + userSelection);
NYM nym = new NYM();
if (userSelection == 0) {
try {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
Map registeredServers = new NYM().registeredServers(nymID);
if (registeredServers == null || registeredServers.size() < 1) {
boolean status = new NYM().deleteWalletNym(nymID);
if (status) {
JOptionPane.showMessageDialog(this, "Nym deleted sucessfully from the wallet", "NYM deletion success", JOptionPane.INFORMATION_MESSAGE);
refreshNYMSList();
return;
} else {
JOptionPane.showMessageDialog(this, "Cannot delete nym from the wallet", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
setCursor(Cursor.getDefaultCursor());
dispose();
}
new DeleteNYMDialog(this, true, nymID).setVisible(true);
}
}
use of com.moneychanger.core.NYM in project otapij by FellowTraveler.
the class MainPage method initNYMSTab.
private void initNYMSTab() {
jTable_NymsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
System.out.println("selectedRow:" + jTable_NymsList.getSelectedRow());
if (jTable_NymsList.getSelectedRow() >= 0) {
String nymID = (String) jTable_NymsList.getModel().getValueAt(jTable_NymsList.getSelectedRow(), 1);
System.out.println("selected nymID:" + nymID);
NYM nym = new NYM();
nymBox = nym.loadNymBox(nymID);
nymOutBox = nym.loadNymOutBox(nymID);
System.out.println("loadNymBox loadNymOutBox data loaded");
populateNYMDetails(nymID, nym.getRawFileData(nymID), nymBox, nymOutBox);
}
}
});
((NYMTableModel) jTable_NymsList.getModel()).setValue(new NYM().loadNYM(), jTable_NymsList);
}
use of com.moneychanger.core.NYM in project otapij by FellowTraveler.
the class MainPage method jComboBox5ActionPerformed.
//GEN-LAST:event_jComboBox4ActionPerformed
private void jComboBox5ActionPerformed(java.awt.event.ActionEvent evt) {
//GEN-FIRST:event_jComboBox5ActionPerformed
// Load the markets for this server
String serverID = "ALL";
String nymID = "ALL";
if (serverMap != null && serverMap.size() > 0 && jComboBox5.getSelectedIndex() > -1) {
serverID = ((String[]) serverMap.get((Integer) jComboBox5.getSelectedIndex()))[1];
}
System.out.println("Mrkets tab - nym selected index - " + jComboBox6.getSelectedIndex());
nymRegisteredMap = new NYM().loadRegisteredNYM(serverID);
Helpers.populateComboWithoutAll(nymRegisteredMap, jComboBox6);
if (nymRegisteredMap != null && nymRegisteredMap.size() > 0 && jComboBox6.getSelectedIndex() > -1) {
nymID = ((String[]) nymRegisteredMap.get((Integer) jComboBox6.getSelectedIndex()))[1];
}
System.out.println("Mrkets tab, serverID:" + serverID + " nymID:" + nymID);
if (jComboBox6.getSelectedIndex() > -1 && jComboBox5.getSelectedIndex() > -1) {
Map marketList = null;
try {
marketList = Market.loadMarketList(serverID, nymID);
} catch (InterruptedException ex) {
Logger.getLogger(MainPage.class.getName()).log(Level.SEVERE, null, ex);
}
if (marketList != null) {
((MarketTableModel) jTable13.getModel()).setValue(marketList, jTable13);
}
if (marketList != null && marketList.size() > 0) {
String marketID = (String) jTable13.getModel().getValueAt(jTable13.getSelectedRow(), 1);
System.out.println("-----marketID----:" + marketID);
boolean marketExists = false;
for (int i = 0; i < jTable13.getRowCount(); i++) {
if (marketID != null && jTable13.getModel().getValueAt(jTable13.getSelectedRow(), 1) != null && marketID.equals(jTable13.getModel().getValueAt(jTable13.getSelectedRow(), 1))) {
jTable13.setRowSelectionInterval(i, i);
marketListClick();
marketExists = true;
break;
}
}
if (jTable13.getRowCount() > 0 && !marketExists) {
jTable13.setRowSelectionInterval(0, 0);
marketListClick();
}
}
}
}
use of com.moneychanger.core.NYM in project otapij by FellowTraveler.
the class MainPage method initMarketsTab.
private void initMarketsTab() {
jLabel25.setText("");
jLabel46.setText("");
jLabel30.setText("");
jLabel27.setText("");
jLabel39.setText("");
jLabel32.setText("");
jLabel40.setText("");
jLabel41.setText("");
jLabel59.setText("");
jLabel60.setText("");
jLabel61.setText("");
MarketTableModel.removeCols(jTable13);
MarketOffersTableModel.removeCols(jTable14);
Helpers.populateComboWithoutAll(serverMap, jComboBox5);
String serverID = "ALL";
String nymID = "ALL";
if (serverMap != null && serverMap.size() > 0 && jComboBox5.getSelectedIndex() > -1) {
serverID = ((String[]) serverMap.get((Integer) jComboBox5.getSelectedIndex()))[1];
}
nymRegisteredMap = new NYM().loadRegisteredNYM(serverID);
Helpers.populateComboWithoutAll(nymRegisteredMap, jComboBox6);
jTable14.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
System.out.println("valueChanged Market List Action Listener :" + jTable14.getSelectedRow() + "e:" + e.getSource());
// Get nym offer details
nymOfferClick();
}
});
jTable13.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
System.out.println("jTable13 valueChanged Market List Action Listener :" + jTable13.getSelectedRow() + "e:" + e.getSource());
// Get market details
marketListClick();
}
});
if (nymRegisteredMap != null && nymRegisteredMap.size() > 0 && jComboBox6.getSelectedIndex() > -1) {
nymID = ((String[]) nymRegisteredMap.get((Integer) jComboBox6.getSelectedIndex()))[1];
}
if (!"ALL".equalsIgnoreCase(nymID)) {
Map nymTrades = Market.getNymTrades(serverID, nymID);
if (nymTrades != null) {
((MarketTradesTableModel) jTable16.getModel()).setValue(nymTrades, jTable16);
}
}
}
use of com.moneychanger.core.NYM in project otapij by FellowTraveler.
the class MainPage method jButton_DeleteActionPerformed.
//GEN-LAST:event_jButton_DownloadMailActionPerformed
private void jButton_DeleteActionPerformed(java.awt.event.ActionEvent evt) {
//GEN-FIRST:event_jButton_DeleteActionPerformed
if (jTable8.getSelectedRow() < 0 && jTable10.getSelectedRow() < 0) {
JOptionPane.showMessageDialog(this, "Please select mail to delete", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
try {
NYM nym = new NYM();
if (jTabbedPane_Nymbox.getSelectedIndex() == 0) {
boolean success = nym.deleteMail(jTextField_NymID.getText(), Integer.parseInt((String) jTable8.getModel().getValueAt(jTable8.getSelectedRow(), 3)));
int previousSelection = jTable8.getSelectedRow();
if (success) {
//JOptionPane.showMessageDialog(this, "Mail deleted successfully", "Mail Deletion Success", JOptionPane.INFORMATION_MESSAGE);
((NYMBoxTableModel) jTable8.getModel()).setValue(nym.loadNymBox(jTextField_NymID.getText()), jTable8);
int newCount = jTable8.getModel().getRowCount();
if (newCount > 0) {
if (newCount > previousSelection) {
jTable8.setRowSelectionInterval(previousSelection, previousSelection);
} else {
jTable8.setRowSelectionInterval(previousSelection - 1, previousSelection - 1);
}
}
} else {
JOptionPane.showMessageDialog(this, "Mail deletion failed", "Error", JOptionPane.ERROR_MESSAGE);
}
} else {
boolean success = nym.deleteOutboxMail(jTextField_NymID.getText(), Integer.parseInt((String) jTable10.getModel().getValueAt(jTable10.getSelectedRow(), 3)));
int previousSelection = jTable10.getSelectedRow();
if (success) {
//JOptionPane.showMessageDialog(this, "Mail deleted successfully", "Mail Deletion Success", JOptionPane.INFORMATION_MESSAGE);
((NYMOutboxTableModel) jTable10.getModel()).setValue(nym.loadNymOutBox(jTextField_NymID.getText()), jTable10);
int newCount = jTable10.getModel().getRowCount();
if (newCount > 0) {
if (newCount > previousSelection) {
jTable10.setRowSelectionInterval(previousSelection, previousSelection);
} else {
jTable10.setRowSelectionInterval(previousSelection - 1, previousSelection - 1);
}
}
} else {
JOptionPane.showMessageDialog(this, "Mail deletion failed", "Error", JOptionPane.ERROR_MESSAGE);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations