use of com.moneychanger.core.NYM in project otapij by FellowTraveler.
the class ImportNYMDialog method jButton1ActionPerformed.
// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
//GEN-FIRST:event_jButton1ActionPerformed
NYM nym = new NYM();
try {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
String importedNymID = nym.importCert(jTextField1.getText(), jTextArea1.getText());
if (importedNymID != null) {
JOptionPane.showMessageDialog(null, "Nym Imported Successfully. NYM ID:" + importedNymID, "Import Success", JOptionPane.INFORMATION_MESSAGE);
} else {
JOptionPane.showMessageDialog(null, "Nym Import Failed", "Error", JOptionPane.ERROR_MESSAGE);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
setCursor(Cursor.getDefaultCursor());
}
dispose();
}
use of com.moneychanger.core.NYM in project otapij by FellowTraveler.
the class RegisterNYMDialog method jButton1ActionPerformed.
// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
//GEN-FIRST:event_jButton1ActionPerformed
String serverID = null;
if (jComboBox1.getSelectedIndex() > -1) {
serverID = ((String[]) serverMap.get((Integer) jComboBox1.getSelectedIndex()))[1];
}
System.out.println("In registerNym Dialog, server ID:" + serverID + " nymID:" + nymID);
try {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
int status = new NYM().registerNym(serverID, nymID);
if (status == 0) {
JOptionPane.showMessageDialog(this, "Nym registered sucessfully on the server", "NYM registration success", JOptionPane.INFORMATION_MESSAGE);
// Refresh Market NYM list
MainPage.refreshMarketNym(serverID);
this.serverID = serverID;
} else if (status == 1) {
JOptionPane.showMessageDialog(this, "Nym is already registered on server " + serverID, "Already registered", JOptionPane.ERROR_MESSAGE);
} else {
JOptionPane.showMessageDialog(this, "Cannot register nym on server", "Error", JOptionPane.ERROR_MESSAGE);
}
} catch (InterruptedException ex) {
ex.printStackTrace();
} finally {
setCursor(Cursor.getDefaultCursor());
dispose();
}
}
use of com.moneychanger.core.NYM in project otapij by FellowTraveler.
the class SendMessageDialog method jButton1ActionPerformed.
// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
//GEN-FIRST:event_jButton1ActionPerformed
try {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
NYM nym = new NYM();
String message = "";
if (jTextField3.getText().length() > 0)
message = "Subject:" + jTextField3.getText() + "\n" + jTextArea1.getText();
else
message = jTextArea1.getText();
if (nym.sendMessage(jTextField2.getText(), nymID, jTextField1.getText(), message)) {
JOptionPane.showMessageDialog(this, "Message Sent!", "Success", JOptionPane.INFORMATION_MESSAGE);
Map nymOutbox = new NYM().loadNymOutBox(nymID);
((NYMOutboxTableModel) outbox.getModel()).setValue(nymOutbox, outbox);
MainPage.setNymOutbox(nymOutbox);
MainPage.refreshMarketNym(jTextField2.getText());
} else {
JOptionPane.showMessageDialog(this, "Message sending failed!", "Error", JOptionPane.ERROR_MESSAGE);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
setCursor(Cursor.getDefaultCursor());
this.dispose();
}
}
use of com.moneychanger.core.NYM in project otapij by FellowTraveler.
the class RegisterNymOnServerDialog method jButton1ActionPerformed.
// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
//GEN-FIRST:event_jButton1ActionPerformed
String nymID = null;
if (jComboBox1.getSelectedIndex() > -1) {
nymID = ((String[]) nymMap.get((Integer) jComboBox1.getSelectedIndex()))[1];
}
System.out.println("In registerNym Dialog, server ID:" + serverID + " nymID:" + nymID);
try {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
int status = new NYM().registerNym(serverID, nymID);
if (status == 0) {
JOptionPane.showMessageDialog(this, "Nym registered sucessfully on the server", "NYM registration success", JOptionPane.INFORMATION_MESSAGE);
// Refresh Market NYM list
MainPage.refreshMarketNym(serverID);
} else if (status == 1) {
JOptionPane.showMessageDialog(this, "Nym is already registered on server " + serverID, "Already registered", JOptionPane.ERROR_MESSAGE);
} else {
nymID = null;
JOptionPane.showMessageDialog(this, "Cannot register nym on server, hence basket details cannot be displayed", "Error", JOptionPane.ERROR_MESSAGE);
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
setCursor(Cursor.getDefaultCursor());
Helpers.setNymID(nymID);
dispose();
}
}
use of com.moneychanger.core.NYM in project otapij by FellowTraveler.
the class NYMAdditionDialog method jButton1ActionPerformed.
// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
//GEN-FIRST:event_jButton1ActionPerformed
NYM nym = new NYM();
String nymID = nym.createNym(jTextField2.getText());
if (nymID != null) {
JOptionPane.showMessageDialog(this, "NYM created successfully", "Success", JOptionPane.INFORMATION_MESSAGE);
} else
JOptionPane.showMessageDialog(this, "Error in NYM creation", "Error", JOptionPane.ERROR_MESSAGE);
this.dispose();
}
Aggregations