Search in sources :

Example 1 with MarketTradesTableModel

use of com.moneychanger.ui.model.MarketTradesTableModel 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);
        }
    }
}
Also used : NYM(com.moneychanger.core.NYM) ListSelectionEvent(javax.swing.event.ListSelectionEvent) MarketTradesTableModel(com.moneychanger.ui.model.MarketTradesTableModel) Map(java.util.Map) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 2 with MarketTradesTableModel

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

the class MainPage method jTabbedPane_MainPageStateChanged.

//GEN-LAST:event_jButton_RegisterNymActionPerformed
private void jTabbedPane_MainPageStateChanged(javax.swing.event.ChangeEvent evt) {
    //GEN-FIRST:event_jTabbedPane_MainPageStateChanged
    JTabbedPane pane = (JTabbedPane) evt.getSource();
    int sel = pane.getSelectedIndex();
    System.out.println("Mainpage tab eventState changed:" + sel);
    if (sel == 4 && Helpers.isLoadNymTrades()) {
        String serverID = "ALL";
        String nymID = "ALL";
        if (serverMap != null && serverMap.size() > 0 && jComboBox5.getSelectedIndex() > -1) {
            serverID = ((String[]) serverMap.get((Integer) jComboBox5.getSelectedIndex()))[1];
        }
        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);
            }
            Helpers.setLoadNymTrades(false);
        }
    }
    if (sel == 3 && !isBasketInit) {
        initBasketsTab();
        isBasketInit = true;
    }
    if (sel == 4 && !isMarketInit) {
        initMarketsTab();
        isMarketInit = true;
    }
    if (sel == 5 && !isPaymentsInit) {
        initPaymentsInitTab();
        isPaymentsInit = true;
    }
}
Also used : JTabbedPane(javax.swing.JTabbedPane) MarketTradesTableModel(com.moneychanger.ui.model.MarketTradesTableModel) Map(java.util.Map) Point(java.awt.Point)

Aggregations

MarketTradesTableModel (com.moneychanger.ui.model.MarketTradesTableModel)2 Map (java.util.Map)2 NYM (com.moneychanger.core.NYM)1 Point (java.awt.Point)1 JTabbedPane (javax.swing.JTabbedPane)1 ListSelectionEvent (javax.swing.event.ListSelectionEvent)1 ListSelectionListener (javax.swing.event.ListSelectionListener)1