/// <summary> /// Creates a panel to display a business object /// </summary> /// <returns>Returns the panel info object containing the panel</returns> public IPanelFactoryInfo CreatePanel() { IPanelFactoryInfo factoryInfo; _firstControl = null; if (_uiForm.Count > 1) { IPanel mainPanel = _controlFactory.CreatePanel(_controlFactory); ControlMapperCollection controlMappers = new ControlMapperCollection(); IDictionary <string, IEditableGridControl> formGrids = new Dictionary <string, IEditableGridControl>(); ITabControl tabControl = _controlFactory.CreateTabControl(); BorderLayoutManager mainPanelManager = _controlFactory.CreateBorderLayoutManager(mainPanel); mainPanelManager.AddControl(tabControl, BorderLayoutManager.Position.Centre); foreach (UIFormTab formTab in _uiForm) { IPanelFactoryInfo onePanelInfo = CreateOnePanel(formTab); AddControlMappers(onePanelInfo, controlMappers); AddFormGrids(onePanelInfo, formGrids); ITabPage page = _controlFactory.CreateTabPage(formTab.Name); BorderLayoutManager manager = _controlFactory.CreateBorderLayoutManager(page); manager.AddControl(onePanelInfo.Panel, BorderLayoutManager.Position.Centre); tabControl.TabPages.Add(page); } factoryInfo = new PanelFactoryInfo(mainPanel, controlMappers, _uiDefName, _firstControl); factoryInfo.FormGrids = formGrids; } else { factoryInfo = CreateOnePanel(_uiForm[0]); } SetFormPreferredHeight(factoryInfo); //TODO_Port AttachTriggers(_uiForm, factoryInfo, _currentBusinessObject); return(factoryInfo); }
///<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; }
private void SetupControl(IControlFactory controlFactory, IBusinessObjectControl businessObjectControl, string uiDefName) { if (controlFactory == null) { throw new ArgumentNullException("controlFactory"); } if (businessObjectControl == null) { throw new ArgumentNullException("businessObjectControl"); } _controlFactory = controlFactory; _businessObjectControl = businessObjectControl; SetupReadOnlyGridControl(uiDefName); SetupButtonGroupControl(); UpdateControlEnabledState(); BorderLayoutManager layoutManager = _controlFactory.CreateBorderLayoutManager(_gridWithPanelControl); layoutManager.AddControl(ReadOnlyGridControl, BorderLayoutManager.Position.North); layoutManager.AddControl(_businessObjectControl, BorderLayoutManager.Position.Centre); layoutManager.AddControl(_buttonControl, BorderLayoutManager.Position.South); ConfirmSaveDelegate += CheckUserWantsToSave; }
/// <summary> /// Adds an <see cref="IControlHabanero"/> to this control. The <paramref name="contentControl"/> is /// wrapped in the appropriate Child Control Type. /// </summary> /// <param name="contentControl">The control that is being placed as a child within this control. The content control could be /// a Panel of <see cref="IBusinessObject"/>.<see cref="IBOProp"/>s or any other child control</param> /// <param name="headingText">The heading text that will be shown as the Header for this Group e.g. For a <see cref="ITabControl"/> /// this will be the Text shown in the Tab for a <see cref="ICollapsiblePanelGroupControl"/> this will be the text shown /// on the Collapse Panel and for an <see cref="IGroupBox"/> this will be the title of the Group Box.</param> /// <param name="minimumControlHeight">The minimum height that the <paramref name="contentControl"/> can be. /// This height along with any other spacing required will be used as the minimum height for the ChildControlCreated</param> /// <param name="minimumControlWidth">The minimum width that the <paramref name="contentControl"/> can be</param> /// <returns></returns> public virtual IControlHabanero AddControl (IControlHabanero contentControl, string headingText, int minimumControlHeight, int minimumControlWidth) { IControlFactory factory = GlobalUIRegistry.ControlFactory; if (factory == null) { const string errMessage = "There is a serious error since the GlobalUIRegistry.ControlFactory has not been set up."; throw new HabaneroDeveloperException(errMessage, errMessage); } var groupBox = factory.CreateGroupBox(headingText); groupBox.Width = minimumControlWidth + 30; groupBox.Height = minimumControlHeight + 30; var layoutManager = factory.CreateBorderLayoutManager(groupBox); layoutManager.BorderSize = 20; layoutManager.AddControl(contentControl); CollapsiblePanelGroup.Width = groupBox.Width + LayoutManager.BorderSize * 2; CollapsiblePanelGroup.Height = groupBox.Height + LayoutManager.BorderSize * 2; LayoutManager.AddControl(groupBox); return(groupBox); }
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> /// 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> ///</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> /// 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> /// 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> /// 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> /// 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> /// 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); }
///<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 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); }
///<summary> /// Constrcutor for the <see cref="StaticDataEditorManager"/> ///</summary> ///<param name="staticDataEditor"></param> ///<param name="controlFactory"></param> public StaticDataEditorManager(IStaticDataEditor staticDataEditor, IControlFactory controlFactory) { _staticDataEditor = staticDataEditor; this._controlFactory = controlFactory; _items = new Dictionary<string, IClassDef>(); _treeView = _controlFactory.CreateTreeView("TreeView"); _treeView.Width = 200; _gridControl = _controlFactory.CreateEditableGridControl(); BorderLayoutManager layoutManager = _controlFactory.CreateBorderLayoutManager(_staticDataEditor); layoutManager.AddControl(_gridControl, BorderLayoutManager.Position.Centre); layoutManager.AddControl(_treeView, BorderLayoutManager.Position.West); _treeView.AfterSelect += ((sender, e) => SelectItem(e.Node.Text)); _treeView.BeforeSelect += _treeView_OnBeforeSelect; _gridControl.Enabled = false; _gridControl.FilterControl.Visible = false; }
///<summary> /// Constrcutor for the <see cref="StaticDataEditorManager"/> ///</summary> ///<param name="staticDataEditor"></param> ///<param name="controlFactory"></param> public StaticDataEditorManager(IStaticDataEditor staticDataEditor, IControlFactory controlFactory) { _staticDataEditor = staticDataEditor; this._controlFactory = controlFactory; _items = new Dictionary <string, IClassDef>(); _treeView = _controlFactory.CreateTreeView("TreeView"); _treeView.Width = 200; _gridControl = _controlFactory.CreateEditableGridControl(); BorderLayoutManager layoutManager = _controlFactory.CreateBorderLayoutManager(_staticDataEditor); layoutManager.AddControl(_gridControl, BorderLayoutManager.Position.Centre); layoutManager.AddControl(_treeView, BorderLayoutManager.Position.West); _treeView.AfterSelect += ((sender, e) => SelectItem(e.Node.Text)); _treeView.BeforeSelect += _treeView_OnBeforeSelect; _gridControl.Enabled = false; _gridControl.FilterControl.Visible = false; }
///<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> /// Sets the current control to the one with the specified heading /// </summary> /// <param name="heading">The heading</param> /// <returns>Returns the relevant IFormControl object</returns> public IFormControl SetCurrentControl(String heading) { if (_formsbyHeading == null) { _formsbyHeading = new Hashtable(); _formsbyForm = new Hashtable(); } if (_formsbyHeading.Contains(heading)) { IFormHabanero frm = (IFormHabanero)_formsbyHeading[heading]; if (_fontSize != 0.0f) { frm.Font = new Font(frm.Font.FontFamily, _fontSize); } frm.Show(); frm.Refresh(); frm.Focus(); frm.PerformLayout(); return((IFormControl)frm.Controls[0]); } IFormControl formCtl = GetFormControl(heading); IFormHabanero newMdiForm = _controlFactory.CreateForm(); newMdiForm.Width = 800; newMdiForm.Height = 600; newMdiForm.MdiParent = _parentForm; newMdiForm.WindowState = FormWindowState.Maximized; //IControlHabanero ctl = formCtl; newMdiForm.Text = heading; newMdiForm.Controls.Clear(); BorderLayoutManager layoutManager = _controlFactory.CreateBorderLayoutManager(newMdiForm); layoutManager.AddControl((IControlHabanero)formCtl, BorderLayoutManager.Position.Centre); newMdiForm.Show(); _formsbyHeading.Add(heading, newMdiForm); _formsbyForm.Add(newMdiForm, heading); formCtl.SetForm(newMdiForm); newMdiForm.Closed += MdiFormClosed; return(formCtl); }
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; }
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)); }
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; }
/* ///<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); }
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; }