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; }
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); }
///<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)); }
///<summary> /// A constructor for the <see cref="ErrorDescriptionForm"/> ///</summary> public ErrorDescriptionForm() { IControlFactory controlFactory = GlobalUIRegistry.ControlFactory; ILabel label = controlFactory.CreateLabel("Please enter further details regarding the error : "); _errorDescriptionTextBox = controlFactory.CreateTextBox(); ErrorDescriptionTextBox.Multiline = true; IButtonGroupControl buttonGroupControl = controlFactory.CreateButtonGroupControl(); buttonGroupControl.AddButton("OK", delegate { this.Close(); }); BorderLayoutManager layoutManager = controlFactory.CreateBorderLayoutManager(this); layoutManager.AddControl(label, BorderLayoutManager.Position.North); layoutManager.AddControl(ErrorDescriptionTextBox, BorderLayoutManager.Position.Centre); layoutManager.AddControl(buttonGroupControl, BorderLayoutManager.Position.South); this.Text = "Error Description"; this.Width = 500; this.Height = 400; this.Closing += delegate(object sender, CancelEventArgs e) { if (ErrorDescriptionFormClosing == null) { return; } ErrorDescriptionFormClosing(sender, e); }; }
/// <summary> ///This method sets up the form so that the menu is displayed and the form is able to ///display the controls loaded when the menu item is clicked. /// </summary> /// <param name="form">The form to set up with the menu</param> /// <param name="menuWidth">The width of the menu - configurable to so that each application can set its menu width</param> public void DockInForm(IControlHabanero form, int menuWidth) { if (form == null) { throw new ArgumentNullException("form"); } _splitContainer = this.ControlFactory.CreateSplitContainer(); _splitContainer.Name = "SplitContainer"; BorderLayoutManager layoutManager = this.ControlFactory.CreateBorderLayoutManager(form); layoutManager.AddControl(_splitContainer, BorderLayoutManager.Position.Centre); SplitContainer splitContainer1 = (SplitContainer)_splitContainer; //splitContainer1.IsSplitterFixed = true; splitContainer1.FixedPanel = FixedPanel.Panel1; splitContainer1.Size = new System.Drawing.Size(400, 450); splitContainer1.SplitterDistance = menuWidth; splitContainer1.Panel1MinSize = menuWidth; splitContainer1.Orientation = System.Windows.Forms.Orientation.Vertical; this.Dock = System.Windows.Forms.DockStyle.Fill; splitContainer1.Panel1.Controls.Add(this); MainEditorPanelWin mainEditorPanel = new MainEditorPanelWin(this.ControlFactory); mainEditorPanel.Dock = System.Windows.Forms.DockStyle.Fill; splitContainer1.Panel2.Controls.Add(mainEditorPanel); }
/// <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> /// 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; }
/// <summary> /// Constructor that sets up the error message form /// </summary> public CollapsibleExceptionNotifyForm(Exception ex, string furtherMessage, string title) { this._exception = ex; this._summary = _controlFactory.CreatePanel(); this._summary.Text = title; this._summary.Height = SUMMARY_HEIGHT; ITextBox messageTextBox = GetSimpleMessage(ex.Message); messageTextBox.ScrollBars = ScrollBars.Vertical; ILabel messageLabel = GetErrorLabel(furtherMessage); BorderLayoutManager summaryManager = _controlFactory.CreateBorderLayoutManager(_summary); summaryManager.AddControl(messageLabel, BorderLayoutManager.Position.North); summaryManager.AddControl(messageTextBox, BorderLayoutManager.Position.Centre); this._buttonsOK = _controlFactory.CreateButtonGroupControl(); this._buttonsOK.AddButton("&OK", new EventHandler(OKButtonClickHandler)); this._buttonsDetail = _controlFactory.CreateButtonGroupControl(); this._buttonsDetail.AddButton("Email Error", EmailErrorClickHandler); this._moreDetailButton = _buttonsDetail.AddButton("More Detail »", MoreDetailClickHandler); this._buttonsDetail.Width = 2 * (_moreDetailButton.Width + 9); this._fullDetailsVisible = false; this.SetFullDetailsPanel(); this.LayoutForm(); this.Text = title; this.Width = 600; this.Height = SUMMARY_HEIGHT + BUTTONS_HEIGHT + 16; this.StartPosition = FormStartPosition.CenterScreen; //this.Resize += ResizeForm; }
public void TestOrders() { //---------------Set up test pack------------------- IControlHabanero managedControl = GetControlFactory().CreateControl(); managedControl.Width = _STD_MANAGEDCONTROL_WIDTH; managedControl.Height = _STD_MANAGEDCONTROL_HEIGHT; BorderLayoutManager manager = GetControlFactory().CreateBorderLayoutManager(managedControl); IControlHabanero ctlEast = CreateControl(30, 50); IControlHabanero ctlNorth = CreateControl(20, 20); IControlHabanero ctlSouth = CreateControl(50, 50); IControlHabanero ctlCentre = CreateControl(1, 1); IControlHabanero ctlWest = CreateControl(10, 10); //---------------Execute Test ---------------------- manager.AddControl(ctlEast, BorderLayoutManager.Position.East); manager.AddControl(ctlNorth, BorderLayoutManager.Position.North); manager.AddControl(ctlSouth, BorderLayoutManager.Position.South); manager.AddControl(ctlCentre, BorderLayoutManager.Position.Centre); manager.AddControl(ctlWest, BorderLayoutManager.Position.West); //---------------Test Result ----------------------- Assert.AreEqual(30, ctlEast.Width); Assert.AreEqual(30, ctlEast.Height); Assert.AreEqual(20, ctlNorth.Height); Assert.AreEqual(100, ctlNorth.Width); Assert.AreEqual(50, ctlSouth.Height); Assert.AreEqual(100, ctlSouth.Width); Assert.AreEqual(10, ctlWest.Width); Assert.AreEqual(30, ctlWest.Height); Assert.AreEqual(30, ctlCentre.Height); Assert.AreEqual(60, ctlCentre.Width); }
///<summary> /// Constructor for <see cref="BusinessObjectPanelVWG{T}"/> ///</summary> ///<param name="controlFactory"></param> ///<param name="uiDefName"></param> public BusinessObjectPanelVWG(IControlFactory controlFactory, string uiDefName) { PanelBuilder panelBuilder = new PanelBuilder(controlFactory); _panelInfo = panelBuilder.BuildPanelForForm(ClassDef.Get <T>().UIDefCol[uiDefName].UIForm); BorderLayoutManager layoutManager = controlFactory.CreateBorderLayoutManager(this); layoutManager.AddControl(_panelInfo.Panel, BorderLayoutManager.Position.Centre); this.Size = _panelInfo.Panel.Size; this.MinimumSize = _panelInfo.Panel.Size; }
internal static IPanelInfo CreatePanelInfo (IControlFactory controlFactory, IClassDef classDef, string uiDefName, IBOEditorControl iboEditorControl) { IUIForm uiForm = GetUiForm(classDef, uiDefName); PanelBuilder panelBuilder = new PanelBuilder(controlFactory); IPanelInfo panelInfo = panelBuilder.BuildPanelForForm(uiForm); BorderLayoutManager layoutManager = controlFactory.CreateBorderLayoutManager(iboEditorControl); layoutManager.AddControl(panelInfo.Panel, BorderLayoutManager.Position.Centre); return(panelInfo); }
public void TestAddControl() { //---------------Set up test pack------------------- IControlHabanero managedControl = GetControlFactory().CreateControl(); IControlHabanero ctl = GetControlFactory().CreateTextBox(); BorderLayoutManager manager = GetControlFactory().CreateBorderLayoutManager(managedControl); //---------------Execute Test ---------------------- manager.AddControl(ctl); //---------------Test Result ----------------------- Assert.AreEqual(1, managedControl.Controls.Count); }
///<summary> /// Constructor with a specified Control Factory ///</summary> ///<param name="controlFactory"></param> public ExtendedComboBoxVWG(IControlFactory controlFactory) { _controlFactory = controlFactory; IUserControlHabanero userControlHabanero = this; ComboBox = _controlFactory.CreateComboBox(); Button = _controlFactory.CreateButton("..."); BorderLayoutManager borderLayoutManager = controlFactory.CreateBorderLayoutManager(userControlHabanero); borderLayoutManager.AddControl(ComboBox, BorderLayoutManager.Position.Centre); borderLayoutManager.AddControl(Button, BorderLayoutManager.Position.East); }
///<summary> /// Constructor with a specified Control Factory ///</summary> ///<param name="factory"></param> public ExtendedTextBoxWin(IControlFactory factory) { Button = factory.CreateButton("..."); TextBox = factory.CreateTextBox(); Button.MinimumSize = new Size(0, 0); TextBox.Enabled = false; this.Height = TextBox.Height; BorderLayoutManager borderLayoutManager = factory.CreateBorderLayoutManager(this); this.Padding = Padding.Empty; borderLayoutManager.AddControl(TextBox, BorderLayoutManager.Position.Centre); borderLayoutManager.AddControl(Button, BorderLayoutManager.Position.East); }
///<summary> /// Constructs the <see cref="ExtendedComboBoxWin"/> with the specified <see cref="IControlFactory"/>. ///</summary> public ExtendedComboBoxWin(IControlFactory controlFactory) { _controlFactory = controlFactory; IUserControlHabanero userControlHabanero = this; _comboBox = _controlFactory.CreateComboBox(); _button = _controlFactory.CreateButton("..."); _button.MinimumSize = new Size(0, 0); BorderLayoutManager borderLayoutManager = controlFactory.CreateBorderLayoutManager(userControlHabanero); borderLayoutManager.AddControl(_comboBox, BorderLayoutManager.Position.Centre); borderLayoutManager.AddControl(_button, BorderLayoutManager.Position.East); }
/// <summary> /// Constructs a <see cref="MainEditorPanelWin"/> /// </summary> /// <param name="controlFactory"></param> public MainEditorPanelWin(IControlFactory controlFactory) { if (controlFactory == null) { throw new ArgumentNullException("controlFactory"); } this.EditorPanel = controlFactory.CreatePanel(); this.MainTitleIconControl = new MainTitleIconControlWin(controlFactory); BorderLayoutManager layoutManager = controlFactory.CreateBorderLayoutManager(this); layoutManager.AddControl(this.MainTitleIconControl, BorderLayoutManager.Position.North); layoutManager.AddControl(this.EditorPanel, BorderLayoutManager.Position.Centre); }
/* * ///<summary> * /// Construct the Dialog form for any situation e.g. where the Form being closed has * /// Mutliple Business Objects is a wizard etc. * ///</summary> * /// <param name="controlFactory">The control Factory used to construct buttons, labels etc by ths control</param> * ///<param name="fullDisplayName">Full display name for the BusienssObject(s)</param> * ///<param name="isInValidState">Are the BusinessObject(s) in a valid state</param> * ///<param name="isDirty"></param> * ///<exception cref="ArgumentNullException">control Factory must not be null</exception> * public CloseBOEditorDialogWin(IControlFactory controlFactory, string fullDisplayName, bool isInValidState, bool isDirty) * { * if (controlFactory == null) throw new ArgumentNullException("controlFactory"); * ConstructControl(controlFactory, fullDisplayName, isInValidState, isDirty); * SetSize(); * }*/ private void ConstructControl(IControlFactory controlFactory) { IButtonGroupControl buttonGroupControl = controlFactory.CreateButtonGroupControl(); CancelCloseBtn = buttonGroupControl.AddButton("CancelClose", "Cancel Close", ButtonClick); CloseWithoutSavingBtn = buttonGroupControl.AddButton("CloseWithoutSaving", "&Close without saving", ButtonClick); SaveAndCloseBtn = buttonGroupControl.AddButton("SaveAndClose", "&Save & Close", ButtonClick); _label = controlFactory.CreateLabel(); BorderLayoutManager layoutManager = controlFactory.CreateBorderLayoutManager(this); layoutManager.AddControl(_label, BorderLayoutManager.Position.Centre); layoutManager.AddControl(buttonGroupControl, BorderLayoutManager.Position.South); }
/// <summary> /// Constructor to initialise a new tab control /// </summary> public BOColTabControlVWG(IControlFactory controlFactory) { if (controlFactory == null) { throw new ArgumentNullException("controlFactory"); } _controlFactory = controlFactory; BorderLayoutManager manager = _controlFactory.CreateBorderLayoutManager(this); _tabControl = _controlFactory.CreateTabControl(); manager.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); }
public OKCancelPanelWin(IControlFactory controlFactory) { _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); }
public void TestAddControlWithPosition() { //---------------Set up test pack------------------- IControlHabanero managedControl = GetControlFactory().CreateControl(); managedControl.Width = _STD_MANAGEDCONTROL_WIDTH; managedControl.Height = _STD_MANAGEDCONTROL_HEIGHT; IControlHabanero ctl = GetControlFactory().CreatePanel(); BorderLayoutManager manager = GetControlFactory().CreateBorderLayoutManager(managedControl); //---------------Execute Test ---------------------- manager.AddControl(ctl, BorderLayoutManager.Position.Centre); //---------------Test Result ----------------------- Assert.AreEqual(1, managedControl.Controls.Count); Assert.AreEqual(manager.ManagedControl.Width, ctl.Width, "Control's width should be the width of the control"); Assert.AreEqual(manager.ManagedControl.Height, ctl.Height, "Control's height should be the height of the control"); }
/// <summary> /// Constructor that sets up the error message form /// </summary> public CollapsibleExceptionNotifyForm(Exception ex, string furtherMessage, string title) { _exception = ex; _summaryPanel = new PanelVWG(); _summaryPanel.Text = title; _summaryPanel.Height = SUMMARY_HEIGHT; ITextBox messageTextBox = GetSimpleMessage(ex.Message); ILabel messageLabel = GetErrorLabel(furtherMessage); BorderLayoutManager summaryManager = new BorderLayoutManagerVWG(_summaryPanel, GlobalUIRegistry.ControlFactory); summaryManager.AddControl(messageLabel, BorderLayoutManager.Position.North); summaryManager.AddControl(messageTextBox, BorderLayoutManager.Position.Centre); IButtonGroupControl buttonsOK = GlobalUIRegistry.ControlFactory.CreateButtonGroupControl(); buttonsOK.AddButton("&OK", OKButtonClickHandler); buttonsOK.Height = BUTTONS_HEIGHT; IButtonGroupControl buttonsDetail = GlobalUIRegistry.ControlFactory.CreateButtonGroupControl(); buttonsDetail.AddButton("Email Error", EmailErrorClickHandler); _moreDetailButton = buttonsDetail.AddButton("More Detail »", MoreDetailClickHandler); buttonsDetail.Height = BUTTONS_HEIGHT; buttonsDetail.Width = 2 * (_moreDetailButton.Width + 9); SetFullDetailsPanel(); BorderLayoutManager manager = //new BorderLayoutManagerVWG(this, GlobalUIRegistry.ControlFactory); GlobalUIRegistry.ControlFactory.CreateBorderLayoutManager(this); manager.AddControl(_summaryPanel, BorderLayoutManager.Position.North); manager.AddControl(buttonsDetail, BorderLayoutManager.Position.West); manager.AddControl(buttonsOK, BorderLayoutManager.Position.East); manager.AddControl(_fullDetailPanel, BorderLayoutManager.Position.South); Text = title; Width = 600; Height = SUMMARY_HEIGHT + BUTTONS_HEIGHT + 16; StartPosition = FormStartPosition.Manual; Location = new Point(50, 50); Resize += ResizeForm; }
private void CreateBOPanel(IControlFactory controlFactory, string uiDefName) { if (controlFactory == null) { throw new ArgumentNullException("controlFactory"); } if (string.IsNullOrEmpty(uiDefName)) { throw new ArgumentNullException("uiDefName"); } PanelBuilder panelBuilder = new PanelBuilder(controlFactory); _panelInfo = panelBuilder.BuildPanelForForm(ClassDef.Get <T>().UIDefCol[uiDefName].UIForm); BorderLayoutManager layoutManager = controlFactory.CreateBorderLayoutManager(this); layoutManager.AddControl(_panelInfo.Panel, BorderLayoutManager.Position.Centre); this.Size = _panelInfo.Panel.Size; this.MinimumSize = _panelInfo.Panel.Size; }
public void TestAddControl_Null_WithPos_ThrowsAppropriateError() { //---------------Set up test pack------------------- IControlHabanero managedControl = GetControlFactory().CreateControl(); BorderLayoutManager manager = GetControlFactory().CreateBorderLayoutManager(managedControl); //---------------Execute Test ---------------------- try { manager.AddControl(null, BorderLayoutManager.Position.Centre); Assert.Fail("expected ArgumentNullException"); } //---------------Test Result ----------------------- catch (ArgumentNullException ex) { StringAssert.Contains("Value cannot be null", ex.Message); StringAssert.Contains("control", ex.ParamName); } }
public void TestSplitter() { //---------------Set up test pack------------------- IControlHabanero managedControl = GetControlFactory().CreateControl(); managedControl.Width = _STD_MANAGEDCONTROL_WIDTH; managedControl.Height = _STD_MANAGEDCONTROL_HEIGHT; IControlHabanero ctlEast = CreateControl(20, 20); IControlHabanero ctlCentre = CreateControl(1, 1); BorderLayoutManager manager = GetControlFactory().CreateBorderLayoutManager(managedControl); //---------------Execute Test ---------------------- manager.AddControl(ctlEast, BorderLayoutManager.Position.East, true); manager.AddControl(ctlCentre, BorderLayoutManager.Position.Centre); //---------------Test Result ----------------------- Assert.AreEqual(managedControl.Controls.Count, 3, "There should be 3 controls because of the splitter."); Assert.AreEqual(80, ctlEast.Left, "East positioned control doesn't change width when splitter is added."); Assert.AreEqual(80 - 3, ctlCentre.Width, "Splitter is 3 wide, so centre control should be 3 less than it would be"); }
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; }
///<summary> /// Constructs a new instance of a <see cref="EditableGridControlVWG"/>. ///</summary> ///<param name="controlFactory">The <see cref="IControlFactory"/> to use to construct the control.</param> public EditableGridControlVWG(IControlFactory controlFactory) { if (controlFactory == null) { throw new HabaneroArgumentException("controlFactory", "Cannot create an editable grid control if the control factory is null"); } _controlFactory = controlFactory; _grid = _controlFactory.CreateEditableGrid(); _editableGridManager = new EditableGridControlManager(this, controlFactory); Buttons = _controlFactory.CreateEditableGridButtonsControl(); FilterControl = _controlFactory.CreateFilterControl(); InitialiseButtons(); InitialiseFilterControl(); BorderLayoutManager manager = controlFactory.CreateBorderLayoutManager(this); manager.AddControl(FilterControl, BorderLayoutManager.Position.North); manager.AddControl(_grid, BorderLayoutManager.Position.Centre); manager.AddControl(Buttons, BorderLayoutManager.Position.South); this.Grid.BusinessObjectSelected += Grid_OnBusinessObjectSelected; this.AllowUsersToAddBO = true; }
///<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)); }
public void TestAddTwoControls() { //---------------Set up test pack------------------- IControlHabanero managedControl = GetControlFactory().CreateControl(); managedControl.Width = _STD_MANAGEDCONTROL_WIDTH; managedControl.Height = _STD_MANAGEDCONTROL_HEIGHT; IControlHabanero ctl1 = GetControlFactory().CreatePanel(); ctl1.Height = 20; IControlHabanero ctl2 = GetControlFactory().CreatePanel(); ctl2.Height = 10; BorderLayoutManager manager = GetControlFactory().CreateBorderLayoutManager(managedControl); //---------------Execute Test ---------------------- manager.AddControl(ctl1, BorderLayoutManager.Position.Centre); manager.AddControl(ctl2, BorderLayoutManager.Position.North); //---------------Test Result ----------------------- Assert.AreEqual(2, managedControl.Controls.Count); Assert.AreEqual(managedControl.Height - ctl2.Height, ctl1.Height, "Control at centre should fill the rest of the space."); Assert.AreEqual(10, ctl2.Height, "Control at position North should retain size."); }
private void LayoutForm() { while (this.Controls.Count > 0) { this.Controls.Remove(this.Controls[0]); } var heightBeforeLayout = this._summary.Height; var buttonsPanel = _controlFactory.CreatePanel(); var buttonsManager = _controlFactory.CreateBorderLayoutManager(buttonsPanel); buttonsManager.AddControl(this._buttonsDetail, BorderLayoutManager.Position.West); buttonsManager.AddControl(this._buttonsOK, BorderLayoutManager.Position.East); buttonsPanel.Height = this._buttonsDetail.Height; var topPanel = _controlFactory.CreatePanel(); var topManager = _controlFactory.CreateBorderLayoutManager(topPanel); topManager.AddControl(this._summary, BorderLayoutManager.Position.Centre); topManager.AddControl(buttonsPanel, BorderLayoutManager.Position.South); this._layoutManager = _controlFactory.CreateBorderLayoutManager(this); if (this._fullDetailsVisible) { var detailsPanel = _controlFactory.CreatePanel(); var detailsManager = _controlFactory.CreateBorderLayoutManager(detailsPanel); detailsManager.AddControl(this._fullDetail, BorderLayoutManager.Position.Centre); this._layoutManager.AddControl(topPanel, BorderLayoutManager.Position.North); this._layoutManager.AddControl(detailsPanel, BorderLayoutManager.Position.Centre); this.MinimumSize = new Size(640, 400); } else { this._layoutManager.AddControl(topPanel, BorderLayoutManager.Position.Centre); this.MinimumSize = new Size(640, 250); } }
public void DoClick() { try { if (_habaneroMenuItem.CustomHandler != null) { _habaneroMenuItem.CustomHandler(this, new EventArgs()); } else { if (ReshowForm()) { return; } if (_habaneroMenuItem.Form == null || _habaneroMenuItem.Form.Controls.Count <= 0) { return; } _createdForm = _habaneroMenuItem.ControlFactory.CreateForm(); _createdForm.Width = 800; _createdForm.Height = 600; _createdForm.MdiParent = (IFormHabanero)_habaneroMenuItem.Form; _createdForm.WindowState = Habanero.Faces.Base.FormWindowState.Maximized; _createdForm.Text = _habaneroMenuItem.Name; //Deerasha 2009/11/26: Line below prevents the std VS icon from appearing on form's upper right ((Form)_createdForm).ShowIcon = false; _createdForm.Controls.Clear(); BorderLayoutManager layoutManager = _habaneroMenuItem.ControlFactory.CreateBorderLayoutManager (_createdForm); IControlHabanero control; if (_habaneroMenuItem.FormControlCreator != null) { _formControl = _habaneroMenuItem.FormControlCreator(); _formControl.SetForm(_createdForm); control = (IControlHabanero)_formControl; } else if (_habaneroMenuItem.ControlManagerCreator != null) { _controlManager = _habaneroMenuItem.ControlManagerCreator(_habaneroMenuItem.ControlFactory); control = _controlManager.Control; } else { throw new Exception ("Please set up the MenuItem with at least one Creational or custom handling delegate"); } layoutManager.AddControl(control, BorderLayoutManager.Position.Centre); _createdForm.Show(); _createdForm.Closed += delegate { _createdForm = null; _formControl = null; _controlManager = null; }; } } catch (Exception ex) { GlobalRegistry.UIExceptionNotifier.Notify(ex, null, null); } }