///<summary>
        ///</summary>
        ///<param name="controlFactory"></param>
        public FilterControlVWG(IControlFactory controlFactory)
        {
            this.Height     = 50;
            _controlFactory = controlFactory;
            _groupBox       = _controlFactory.CreateGroupBox();
            //_groupBox.Anchor = AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom;
            //_groupBox.Top = 0;
            //_groupBox.Left = 0;
            //_groupBox.Width = this.Width;
            //_groupBox.Height = this.Height;
            //this.Controls.Add((Control) _groupBox);
            _controlFactory.CreateBorderLayoutManager(this).AddControl(_groupBox, BorderLayoutManager.Position.Centre);
            _groupBox.Text = "Filter the Grid";

            BorderLayoutManager layoutManager = controlFactory.CreateBorderLayoutManager(_groupBox);

            layoutManager.BorderSize = 20;
            IPanel filterButtonPanel = controlFactory.CreatePanel();

            filterButtonPanel.Height = 50;
            filterButtonPanel.Width  = 110;
            CreateFilterButtons(filterButtonPanel);

            layoutManager.AddControl(filterButtonPanel, BorderLayoutManager.Position.West);

            _filterPanel       = controlFactory.CreatePanel();
            _filterPanel.Width = this.Width;

            layoutManager.AddControl(_filterPanel, BorderLayoutManager.Position.Centre);
            _filterControlManager = new FilterControlManager(controlFactory, new FlowLayoutManager(_filterPanel, controlFactory));
        }
        public void TestCreateFilterControlManager()
        {
            //---------------Set up test pack-------------------
            GridLayoutManager layoutManager = new GridLayoutManager(GetControlFactory().CreatePanel(),
                                                                    GetControlFactory());
            //---------------Execute Test ----------------------
            FilterControlManager filterControlManager = new FilterControlManager(GetControlFactory(), layoutManager);

            //---------------Test Result -----------------------
            Assert.AreEqual(layoutManager, filterControlManager.LayoutManager);
        }
        public void ClearFilters_FIXBUG()
        {
            //---------------Set up test pack-------------------
            GridLayoutManager layoutManager = new GridLayoutManager(GetControlFactory().CreatePanel(),
                                                                    GetControlFactory());
            IFilterClauseFactory filterClauseFactory  = new DataViewFilterClauseFactory();
            FilterControlManager filterControlManager = new FilterControlManager(GetControlFactory(), layoutManager);

            filterControlManager.AddStringFilterTextBox("Test:", "TestColumn");
            filterClauseFactory.CreateStringFilterClause("TestColumn", FilterClauseOperator.OpLike, "testvalue");

            filterControlManager.AddStringFilterTextBox("Test2:", "TestColumn2");
            filterControlManager.GetFilterClause().GetFilterClauseString();
            //---------------Execute Test ----------------------
            filterControlManager.ClearFilters();
            //---------------Test Result -----------------------
            Assert.IsTrue(true, "Should not cause an Erro");
        }
        public void Test_AddStaticFilterClause()
        {
            //---------------Set up test pack-------------------
            GridLayoutManager    layoutManager        = new GridLayoutManager(GetControlFactory().CreatePanel(), GetControlFactory());
            FilterControlManager filterControlManager = new FilterControlManager(GetControlFactory(), layoutManager);
            //---------------Execute Test ----------------------
            const string propertyName = "TestColumn2";
            const string filtervalue  = "FilterValue";

            filterControlManager.AddStaticStringFilterClause(propertyName, FilterClauseOperator.OpGreaterThan, filtervalue);
            //---------------Test Result -----------------------
            Assert.AreEqual(1, filterControlManager.FilterControls.Count);
            ICustomFilter control = filterControlManager.FilterControls[0];

            Assert.AreEqual(propertyName, control.PropertyName);
            Assert.AreEqual(FilterClauseOperator.OpGreaterThan, control.FilterClauseOperator);
            IFilterClause filterClause = control.GetFilterClause(new DataViewFilterClauseFactory());

            Assert.AreEqual(string.Format("{0} > '{1}'", propertyName, filtervalue), filterClause.GetFilterClauseString());
        }
        ///<summary>
        /// Constructor for <see cref="FilterControlWin"/>
        ///</summary>
        ///<param name="controlFactory"></param>
        public FilterControlWin(IControlFactory controlFactory)
        {
            Height = 50;
            _controlFactory = controlFactory;
            FilterGroupBox = _controlFactory.CreateGroupBox();
//            _groupBox = _controlFactory.CreatePanel();
            _controlFactory.CreateBorderLayoutManager(this).AddControl(FilterGroupBox, BorderLayoutManager.Position.Centre);
            FilterGroupBox.Text = "Filter the Grid";
            BorderLayoutManager layoutManager = controlFactory.CreateBorderLayoutManager(FilterGroupBox);
            layoutManager.BorderSize = 20;
            _filterButtonPanel = controlFactory.CreatePanel();
            _filterButtonPanel.Height = 50;
            _filterButtonPanel.Width = 120;   //110;
            _filterButtonPanel.Visible = false;
            CreateFilterButtons(_filterButtonPanel);

            _controlPanel = controlFactory.CreatePanel();
            _controlPanel.Width = Width;

            this.EnsureButtonsFit();
            this._filterButtonPanel.Resize += (sender, e) => { this.EnsureButtonsFit(); };

            layoutManager.AddControl(_controlPanel, BorderLayoutManager.Position.Centre);
            layoutManager.AddControl(_filterButtonPanel, BorderLayoutManager.Position.East);


            Height = 50;
            this._controlPanel.Resize += (sender, e) =>
                {
                    this.Height = this._controlPanel.Height + layoutManager.BorderSize;
                    if ((this.FilterGroupBox.Height - layoutManager.BorderSize) < this.Height)
                    {
                        this.FilterGroupBox.Height = this.Height;
                    }
                };
            _filterControlManager = new FilterControlManager(controlFactory,
                                                             new FlowLayoutManager(_controlPanel, controlFactory));
        }