コード例 #1
0
        void onPageSelected(int pageIdx)
        {
            mContext.setMarketControlTab(mMarketID, pageIdx);

            int      idx  = TAB_INDEX[pageIdx];
            xTabPage page = mTab.getPageAtIndex(pageIdx);

            if (idx == ID_ONLINE_CHART)
            {
                mRealtimeChart.invalidate();
            }
            else if (idx == ID_CANDLE)
            {
                xContainer c = new xContainer();
                c.setSize(mCurrentChart);

                TodayCandle            candle = new TodayCandle();
                stPriceboardStateIndex pi     = mContext.mPriceboard.getPriceboardIndexOfMarket(mMarketID);
                Share share = mContext.mShareManager.getShare(pi.code);
                candle.setShare(share);

                int w  = mCurrentChart.getW();
                int h  = mCurrentChart.getH();
                int cw = w * 3 / 7;
                if (cw > 160)
                {
                    cw = 160;
                }
                candle.setSize(cw, h);

                c.addControl(candle);

                //  summary
                xBaseControl summary = createMarketSummary(w - cw, h);
                summary.setPosition(cw, 0);
                c.addControl(summary);

                mCurrentChart = c;
                //==============================
                page.resetContent();
                page.addControl(c);
            }
            else if (idx == ID_MONEY_CHART)
            {
                page.resetContent();

                ChartStatistics moneyChart = new ChartStatistics(mMarketID, mListener);
                moneyChart.setSize(mRealtimeChart.getW(), mRealtimeChart.getH() - 18);
                moneyChart.setPosition(mRealtimeChart.getX(), mRealtimeChart.getY());
                moneyChart.setChartType(ChartStatistics.BUBBLE_TRADE_MONEY);

                moneyChart.doCalcChanged();

                page.addControl(moneyChart);

                mCurrentChart = moneyChart;
            }
            else if (idx == ID_VOLUMN_CHART)
            {
                page.resetContent();

                ChartStatistics moneyChart = new ChartStatistics(mMarketID, mListener);
                moneyChart.setSize(mRealtimeChart.getW(), mRealtimeChart.getH() - 18);
                moneyChart.setPosition(mRealtimeChart.getX(), mRealtimeChart.getY());
                moneyChart.setChartType(ChartStatistics.BUBBLE_VOLUME_WEIGHT);

                moneyChart.doCalcChanged();

                page.addControl(moneyChart);

                mCurrentChart = moneyChart;
            }
            else if (idx == ID_INDEX_EFFECT_INC)
            {
                page.resetContent();

                ChartStatistics moneyChart = new ChartStatistics(mMarketID, mListener);
                moneyChart.setSize(mRealtimeChart.getW(), mRealtimeChart.getH() - 18);
                moneyChart.setPosition(mRealtimeChart.getX(), mRealtimeChart.getY());
                moneyChart.setChartType(ChartStatistics.BUBBLE_INDEX_WEIGHT_RATIO_INC);

                moneyChart.doCalcChanged();

                page.addControl(moneyChart);

                mCurrentChart = moneyChart;
            }
            else if (idx == ID_INDEX_EFFECT_DEC)
            {
                page.resetContent();

                ChartStatistics moneyChart = new ChartStatistics(mMarketID, mListener);
                moneyChart.setSize(mRealtimeChart.getW(), mRealtimeChart.getH() - 18);
                moneyChart.setPosition(mRealtimeChart.getX(), mRealtimeChart.getY());
                moneyChart.setChartType(ChartStatistics.BUBBLE_INDEX_WEIGHT_RATIO_DEC);

                moneyChart.doCalcChanged();

                page.addControl(moneyChart);

                mCurrentChart = moneyChart;
            }
        }