Search in sources :

Example 1 with Action

use of org.jdesktop.application.Action in project otapij by FellowTraveler.

the class OpenTransactionAccountBottomPanel method ProcessInbox.

@Action
public void ProcessInbox() {
    try {
        OpenTransactionAccount openTransaction = new OpenTransactionAccount();
        Map selectedIndices = new HashMap();
        List finalReceiptRefNo = new ArrayList();
        for (int i = 0; i < jTable_Inbox.getRowCount(); i++) {
            String key = (String) jTable_Inbox.getModel().getValueAt(i, 9);
            if (!Utility.VerifyStringVal(key))
                key = new String("");
            if ((Boolean) jTable_Inbox.getModel().getValueAt(i, 7)) {
                selectedIndices.put(key, true);
            }
            if ((Boolean) jTable_Inbox.getModel().getValueAt(i, 8)) {
                selectedIndices.put(key, false);
            }
            if ("finalReceipt".equalsIgnoreCase((String) jTable_Inbox.getModel().getValueAt(i, 3)) && (Boolean) jTable_Inbox.getModel().getValueAt(i, 7)) {
                finalReceiptRefNo.add((String) jTable_Inbox.getModel().getValueAt(i, 1));
            }
        }
        System.out.println("selectedIndices:" + selectedIndices.entrySet());
        if (jTable_Inbox.getRowCount() < 1 || selectedIndices.size() < 1) {
            JOptionPane.showMessageDialog(this, "Please check some transactions to process", "Error", JOptionPane.ERROR_MESSAGE);
            return;
        }
        for (int j = 0; j < finalReceiptRefNo.size(); j++) {
            String referenceNo = (String) finalReceiptRefNo.get(j);
            for (int i = 0; i < jTable_Inbox.getRowCount(); i++) {
                if (referenceNo.equals((String) jTable_Inbox.getModel().getValueAt(i, 1)) && !(Boolean) jTable_Inbox.getModel().getValueAt(i, 7)) {
                    JOptionPane.showMessageDialog(this, "To close a finalReceipt, you must also close the other receipts that have the same reference number", "Error", JOptionPane.ERROR_MESSAGE);
                    return;
                }
            }
        }
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        boolean success = openTransaction.processInbox(accountID, selectedIndices);
        if (success) {
            JOptionPane.showMessageDialog(this, "Inbox processed successfully", "Processing Success", JOptionPane.INFORMATION_MESSAGE);
            Helpers.reloadOTDetails(accountID);
            MainPage.reLoadAccount();
            Helpers.setLoadNymTrades(true);
        } else {
            JOptionPane.showMessageDialog(this, "Error in processing Inbox", "Server Error", JOptionPane.ERROR_MESSAGE);
        }
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        setCursor(Cursor.getDefaultCursor());
    }
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) OpenTransactionAccount(com.moneychanger.core.OpenTransactionAccount) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) Action(org.jdesktop.application.Action)

Example 2 with Action

use of org.jdesktop.application.Action in project darkFunction-Editor by darkFunction.

the class dfEditorView method showAboutBox.

@Action
public void showAboutBox() {
    if (aboutBox == null) {
        JFrame mainFrame = dfEditorApp.getApplication().getMainFrame();
        aboutBox = new dfEditorAboutBoxFree(mainFrame);
        aboutBox.setLocationRelativeTo(mainFrame);
    }
    dfEditorApp.getApplication().show(aboutBox);
}
Also used : JFrame(javax.swing.JFrame) Action(org.jdesktop.application.Action)

Aggregations

Action (org.jdesktop.application.Action)2 OpenTransactionAccount (com.moneychanger.core.OpenTransactionAccount)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 JFrame (javax.swing.JFrame)1