public void setFilterSet(FilterSet filterSet)
        {
            this.filterSet = filterSet;

            if (filterSet.name != null)
            {
                this.textBox1.Text = filterSet.name;
            }

            xVector v = FilterManager.getAvailableSignalItemsAndFilterSet(filterSet);

            vFilters = v;

            int w     = 340;
            int h     = 500;
            int itemH = 30;
            int itemW = w;

            xScrollView scroll = new xScrollView(null, w, h);

            scroll.setSize(w, h);

            w    -= 26;
            itemW = w;

            panel1.Controls.Add(scroll.getControl());

            xContainer container = new xContainer();

            //container.setBackgroundColor(0xff00ff00);
            container.setSize(w, v.size() * itemH);
            //scroll.setControl(container.getControl());

            scroll.addControl(container);

            Context   ctx  = Context.getInstance();
            ImageList imgs = ctx.getImageList(C.IMG_SUB_BUTTONS, 16, 15);

            for (int i = 0; i < v.size(); i++)
            {
                FilterItem item = (FilterItem)v.elementAt(i);
                xContainer c    = new xContainer();
                c.setPosition(0, i * itemH);
                c.setSize(itemW, itemH);

                //  title
                //xLabel l = xLabel.createSingleLabel("asdas ad sad asd");//item.getTitle());

                string s = item.getTitle();
                Utils.trace(s);

                xCheckbox l = xCheckbox.createCheckbox(item.getTitle(), item.selected, null, itemW - 60);

                xFillBackground sep = new xFillBackground(0x80808080);
                sep.setPosition(0, itemH - 1);
                sep.setSize(w, 1);

                xButton setting = null;

                if (item.hasSetting)
                {
                    setting = xButton.createImageButton(0, this, imgs, 0);
                    setting.setPosition(0, (itemH - setting.getH()) / 2);
                    setting.setID(i);

                    l.setPosition(30, (itemH - l.getH()) / 2);
                }
                else
                {
                    l.setPosition(30, (itemH - l.getH()) / 2);
                }

                if (setting != null)
                {
                    c.addControl(setting);
                }

                c.addControl(l);
                c.addControl(sep);

                container.addControl(c);
                //xSco
            }
        }
Example #2
0
        void setShareGroup(stShareGroup g, int sortType)
        {
            if (mTableType == TABLE_GAINLOSS)
            {
                setShareGroupAsFilterResult(g, sortType);
                return;
            }
            //=========================
            this.removeAllControls();

            mTableType = TABLE_NORMAL_PRICEBOARD;

            if (g == null)
            {
                return;
            }

            _shareGroup = g;

            int cnt = g.getTotal();

            int y = 0;

            xLabel l;

            if (hasTitle)
            {
                Font f = Context.getInstance().getFontText();
                l = xLabel.createSingleLabel(g.getName(), f, 300);
                l.setBackgroundColor(C.COLOR_ORANGE);
                l.setSize(rowW, (int)f.GetHeight() + 4);
                l.setPosition(0, 0);
                l.setTextColor(C.COLOR_WHITE);
                addControl(l);

                y = (int)l.getBottom() + 1;
            }

            bool deletable = g.getType() == stShareGroup.ID_GROUP_FAVOR;

            if (deletable)
            {
                Utils.trace("++++++++++===============row is detelable");
            }
            for (int i = 0; i <= cnt; i++)
            {
                int idx = i - 1;
                int rH  = i == 0? 36: rowH;

                RowNormalShare r;
                if (g.getType() == stShareGroup.ID_GROUP_INDICES)
                {
                    r = new RowIndice(mListener, i, rowW, rH);
                    if (idx >= 0)
                    {
                        String code = g.getCodeAt(idx);

                        if (code != null && code.Length > 0)
                        {
                            r.setData(code);
                        }
                        else
                        {
                            continue;
                        }
                        //r.mAllowDelete = deletable;
                    }
                }
                else
                {
                    r = new RowNormalShare(mListener, i, rowW, rH);
                    r.onShowSortMenu += delegateShowSortMenu;
                    r.onSortABC      += delegateSortABC;
                    if (idx >= 0)
                    {
                        int    shareID = g.getIDAt(idx);
                        String code    = g.getCodeAt(idx);

                        if (code != null && code.Length > 0 && shareID >= 0)
                        {
                            r.setData(code);
                        }
                        else
                        {
                            continue;
                        }
                        //r.mAllowDelete = deletable;
                    }
                }
                r.setParent(this);
                r.setSortType(sortType);

                r.setPosition(0, y);
                r.invalidate();
                addControl(r);
                vRows.addElement(r);

                y += rH + 1;
            }

            if (g.getType() == stShareGroup.ID_GROUP_FAVOR)
            {
                xFillBackground bottom = xFillBackground.createFill(rowW, 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);
                int tmp = l.getX();

                //	xoa nhom
                y = (int)l.getBottom() + 4;

                /*
                 * bt = xUIButton.createButton(listener, C.ID_BUTTON_REMOVE_GROUP, " - ", bw);
                 * bt.setSize(bw, xApplication.point2Pixels(40));
                 * bt.setPosition(w - bw - 2, y+1);
                 * addControl(bt);
                 *
                 * l = xLabel.createSingleLabel("Xóa nhóm ->", AppContext.getInstance().getFontText());
                 * l.setTextColor(C.COLOR_RED);
                 * l.setPosition(bt.getX() - l.getW() - 4, y + (bt.getH()-l.getH())/2);
                 * addControl(l);
                 *
                 * y += bt.getH() + 2;
                 */
            }

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

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

            invalidate();
        }
Example #3
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();
        }
Example #4
0
        void createControl(int w)
        {
            xLabel          l;
            int             y      = 0;
            xFillBackground bottom = xFillBackground.createFill(w, 1, C.COLOR_GRAY_LIGHT);

            bottom.setPosition(0, y);
            addControl(bottom);
            y += 1;

            int xPivot = w / 2 + 10;// - xApplication.point2Pixels(120);

            double[] values = { 0, 0, 0 };
            Context.getInstance().getGainLossValue(values);

            String sTmp = Utils.formatNumberDouble(values[0]);

            //	total
            l = xLabel.createSingleLabel("Tổng vốn đầu tư: ");
            l.setTextColor(C.COLOR_WHITE);
            l.setPosition(xPivot - l.getW() - 4, y);

            addControl(l);

            l = xLabel.createSingleLabel(sTmp);
            l.setTextColor(C.COLOR_WHITE);
            l.setPosition(xPivot, y);
            l.setSize(120, l.getH());
            addControl(l);

            // gia tri
            y += l.getH() + 4;
            l  = xLabel.createSingleLabel("Tổng giá trị cổ phiếu: ");
            l.setTextColor(C.COLOR_WHITE);
            l.setPosition(xPivot - l.getW() - 4, y);
            addControl(l);

            sTmp = Utils.formatNumberDouble(values[1]);
            l    = xLabel.createSingleLabel(sTmp);
            l.setSize(120, l.getH());
            l.setTextColor(C.COLOR_WHITE);
            l.setPosition(xPivot, y);
            addControl(l);

            //	loi nhuan
            y += l.getH() + 4;
            l  = xLabel.createSingleLabel("Tổng lợi nhuận: ");
            l.setTextColor(C.COLOR_WHITE);
            l.setPosition(xPivot - l.getW() - 4, y);
            addControl(l);

            sTmp = Utils.formatNumberDouble(values[2]);

            //  percent
            if (values[0] > 0)
            {
                double percent = (values[1] - values[0]) / values[0];
                percent *= 100;

                String sTmp2 = String.Format("{0} ({1:F1}%)", sTmp, percent);
                l = xLabel.createSingleLabel(sTmp2);
            }
            else
            {
                l = xLabel.createSingleLabel(sTmp);
            }
            if (values[2] > 0)
            {
                l.setTextColor(C.COLOR_GREEN);
            }
            else if (values[2] < 0)
            {
                l.setTextColor(C.COLOR_RED);
            }
            else
            {
                l.setTextColor(C.COLOR_WHITE);
            }
            l.setPosition(xPivot, y);
            l.setSize(120, l.getH());
            addControl(l);

            y += l.getH() + 10;

            setSize(w, y);
        }