Ejemplo n.º 1
0
        void doMoveNextItem(int dir)
        {
            int newItem = mSelectedIndex;

            newItem += dir;

            if (newItem >= vRows.size() && vRows.size() > 1)
            {
                newItem = 1;
            }
            if (newItem < 0 || newItem >= vRows.size())
            {
                return;
            }

            RowNormalShare row = (RowNormalShare)vRows.elementAt(newItem);


            String code = row.getCode();

            if (code != null && code.Length > 0)
            {
                Share share = Context.getInstance().mShareManager.getShare(code);

                if (share != null)
                {
                    mSelectedIndex = newItem;
                    selectRow(row);

                    mListener.onEvent(this, xBaseControl.EVT_BUTTON_CLICKED, C.ID_SELECT_SHARE_CANDLE, share);
                }
            }
        }
Ejemplo n.º 2
0
        public void selectRow(RowNormalShare row)
        {
            if (row == mLastSelectedRow)
            {
                row.deselect();
                mLastSelectedRow = null;
            }
            else
            {
                if (mLastSelectedRow != null)
                {
                    mLastSelectedRow.deselect();
                }

                row.select();
                mLastSelectedRow = row;
            }
        }
Ejemplo n.º 3
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();
        }