Пример #1
0
        }                                    // sortable

        internal LgColumn(TableManager tableManager, GuiMgControl columnControl, int mgColumnIdx)
            : base(columnControl, tableManager.getTable())
        {
            _tableManager = tableManager;
            _children     = new List <GuiMgControl>();
            List <GuiMgControl> tableChildren = tableManager.getChildren();
            int rowChildrenCount = 0;

            for (int i = 0;
                 i < tableChildren.Count;
                 i++)
            {
                GuiMgControl guiMgControl = tableChildren[i];
                if (guiMgControl.Layer - 1 == mgColumnIdx)
                {
                    // add control to the children's list
                    _children.Add(guiMgControl);

                    if (!guiMgControl.IsTableHeaderChild)
                    {
                        // save index in the list on MgControlData
                        tableManager.setIndexIncolumn(guiMgControl, rowChildrenCount++);
                    }
                }
            }
            _tableControl        = tableManager.getTable();
            _logicalColumnHelper = new LogicalColumnHelper(_tableControl, mgColumnIdx, GuiUtils.AccessTest);
            ContentAlignment     = ContentAlignment.MiddleLeft;
            TopBorder            = true;
            RightBorder          = true;

            if (TableColumn != null)
            {
                base.Visible    = true;
                TableColumn.Tag = new TagData();
                ColumnHandler.getInstance().addHandler(TableColumn);
                var td = (TagData)TableColumn.Tag;
                td.ColumnManager = this;
            }
        }
Пример #2
0
        /// <summary>
        ///   set visible column
        /// </summary>
        /// <param name = "visible"> </param>
        internal void setVisible(bool visible)
        {
            if (visible == Visible)
            {
                return;
            }

            bool applyPlacement  = false;
            bool layoutSuspended = false;

            if (visible == false)
            {
                TableColumn.Dispose();
                TableColumn = null;

                //If there is no scrollbar (i.e. there is blank area) after hiding the column, apply the placement.
                if (_tableManager.FillWidth)
                {
                    applyPlacement = !_tableControl.isHscrollShown();
                }
            }
            else if (visible)
            {
                if (_tableManager.FillWidth)
                {
                    //If there is scrollbar even before showing the new column, do not apply the placement.
                    applyPlacement = !_tableControl.isHscrollShown();

                    if (applyPlacement)
                    {
                        _tableManager._tableControl.SuspendLayout();
                        layoutSuspended = true;
                    }
                }

                List <ILogicalColumn> columns = _tableManager.getColumns();
                int guiColumnIdx = 0;

                // find new Gui index
                int orgGuiIndex = columns.IndexOf(this);
                for (int i = 0;
                     i < orgGuiIndex;
                     i++)
                {
                    if (((LgColumn)columns[i]).GuiColumnIdx >= 0)
                    {
                        guiColumnIdx++;
                    }
                }

                TableColumn = new TableColumn();
                _tableControl.Columns.Insert(guiColumnIdx, TableColumn);

                TableColumn.Tag = new TagData();
                ColumnHandler.getInstance().addHandler(TableColumn);
                var td = (TagData)TableColumn.Tag;
                td.ColumnManager = this;

                // set column properties
                TableColumn.Text    = Text;
                TableColumn.FgColor = FgColor;
                TableColumn.BgColor = BgColor;

                TableColumn.Font             = Font;
                TableColumn.ContentAlignment = ContentAlignment;
                TableColumn.FontOrientation  = FontOrientation;

                TableColumn.AllowFilter = AllowFilter;
                TableColumn.RightBorder = RightBorder;
                TableColumn.TopBorder   = TopBorder;

                TableColumn.Width = Width;
            }

            _logicalColumnHelper.Visible = visible;
            base.Visible = visible;

            if (applyPlacement)
            {
                _tableManager.ExecuteFillTablePlacement();

                if (layoutSuspended)
                {
                    _tableManager._tableControl.ResumeLayout();
                }
            }

            _tableManager.updateEditorsOnColumnVisibility(MgColumnIdx, visible);
        }