Search in sources :

Example 11 with NYM

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();
}
Also used : NYM(com.moneychanger.core.NYM)

Example 12 with NYM

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();
    }
}
Also used : NYM(com.moneychanger.core.NYM)

Example 13 with NYM

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();
    }
}
Also used : NYM(com.moneychanger.core.NYM) NYMOutboxTableModel(com.moneychanger.ui.model.NYMOutboxTableModel) Map(java.util.Map)

Example 14 with NYM

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();
    }
}
Also used : NYM(com.moneychanger.core.NYM)

Example 15 with NYM

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();
}
Also used : NYM(com.moneychanger.core.NYM)

Aggregations

NYM (com.moneychanger.core.NYM)19 Point (java.awt.Point)5 Map (java.util.Map)4 ListSelectionEvent (javax.swing.event.ListSelectionEvent)4 ListSelectionListener (javax.swing.event.ListSelectionListener)4 Contract (com.moneychanger.core.Contract)3 AWTException (java.awt.AWTException)3 NYMBoxTableModel (com.moneychanger.ui.model.NYMBoxTableModel)2 NYMOutboxTableModel (com.moneychanger.ui.model.NYMOutboxTableModel)2 NYMTableModel (com.moneychanger.ui.model.NYMTableModel)2 Account (com.moneychanger.core.Account)1 OpenTransactionAccount (com.moneychanger.core.OpenTransactionAccount)1 RippleAccount (com.moneychanger.core.RippleAccount)1 CashPurseDetails (com.moneychanger.core.dataobjects.CashPurseDetails)1 OTDetails (com.moneychanger.core.dataobjects.OTDetails)1 ComboObject (com.moneychanger.core.util.ComboObject)1 DateField (com.moneychanger.ui.custom.DateField)1 DeleteNYMDialog (com.moneychanger.ui.dialogs.DeleteNYMDialog)1 MarketTableModel (com.moneychanger.ui.model.MarketTableModel)1 MarketTradesTableModel (com.moneychanger.ui.model.MarketTradesTableModel)1