コード例 #1
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);
            }
コード例 #2
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";
        }
コード例 #3
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";
        }
コード例 #4
0
        ///<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);
            };
        }
コード例 #5
0
        public void Test_Visually_Advanced()
        {
            //---------------Set up test pack-------------------
            IControlFactory controlFactory = GetControlFactory();
            IGroupBox       groupBox       = controlFactory.CreateGroupBox("Test Layout");
            IPanel          panel          = controlFactory.CreatePanel();

            panel.Dock = DockStyle.Fill;
            groupBox.Controls.Add(panel);
            ColumnLayoutManager columnLayoutManager = new ColumnLayoutManager(panel, controlFactory)
            {
                ColumnCount = 1
            };
            int    controlNumber = 1;
            IPanel panel1        = CreateColoredPanel(controlFactory, controlNumber++ + ":");

            panel1.Controls.Clear();
            GridLayoutManager gridLayoutManager = new GridLayoutManager(panel1, controlFactory);

            gridLayoutManager.SetGridSize(4, 3);
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "a:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "b:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "c:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "d:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "e:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "f:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "g:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "h:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "i:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "j:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "k:"));
            gridLayoutManager.AddControl(CreateColoredPanel(controlFactory, "l:"));


            columnLayoutManager.AddControl(panel1);
            columnLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++ + ":"));
            IButtonGroupControl buttonGroupControl = controlFactory.CreateButtonGroupControl();

            buttonGroupControl.Dock = DockStyle.Top;
            groupBox.Controls.Add(buttonGroupControl);
            buttonGroupControl.AddButton("Add Control", (sender, e) => columnLayoutManager.AddControl(CreateColoredPanel(controlFactory, controlNumber++ + ":")));
            buttonGroupControl.AddButton("-Columns", (sender, e) =>
            {
                if (columnLayoutManager.ColumnCount > 1)
                {
                    columnLayoutManager.ColumnCount--;
                    columnLayoutManager.Refresh();
                }
            });
            buttonGroupControl.AddButton("+Columns", (sender, e) => { columnLayoutManager.ColumnCount++; columnLayoutManager.Refresh(); });
            IFormHabanero form = controlFactory.CreateOKCancelDialogFactory().CreateOKCancelForm(groupBox, "Test Column Layout Manager");

            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            form.ShowDialog();
            //---------------Test Result -----------------------
        }
コード例 #6
0
 private void SetupButtonGroupControl()
 {
     _buttonGroupControl   = _controlFactory.CreateButtonGroupControl();
     _cancelButton         = _buttonGroupControl.AddButton("Cancel", CancelButtonClicked);
     _saveButton           = _buttonGroupControl.AddButton("Save", SaveClickHandler);
     _deleteButton         = _buttonGroupControl.AddButton("Delete", DeleteButtonClicked);
     _newButton            = _buttonGroupControl.AddButton("New", NewButtonClicked);
     _cancelButton.Enabled = false;
     _deleteButton.Enabled = false;
     _newButton.Enabled    = false;
 }
コード例 #7
0
/*
 *      ///<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);
        }
コード例 #8
0
            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);
            }
コード例 #9
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);
            }
コード例 #10
0
        /// <summary>
        /// Constructs the <see cref="DefaultBOEditorFormVWG"/> class  with
        /// the specified <see cref="BusinessObject"/>, uiDefName and <see cref="IControlFactory"/>.
        /// </summary>
        /// <param name="bo">The business object to represent</param>
        /// <param name="uiDefName">The name of the ui def to use.</param>
        /// <param name="controlFactory">The <see cref="IControlFactory"/> to use for creating the Editor form controls</param>
        public DefaultBOEditorFormVWG(BusinessObject bo, string uiDefName, IControlFactory controlFactory)
        {
            _bo                 = bo;
            _controlFactory     = controlFactory;
            _uiDefName          = uiDefName;
            GroupControlCreator = _controlFactory.CreateTabControl;
            BOMapper mapper = new BOMapper(bo);

            IUIForm def;

            if (_uiDefName.Length > 0)
            {
                IUIDef uiMapper = mapper.GetUIDef(_uiDefName);
                if (uiMapper == null)
                {
                    throw new NullReferenceException("An error occurred while " +
                                                     "attempting to load an object editing form.  A possible " +
                                                     "cause is that the class definitions do not have a " +
                                                     "'form' section for the class, under the 'ui' " +
                                                     "with the name '" + _uiDefName + "'.");
                }
                def = uiMapper.UIForm;
            }
            else
            {
                IUIDef uiMapper = mapper.GetUIDef();
                if (uiMapper == null)
                {
                    throw new NullReferenceException("An error occurred while " +
                                                     "attempting to load an object editing form.  A possible " +
                                                     "cause is that the class definitions do not have a " +
                                                     "'form' section for the class.");
                }
                def = uiMapper.UIForm;
            }
            if (def == null)
            {
                throw new NullReferenceException("An error occurred while " +
                                                 "attempting to load an object editing form.  A possible " +
                                                 "cause is that the class definitions do not have a " +
                                                 "'form' section for the class.");
            }

            PanelBuilder panelBuilder = new PanelBuilder(_controlFactory);

            //_panelInfo = panelBuilder.BuildPanelForForm(_bo.ClassDef.UIDefCol["default"].UIForm);
            //_panelInfo = panelBuilder.BuildPanelForForm(_bo.ClassDef.UIDefCol[uiDefName].UIForm);
            _panelInfo = panelBuilder.BuildPanelForForm(def);

            _panelInfo.BusinessObject = _bo;
            _boPanel = _panelInfo.Panel;
            _buttons = _controlFactory.CreateButtonGroupControl();
            // These buttons used to be "&Cancel" and "&OK", but they are missing the "&" in win, so I took them out for VWG
            //  Soriya had originally removed them from Win in revision 2854, but I'm not sure of the reason other than
            //  externally, when fetching the button from the button control, it would be fetched using the text only.
            //  I would prefer to have the "&" in the control, but it may break existing code that uses the buttons on this form.
            //  Also, it seems that VWG does not do anything with the "&"
            _buttons.AddButton("Cancel", CancelButtonHandler);
            IButton okbutton = _buttons.AddButton("OK", OKButtonHandler);

            okbutton.TabStop = false;
            //okbutton.TabIndex = 3;
            //okbutton.TabStop = true;
            //cancelButton.TabIndex = 4;
            //cancelButton.TabStop = true;

            okbutton.NotifyDefault(true);
            this.AcceptButton = (ButtonVWG)okbutton;
            this.Load        += delegate { FocusOnFirstControl(); };
            this.Closing     += OnClosing;

            this.Text = def.Title;
            SetupFormSize(def);
            MinimizeBox = false;
            MaximizeBox = false;
            //this.ControlBox = false;
            this.StartPosition = FormStartPosition.CenterScreen;

            CreateLayout();
            OnResize(new EventArgs());
        }
コード例 #11
0
        /// <summary>
        /// Constructs the <see cref="DefaultBOEditorFormVWG"/> class  with 
        /// the specified <see cref="BusinessObject"/>, uiDefName and <see cref="IControlFactory"/>. 
        /// </summary>
        /// <param name="bo">The business object to represent</param>
        /// <param name="uiDefName">The name of the ui def to use.</param>
        /// <param name="controlFactory">The <see cref="IControlFactory"/> to use for creating the Editor form controls</param>
        public DefaultBOEditorFormVWG(BusinessObject bo, string uiDefName, IControlFactory controlFactory)
        {
            _bo = bo;
            _controlFactory = controlFactory;
            _uiDefName = uiDefName;
            GroupControlCreator = _controlFactory.CreateTabControl;
            BOMapper mapper = new BOMapper(bo);

            IUIForm def;
            if (_uiDefName.Length > 0)
            {
                IUIDef uiMapper = mapper.GetUIDef(_uiDefName);
                if (uiMapper == null)
                {
                    throw new NullReferenceException("An error occurred while " +
                                                     "attempting to load an object editing form.  A possible " +
                                                     "cause is that the class definitions do not have a " +
                                                     "'form' section for the class, under the 'ui' " +
                                                     "with the name '" + _uiDefName + "'.");
                }
                def = uiMapper.UIForm;
            }
            else
            {
                IUIDef uiMapper = mapper.GetUIDef();
                if (uiMapper == null)
                {
                    throw new NullReferenceException("An error occurred while " +
                                                     "attempting to load an object editing form.  A possible " +
                                                     "cause is that the class definitions do not have a " +
                                                     "'form' section for the class.");
                }
                def = uiMapper.UIForm;
            }
            if (def == null)
            {
                throw new NullReferenceException("An error occurred while " +
                                                 "attempting to load an object editing form.  A possible " +
                                                 "cause is that the class definitions do not have a " +
                                                 "'form' section for the class.");
            }

            PanelBuilder panelBuilder = new PanelBuilder(_controlFactory);
            //_panelInfo = panelBuilder.BuildPanelForForm(_bo.ClassDef.UIDefCol["default"].UIForm);
            //_panelInfo = panelBuilder.BuildPanelForForm(_bo.ClassDef.UIDefCol[uiDefName].UIForm);
            _panelInfo = panelBuilder.BuildPanelForForm(def);

            _panelInfo.BusinessObject = _bo;
            _boPanel = _panelInfo.Panel;
            _buttons = _controlFactory.CreateButtonGroupControl();
            // These buttons used to be "&Cancel" and "&OK", but they are missing the "&" in win, so I took them out for VWG
            //  Soriya had originally removed them from Win in revision 2854, but I'm not sure of the reason other than 
            //  externally, when fetching the button from the button control, it would be fetched using the text only.
            //  I would prefer to have the "&" in the control, but it may break existing code that uses the buttons on this form.
            //  Also, it seems that VWG does not do anything with the "&"
            _buttons.AddButton("Cancel", CancelButtonHandler);
            IButton okbutton = _buttons.AddButton("OK", OKButtonHandler);
            okbutton.TabStop = false;
            //okbutton.TabIndex = 3;
            //okbutton.TabStop = true;
            //cancelButton.TabIndex = 4;
            //cancelButton.TabStop = true;

            okbutton.NotifyDefault(true);
            this.AcceptButton = (ButtonVWG)okbutton;
            this.Load += delegate { FocusOnFirstControl(); };
            this.Closing += OnClosing;

            this.Text = def.Title;
            SetupFormSize(def);
            MinimizeBox = false;
            MaximizeBox = false;
            //this.ControlBox = false;
            this.StartPosition = FormStartPosition.CenterScreen;

            CreateLayout();
            OnResize(new EventArgs());
        }
コード例 #12
0
        /// <summary>
        /// Constructs the <see cref="DefaultBOEditorFormWin"/> class  with 
        /// the specified businessObject, uiDefName and post edit action. 
        /// </summary>
        /// <param name="bo">The business object to represent</param>
        /// <param name="uiDefName">The name of the ui def to use.</param>
        /// <param name="controlFactory">The <see cref="IControlFactory"/> to use for creating the Editor form controls</param>
        /// <param name="creator">The Creator used to Create the Group Control.</param>
        public DefaultBOEditorFormWin(BusinessObject bo, string uiDefName, IControlFactory controlFactory, GroupControlCreator creator)
        {
            _bo = bo;
            _controlFactory = controlFactory;
            GroupControlCreator = creator;
            _uiDefName = uiDefName;

            BOMapper mapper = new BOMapper(bo);

            IUIForm def;
            if (_uiDefName.Length > 0)
            {
                IUIDef uiMapper = mapper.GetUIDef(_uiDefName);
                if (uiMapper == null)
                {
                    throw new NullReferenceException("An error occurred while " +
                                                     "attempting to load an object editing form.  A possible " +
                                                     "cause is that the class definitions do not have a " +
                                                     "'form' section for the class, under the 'ui' " +
                                                     "with the name '" + _uiDefName + "'.");
                }
                def = uiMapper.UIForm;
            }
            else
            {
                IUIDef uiMapper = mapper.GetUIDef();
                if (uiMapper == null)
                {
                    throw new NullReferenceException("An error occurred while " +
                                                     "attempting to load an object editing form.  A possible " +
                                                     "cause is that the class definitions do not have a " +
                                                     "'form' section for the class.");
                }
                def = uiMapper.UIForm;
            }
            if (def == null)
            {
                throw new NullReferenceException("An error occurred while " +
                                                 "attempting to load an object editing form.  A possible " +
                                                 "cause is that the class definitions do not have a " +
                                                 "'form' section for the class.");
            }

            PanelBuilder panelBuilder = new PanelBuilder(_controlFactory);
            //_panelInfo = panelBuilder.BuildPanelForForm(_bo.ClassDef.UIDefCol["default"].UIForm);
            //_panelInfo = panelBuilder.BuildPanelForForm(_bo.ClassDef.UIDefCol[uiDefName].UIForm, this.GroupControlCreator);
            _panelInfo = panelBuilder.BuildPanelForForm(def, this.GroupControlCreator);

            _panelInfo.BusinessObject = _bo;
            _boPanel = _panelInfo.Panel;

            _buttons = _controlFactory.CreateButtonGroupControl();
            _buttons.AddButton("Cancel", CancelButtonHandler);
            IButton okbutton = _buttons.AddButton("OK", OkButtonHandler);

            okbutton.NotifyDefault(true);
            this.AcceptButton = (ButtonWin) okbutton;
            this.Load += delegate { FocusOnFirstControl(); };
            this.FormClosing += OnFormClosing;

            this.Text = def.Title;
            SetupFormSize(def);
            MinimizeBox = false;
            MaximizeBox = false;
            //this.ControlBox = false;
            this.StartPosition = FormStartPosition.CenterScreen;

            CreateLayout();
            OnResize(new EventArgs());
        }
コード例 #13
0
            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);
            }
コード例 #14
0
        /// <summary>
        /// Constructs the <see cref="DefaultBOEditorFormWin"/> class  with
        /// the specified businessObject, uiDefName and post edit action.
        /// </summary>
        /// <param name="bo">The business object to represent</param>
        /// <param name="uiDefName">The name of the ui def to use.</param>
        /// <param name="controlFactory">The <see cref="IControlFactory"/> to use for creating the Editor form controls</param>
        /// <param name="creator">The Creator used to Create the Group Control.</param>
        public DefaultBOEditorFormWin(BusinessObject bo, string uiDefName, IControlFactory controlFactory, GroupControlCreator creator)
        {
            _bo                 = bo;
            _controlFactory     = controlFactory;
            GroupControlCreator = creator;
            _uiDefName          = uiDefName;

            BOMapper mapper = new BOMapper(bo);

            IUIForm def;

            if (_uiDefName.Length > 0)
            {
                IUIDef uiMapper = mapper.GetUIDef(_uiDefName);
                if (uiMapper == null)
                {
                    throw new NullReferenceException("An error occurred while " +
                                                     "attempting to load an object editing form.  A possible " +
                                                     "cause is that the class definitions do not have a " +
                                                     "'form' section for the class, under the 'ui' " +
                                                     "with the name '" + _uiDefName + "'.");
                }
                def = uiMapper.UIForm;
            }
            else
            {
                IUIDef uiMapper = mapper.GetUIDef();
                if (uiMapper == null)
                {
                    throw new NullReferenceException("An error occurred while " +
                                                     "attempting to load an object editing form.  A possible " +
                                                     "cause is that the class definitions do not have a " +
                                                     "'form' section for the class.");
                }
                def = uiMapper.UIForm;
            }
            if (def == null)
            {
                throw new NullReferenceException("An error occurred while " +
                                                 "attempting to load an object editing form.  A possible " +
                                                 "cause is that the class definitions do not have a " +
                                                 "'form' section for the class.");
            }

            PanelBuilder panelBuilder = new PanelBuilder(_controlFactory);

            //_panelInfo = panelBuilder.BuildPanelForForm(_bo.ClassDef.UIDefCol["default"].UIForm);
            //_panelInfo = panelBuilder.BuildPanelForForm(_bo.ClassDef.UIDefCol[uiDefName].UIForm, this.GroupControlCreator);
            _panelInfo = panelBuilder.BuildPanelForForm(def, this.GroupControlCreator);

            _panelInfo.BusinessObject = _bo;
            _boPanel = _panelInfo.Panel;

            _buttons = _controlFactory.CreateButtonGroupControl();
            _buttons.AddButton("Cancel", CancelButtonHandler);
            IButton okbutton = _buttons.AddButton("OK", OkButtonHandler);

            okbutton.NotifyDefault(true);
            this.AcceptButton = (ButtonWin)okbutton;
            this.Load        += delegate { FocusOnFirstControl(); };
            this.FormClosing += OnFormClosing;

            this.Text = def.Title;
            SetupFormSize(def);
            MinimizeBox = false;
            MaximizeBox = false;
            //this.ControlBox = false;
            this.StartPosition = FormStartPosition.CenterScreen;

            CreateLayout();
            OnResize(new EventArgs());
        }
コード例 #15
0
/*
        ///<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);
        }