Пример #1
0
        public TablePriceboard(xIEventListener listener, GainLossManager gainlosses, int w, int rowH)
            : base(listener)
        {
            setBackgroundColor(C.COLOR_BLACK);

            int cnt = gainlosses.getTotal();

            int y = 0;

            Font   f = Context.getInstance().getFontText();
            xLabel l = xLabel.createSingleLabel("Lãi lỗ");

            l.setBackgroundColor(C.COLOR_ORANGE);
            l.setSize(w, (int)f.GetHeight() + 4);
            l.setPosition(0, 0);
            l.setTextColor(C.COLOR_GREEN);
            y = l.getBottom() + 1;

            addControl(l);

            for (int i = 0; i <= cnt; i++)
            {
                int idx = i - 1;
                int rH  = rowH;
                if (idx == -1)
                {
                    rH = 20;
                }

                RowGainloss r = new RowGainloss(listener, i, w, rH);

                if (idx >= 0)
                {
                    stGainloss g = (stGainloss)gainlosses.getGainLossAt(idx);

                    r.setData(g);
                }
                r.setParent(this);
                r.setPosition(0, y);

                addControl(r);
                vRows.addElement(r);

                y += rH + 1;
            }

            //	thong ke
            {
                GainLossSumary sumary = new GainLossSumary(w);
                sumary.setPosition(0, y);
                addControl(sumary);

                y += sumary.getH();
            }
            //  Help
            {
                xFillBackground bottom = xFillBackground.createFill(w, 1, C.COLOR_GRAY_LIGHT);
                bottom.setPosition(0, y);
                addControl(bottom);
                y += 1;

                l = xLabel.createSingleLabel("Click phím phải chuột để thêm/xóa mã hoặc nhóm");
                l.setTextColor(C.COLOR_WHITE);
                l.setPosition(l.getW() - 4, y + 3);
                addControl(l);

                y += l.getH() + 4;
            }

            xFillBackground fillBottom = xFillBackground.createFill(w, 2, C.COLOR_GRAY_LIGHT);

            fillBottom.setPosition(0, y);
            addControl(fillBottom);

            invalidate();
        }
Пример #2
0
        protected xContainer createChartRangeControls(int sel, xContainer c)
        {
            Share share        = mContext.getSelectedShare();
            int   currentRange = 0;

            if (share != null)
            {
                currentRange = share.getCursorScope();
            }
            c.removeAllControls();
            //  5 days, 1 month, 3 month, 6 month, 1 year, 2 year
            String[] ss     = { "5d", "1m", "3m", "6m", "1y", "2y", "-", null };
            int[]    scopes = { Share.SCOPE_1WEEKS, Share.SCOPE_1MONTH, Share.SCOPE_3MONTHS, Share.SCOPE_6MONTHS, Share.SCOPE_1YEAR, Share.SCOPE_2YEAR, Share.SCOPE_ALL };
            int      i      = 0;

            int w = 10;
            int h = 20;
            int x = 0;

            //  update sel
            if (currentRange > 0)
            {
                for (i = 0; i < scopes.Length; i++)
                {
                    if (currentRange >= scopes[i])
                    {
                        sel = i;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            if (currentRange > Share.SCOPE_2YEAR)
            {
                sel = scopes.Length - 1;
            }
            //==========================
            i = 0;
            while (ss[i] != null)
            {
                xLabel l = xLabel.createSingleLabel(ss[i], mContext.getFontSmallest(), 25);

                l.setPosition(x, 0);
                l.setAlign(xGraphics.HCENTER);
                l.enableClick(C.ID_CHART_RANGE + i, this);
                c.addControl(l);
                if (i == sel)
                {
                    l.setBackgroundColor(C.COLOR_GRAY_DARK);
                    l.setTextColor(C.COLOR_WHITE);
                }
                else
                {
                    l.setBackgroundColor(C.COLOR_GRAY_LIGHT);
                    l.setTextColor(C.COLOR_BLACK);
                }

                x = l.getRight() + 1;
                h = l.getH();

                i++;
            }
            w = x;
            c.setSize(w, h);
            c.setOpaque(0.7f);

            return(c);
        }