Search in sources :

Example 1 with BasketTableModel

use of com.moneychanger.ui.model.BasketTableModel in project otapij by FellowTraveler.

the class CustomTable method prepareRenderer.

public Component prepareRenderer(TableCellRenderer renderer, int rowIndex, int vColIndex) {
    Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
    if (c instanceof JComponent) {
        JComponent jc = (JComponent) c;
        if (getValueAt(rowIndex, vColIndex) instanceof String) {
            //Utility.getKeyFromName((String)getValueAt(rowIndex, vColIndex));
            String value = (String) getValueAt(rowIndex, vColIndex);
            if (this.getModel() instanceof AccountTableModel && vColIndex == 0) {
                value = (String) this.getModel().getValueAt(rowIndex, 3);
            }
            if (this.getModel() instanceof NYMTableModel && vColIndex == 0) {
                value = (String) this.getModel().getValueAt(rowIndex, 1);
            }
            if (this.getModel() instanceof BasketTableModel && vColIndex == 0) {
                value = (String) this.getModel().getValueAt(rowIndex, 1);
            }
            if (this.getModel() instanceof AssetContractTableModel && vColIndex == 0) {
                value = (String) this.getModel().getValueAt(rowIndex, 1);
            }
            if (this.getModel() instanceof ServerContractTableModel && vColIndex == 0) {
                value = (String) this.getModel().getValueAt(rowIndex, 1);
            }
            if (this.getModel() instanceof OTOutboxTableModel) {
                if (vColIndex == 4)
                    value = (String) this.getModel().getValueAt(rowIndex, 8);
                if (vColIndex == 5)
                    value = (String) this.getModel().getValueAt(rowIndex, 9);
            }
            if (this.getModel() instanceof OTInboxTableModel) {
                if (vColIndex == 4)
                    value = (String) this.getModel().getValueAt(rowIndex, 10);
                if (vColIndex == 5)
                    value = (String) this.getModel().getValueAt(rowIndex, 11);
            }
            if (this.getModel() instanceof NYMOutboxTableModel) {
                if (vColIndex == 1)
                    value = (String) this.getModel().getValueAt(rowIndex, 4);
                if (vColIndex == 2)
                    value = (String) this.getModel().getValueAt(rowIndex, 5);
            }
            if (this.getModel() instanceof NYMBoxTableModel) {
                if (vColIndex == 1)
                    value = (String) this.getModel().getValueAt(rowIndex, 4);
                if (vColIndex == 2)
                    value = (String) this.getModel().getValueAt(rowIndex, 5);
            }
            jc.setToolTipText(value);
        }
    }
    return c;
}
Also used : BasketTableModel(com.moneychanger.ui.model.BasketTableModel) NYMTableModel(com.moneychanger.ui.model.NYMTableModel) OTInboxTableModel(com.moneychanger.ui.model.OTInboxTableModel) NYMBoxTableModel(com.moneychanger.ui.model.NYMBoxTableModel) AccountTableModel(com.moneychanger.ui.model.AccountTableModel) NYMOutboxTableModel(com.moneychanger.ui.model.NYMOutboxTableModel) JComponent(javax.swing.JComponent) OTOutboxTableModel(com.moneychanger.ui.model.OTOutboxTableModel) JComponent(javax.swing.JComponent) Component(java.awt.Component) ServerContractTableModel(com.moneychanger.ui.model.ServerContractTableModel) AssetContractTableModel(com.moneychanger.ui.model.AssetContractTableModel)

Example 2 with BasketTableModel

use of com.moneychanger.ui.model.BasketTableModel in project otapij by FellowTraveler.

the class MainPage method jComboBox7ActionPerformed.

//GEN-LAST:event_jTabbedPane_MainPageStateChanged
private void jComboBox7ActionPerformed(java.awt.event.ActionEvent evt) {
    //GEN-FIRST:event_jComboBox7ActionPerformed
    String currentServerID = "ALL";
    if (serverMap != null && serverMap.size() > 0 && jComboBox7.getSelectedIndex() > -1) {
        currentServerID = ((String[]) serverMap.get((Integer) jComboBox7.getSelectedIndex()))[1];
    }
    System.out.println("Server dropdown currentServerID:" + currentServerID);
    List baskets = Basket.getBasketList(currentServerID, null);
    System.out.println("baskets:" + baskets);
    System.out.println("baskets.size():" + baskets.size());
    if (baskets != null && baskets.size() > 0 && !"Popup Dialog".equalsIgnoreCase(((String[]) baskets.get(0))[0])) {
        ((BasketTableModel) jTable19.getModel()).setValue(baskets);
    } else if (baskets != null && baskets.size() != 0) {
        // Show dialog asking for register
        new RegisterNymOnServerDialog(this, true, currentServerID).setVisible(true);
        if (!Utility.VerifyStringVal(Helpers.getNymID())) {
            return;
        }
        String nymID = Helpers.getNymID();
        ((BasketTableModel) jTable19.getModel()).setValue(Basket.getBasketList(currentServerID, nymID));
    }
    jTextField9.setText("");
    jTextField11.setText("");
    jLabel62.setText("");
}
Also used : BasketTableModel(com.moneychanger.ui.model.BasketTableModel) RegisterNymOnServerDialog(com.moneychanger.ui.dialogs.RegisterNymOnServerDialog) List(java.util.List)

Example 3 with BasketTableModel

use of com.moneychanger.ui.model.BasketTableModel in project otapij by FellowTraveler.

the class MainPage method initBasketsTab.

private void initBasketsTab() {
    Helpers.populateComboWithoutAll(serverMap, jComboBox7);
    BasketTableModel.removeCols(jTable19);
    jLabel62.setText("");
    String currentServerID = "ALL";
    if (serverMap != null && serverMap.size() > 0 && jComboBox7.getSelectedIndex() > -1) {
        currentServerID = ((String[]) serverMap.get((Integer) jComboBox7.getSelectedIndex()))[1];
    }
    List baskets = Basket.getBasketList(currentServerID, null);
    System.out.println("baskets:" + baskets);
    System.out.println("baskets.size():" + baskets.size());
    if (baskets != null && baskets.size() > 0 && !"Popup Dialog".equalsIgnoreCase(((String[]) baskets.get(0))[0])) {
        ((BasketTableModel) jTable19.getModel()).setValue(baskets);
    } else if (baskets != null && !baskets.isEmpty()) {
        // Show dialog asking for register
        new RegisterNymOnServerDialog(this, true, currentServerID).setVisible(true);
        if (!Utility.VerifyStringVal(Helpers.getNymID())) {
            return;
        }
        String nymID = Helpers.getNymID();
        ((BasketTableModel) jTable19.getModel()).setValue(Basket.getBasketList(currentServerID, nymID));
    }
    jTable19.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }
            System.out.println("jTable19 valueChanged Basket List Action Listener :" + jTable19.getSelectedRow() + "e:" + e.getSource());
            basketClick();
        }
    });
}
Also used : BasketTableModel(com.moneychanger.ui.model.BasketTableModel) RegisterNymOnServerDialog(com.moneychanger.ui.dialogs.RegisterNymOnServerDialog) ListSelectionEvent(javax.swing.event.ListSelectionEvent) List(java.util.List) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 4 with BasketTableModel

use of com.moneychanger.ui.model.BasketTableModel in project otapij by FellowTraveler.

the class MainPage method jButton32ActionPerformed.

private void jButton32ActionPerformed(java.awt.event.ActionEvent evt) {
    //GEN-FIRST:event_jButton32ActionPerformed
    if (jTable19.getSelectedRow() > -1) {
        String assetID = (String) jTable19.getModel().getValueAt(jTable19.getSelectedRow(), 1);
        new AssetContractEditDialog(this, true, (String) jTable19.getModel().getValueAt(jTable19.getSelectedRow(), 1)).setVisible(true);
        refreshAssetContractList();
        String currentServerID = "ALL";
        if (serverMap != null && serverMap.size() > 0 && jComboBox7.getSelectedIndex() > -1) {
            currentServerID = ((String[]) serverMap.get((Integer) jComboBox7.getSelectedIndex()))[1];
        }
        System.out.println("currentServerID:" + currentServerID);
        List baskets = Basket.getBasketList(currentServerID, null);
        if (baskets != null && baskets.size() > 0 && !"Popup Dialog".equalsIgnoreCase(((String[]) baskets.get(0))[0])) {
            ((BasketTableModel) jTable19.getModel()).setValue(baskets);
            if (Utility.VerifyStringVal(assetID)) {
                for (int i = 0; i < jTable19.getRowCount(); i++) {
                    String id = (String) jTable19.getModel().getValueAt(i, 1);
                    if (!Utility.VerifyStringVal(id)) {
                        continue;
                    }
                    if (assetID.equals(id)) {
                        jTable19.setRowSelectionInterval(i, i);
                        break;
                    }
                }
            }
        }
    } else {
        JOptionPane.showMessageDialog(this, "Please select an Asset Contract to edit.", "Asset Contract Edit Error", JOptionPane.ERROR_MESSAGE);
    }
}
Also used : BasketTableModel(com.moneychanger.ui.model.BasketTableModel) List(java.util.List) AssetContractEditDialog(com.moneychanger.ui.dialogs.AssetContractEditDialog) Point(java.awt.Point)

Example 5 with BasketTableModel

use of com.moneychanger.ui.model.BasketTableModel in project otapij by FellowTraveler.

the class MainPage method setAssets.

public static void setAssets(String serverID, String assetID) {
    List baskets = Basket.getBasketList(serverID, null);
    if (baskets != null && baskets.size() > 0 && !"Popup Dialog".equalsIgnoreCase(((String[]) baskets.get(0))[0])) {
        ((BasketTableModel) jTable19.getModel()).setValue(baskets);
    }
    refreshAssetContractList();
    if (Utility.VerifyStringVal(assetID)) {
        for (int i = 0; i < jTable19.getRowCount(); i++) {
            String id = (String) jTable19.getModel().getValueAt(i, 1);
            if (!Utility.VerifyStringVal(id)) {
                continue;
            }
            if (assetID.equals(id)) {
                jTable19.setRowSelectionInterval(i, i);
                break;
            }
        }
    }
}
Also used : BasketTableModel(com.moneychanger.ui.model.BasketTableModel) List(java.util.List) Point(java.awt.Point)

Aggregations

BasketTableModel (com.moneychanger.ui.model.BasketTableModel)5 List (java.util.List)4 RegisterNymOnServerDialog (com.moneychanger.ui.dialogs.RegisterNymOnServerDialog)2 Point (java.awt.Point)2 AssetContractEditDialog (com.moneychanger.ui.dialogs.AssetContractEditDialog)1 AccountTableModel (com.moneychanger.ui.model.AccountTableModel)1 AssetContractTableModel (com.moneychanger.ui.model.AssetContractTableModel)1 NYMBoxTableModel (com.moneychanger.ui.model.NYMBoxTableModel)1 NYMOutboxTableModel (com.moneychanger.ui.model.NYMOutboxTableModel)1 NYMTableModel (com.moneychanger.ui.model.NYMTableModel)1 OTInboxTableModel (com.moneychanger.ui.model.OTInboxTableModel)1 OTOutboxTableModel (com.moneychanger.ui.model.OTOutboxTableModel)1 ServerContractTableModel (com.moneychanger.ui.model.ServerContractTableModel)1 Component (java.awt.Component)1 JComponent (javax.swing.JComponent)1 ListSelectionEvent (javax.swing.event.ListSelectionEvent)1 ListSelectionListener (javax.swing.event.ListSelectionListener)1