AddControl() public method

Add a control to the layout
public AddControl ( IControlHabanero control, Position pos, bool includeSplitter ) : IControlHabanero
control IControlHabanero The control to add
pos Position The position at which to add the control
includeSplitter bool True to include a splitter between the controls
return IControlHabanero
        /// <summary>
        /// Sets all the controls up in a layout manager. By default uses the border layout manager
        /// with the editor control centre and the buttons south.
        /// </summary>
        protected virtual void CreateLayout()
        {
            IPanel panel = _controlFactory.CreatePanel();
            BorderLayoutManager borderLayoutManager = new BorderLayoutManagerVWG(this, _controlFactory);

            borderLayoutManager.AddControl(panel, BorderLayoutManager.Position.Centre);
            panel.Controls.Add(BoPanel);
            borderLayoutManager.AddControl(Buttons, BorderLayoutManager.Position.South);
        }
            /// <summary>
            /// Sets up the panel that shows the error details
            /// </summary>
            private void SetFullDetailsPanel()
            {
                _fullDetailPanel                = new PanelVWG();
                _fullDetailPanel.Text           = "Error Detail";
                _fullDetailPanel.Height         = FULL_DETAIL_HEIGHT;
                _fullDetailPanel.Visible        = false;
                _errorDetails                   = new TextBoxVWG();
                _errorDetails.Text              = ExceptionUtilities.GetExceptionString(_exception, 0, false);
                _errorDetails.Multiline         = true;
                _errorDetails.ScrollBars        = Gizmox.WebGUI.Forms.ScrollBars.Both;
                _showStackTrace                 = new CheckBoxVWG();
                _showStackTrace.Text            = "&Show stack trace";
                _showStackTrace.CheckedChanged += ShowStackTraceClicked;
                BorderLayoutManager detailsManager = new BorderLayoutManagerVWG(_fullDetailPanel, GlobalUIRegistry.ControlFactory);

                detailsManager.AddControl(_errorDetails, BorderLayoutManager.Position.Centre);
                detailsManager.AddControl(_showStackTrace, BorderLayoutManager.Position.South);
            }
            /// <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;
            }
        /// <summary>
        /// Initialises the WizardControl with the IWizardController.  No logic is performed other than storing the wizard controller.
        /// </summary>
        /// <param name="wizardController"></param>
        /// <param name="controlFactory">The control factory that this control will use to create a button</param>
        public WizardControlVWG(IWizardController wizardController, IControlFactory controlFactory)
        {
            if (wizardController == null)
            {
                throw new ArgumentNullException("wizardController");
            }
            if (controlFactory == null)
            {
                throw new ArgumentNullException("controlFactory");
            }
            _wizardController = wizardController;
            _controlFactory   = controlFactory;

            _wizardControlManager = new WizardControlManager(this);
            IPanel buttonPanel = CreateButtonPanel();

            _wizardStepPanel = _controlFactory.CreatePanel();

            BorderLayoutManagerVWG borderLayoutManager = new BorderLayoutManagerVWG(this, _controlFactory);

            borderLayoutManager.AddControl(_wizardStepPanel, BorderLayoutManager.Position.Centre);
            borderLayoutManager.AddControl(buttonPanel, BorderLayoutManager.Position.South);
        }
Example #5
0
        ///<summary>
        /// Constructs a new instance of a <see cref="ReadOnlyGridControlVWG"/>.
        ///</summary>
        ///<param name="controlFactory">The <see cref="IControlFactory"/> to use to construct the control.</param>
        public ReadOnlyGridControlVWG(IControlFactory controlFactory)
        {
            _controlFactory             = controlFactory;
            _grid                       = new ReadOnlyGridVWG();
            _readOnlyGridControlManager = new ReadOnlyGridControlManager(this, _controlFactory);
            FilterControl               = _controlFactory.CreateFilterControl();
            _buttons                    = _controlFactory.CreateReadOnlyGridButtonsControl();
            InitialiseButtons();
            InitialiseFilterControl();
            BorderLayoutManager borderLayoutManager = new BorderLayoutManagerVWG(this, _controlFactory);

            borderLayoutManager.AddControl(_grid, BorderLayoutManager.Position.Centre);
            borderLayoutManager.AddControl(_buttons, BorderLayoutManager.Position.South);
            borderLayoutManager.AddControl(FilterControl, BorderLayoutManager.Position.North);
            FilterMode = FilterModes.Filter;
            _grid.Name = "GridControl";
            this.Grid.BusinessObjectSelected += Grid_OnBusinessObjectSelected;
            this.Buttons["Add"].Visible       = _allowUsersToAddBo;
            this.Buttons["Edit"].Visible      = _allowUsersToEditBo;
            this.BusinessObjectSelected      += (s, e) =>
            {
                this.SetButtonStatesForSelectedObject();
            };
        }
 /// <summary>
 /// Sets all the controls up in a layout manager. By default uses the border layout manager
 /// with the editor control centre and the buttons south.
 /// </summary>
 protected virtual void CreateLayout()
 {
     IPanel panel = _controlFactory.CreatePanel();
     BorderLayoutManager borderLayoutManager = new BorderLayoutManagerVWG(this, _controlFactory);
     borderLayoutManager.AddControl(panel, BorderLayoutManager.Position.Centre);
     panel.Controls.Add(BoPanel);
     borderLayoutManager.AddControl(Buttons, BorderLayoutManager.Position.South);
 }
        /// <summary>
        /// Initialises the WizardControl with the IWizardController.  No logic is performed other than storing the wizard controller.
        /// </summary>
        /// <param name="wizardController"></param>
        /// <param name="controlFactory">The control factory that this control will use to create a button</param>
        public WizardControlVWG(IWizardController wizardController, IControlFactory controlFactory)
        {
            if (wizardController == null) throw new ArgumentNullException("wizardController");
            if (controlFactory == null) throw new ArgumentNullException("controlFactory");
            _wizardController = wizardController;
            _controlFactory = controlFactory;

            _wizardControlManager = new WizardControlManager(this);
            IPanel buttonPanel = CreateButtonPanel();

            _wizardStepPanel = _controlFactory.CreatePanel();

            BorderLayoutManagerVWG borderLayoutManager = new BorderLayoutManagerVWG(this, _controlFactory);
            borderLayoutManager.AddControl(_wizardStepPanel, BorderLayoutManager.Position.Centre);
            borderLayoutManager.AddControl(buttonPanel, BorderLayoutManager.Position.South);
        }
            /// <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;
            }
 /// <summary>
 /// Sets up the panel that shows the error details
 /// </summary>
 private void SetFullDetailsPanel()
 {
     _fullDetailPanel = new PanelVWG();
     _fullDetailPanel.Text = "Error Detail";
     _fullDetailPanel.Height = FULL_DETAIL_HEIGHT;
     _fullDetailPanel.Visible = false;
     _errorDetails = new TextBoxVWG();
     _errorDetails.Text = ExceptionUtilities.GetExceptionString(_exception, 0, false);
     _errorDetails.Multiline = true;
     _errorDetails.ScrollBars = Gizmox.WebGUI.Forms.ScrollBars.Both;
     _showStackTrace = new CheckBoxVWG();
     _showStackTrace.Text = "&Show stack trace";
     _showStackTrace.CheckedChanged += ShowStackTraceClicked;
     BorderLayoutManager detailsManager = new BorderLayoutManagerVWG(_fullDetailPanel, GlobalUIRegistry.ControlFactory);
     detailsManager.AddControl(_errorDetails, BorderLayoutManager.Position.Centre);
     detailsManager.AddControl(_showStackTrace, BorderLayoutManager.Position.South);
 }