/// <summary>
 /// Constructs the <see cref="CollapsiblePanelGroupManager"/>
 /// </summary>
 // ReSharper disable SuggestBaseTypeForParameter
 public CollapsiblePanelGroupManager
     (ICollapsiblePanelGroupControl collapsiblePanelGroup, IControlFactory controlFactory)
 {
     ControlFactory      = controlFactory;
     PanelsList          = new List <ICollapsiblePanel>();
     ColumnLayoutManager = new ColumnLayoutManager(collapsiblePanelGroup, ControlFactory);
 }
Exemplo n.º 2
0
        public void Test_BusinessObjectRemovedFromCollection()
        {
            IComboBox cmbox = GetControlFactory().CreateComboBox();

            DisposeOnTearDown(cmbox);
            IControlFactory            controlFactory  = GetControlFactory();
            ComboBoxCollectionSelector selectorManager = new ComboBoxCollectionSelector(cmbox, controlFactory)
            {
                IncludeBlankItem = false
            };

            DisposeOnTearDown(selectorManager);
            MyBO.LoadDefaultClassDef();
            MyBO removedBo = new MyBO();
            BusinessObjectCollection <MyBO> myBoCol = new BusinessObjectCollection <MyBO>
            {
                new MyBO(), removedBo, new MyBO()
            };

            selectorManager.SetCollection(myBoCol);
            //---------------Execute Test ----------------------
            selectorManager.BusinessObjectCollection.Remove(removedBo);
            //---------------Test Result -----------------------
            Assert.AreEqual(2, selectorManager.Control.Items.Count);
        }
Exemplo n.º 3
0
        public void Test_SelectedBusinessObject_EdgeCase_SelectCustomStringItem_ShouldReturnNull()
        {
            //---------------Set up test pack-------------------
            IComboBox cmbox = GetControlFactory().CreateComboBox();

            DisposeOnTearDown(cmbox);
            IControlFactory controlFactory  = GetControlFactory();
            var             selectorManager = new ComboBoxCollectionSelector(cmbox, controlFactory);

            DisposeOnTearDown(selectorManager);
            selectorManager.IncludeBlankItem = false;
            MyBO.LoadDefaultClassDef();
            MyBO selectedBO = new MyBO();
            BusinessObjectCollection <MyBO> myBoCol = new BusinessObjectCollection <MyBO> {
                new MyBO(), selectedBO, new MyBO()
            };

            selectorManager.IncludeBlankItem = false;
            selectorManager.SetCollection(myBoCol);
            selectorManager.Control.SelectedIndex = 1;
            cmbox.Items.Add("SomeItem");
            //---------------Assert Preconditions---------------
            Assert.AreEqual(selectedBO, selectorManager.SelectedBusinessObject);
            //---------------Execute Test ----------------------
            cmbox.SelectedIndex = cmbox.Items.Count - 1;
            IBusinessObject selectedBusinessObject = selectorManager.SelectedBusinessObject;

            //---------------Test Result -----------------------
            Assert.IsNull(selectedBusinessObject);
        }
Exemplo n.º 4
0
        /// <summary>
        /// A constructor as before, but with a UIDefName specified
        /// </summary>
        public PanelFactory(BusinessObject bo, string uiDefName, IControlFactory controlFactory)
        {
            _uiDefName = uiDefName;
            _controlFactory = controlFactory;
            BOMapper mapper = new BOMapper(bo);

            IUIDef uiDef = mapper.GetUIDef(uiDefName);
            if (uiDef == null)
            {
                string errMessage = "Cannot create a panel factory for '" + bo.ClassDef.ClassName
                                    + "' since the classdefs do not contain a uiDef '" + uiDefName + "'";
                throw new HabaneroDeveloperException
                    ("There is a serious application error please contact your system administrator"
                     + Environment.NewLine + errMessage, errMessage);
            }
            _uiForm = uiDef.GetUIFormProperties();
            if (_uiForm == null)
            {
                string errMsg = "Cannot create a panel factory for '" + bo.ClassDef.ClassName
                                + "' since the classdefs do not contain a form def for uidef '" + uiDefName + "'";
                throw new HabaneroDeveloperException
                    ("There is a serious application error please contact your system administrator"
                     + Environment.NewLine + errMsg, errMsg);
            }
            InitialiseFactory(bo);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Constructor for an <see cref="Item"/>
 /// </summary>
 /// <param name="parentMenu"></param>
 /// <param name="name"></param>
 /// <param name="form"></param>
 /// <param name="controlFactory"></param>
 public Item(HabaneroMenu parentMenu, string name, IControlHabanero form, IControlFactory controlFactory)
 {
     _parentMenu     = parentMenu;
     _name           = name;
     _controlFactory = controlFactory;
     _form           = form;
 }
Exemplo n.º 6
0
 /// <summary>
 /// A constructor to initialise a new instance, with a UIForm object 
 /// specified
 /// </summary>
 /// <param name="bo">The business object to be represented</param>
 /// <param name="uiForm"></param>
 /// <param name="controlFactory">the control factory used to create controls</param>
 public PanelFactory(BusinessObject bo, UIForm uiForm, IControlFactory controlFactory)
 {
     if (uiForm == null) throw new ArgumentNullException("uiForm");
     _uiForm = uiForm;
     _controlFactory = controlFactory;
     InitialiseFactory(bo);
 }
 ///<summary>
 /// Constructor for <see cref="InputFormComboBox"/>
 ///</summary>
 ///<param name="controlFactory"></param>
 ///<param name="message"></param>
 ///<param name="choices"></param>
 public InputFormComboBox(IControlFactory controlFactory, string message, List<object> choices)
 {
     _controlFactory = controlFactory;
     _message = message;
     _comboBox = _controlFactory.CreateComboBox();
     choices.ForEach(item => _comboBox.Items.Add(item));
 }
 /// <summary>
 /// Constructs the <see cref="CollapsiblePanelGroupManager"/>
 /// </summary>
 // ReSharper disable SuggestBaseTypeForParameter
 public CollapsiblePanelGroupManager
     (ICollapsiblePanelGroupControl collapsiblePanelGroup, IControlFactory controlFactory)
 {
     ControlFactory = controlFactory;
     PanelsList = new List<ICollapsiblePanel>();
     ColumnLayoutManager = new ColumnLayoutManager(collapsiblePanelGroup, ControlFactory);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Constructor to initialise a new instance of the mapper
 /// </summary>
 /// <param name="tb">The TextBox to map</param>
 /// <param name="propName">The property name</param>
 /// <param name="isReadOnly">Whether this control is read only</param>
 /// <param name="factory">the control factory to be used when creating the controlMapperStrategy</param>
 public TextBoxMapper(ITextBox tb, string propName, bool isReadOnly, IControlFactory factory)
     : base(tb, propName, isReadOnly, factory)
 {
     _textBox = tb;
     _textBoxMapperStrategy = factory.CreateTextBoxMapperStrategy();
     _oldText = "";
 }
Exemplo n.º 10
0
        /// <summary>
        /// Constructs a <see cref="MainTitleIconControlWin"/>
        /// </summary>
        public MainTitleIconControlWin(IControlFactory controlFactory)
        {
            if (controlFactory == null)
            {
                throw new ArgumentNullException("controlFactory");
            }
            _controlFactory = controlFactory;
            _panel          = _controlFactory.CreatePanel();
            ((PanelWin)_panel).BackgroundImage = CollapsiblePanelResource.headergradient;
            _panel.BackColor = Color.Transparent;
            _panel.Dock      = Habanero.Faces.Base.DockStyle.Top;

            _panel.Height = 23;

            _icon = _controlFactory.CreateLabel();
            ((LabelWin)_icon).BackgroundImage = CollapsiblePanelResource.headergradient;
            _icon.BackColor = Color.Transparent;
            ((LabelWin)_icon).BackgroundImageLayout = ImageLayout.Center;
            _icon.Dock = Habanero.Faces.Base.DockStyle.Left;
            _icon.Size = new Size(20, 20);

            _title           = _controlFactory.CreateLabel();
            _title.Dock      = Habanero.Faces.Base.DockStyle.Fill;
            _title.BackColor = Color.Transparent;
            _title.TextAlign = ContentAlignment.MiddleLeft;
            _title.ForeColor = Color.White;

            _panel.Controls.Add(_title);
            _panel.Controls.Add(_icon);
            _panel.MaximumSize = new Size(2000, 23);
            this.Dock          = DockStyleWin.GetDockStyle(DockStyle.Top);
            this.Controls.Add((PanelWin)_panel);
            this.Height = 23;
        }
 /// <summary>
 /// Constructor to initialise a new instance of the class
 /// </summary>
 /// <param name="numericUpDownControl">The numericUpDownControl object to map</param>
 /// <param name="propName">The property name</param>
 /// <param name="isReadOnly">Whether this control is read only</param>
 /// <param name="factory">the control factory to be used when creating the controlMapperStrategy</param>
 public NumericUpDownCurrencyMapper(INumericUpDown numericUpDownControl, string propName, bool isReadOnly, IControlFactory factory)
     : base(numericUpDownControl, propName, isReadOnly, factory)
 {
     _numericUpDown.DecimalPlaces = 2;
     _numericUpDown.Maximum = decimal.MaxValue;
     _numericUpDown.Minimum = decimal.MinValue;
 }
Exemplo n.º 12
0
 public void RegisterControls(IControlFactory controlFactory)
 {
     _controlManager.Register("MainWindow", _mainWindow);
     _controlManager.Register("LoginControl", controlFactory.Create <LoginControl>());
     _controlManager.Register("RegisterControl", controlFactory.Create <RegisterControl>());
     _controlManager.Register("DashboardControl", controlFactory.Create <DashboardControl>());
 }
Exemplo n.º 13
0
 /// <summary>
 /// Constructor to initialise a new grid layout
 /// </summary>
 /// <param name="managedControl">The control to manage</param>
 /// <param name="controlFactory">The control factory used to create any controls</param>
 public GridLayoutManager(IControlHabanero managedControl, IControlFactory controlFactory)
     : base(managedControl, controlFactory)
 {
     _controls = new List<IControlHabanero>();
     _controlInfoTable = new Hashtable();
     this.SetGridSize(2, 2);
 }
Exemplo n.º 14
0
        ///<summary>
        /// Constructor for <see cref="CollapsiblePanelManager"/>
        ///</summary>
        ///<param name="collapsiblePanel"></param>
        ///<param name="controlFactory"></param>
        public CollapsiblePanelManager(ICollapsiblePanel collapsiblePanel, IControlFactory controlFactory)
        {
            _controlFactory   = controlFactory;
            _collapsiblePanel = collapsiblePanel;
            _collapseButton   = _controlFactory.CreateButtonCollapsibleStyle();


            _collapseButton.Click += delegate { Collapsed = !Collapsed; };
            _pinLabel              = controlFactory.CreateLabelPinOffStyle();
            _pinLabel.Click       += delegate { Pinned = !Pinned; };

            IPanel buttonPanel = _controlFactory.CreatePanel();
            BorderLayoutManager buttonLayoutManager =
                _controlFactory.CreateBorderLayoutManager(buttonPanel);

            buttonPanel.Height = _collapseButton.Height;

            buttonLayoutManager.AddControl(_collapseButton, BorderLayoutManager.Position.Centre);
            buttonLayoutManager.AddControl(_pinLabel, BorderLayoutManager.Position.East);

            _layoutManager = _controlFactory.CreateBorderLayoutManager(collapsiblePanel);
            _layoutManager.AddControl(buttonPanel, BorderLayoutManager.Position.North);


            _collapseButton.BackColor = System.Drawing.Color.Transparent;
            _collapseButton.ForeColor = System.Drawing.Color.Transparent;
        }
Exemplo n.º 15
0
 public void RegisterFactory(IControlFactory factory)
 {
     if (null != factory && this.factories.IndexOf(factory) < 0)
     {
         this.factories.Add(factory);
     }
 }
Exemplo n.º 16
0
        /// <summary>
        /// A constructor as before, but with a UIDefName specified
        /// </summary>
        public PanelFactory(BusinessObject bo, string uiDefName, IControlFactory controlFactory)
        {
            _uiDefName      = uiDefName;
            _controlFactory = controlFactory;
            BOMapper mapper = new BOMapper(bo);

            IUIDef uiDef = mapper.GetUIDef(uiDefName);

            if (uiDef == null)
            {
                string errMessage = "Cannot create a panel factory for '" + bo.ClassDef.ClassName
                                    + "' since the classdefs do not contain a uiDef '" + uiDefName + "'";
                throw new HabaneroDeveloperException
                          ("There is a serious application error please contact your system administrator"
                          + Environment.NewLine + errMessage, errMessage);
            }
            _uiForm = uiDef.GetUIFormProperties();
            if (_uiForm == null)
            {
                string errMsg = "Cannot create a panel factory for '" + bo.ClassDef.ClassName
                                + "' since the classdefs do not contain a form def for uidef '" + uiDefName + "'";
                throw new HabaneroDeveloperException
                          ("There is a serious application error please contact your system administrator"
                          + Environment.NewLine + errMsg, errMsg);
            }
            InitialiseFactory(bo);
        }
 ///<summary>
 /// Constructor for <see cref="ComboBoxSelectorVWG"/>
 ///</summary>
 ///<param name="controlFactory"></param>
 public ComboBoxSelectorVWG(IControlFactory controlFactory)
 {
     if (controlFactory == null) throw new ArgumentNullException("controlFactory");
     _manager = new ComboBoxCollectionSelector(this, controlFactory);
      _manager.IncludeBlankItem = true;
     _manager.BusinessObjectSelected += delegate { FireBusinessObjectSelected(); };
 }
        protected virtual ICloseBOEditorDialog CreateDialogBox()
        {
            IControlFactory factory = CreateControlFactoryWin();

            //var businessObject = CreateMockBO();
            return(CreateDialogBox(factory));
        }
Exemplo n.º 19
0
        ///<summary>
        /// Constructor for the <see cref="HelpAboutBoxManager"/>
        ///</summary>
        ///<param name="controlFactory"></param>
        ///<param name="formHabanero"></param>
        ///<param name="programName"></param>
        ///<param name="producedForName"></param>
        ///<param name="producedByName"></param>
        ///<param name="versionNumber"></param>
        public HelpAboutBoxManager(IControlFactory controlFactory, IFormHabanero formHabanero, string programName, string producedForName, string producedByName, string versionNumber)
        {
            _FormHabanero = formHabanero;
            _mainPanel    = controlFactory.CreatePanel();
            GridLayoutManager mainPanelManager = new GridLayoutManager(_mainPanel, controlFactory);

            mainPanelManager.SetGridSize(4, 2);
            mainPanelManager.FixAllRowsBasedOnContents();
            mainPanelManager.FixColumnBasedOnContents(0);
            mainPanelManager.FixColumnBasedOnContents(1);
            mainPanelManager.AddControl(controlFactory.CreateLabel("Programme Name:", false));
            mainPanelManager.AddControl(controlFactory.CreateLabel(programName, false));
            mainPanelManager.AddControl(controlFactory.CreateLabel("Produced For:", false));
            mainPanelManager.AddControl(controlFactory.CreateLabel(producedForName, false));
            mainPanelManager.AddControl(controlFactory.CreateLabel("Produced By:", false));
            mainPanelManager.AddControl(controlFactory.CreateLabel(producedByName, false));
            mainPanelManager.AddControl(controlFactory.CreateLabel("Version:", false));
            mainPanelManager.AddControl(controlFactory.CreateLabel(versionNumber, false));

            IButtonGroupControl buttons = controlFactory.CreateButtonGroupControl();

            buttons.AddButton("OK", new EventHandler(OKButtonClickHandler));

            BorderLayoutManager manager = controlFactory.CreateBorderLayoutManager(formHabanero);

            manager.AddControl(_mainPanel, BorderLayoutManager.Position.Centre);
            manager.AddControl(buttons, BorderLayoutManager.Position.South);
            formHabanero.Width  = 300;
            formHabanero.Height = 200;
            formHabanero.Text   = "About";
        }
Exemplo n.º 20
0
        public void Test_Constructor()
        {
            //---------------Set up test pack-------------------
            IControlFactory controlFactory = GetControlFactory();
            //---------------Execute Test ----------------------
            IExtendedTextBox extendedTextBox = controlFactory.CreateExtendedTextBox();
            //---------------Test Result -----------------------
            ITextBox textBox = extendedTextBox.TextBox;

            Assert.IsNotNull(textBox);
            IButton button = extendedTextBox.Button;

            Assert.IsNotNull(button);
            Assert.AreEqual("...", button.Text);
            Assert.IsFalse(textBox.Enabled);
            if (controlFactory is ControlFactoryWin)
            {
                Assert.AreEqual(SystemColors.Window, textBox.BackColor);
            }
            else
            {
                Assert.AreEqual(Color.White, textBox.BackColor);
            }
            Assert.AreEqual(extendedTextBox.Height, textBox.Height);
            Assert.Greater(button.Left, textBox.Left);
        }
Exemplo n.º 21
0
        /// <summary>
        /// Initialises the WizardForm, sets the controller and starts the wizard.
        /// </summary>
        /// <param name="controller">the wizrd controller that controls moving the wizard steps and the </param>
        /// <param name="controlFactory">The control factory to use for creating any controls</param>
        public WizardFormWin(IWizardController controller, IControlFactory controlFactory)
        {
            _wizardController = controller;
            var wizardControl = (WizardControlWin) controlFactory.CreateWizardControl(controller);

            SetupWizardControl(wizardControl);
        }
Exemplo n.º 22
0
        protected override IControlFactory GetControlFactory()
        {
            if ((_factory == null)) _factory = new ControlFactoryVWG();

            GlobalUIRegistry.ControlFactory = _factory;
            return _factory;
        }
Exemplo n.º 23
0
 ///<summary>
 /// Constructor form <see cref="ListComboBoxMapper"/>
 ///</summary>
 ///<param name="ctl"></param>
 ///<param name="propName"></param>
 ///<param name="isReadOnly"></param>
 ///<param name="factory"></param>
 public ListComboBoxMapper(IControlHabanero ctl, string propName, bool isReadOnly, IControlFactory factory)
     : base(ctl, propName, isReadOnly, factory)
 {
     _comboBox = (IComboBox)ctl;
     _mapperStrategy = factory.CreateListComboBoxMapperStrategy();
     _mapperStrategy.AddItemSelectedEventHandler(this);
 }
Exemplo n.º 24
0
 /// <summary>
 /// Instantiates a new mapper
 /// </summary>
 /// <param name="comboBox">The ComboBox to map</param>
 /// <param name="propName">The property name</param>
 /// <param name="isReadOnly">Whether this control is read only</param>
 /// <param name="factory">The control factory to be used when creating the controlMapperStrategy</param>
 public EnumComboBoxMapper(IComboBox comboBox, string propName, bool isReadOnly, IControlFactory factory) 
     : base(comboBox, propName, isReadOnly, factory)
 {
     _mapperStrategy = factory.CreateLookupComboBoxDefaultMapperStrategy();
     if (_mapperStrategy == null) return;
     _mapperStrategy.AddHandlers(this);
 }
Exemplo n.º 25
0
        /// <summary>
        /// Constructor to initialise a new tab control
        /// </summary>
        public BOColTabControlWin(IControlFactory controlFactory)
        {
            if (controlFactory == null)
            {
                throw new ArgumentNullException("controlFactory");
            }
            _controlFactory = controlFactory;
            BorderLayoutManager layoutManager = _controlFactory.CreateBorderLayoutManager(this);

            _tabControl = _controlFactory.CreateTabControl();
            layoutManager.AddControl(_tabControl, BorderLayoutManager.Position.Centre);
            _boColTabControlManager = new BOColTabControlManager(_tabControl, _controlFactory);
            _boColTabControlManager.BusinessObjectSelected += delegate { FireBusinessObjectSelected(); };
            _boColTabControlManager.TabPageAdded           += (sender, e) => FireTabPageAdded(e.TabPage, e.BOControl);
            _boColTabControlManager.TabPageRemoved         += (sender, e) => FireTabPageRemoved(e.TabPage, e.BOControl);

            this.OnAsyncOperationStarted += (sender, e) =>
            {
                this.UseWaitCursor = true;
                this.Cursor        = Cursors.WaitCursor;
                this.Enabled       = false;
            };

            this.OnAsyncOperationComplete += (sender, e) =>
            {
                this.UseWaitCursor = false;
                this.Cursor        = Cursors.Default;
                this.Enabled       = true;
            };
        }
        /// <summary>
        /// Constructs a <see cref="MainTitleIconControlVWG"/>
        /// </summary>
        public MainTitleIconControlVWG(IControlFactory controlFactory)
        {
            if (controlFactory == null) throw new ArgumentNullException("controlFactory");
            _controlFactory = controlFactory;
            _panel = _controlFactory.CreatePanel();
            ((PanelVWG)_panel).BackgroundImage = @"Images.headergradient.png";
            
            _panel.BackColor = Color.Transparent;
            _panel.Dock = Habanero.Faces.Base.DockStyle.Top;
            
            _panel.Height = 23;
            this.Size = new Size(_panel.Width,_panel.Height);
            _icon = _controlFactory.CreateLabel();
            ((LabelVWG)_icon).BackgroundImage = "";
            _icon.BackColor = Color.Transparent;
            ((LabelVWG)_icon).BackgroundImageLayout = ImageLayout.Center;
            _icon.Dock = Habanero.Faces.Base.DockStyle.Left;
            _icon.Size = new Size(20, 20);

            _title = _controlFactory.CreateLabel();
            _title.Font = new Font("Verdana", 10);
            _title.Dock = Habanero.Faces.Base.DockStyle.Fill;
            _title.BackColor = Color.Transparent;
            _title.TextAlign = ContentAlignment.MiddleLeft;
            _title.ForeColor = Color.White;

            _panel.Controls.Add(_title);
            _panel.Controls.Add(_icon);

            this.Dock = DockStyleVWG.GetDockStyle(DockStyle.Top);
            this.Controls.Add((PanelVWG)_panel);
            this.Height = 23;
        }
Exemplo n.º 27
0
 public void TestSetup()
 {
     GlobalUIRegistry.UIStyleHints = null;
     _factory = GetControlFactory();
     ClassDef.ClassDefs.Clear();
     
 }
Exemplo n.º 28
0
            public OKCancelPanelVWG(IControlFactory controlFactory)
            {
                //_controlFactory = controlFactory;
                //// create content panel
                //_contentPanel = _controlFactory.CreatePanel();
                //_contentPanel.Dock = DockStyle.Fill;
                //this.Controls.Add((Control)_contentPanel);

                //// create buttons
                //IButtonGroupControl buttonGroupControl = _controlFactory.CreateButtonGroupControl();
                //buttonGroupControl.Dock = DockStyle.Bottom;
                //_okButton = buttonGroupControl.AddButton("OK");
                //_okButton.NotifyDefault(true);
                //_cancelButton = buttonGroupControl.AddButton("Cancel");
                //this.Controls.Add((Control)buttonGroupControl);

                _controlFactory = controlFactory;
                // create content panel
                _contentPanel = _controlFactory.CreatePanel();
                // create buttons
                _buttonGroupControl = _controlFactory.CreateButtonGroupControl();
                _cancelButton       = _buttonGroupControl.AddButton("Cancel");
                _okButton           = _buttonGroupControl.AddButton("OK");
                _okButton.NotifyDefault(true);

                BorderLayoutManager layoutManager = controlFactory.CreateBorderLayoutManager(this);

                layoutManager.AddControl(_contentPanel, BorderLayoutManager.Position.Centre);
                layoutManager.AddControl(_buttonGroupControl, BorderLayoutManager.Position.South);
            }
Exemplo n.º 29
0
        public void Test_ItemsShowingInComboBox()
        {
            //--------------- Set up test pack ------------------

            ContactPersonTestBO contactPersonTestBO = new ContactPersonTestBO();

            contactPersonTestBO.Surname   = TestUtil.GetRandomString();
            contactPersonTestBO.FirstName = TestUtil.GetRandomString();
            OrganisationTestBO.LoadDefaultClassDef();
            OrganisationTestBO.CreateSavedOrganisation();
            OrganisationTestBO.CreateSavedOrganisation();

            IControlFactory       controlFactory     = GetControlFactory();
            ExtendedTextBoxWin    extendedTextBoxWin = new ExtendedTextBoxWin(controlFactory);
            const string          propName           = "OrganisationID";
            ExtendedTextBoxMapper mapper             = new ExtendedTextBoxMapper(
                extendedTextBoxWin, propName, true, controlFactory);

            //--------------- Test Preconditions ----------------
            Assert.IsNull(mapper.BusinessObject);
            Assert.IsNull(mapper.BusinessObject);

            //--------------- Execute Test ----------------------
            mapper.BusinessObject = contactPersonTestBO;
            //--------------- Test Result -----------------------
            Assert.AreSame(contactPersonTestBO, mapper.BusinessObject);
            Assert.AreSame(contactPersonTestBO, mapper.BusinessObject);
//            Assert.AreEqual(2, mapper.LookupList.Count);
        }
        /// <summary>
        /// Constructs a <see cref="MainTitleIconControlWin"/>
        /// </summary>
        public MainTitleIconControlWin(IControlFactory controlFactory)
        {
            if (controlFactory == null) throw new ArgumentNullException("controlFactory");
            _controlFactory = controlFactory;
            _panel = _controlFactory.CreatePanel();
            ((PanelWin)_panel).BackgroundImage = CollapsiblePanelResource.headergradient;
            _panel.BackColor = Color.Transparent;
            _panel.Dock = Habanero.Faces.Base.DockStyle.Top;

            _panel.Height = 23;

            _icon = _controlFactory.CreateLabel();
            ((LabelWin)_icon).BackgroundImage = CollapsiblePanelResource.headergradient;
            _icon.BackColor = Color.Transparent;
            ((LabelWin)_icon).BackgroundImageLayout = ImageLayout.Center;
            _icon.Dock = Habanero.Faces.Base.DockStyle.Left;
            _icon.Size = new Size(20, 20);

            _title = _controlFactory.CreateLabel();
            _title.Dock = Habanero.Faces.Base.DockStyle.Fill;
            _title.BackColor = Color.Transparent;
            _title.TextAlign = ContentAlignment.MiddleLeft;
            _title.ForeColor = Color.White;

            _panel.Controls.Add(_title);
            _panel.Controls.Add(_icon);
            _panel.MaximumSize = new Size(2000, 23);
            this.Dock = DockStyleWin.GetDockStyle(DockStyle.Top);
            this.Controls.Add((PanelWin)_panel);
            this.Height = 23;
        }
Exemplo n.º 31
0
        /// <summary>
        /// Stores dependencies and initialises selected bug list. Also
        /// sets up a message listener to recieve incoming messages.
        /// </summary>
        /// <param name="comm">The mediator for communicatin with other view models.</param>
        /// <param name="svc">The bug tracker web service.</param>
        /// <param name="activeProj">The currently active project</param>
        public BugTableViewModel(IMessenger comm, ITrackerService svc, IGrowlNotifiactions notifier,
                                 IControlFactory ctrlfactory, ProjectViewModel activeProj)
        {
            _Messenger      = comm;
            _Service        = svc;
            _ControlFactory = ctrlfactory;

            if (activeProj != null && activeProj.Id != 0)
            {
                _ActiveProject = activeProj;
                ProjectTitle   = activeProj.Name;
            }

            _Notifier = notifier;

            _SearchText = "";

            _PageSize = GetPageSizeFromSettings();

            _DefaultTableSortOrder    = new SortDescription("Id", ListSortDirection.Descending);
            _BugListViewSource.Source = _BugList;

            InitSortingAndPaging();

            if (_ActiveProject != null)
            {
                UpdateTableData();
            }

            ListenForMessages();
        }
Exemplo n.º 32
0
        public void Test_Set_SelectedBusinessObject_BOColNull_ShouldRaiseError()
        {
            //---------------Set up test pack-------------------
            ITabControl            tabControl      = CreateTabControl();
            IControlFactory        controlFactory  = GetControlFactory();
            BOColTabControlManager selectorManager = new BOColTabControlManager(tabControl, controlFactory);
            MyBO selectedBO = new MyBO();

            selectorManager.BusinessObjectControl    = this.GetBusinessObjectControl();
            selectorManager.BusinessObjectCollection = null;
            //---------------Assert Precondition----------------
            Assert.IsNull(selectorManager.BusinessObjectCollection);
            Assert.IsNotNull(selectorManager.BusinessObjectControl);
            //---------------Execute Test ----------------------
            try
            {
                selectorManager.CurrentBusinessObject = selectedBO;
                Assert.Fail("expected Err");
            }
            //---------------Test Result -----------------------
            catch (HabaneroDeveloperException ex)
            {
                const string expectedMessage = "You cannot set the 'CurrentBusinessObject' for BOColTabControlManager since the BusinessObjectCollection has not been set";
                StringAssert.Contains(expectedMessage, ex.Message);
            }
        }
Exemplo n.º 33
0
 /// <summary>
 /// Constructor to initialise a new grid layout
 /// </summary>
 /// <param name="managedControl">The control to manage</param>
 /// <param name="controlFactory">The control factory used to create any controls</param>
 public GridLayoutManager(IControlHabanero managedControl, IControlFactory controlFactory)
     : base(managedControl, controlFactory)
 {
     _controls         = new List <IControlHabanero>();
     _controlInfoTable = new Hashtable();
     this.SetGridSize(2, 2);
 }
Exemplo n.º 34
0
        /// <summary>
        /// Creates saveDialog Component. Expects ControlFactory for component creation.
        /// </summary>
        /// <param name="controlFactory">medja.UI object which is needed for control creation.</param>
        public SteSaveDialog(IControlFactory controlFactory, int inputLength)
        {
            _controlFactory = controlFactory;
            _inputLength    = inputLength;

            _config = new CryptoConfig();

            _firstColumnStack = GetVertStackPanel(140);
            _secColumnStack   = GetVertStackPanel(150);
            _thirdColumnStack = GetVertStackPanel(160);

            //Filler CREATION
            _pbeFill = new Control();

            CreateLabels();
            CreateInputs();
            CreateAndBindComboBoxes();
            CreateCheckBoxes();
            FillStackPanels();
            UpdateSectionVisibility(Sections.Encryption, Visibility.Visible);
            UpdateSectionVisibility(Sections.Pbe, Visibility.Collapsed);
            UpdateSectionVisibility(Sections.Integrity, Visibility.Collapsed);
            Content = CreateDockPanel();
            FocusManager.Default.SetFocus(_filenameInput);
        }
Exemplo n.º 35
0
        public void Test_Set_Collection_WhenBOControlNotSet_ShouldRaiseError()
        {
            //---------------Set up test pack-------------------
            ITabControl                     tabControl      = CreateTabControl();
            IControlFactory                 controlFactory  = GetControlFactory();
            BOColTabControlManager          selectorManager = new BOColTabControlManager(tabControl, controlFactory);
            BusinessObjectCollection <MyBO> myBoCol         = new BusinessObjectCollection <MyBO> {
                new MyBO(), new MyBO(), new MyBO()
            };

            //---------------Assert Precondition----------------
            Assert.IsNull(selectorManager.BusinessObjectCollection);
            Assert.IsNull(selectorManager.BusinessObjectControl);
            //---------------Execute Test ----------------------
            try
            {
                selectorManager.BusinessObjectCollection = myBoCol;
                Assert.Fail("expected Err");
            }
            //---------------Test Result -----------------------
            catch (HabaneroDeveloperException ex)
            {
                const string expectedMessage = "You cannot set the 'BusinessObjectCollection' for BOColTabControlManager since the BusinessObjectControl has not been set";
                StringAssert.Contains(expectedMessage, ex.Message);
            }
        }
Exemplo n.º 36
0
 /// <summary>
 /// Constructor to initialise a new instance of the mapper
 /// </summary>
 /// <param name="tb">The TextBox to map</param>
 /// <param name="propName">The property name</param>
 /// <param name="isReadOnly">Whether this control is read only</param>
 /// <param name="factory">the control factory to be used when creating the controlMapperStrategy</param>
 public TextBoxMapper(ITextBox tb, string propName, bool isReadOnly, IControlFactory factory)
     : base(tb, propName, isReadOnly, factory)
 {
     _textBox = tb;
     _textBoxMapperStrategy = factory.CreateTextBoxMapperStrategy();
     _oldText = "";
 }
        ///<summary>
        /// Constructor for the <see cref="HelpAboutBoxManager"/>
        ///</summary>
        ///<param name="controlFactory"></param>
        ///<param name="formHabanero"></param>
        ///<param name="programName"></param>
        ///<param name="producedForName"></param>
        ///<param name="producedByName"></param>
        ///<param name="versionNumber"></param>
        public HelpAboutBoxManager(IControlFactory controlFactory, IFormHabanero formHabanero, string programName, string producedForName, string producedByName, string versionNumber)
        {
            _FormHabanero = formHabanero;
            _mainPanel = controlFactory.CreatePanel();
            GridLayoutManager mainPanelManager = new GridLayoutManager(_mainPanel, controlFactory);
            mainPanelManager.SetGridSize(4, 2);
            mainPanelManager.FixAllRowsBasedOnContents();
            mainPanelManager.FixColumnBasedOnContents(0);
            mainPanelManager.FixColumnBasedOnContents(1);
            mainPanelManager.AddControl(controlFactory.CreateLabel("Programme Name:", false));
            mainPanelManager.AddControl(controlFactory.CreateLabel(programName, false));
            mainPanelManager.AddControl(controlFactory.CreateLabel("Produced For:", false));
            mainPanelManager.AddControl(controlFactory.CreateLabel(producedForName, false));
            mainPanelManager.AddControl(controlFactory.CreateLabel("Produced By:", false));
            mainPanelManager.AddControl(controlFactory.CreateLabel(producedByName, false));
            mainPanelManager.AddControl(controlFactory.CreateLabel("Version:", false));
            mainPanelManager.AddControl(controlFactory.CreateLabel(versionNumber, false));

            IButtonGroupControl buttons = controlFactory.CreateButtonGroupControl();
            buttons.AddButton("OK", new EventHandler(OKButtonClickHandler));

            BorderLayoutManager manager = controlFactory.CreateBorderLayoutManager(formHabanero);
            manager.AddControl(_mainPanel, BorderLayoutManager.Position.Centre);
            manager.AddControl(buttons, BorderLayoutManager.Position.South);
            formHabanero.Width = 300;
            formHabanero.Height = 200;
            formHabanero.Text = "About";
        }
 /// <summary>
 /// Constructor to instantiate a new instance of the class
 /// </summary>
 /// <param name="ctl">The control object to map</param>
 /// <param name="propName">The property name</param>
 /// <param name="isReadOnly">Whether the control is read only.
 /// If so, it then becomes disabled.  If not,
 /// handlers are assigned to manage key presses, depending on the strategy assigned to this mapper.</param>
 /// <param name="factory">The control factory to be used when creating the controlMapperStrategy</param>
 protected NumericUpDownMapper(INumericUpDown ctl, string propName, bool isReadOnly, IControlFactory factory)
     : base(ctl, propName, isReadOnly, factory)
 {
     _numericUpDown = (INumericUpDown)ctl;
     _mapperStrategy = factory.CreateNumericUpDownMapperStrategy();
     _mapperStrategy.ValueChanged(this);
 }
 ///<summary>
 /// Creates the <see cref="EditableGridButtonsControlVWG"/>
 ///</summary>
 ///<param name="controlFactory"></param>
 public EditableGridButtonsControlVWG(IControlFactory controlFactory) : base(controlFactory)
 {
     IButton cancelButton = AddButton("Cancel", FireCancelButtonClicked);
     cancelButton.Visible = true;
     IButton saveButton = AddButton("Save", FireSaveButtonClicked);
     saveButton.Visible = true;
 }
        ///<summary>
        /// Constructor for <see cref="CollapsiblePanelManager"/>
        ///</summary>
        ///<param name="collapsiblePanel"></param>
        ///<param name="controlFactory"></param>
        public CollapsiblePanelManager(ICollapsiblePanel collapsiblePanel, IControlFactory controlFactory)
        {
            _controlFactory = controlFactory;
            _collapsiblePanel = collapsiblePanel;
            _collapseButton = _controlFactory.CreateButtonCollapsibleStyle();


            _collapseButton.Click += delegate { Collapsed = !Collapsed; };
            _pinLabel = controlFactory.CreateLabelPinOffStyle();
            _pinLabel.Click += delegate { Pinned = !Pinned; };

            IPanel buttonPanel = _controlFactory.CreatePanel();
            BorderLayoutManager buttonLayoutManager =
                _controlFactory.CreateBorderLayoutManager(buttonPanel);
            buttonPanel.Height = _collapseButton.Height;

            buttonLayoutManager.AddControl(_collapseButton, BorderLayoutManager.Position.Centre);
            buttonLayoutManager.AddControl(_pinLabel, BorderLayoutManager.Position.East);

            _layoutManager = _controlFactory.CreateBorderLayoutManager(collapsiblePanel);
            _layoutManager.AddControl(buttonPanel, BorderLayoutManager.Position.North);


            _collapseButton.BackColor = System.Drawing.Color.Transparent;
            _collapseButton.ForeColor = System.Drawing.Color.Transparent;
        }
Exemplo n.º 41
0
 ///<summary>
 /// Constructor for <see cref="InputFormComboBox"/>
 ///</summary>
 ///<param name="controlFactory"></param>
 ///<param name="message"></param>
 ///<param name="choices"></param>
 public InputFormComboBox(IControlFactory controlFactory, string message, List <object> choices)
 {
     _controlFactory = controlFactory;
     _message        = message;
     _comboBox       = _controlFactory.CreateComboBox();
     choices.ForEach(item => _comboBox.Items.Add(item));
 }
Exemplo n.º 42
0
 /// <summary>
 /// Constructor to initialise a new manager
 /// </summary>
 /// <param name="managedControl">The control to manage e.g. a Panel</param>
 /// <param name="controlFactory">The factory which generates controls</param>
 public FlowLayoutManager(IControlHabanero managedControl, IControlFactory controlFactory)
     : base(managedControl, controlFactory)
 {
     _controls = new List<IControlHabanero>();
     _newLinePositions = new ArrayList(3);
     _gluePositions = new ArrayList(5);
 }
Exemplo n.º 43
0
        public void Test_SelectButtonWhenClicked_ShouldApplyBusinessObjectChanges(bool enableEditing)
        {
            //---------------Set up test pack-------------------
            GetClassDefs();
            IControlFactory          controlFactory     = GetControlFactory();
            ExtendedTextBoxWin       extendedTextBoxWin = new ExtendedTextBoxWin(controlFactory);
            const string             propName           = "OrganisationID";
            ExtendedTextBoxMapperSpy mapperSpy          = new ExtendedTextBoxMapperSpy(
                extendedTextBoxWin, propName, true, controlFactory);

            mapperSpy.EnableEditing = enableEditing;
            ContactPersonTestBO contactPersonTestBo = new ContactPersonTestBO();

            mapperSpy.BusinessObject = contactPersonTestBo;
            var expectedSelectedBO = new OrganisationTestBO();

            //---------------Assert Precondition----------------
            Assert.AreSame(contactPersonTestBo, mapperSpy.BusinessObject);
            Assert.IsNull(contactPersonTestBo.OrganisationID);
            //---------------Execute Test ----------------------
            mapperSpy.CallSetupPopupForm();
            mapperSpy.SetSelectedBusinessObject(expectedSelectedBO);
            mapperSpy.CallSelectClick();
            //---------------Test Result -----------------------
            Assert.IsNotNull(contactPersonTestBo.OrganisationID);
            Assert.AreSame(expectedSelectedBO, contactPersonTestBo.Organisation);
        }
Exemplo n.º 44
0
        /// <summary>
        /// Initialises the WizardForm, sets the controller and starts the wizard.
        /// </summary>
        /// <param name="controller">the wizrd controller that controls moving the wizard steps and the </param>
        /// <param name="controlFactory">The control factory to use for creating any controls</param>
        public WizardFormVWG(IWizardController controller, IControlFactory controlFactory)
        {
            _wizardController = controller;
            var wizardControl = (WizardControlVWG)controlFactory.CreateWizardControl(controller);

            SetupWizardControl(wizardControl);
        }
Exemplo n.º 45
0
        public void Test_Construct()
        {
            //--------------- Set up test pack ------------------
            IControlFactory    controlFactory     = GetControlFactory();
            ExtendedTextBoxWin extendedTextBoxWin = new ExtendedTextBoxWin(controlFactory);
            string             propName           = TestUtil.GetRandomString();
            //--------------- Test Preconditions ----------------

            //--------------- Execute Test ----------------------
            ExtendedTextBoxMapper mapper = new ExtendedTextBoxMapper(
                extendedTextBoxWin, propName, false, controlFactory);

            //--------------- Test Result -----------------------
            Assert.IsInstanceOf(typeof(IControlMapper), mapper);
            Assert.AreSame(extendedTextBoxWin, mapper.Control);
            Assert.AreEqual(propName, mapper.PropertyName);
            Assert.AreEqual(false, mapper.IsReadOnly);
            Assert.AreEqual(controlFactory, mapper.ControlFactory);
            ExtendedTextBoxMapper lookupComboBoxMapper = mapper;

            Assert.IsNotNull(lookupComboBoxMapper);
            Assert.AreSame(extendedTextBoxWin, lookupComboBoxMapper.Control);
            Assert.AreEqual(propName, lookupComboBoxMapper.PropertyName);
            Assert.AreEqual(false, lookupComboBoxMapper.IsReadOnly);
            Assert.AreEqual(controlFactory, lookupComboBoxMapper.ControlFactory);
            Assert.AreEqual(lookupComboBoxMapper.ErrorProvider, mapper.ErrorProvider);
        }
Exemplo n.º 46
0
        ///<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));
        }
        private void SetupGridAndBOEditorControlWin(IControlFactory controlFactory, IBOEditorControl iboEditorControl, string gridUiDefName)
        {
            if (controlFactory == null)
            {
                throw new ArgumentNullException("controlFactory");
            }
            if (iboEditorControl == null)
            {
                throw new ArgumentNullException("iboEditorControl");
            }

            _controlFactory   = controlFactory;
            _iboEditorControl = iboEditorControl;

            SetupReadOnlyGridControl(gridUiDefName);
            SetupButtonGroupControl();
            UpdateControlEnabledState();

            BorderLayoutManager layoutManager = _controlFactory.CreateBorderLayoutManager(this);

            layoutManager.AddControl(_readOnlyGridControl, BorderLayoutManager.Position.West);
            layoutManager.AddControl(_iboEditorControl, BorderLayoutManager.Position.Centre);
            layoutManager.AddControl(_buttonGroupControl, BorderLayoutManager.Position.South);

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

            _readOnlyGridControl.Grid.SelectionChanged += GridSelectionChanged;
        }
Exemplo n.º 48
0
        public void TestAddDateFilterDateTimePicker_Composites()
        {
            //---------------Set up test pack-------------------
            IControlFactory      factory             = GetControlFactory();
            IFilterClauseFactory filterClauseFactory = new DataViewFilterClauseFactory();
            IFilterControl       filterControl       = factory.CreateFilterControl();
            DateTime             testDate1           = DateTime.Now;
            DateTime             testDate2           = testDate1.AddDays(1);

            filterControl.AddDateFilterDateTimePicker("test1:", "TestColumn1", testDate1, FilterClauseOperator.OpLessThan, false);
            filterControl.AddDateFilterDateTimePicker("test2:", "TestColumn2", testDate2, FilterClauseOperator.OpLessThan, false);

            //---------------Execute Test ----------------------
            string expectedFilterClause = filterControl.GetFilterClause().GetFilterClauseString();

            //---------------Test Result -----------------------
            IFilterClause clause1 =
                filterClauseFactory.CreateDateFilterClause("TestColumn1", FilterClauseOperator.OpLessThan, new DateTime(testDate1.Year, testDate1.Month, testDate1.Day));
            IFilterClause clause2 =
                filterClauseFactory.CreateDateFilterClause("TestColumn2", FilterClauseOperator.OpLessThan, new DateTime(testDate2.Year, testDate2.Month, testDate2.Day));
            IFilterClause compClause =
                filterClauseFactory.CreateCompositeFilterClause(clause1, FilterClauseCompositeOperator.OpAnd, clause2);

            Assert.AreEqual(compClause.GetFilterClauseString(), expectedFilterClause);

            //---------------Tear Down -------------------------
        }
Exemplo n.º 49
0
        public void Test_Set_CurrentBusinessObject_WhenUsingABusinessObjectControl_ShouldOnlySetBOOnce()
        {
            //---------------Set up test pack-------------------
            ITabControl            tabControl      = CreateTabControl();
            IControlFactory        controlFactory  = GetControlFactory();
            BOColTabControlManager selectorManager = new BOColTabControlManager(tabControl, controlFactory);
            MyBO firstBo;
            BusinessObjectCollection <MyBO> myBoCol = GetMyBoCol_3Items(out firstBo);
            var list = new List <IBusinessObject>();
            var businessObjectControl = GetBusinessObjectControlSpy(list.Add);

            selectorManager.BusinessObjectControl    = businessObjectControl;
            selectorManager.BusinessObjectCollection = myBoCol;
            list.Clear();
            //---------------Assert Precondition----------------
            Assert.IsTrue(selectorManager.AutoSelectFirstItem);
            Assert.AreEqual(0, list.Count);
            //---------------Execute Test ----------------------
            var newSelectedBo = myBoCol[1];

            selectorManager.CurrentBusinessObject = newSelectedBo;
            //---------------Test Result -----------------------
            Assert.AreEqual(1, list.Count);
            Assert.AreEqual(newSelectedBo, list[0]);
        }
Exemplo n.º 50
0
        ///<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));
        }
Exemplo n.º 51
0
        protected virtual IControlFactory GetControlFactory()
        {
            IControlFactory factory = CreateNewControlFactory();

            GlobalUIRegistry.ControlFactory = factory;
            return(factory);
        }
 ///<summary>
 /// Constructor for <see cref="CollapsiblePanelSelectorWin"/>
 ///</summary>
 ///<param name="controlFactory"></param>
 ///<exception cref="NotImplementedException"></exception>
 public CollapsiblePanelSelectorWin(IControlFactory controlFactory)
 {
     _controlFactory = controlFactory;
     if (controlFactory == null) throw new ArgumentNullException("controlFactory");
     this.ItemSelected += delegate { FireBusinessObjectSelected(); };
     this.AutoSelectFirstItem = true;
 }
        protected IControlFactory GetControlFactory()
        {
            if ((_factory == null)) _factory = new ControlFactoryWin();

            GlobalUIRegistry.ControlFactory = _factory;
            return _factory;
        }
 ///<summary>
 /// Constructor for <see cref="EditableGridControlManager"/>
 ///</summary>
 ///<param name="gridControl"></param>
 ///<param name="controlFactory"></param>
 public ReadOnlyGridControlManager(IReadOnlyGridControl gridControl, IControlFactory controlFactory)
 {
     GridControl = gridControl;
     ControlFactory = controlFactory;
     if (gridControl == null) throw new ArgumentNullException("gridControl");
     if (controlFactory == null) throw new ArgumentNullException("controlFactory");
     GridInitialiser = new GridInitialiser(gridControl, controlFactory);
 }
Exemplo n.º 55
0
		///<summary>
		/// Constructor with controlFactory, propertyName and filterClauseOperator
		///</summary>
		///<param name="controlFactory"></param>
		///<param name="propertyName"></param>
		///<param name="filterClauseOperator"></param>
		///<param name="enumType"></param>
		public EnumComboBoxFilter(IControlFactory controlFactory, string propertyName
				, FilterClauseOperator filterClauseOperator, Type enumType)
			:this(controlFactory, propertyName, filterClauseOperator)
		{
			EnumType = enumType;
			if (enumType == null) throw new ArgumentNullException("enumType");
			EnumType = enumType;
		}
Exemplo n.º 56
0
 /// <summary>
 /// Constructor to create a new CheckBox mapper object
 /// </summary>
 /// <param name="cb">The CheckBox object to be mapped</param>
 /// <param name="propName">A name for the property</param>
 /// <param name="isReadOnly">Whether this control is read only</param>
 /// <param name="factory">the control factory to be used when creating the controlMapperStrategy</param>
 public CheckBoxMapper(ICheckBox cb, string propName, bool isReadOnly, IControlFactory factory)
     : base(cb, propName, isReadOnly, factory)
 {
     _checkBox = cb;
     _strategy = factory.CreateCheckBoxMapperStrategy();
     if (_strategy == null) return;
     _strategy.AddClickEventHandler(this);
 }
 /// <summary>
 /// Constructor for <see cref="ReadOnlyGridButtonsControlVWG"/>
 /// </summary>
 /// <param name="controlFactory"></param>
 public ReadOnlyGridButtonsControlVWG(IControlFactory controlFactory)
     : base(controlFactory)
 {
     _manager = new ReadOnlyGridButtonsControlManager(this);
     _manager.CreateDeleteButton(delegate { if (DeleteClicked != null) DeleteClicked(this, new EventArgs()); });
     _manager.CreateEditButton(delegate { if (EditClicked != null) EditClicked(this, new EventArgs()); });
     _manager.CreateAddButton(delegate { if (AddClicked != null) AddClicked(this, new EventArgs()); });
 }
Exemplo n.º 58
0
 ///<summary>
 /// Initialise the grid with the appropriate control factory.
 ///</summary>
 ///<param name="gridControl"></param>
 ///<param name="controlFactory"></param>
 public GridInitialiser(IGridControl gridControl, IControlFactory controlFactory)
 {
     if (gridControl == null) throw new ArgumentNullException("gridControl");
     if (controlFactory == null) throw new ArgumentNullException("controlFactory");
     Grid = gridControl;
     _controlFactory = controlFactory;
     _gridBaseInitialiser = new GridBaseInitialiser(Grid.Grid, controlFactory);
 }
 ///<summary>
 /// Constructor for the <see cref="BOSelectorAndBOEditorControlWin"/>
 ///</summary>
 ///<param name="controlFactory"></param>
 ///<param name="classDef"></param>
 ///<param name="uiDefName"></param>
 ///<exception cref="ArgumentNullException"></exception>
 public BOSelectorAndBOEditorControlWin(IControlFactory controlFactory, ClassDef classDef, string uiDefName)
 {
     if (controlFactory == null) throw new ArgumentNullException("controlFactory");
     if (classDef == null) throw new ArgumentNullException("classDef");
     _classDef = classDef;
     BOEditorControl boEditorControl = new BOEditorControl(controlFactory, classDef, uiDefName);
     SetupGridAndBOEditorControlWin(controlFactory, boEditorControl, uiDefName);
 }
 protected override IBOPanelEditorControl CreateEditorControl
     (IControlFactory controlFactory, IClassDef classDef, string uiDefName)
 {
     if (classDef.ClassName == "OrganisationTestBO")
     {
         return new BOEditorControlVWG<OrganisationTestBO>(controlFactory, uiDefName);
     }
     return new BOEditorControlVWG<ContactPersonTestBO>(controlFactory, uiDefName);
 }