Search in sources :

Example 1 with MarketOffersTableModel

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

the class MainPage method marketListClick.

private void marketListClick() {
    try {
        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)) {
            MarketDetails marketDetails = Market.getMarketDetails((String) jTable13.getModel().getValueAt(jTable13.getSelectedRow(), 1), serverID, nymID);
            System.out.println("marketDetails:" + marketDetails);
            if (marketDetails != null) {
                MarketTicker marketTicker = marketDetails.getMarketTicker();
                jLabel3.setText("Last:" + marketTicker.getLastPrice() + "          Bid:" + marketTicker.getHighestBid() + "          Ask:" + marketTicker.getLowestAsk());
                jLabel46.setVisible(true);
                jLabel46.setText(!Utility.VerifyStringVal(marketDetails.getAssetTypeID()) ? "" : marketDetails.getAssetTypeID());
                jLabel46.setToolTipText(jLabel46.getText());
                jLabel25.setVisible(true);
                jLabel25.setText(!Utility.VerifyStringVal(marketDetails.getAssetTypeName()) ? "" : marketDetails.getAssetTypeName());
                jLabel30.setVisible(true);
                jLabel25.setToolTipText(jLabel25.getText());
                jLabel30.setText(!Utility.VerifyStringVal(marketDetails.getCurrencyName()) ? "" : marketDetails.getCurrencyName());
                jLabel30.setToolTipText(jLabel30.getText());
                jLabel27.setVisible(true);
                jLabel27.setText(!Utility.VerifyStringVal(marketDetails.getCurrencyID()) ? "" : marketDetails.getCurrencyID());
                jLabel27.setToolTipText(jLabel27.getText());
                jLabel39.setVisible(true);
                jLabel39.setText(!Utility.VerifyStringVal(marketDetails.getServerName()) ? "" : marketDetails.getServerName());
                jLabel39.setToolTipText(jLabel39.getText());
                jLabel32.setVisible(true);
                jLabel32.setText(!Utility.VerifyStringVal(marketDetails.getServerID()) ? "" : marketDetails.getServerID());
                jLabel32.setToolTipText(jLabel32.getText());
                jLabel41.setVisible(true);
                jLabel40.setVisible(true);
                jLabel40.setText("Scale");
                jLabel41.setText(!Utility.VerifyStringVal(marketDetails.getGranularity()) ? "" : marketDetails.getGranularity());
                jLabel41.setToolTipText(jLabel41.getText());
                jLabel59.setText(marketDetails.getTotalAssets());
                jLabel59.setToolTipText(jLabel59.getText());
                jLabel60.setText(marketDetails.getNbrBids());
                jLabel60.setToolTipText(jLabel60.getText());
                jLabel61.setText(marketDetails.getNbrAsks());
                jLabel61.setToolTipText(jLabel61.getText());
                ((MarketBidTableModel) jTable15.getModel()).setValue(marketDetails.getMarketBid(), jTable15);
                ((MarketAskTableModel) jTable17.getModel()).setValue(marketDetails.getMarketAsk(), jTable17);
                ((MarketRecentTradesTableModel) jTable18.getModel()).setValue(marketDetails.getMarketRecentTrades(), jTable18);
                ((MarketOffersTableModel) jTable14.getModel()).setValue(marketDetails.getNymOffers(), jTable14);
                if (jTable14.getRowCount() > 0) {
                    jTable14.setRowSelectionInterval(0, 0);
                    nymOfferClick();
                }
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(MainPage.class.getName()).log(Level.SEVERE, null, ex);
    }
}
Also used : MarketOffersTableModel(com.moneychanger.ui.model.MarketOffersTableModel) MarketAskTableModel(com.moneychanger.ui.model.MarketAskTableModel) MarketDetails(com.moneychanger.core.dataobjects.MarketDetails) MarketTicker(com.moneychanger.core.dataobjects.MarketTicker) MarketRecentTradesTableModel(com.moneychanger.ui.model.MarketRecentTradesTableModel) AWTException(java.awt.AWTException) MarketBidTableModel(com.moneychanger.ui.model.MarketBidTableModel)

Example 2 with MarketOffersTableModel

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

the class MainPage method refreshMarketOfferList.

public static void refreshMarketOfferList(String serverID, String nymID) {
    Map marketList = null;
    Map offerList = null;
    try {
        // DEBUGGING: this is where the next step happens
        marketList = Market.loadMarketList(serverID, nymID);
        offerList = Market.getNymOfferList(serverID, nymID);
        if (marketList != null) {
            ((MarketTableModel) jTable13.getModel()).setValue(marketList, jTable13);
        } else {
            System.out.println("refreshMarketOfferList:  Market.loadMarketList() returned null!");
        }
        // ------------------------------------
        if (offerList != null) {
            ((MarketOffersTableModel) jTable14.getModel()).setValue(offerList, jTable14);
        } else {
            System.out.println("refreshMarketOfferList:  Market.getNymOfferList() returned null!");
        }
        // ------------------------------------
        if (marketList != null && marketList.size() > 0) {
            jTable13.setRowSelectionInterval(0, 0);
        } else {
            System.out.println("refreshMarketOfferList:  marketList.size() was <= 0");
        }
        // ------------------------------------
        if (offerList != null && offerList.size() > 0) {
            jTable14.setRowSelectionInterval(0, 0);
        } else {
            System.out.println("refreshMarketOfferList:  offerList.size() was <= 0");
        }
    // ------------------------------------
    } catch (Exception ex) {
        Logger.getLogger(MainPage.class.getName()).log(Level.SEVERE, null, ex);
    }
}
Also used : MarketTableModel(com.moneychanger.ui.model.MarketTableModel) MarketOffersTableModel(com.moneychanger.ui.model.MarketOffersTableModel) Map(java.util.Map) AWTException(java.awt.AWTException)

Aggregations

MarketOffersTableModel (com.moneychanger.ui.model.MarketOffersTableModel)2 AWTException (java.awt.AWTException)2 MarketDetails (com.moneychanger.core.dataobjects.MarketDetails)1 MarketTicker (com.moneychanger.core.dataobjects.MarketTicker)1 MarketAskTableModel (com.moneychanger.ui.model.MarketAskTableModel)1 MarketBidTableModel (com.moneychanger.ui.model.MarketBidTableModel)1 MarketRecentTradesTableModel (com.moneychanger.ui.model.MarketRecentTradesTableModel)1 MarketTableModel (com.moneychanger.ui.model.MarketTableModel)1 Map (java.util.Map)1