Ejemplo n.º 1
0
        //  code | _ref | KL1 | G1 |= GiaKhop | KLKhop | TongKL =| KL1 | G1 |=== TB | Cao | Thap
        virtual protected void updateQuote()
        {
            if (getID() < 0)
            {
                return;
            }

            Context ctx = Context.getInstance();
            stCell  c;

            if (getID() == 0)
            {
                //  code
                setCellValue(0, "▼ Mã\nTC", C.COLOR_ORANGE);

                setCellValue(2, "M3/KL", C.COLOR_GRAY);
                setCellValue(3, "M2/KL", C.COLOR_GRAY);
                setCellValue(4, "M1/KL", C.COLOR_GRAY);

                setCellValue(5, "Khớp", C.COLOR_GRAY);
                setCellValue(6, "+/-", C.COLOR_GRAY);

                setCellValue(7, "B1/KL", C.COLOR_GRAY);
                setCellValue(8, "B2/KL", C.COLOR_GRAY);
                setCellValue(9, "B3/KL", C.COLOR_GRAY);

                setCellValue(10, "H/L", C.COLOR_GRAY);

                setCellValue(11, "TổngKL", C.COLOR_GRAY);

                /*
                 * c = getCellAt(11);
                 * if (c != null)
                 * {
                 *  c.text2 = "DưB";
                 *  c.textColor2 = C.COLOR_GRAY;
                 * }
                 */

                if (sortType == ShareSortUtils.SORT_DUMUA_DUBAN)
                {
                    setCellValue(12, "▼ Dư\nM/B", C.COLOR_ORANGE);
                }
                else
                {
                    setCellValue(12, "▼ " + ShareSortUtils.sortTypeToString(sortType), C.COLOR_ORANGE);
                }
            }

            if (getID() == 0)
            {
                return;
            }

            String code = (String)getUserData();

            if (code == null)
            {
                return;
            }
            stPriceboardState item = ctx.mPriceboard.getPriceboard(code);
            stPriceboardState ps   = item;

            if (item == null)
            {
                return;
            }

            Share share = ctx.mShareManager.getShare(ps.id);

            if (share == null)
            {
                return;
            }

            String s;

            //  code
            uint color;

            setCellValue(0, code, C.COLOR_WHITE);
            addCellValue1(0, String.Format("{0:F2}", item.getRef()), C.COLOR_YELLOW);
            float _ref = item.getRef();

            int   j = 0;
            float v;

            int[]   rbc = { 2, 3, 4 };  //	remain buy col
            float[] rb  = { ps.getRemainBuyPrice2(), ps.getRemainBuyPrice1(), ps.getRemainBuyPrice0() };
            int[]   rbv = { ps.getRemainBuyVolume2(), ps.getRemainBuyVolume1(), ps.getRemainBuyVolume0() };

            int[]   rsc = { 7, 8, 9 };
            float[] rs  = { ps.getRemainSellPrice0(), ps.getRemainSellPrice1(), ps.getRemainSellPrice2() };
            int[]   rsv = { ps.getRemainSellVolume0(), ps.getRemainSellVolume1(), ps.getRemainSellVolume2() };
            //	mua1, mua2, mua3

            for (j = 0; j < 3; j++)
            {
                //	price
                color = ctx.valToColorF(rb[j], item.getCe(), item.getRef(), item.getFloor());
                setCellValue(rbc[j], String.Format("{0:F2}", rb[j]), color);
                //	vol
                s = volumeToString(rbv[j]);

                addCellValue1(rbc[j], s);
            }

            //  Khop
            float currentPrice = item.getCurrentPrice();
            int   currentVol   = item.getCurrentVolume();

            color = ctx.valToColorF(currentPrice, item.getCe(), item.getRef(), item.getFloor());
            setCellValue(5, String.Format("{0:F2}", currentPrice), color);

            s = volumeToString(currentVol);

            addCellValue1(5, s);

            //  change +/-
            v = currentPrice - item.getRef();
            s = String.Format("{0:F2}", (float)v);
            if (currentPrice == 0)
            {
                s = "-";
            }
            setCellValue(6, s, color);

            //	sell1, sell2, sell3
            for (j = 0; j < 3; j++)
            {
                //	price
                color = ctx.valToColorF(rs[j], item.getCe(), item.getRef(), item.getFloor());
                setCellValue(rsc[j], String.Format("{0:F2}", rs[j]), color);
                //	vol
                s = volumeToString(rsv[j]);

                addCellValue1(rsc[j], s);
            }

            //  cao - thap
            setCellValue(10, String.Format("{0:F2}", item.getMax()), ctx.valToColorF(item.getMax(), item.getCe(), item.getRef(), item.getFloor()));
            addCellValue1(10, String.Format("{0:F2}", item.getMin()), ctx.valToColorF(item.getMin(), item.getCe(), item.getRef(), item.getFloor()));

            //  total volume
//            s = volumeToString(item.getTotalVolume());
//            setCellValue(11, s, C.COLOR_WHITE);
            mVolumeColumn = 11;

            //  cung - cau
            if (sortType == ShareSortUtils.SORT_DUMUA_DUBAN)
            {
                int    buy   = item.getRemainBuyVolume0() + item.getRemainBuyVolume1() + item.getRemainBuyVolume2();
                int    sell  = item.getRemainSellVolume0() + item.getRemainSellVolume1() + item.getRemainSellVolume2();
                String sbuy  = volumeToString(buy);
                String ssell = volumeToString(sell);
                setCellValue(12, sbuy, C.COLOR_ORANGE);
                c = getCellAt(12);
                if (c != null)
                {
                    c.text2      = ssell;
                    c.textColor2 = C.COLOR_ORANGE;
                }
            }
            else
            {
                setCellValue(12, share.mCompareText, C.COLOR_ORANGE);
                c = getCellAt(12);
                if (c != null)
                {
                    c.text2      = null;
                    c.textColor2 = C.COLOR_ORANGE;
                }
            }
        }
Ejemplo n.º 2
0
        //  code | ref | KL1 | G1 |= GiaKhop | KLKhop | TongKL =| KL1 | G1 |=== TB | Cao | Thap
        override protected void updateQuote()
        {
            if (getID() < 0)
            {
                return;
            }
            Context ctx = Context.getInstance();

            if (getID() == 0)
            {
                //  code
                setCellValue(0, "Mã/Giá", C.COLOR_GRAY);

                setCellValue(2, "+/-", C.COLOR_GRAY);
                addCellValue1(2, "%", C.COLOR_GRAY);

                setCellValue(3, "Khối lượng", C.COLOR_GRAY);
                setCellValue(4, ShareSortUtils.sortTypeToString(sortType), C.COLOR_ORANGE);
            }

            if (getID() == 0)
            {
                return;
            }

            String code = (String)this.getUserData();

            if (code == null)
            {
                return;
            }
            stPriceboardState item = ctx.mPriceboard.getPriceboard(code);

            if (item == null)
            {
                return;
            }

            String s;

            //  code
            uint color;

            setCellValue(0, item.getCode(), C.COLOR_WHITE);

            float reference = item.getRef();
            float price     = item.getCurrentPrice();

            if (price == 0)
            {
                price = reference;
            }
            color = ctx.valToColorF(item.getCurrentPrice(), item.getCe(), item.getRef(), item.getFloor());
            addCellValue1(0, String.Format("{0:F2}", item.getCurrentPrice()), color);

            int j = 0;
            //  change +/-
            float v = price - reference;

            s = String.Format("{0:F2}", (float)v);
            if (item.getCurrentPrice() == 0)
            {
                s = "-";
            }
            setCellValue(2, s, color);

            //  change percent
            if (reference > 0)
            {
                s = String.Format("{0:F1}", (float)((v * 100) / reference));
                addCellValue1(2, s, color);
            }

            //  volume
            //s = volumeToString(item.getTotalVolume());
            //setCellValue(3, s, C.COLOR_WHITE);

            //Share share = (Share)mFilteredShares.elementAt(row);
            mVolumeColumn = 3;

            //  short column
            Share share = Context.getInstance().mShareManager.getShare(getCode());

            if (share != null)
            {
                setCellValue(4, share.mCompareText, C.COLOR_ORANGE);
                stCell c = getCellAt(4);
                if (c != null)
                {
                    c.text2      = null;
                    c.textColor2 = C.COLOR_ORANGE;
                }
            }
        }