///<summary> /// Shows the popup form that is displayed when the button is clicked. /// This popup form is used to edit the <see cref="BusinessObject"/>s that fill the combobox. ///</summary> public virtual void SetupPopupForm() { Type classType; IClassDef lookupTypeClassDef = GetLookupTypeClassDef(out classType); CreatePopupForm(); var originalSize = new Size(PopupForm.Size.Width, PopupForm.Size.Height); SetupSelectButtonGroupControl(); ISupportAsyncLoadingCollection viewer; int minHeight; int minWidth; IGenericGridFilterControl filterControlPanel; var control = this.GenerateSelectionInterface(lookupTypeClassDef, out viewer, out minHeight, out minWidth, out filterControlPanel); this.LoadSelectionCollection(viewer, classType); BorderLayoutManager manager = ControlFactory.CreateBorderLayoutManager(PopupForm); manager.AddControl(control, BorderLayoutManager.Position.Centre); manager.AddControl(SelectButtonGroupControl, BorderLayoutManager.Position.South); if (filterControlPanel != null) { manager.AddControl(filterControlPanel, BorderLayoutManager.Position.North); } this.PopupForm.Text = "Loading... Please wait..."; control.Dock = DockStyle.Fill; PopupForm.MinimumSize = new Size(minWidth + 250, minHeight + 100); PopupForm.Size = originalSize; if (this.PopupFormCreated != null) { this.PopupFormCreated(this.PopupForm, new EventArgs()); } }
/// <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 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"; }
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> /// 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> /// 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 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); } }