private void SetupGridAndBOEditorControlVWG(IControlFactory controlFactory, IBOEditorControl iboEditorControl, IClassDef classDef, string gridUiDefName)
        {
            if (controlFactory == null)
            {
                throw new ArgumentNullException("controlFactory");
            }
            if (iboEditorControl == null)
            {
                throw new ArgumentNullException("iboEditorControl");
            }

            _controlFactory   = controlFactory;
            _iboEditorControl = iboEditorControl;

            IPanel panel = _controlFactory.CreatePanel();

            SetupReadOnlyGridControl(classDef, gridUiDefName);
            SetupButtonGroupControl();
            UpdateControlEnabledState();

            GridLayoutManager manager = new GridLayoutManager(panel, _controlFactory);

            manager.SetGridSize(2, 1);
            manager.FixAllRowsBasedOnContents();
            manager.AddControl(_iboEditorControl);
            manager.AddControl(_buttonGroupControl);

            this.FilterControl = _controlFactory.CreateGenericGridFilter(_readOnlyGridControl.Grid);

            BorderLayoutManager layoutManager = _controlFactory.CreateBorderLayoutManager(this);

            layoutManager.AddControl(this.FilterControl, BorderLayoutManager.Position.North);
            layoutManager.AddControl(_readOnlyGridControl, BorderLayoutManager.Position.West);
            layoutManager.AddControl(panel, BorderLayoutManager.Position.Centre);
            //layoutManager.AddControl(_selectButtonGroupControl, BorderLayoutManager.Position.South);

            _readOnlyGridControl.BusinessObjectSelected +=
                ((sender, e) => FireBusinessObjectSelected(e.BusinessObject));

            _readOnlyGridControl.Grid.SelectionChanged += GridSelectionChanged;
        }
        private void SetupGridAndBOEditorControlWin(IControlFactory controlFactory, IBOEditorControl iboEditorControl, IClassDef classDef, string gridUiDefName)
        {
            if (controlFactory == null)
            {
                throw new ArgumentNullException("controlFactory");
            }
            if (iboEditorControl == null)
            {
                throw new ArgumentNullException("iboEditorControl");
            }
            _controlFactory   = controlFactory;
            _iboEditorControl = iboEditorControl;

            SetupReadOnlyGridControl(classDef, gridUiDefName);
            SetupButtonGroupControl();
            UpdateControlEnabledState();

            this.FilterControl = controlFactory.CreateGenericGridFilter(this.GridControl.Grid);
            this.FilterControl.FilterStarted   += (sender, e) => { this.SetFilteringUIState(true); };
            this.FilterControl.FilterCompleted += (sender, e) => { this.SetFilteringUIState(false); };

            var grid = new GridLayoutManager(this, _controlFactory);

            grid.SetGridSize(3, 4);
            grid.FixRow(2, _buttonGroupControl.Height);
            grid.FixRow(0, this.FilterControl.Height + 5);
            grid.FixColumn(0, this.FilterControl.Width);

            var leftMost   = this.Width;
            var rightMost  = 0;
            var bottomMost = 0;

            foreach (var control in this._iboEditorControl.Controls)
            {
                var ctl = control as Control;
                if (ctl == null)
                {
                    continue;
                }
                if (ctl.Left < leftMost)
                {
                    leftMost = ctl.Left;
                }
                if (ctl.Right > rightMost)
                {
                    rightMost = ctl.Right;
                }
                if (ctl.Bottom > bottomMost)
                {
                    bottomMost = ctl.Bottom;
                }
            }
            var editorWidth = rightMost - leftMost;

            grid.FixColumn(3, editorWidth);

            grid.AddControl(this.FilterControl, 1, 3);
            grid.AddControl(controlFactory.CreateControl());
            grid.AddControl(_readOnlyGridControl, 1, 3);
            grid.AddControl(_iboEditorControl);
            grid.AddControl(_buttonGroupControl, 1, 4);

            this.MinimumSize = new Size(editorWidth, bottomMost);

            _readOnlyGridControl.BusinessObjectSelected +=
                ((sender, e) => FireBusinessObjectSelected(e.BusinessObject));

            _readOnlyGridControl.Grid.SelectionChanged += GridSelectionChanged;
        }