Search in sources :

Example 1 with MarketRecentTradesTableModel

use of com.moneychanger.ui.model.MarketRecentTradesTableModel 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)

Aggregations

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 MarketOffersTableModel (com.moneychanger.ui.model.MarketOffersTableModel)1 MarketRecentTradesTableModel (com.moneychanger.ui.model.MarketRecentTradesTableModel)1 AWTException (java.awt.AWTException)1