/// <summary>
 /// Constructor to initialise a new grid layout
 /// </summary>
 /// <param name="managedControl">The control to manage</param>
 /// <param name="controlFactory">The control factory used to create any controls</param>
 public GridLayoutManager(IControlHabanero managedControl, IControlFactory controlFactory)
     : base(managedControl, controlFactory)
 {
     _controls = new List<IControlHabanero>();
     _controlInfoTable = new Hashtable();
     this.SetGridSize(2, 2);
 }
 private static Form AddControlToForm(IControlHabanero parentControl)
 {
     Form frm = new Form();
     frm.Controls.Clear();
     frm.Controls.Add((Control)parentControl);
     return frm;
 }
Exemplo n.º 3
0
 private void SetManagedControl(IControlHabanero managedControl)
 {
     _managedControl = managedControl;
     if (managedControl == null)
         return;
     _managedControl.Resize += this.ManagedControlResizeHandler;
 }
 ///<summary>
 /// Constructor form <see cref="ListComboBoxMapper"/>
 ///</summary>
 ///<param name="ctl"></param>
 ///<param name="propName"></param>
 ///<param name="isReadOnly"></param>
 ///<param name="factory"></param>
 public ListComboBoxMapper(IControlHabanero ctl, string propName, bool isReadOnly, IControlFactory factory)
     : base(ctl, propName, isReadOnly, factory)
 {
     _comboBox = (IComboBox)ctl;
     _mapperStrategy = factory.CreateListComboBoxMapperStrategy();
     _mapperStrategy.AddItemSelectedEventHandler(this);
 }
 public void SetupLayoutManager()
 {
     managedControl = GetControlFactory().CreateControl();
     managedControl.Width = 100;
     managedControl.Height = 100;
     _ManagerStub = new LayoutManagerStub(managedControl);
 }
        /// <summary>
        /// Add a control to the layout
        /// </summary>
        /// <param name="control">The control to add</param>
        /// /// <param name="pos">The position at which to add the control</param>
        /// <param name="includeSplitter">True to include a splitter between the controls</param>
        /// <returns>Returns the control added</returns>
        public override IControlHabanero AddControl(IControlHabanero control, Position pos, bool includeSplitter)
        {
            SetupDockOfControl(control, pos);
            _controls[(int)pos] = control;
            _splitters[(int)pos] = includeSplitter;
            this.ManagedControl.Controls.Clear();
            //this.ManagedControl.Width = 100;
            //this.ManagedControl.Height = 100;
            for (int i = 0; i < _controls.Length; i++)
            {
                IControlHabanero habaneroControl = _controls[i];
                if (habaneroControl != null)
                {
                    if (_splitters[i])
                    {
                        ISplitter splt = _controlFactory.CreateSplitter();
                        Color newBackColor =
                            Color.FromArgb(Math.Min(splt.BackColor.R - 30, 255), Math.Min(splt.BackColor.G - 30, 255),
                                           Math.Min(splt.BackColor.B - 30, 255));
                        splt.BackColor = newBackColor;

                        if (_controls[i].Dock != Base.DockStyle.Fill)
                            splt.Dock = _controls[i].Dock;
                        ManagedControl.Controls.Add(splt);
                    }
                    this.ManagedControl.Controls.Add(habaneroControl);
                }
            }

            return control;
        }
 /// <summary>
 /// Constructor to initialise a new manager
 /// </summary>
 /// <param name="managedControl">The control to manage e.g. a Panel</param>
 /// <param name="controlFactory">The factory which generates controls</param>
 public FlowLayoutManager(IControlHabanero managedControl, IControlFactory controlFactory)
     : base(managedControl, controlFactory)
 {
     _controls = new List<IControlHabanero>();
     _newLinePositions = new ArrayList(3);
     _gluePositions = new ArrayList(5);
 }
 protected override void AddControlToForm(IControlHabanero control, int formHeight)
 {
     Gizmox.WebGUI.Forms.Form frm = new Gizmox.WebGUI.Forms.Form();
     frm.Controls.Add((Gizmox.WebGUI.Forms.Control)control);
     frm.Height = formHeight;
     frm.Visible = true;
 }
        protected override IFormHabanero AddControlToForm(IControlHabanero cntrl)
        {
            FormVWG form = (FormVWG)GetControlFactory().CreateForm();
            Form formVWG = form;
            formVWG.Controls.Add((Control)cntrl);

            return GetControlledLifetimeFor(form);
        }
Exemplo n.º 10
0
 /// <summary>
 /// Constructor to initialise a new instance of the class
 /// </summary>
 /// <param name="panel">The panel control being managed</param>
 /// <param name="mappers">The control mappers collection</param>
 /// <param name="uiDefName">The UI definition name to use</param>
 /// <param name="firstControlToFocus">The first control to focus on</param>
 public PanelFactoryInfo(IPanel panel, IControlMapperCollection mappers, string uiDefName, IControlHabanero firstControlToFocus)
 {
     _panel = panel;
     _mappers = mappers;
     _firstControlToFocus = firstControlToFocus;
     _uiDefName = uiDefName;
     _formGrids = new Dictionary<string, IEditableGridControl>();
 }
Exemplo n.º 11
0
 protected override void AssertControlDockedInForm(IControlHabanero control, IFormHabanero form)
 {
     Assert.AreEqual(1, form.Controls.Count, "No container control found in form");
     IControlHabanero contentControl = form.Controls[0];
     Assert.AreEqual(1, contentControl.Controls.Count);
     Assert.AreSame(control, contentControl.Controls[0]);
     Assert.AreEqual(DockStyle.Fill, control.Dock);
 }
 protected override void AddControlToForm(IControlHabanero control, int formHeight)
 {
     System.Windows.Forms.Form frmLocal = new System.Windows.Forms.Form();
     DisposeOnTearDown(frmLocal);
     frmLocal.Controls.Add((System.Windows.Forms.Control)control);
     frmLocal.Height = formHeight;
     frmLocal.Visible = true;
 }
        //protected override IGridBase CreateGridBaseStub()
        //{
        //    GridBaseWinStub gridBase = new GridBaseWinStub();
        //    System.Windows.Forms.Form frm = new System.Windows.Forms.Form();
        //    frm.Controls.Add(gridBase);
        //    return gridBase;
        //}

        //private static System.Windows.Forms.DataGridViewCell GetCell(int rowIndex, string propName,
        //                                                             IGridBase gridBase)
        //{
        //    System.Windows.Forms.DataGridView dgv = (System.Windows.Forms.DataGridView) gridBase;
        //    System.Windows.Forms.DataGridViewRow row = dgv.Rows[rowIndex];
        //    return row.Cells[propName];
        //}

        //protected override void AddControlToForm(IGridBase gridBase)
        //{
        //    throw new NotImplementedException();
        //}
        protected override IFormHabanero AddControlToForm(IControlHabanero cntrl)
        {
            //System.Windows.Forms.Form frm = new System.Windows.Forms.Form();
            //frm.Controls.Add((System.Windows.Forms.Control)cntrl);

            IFormHabanero frm = GetControlFactory().CreateForm();
            frm.Controls.Add(cntrl);
            return frm;
        }
Exemplo n.º 14
0
 /// <summary>
 /// Adds a control to the layout
 /// </summary>
 /// <param name="control">The control to add</param>
 /// <returns>Returns the control once it has been added</returns>
 public override IControlHabanero AddControl(IControlHabanero control)
 {
     _controls.Add(control);
     RefreshControlPositions();
     control.VisibleChanged += ControlVisibleChangedHandler;
     control.Resize += ControlResizedHandler;
     this.ManagedControl.Controls.Add(control);
     return control;
 }
 /// <summary>
 /// Handles the default key press behaviours on a control.
 /// This is typically used to change the handling of the enter key (such as having
 /// the enter key cause focus to move to the next control).
 /// </summary>
 /// <param name="control">The control whose events will be handled</param>
 public void AddKeyPressEventHandler(IControlHabanero control)
 {
     if (control == null) throw new ArgumentNullException("control");
     _control = control.GetControl();
     if (_control == null) return;
     _control.KeyUp += CtlKeyUpHandler;
     _control.KeyDown += CtlKeyDownHandler;
     _control.KeyPress += CtlKeyPressHandler;
 }
 /// <summary>
 /// Creates a panel containing OK and Cancel buttons
 /// </summary>
 /// <param name="nestedControl">The control to place above the buttons</param>
 /// <returns>Returns the created panel</returns>
 public IOKCancelPanel CreateOKCancelPanel(IControlHabanero nestedControl)
 {
     OKCancelPanelVWG mainPanel = new OKCancelPanelVWG(_controlFactory);
     mainPanel.Width = nestedControl.Width;
     mainPanel.Height = nestedControl.Height + mainPanel.ButtonGroupControl.Height;
     mainPanel.ContentPanel.Controls.Add(nestedControl);
     nestedControl.Dock = DockStyle.Fill;
     return mainPanel;
 }
 private void SetupControlAndGridLayout()
 {
     _ctl = GetControlFactory().CreateControl();
     _ctl.Width = 74;
     _ctl.Height = 72;
     _manager = new GridLayoutManager(_ctl, GetControlFactory());
     _manager.SetGridSize(2, 3);
     _manager.HorizontalGapSize = 2;
     _manager.VerticalGapSize = 2;
 }
 /// <summary>
 /// Determines a unique name for the control within the context of the controls that already exist in the <paramref name="containerControl"/>.
 /// </summary>
 /// <param name="containerControl">The control within which the supplied <paramref name="name"/> should be unique.</param>
 /// <param name="name">The name to be altered for uniqueness.</param>
 /// <returns>A unique name.</returns>
 public string GetUniqueControlNameWithin(IControlHabanero containerControl, string name)
 {
     var uniqueName = name;
     var index = 0;
     if (containerControl == null) return uniqueName;
     var siblingControls = containerControl.Controls.OfType<IControlHabanero>().ToList();
     while (siblingControls.Any(ctl => ctl.Name == uniqueName))
     {
         index++;
         uniqueName = string.Format("{0}_{1}", name, index);
     }
     return uniqueName;
 }
 /// <summary>
 /// Add a control to the layout
 /// </summary>
 /// <param name="control">The control to add</param>
 /// /// <param name="pos">The position at which to add the control</param>
 /// <param name="includeSplitter">True to include a splitter between the controls</param>
 /// <returns>Returns the control added</returns>
 public override IControlHabanero AddControl(IControlHabanero control, Position pos, bool includeSplitter)
 {
     SetupDockOfControl(control, pos);
     _controls[(int) pos] = control;
     this.ManagedControl.Controls.Clear();
     foreach (IControlHabanero controlHabanero in _controls)
     {
         if (controlHabanero != null)
         {
             this.ManagedControl.Controls.Add(controlHabanero);
         }
     }
     return control;
 }
 /// <summary>
 /// Creates a form containing OK and Cancel buttons
 /// </summary>
 /// <param name="nestedControl">The control to place above the buttons</param>
 /// <param name="formTitle">The title shown on the form</param>
 /// <returns>Returns the created form</returns>
 public IFormHabanero CreateOKCancelForm(IControlHabanero nestedControl, string formTitle)
 {
     IOKCancelPanel mainPanel = CreateOKCancelPanel(nestedControl);
     IFormHabanero form = _controlFactory.CreateForm();
     form.Text = formTitle;
     form.ClientSize = mainPanel.Size;
     mainPanel.Dock = DockStyle.Fill;
     form.Controls.Add(mainPanel);
     mainPanel.OKButton.Click += delegate
     {
         OkButton_ClickHandler(form);
     };
     mainPanel.CancelButton.Click += delegate
     {
         CancelButton_ClickHandler(form);
     };
     return form;
 }
Exemplo n.º 21
0
 /// <summary>
 /// Constructor to initialise a new layout manager
 /// </summary>
 /// <param name="managedControl">The control to manage</param>
 /// <param name="controlFactory">control factory used to create any child controls</param>
 protected LayoutManager(IControlHabanero managedControl, IControlFactory controlFactory)
 {
     if (managedControl == null)
     {
         throw new LayoutManagerException("You cannot initialise the layout manager with a null control");
     }
     if (managedControl.Controls == null)
     {
         throw new LayoutManagerException("You cannot initialise the layout manager with a control that has a null controls collection");
     }
     if (managedControl.Controls.Count > 0)
     {
         throw new LayoutManagerException("You cannot initialise the layout manager with a control that already contains controls");
     }
     this.ObserveGlobalUIHints();
     _controlFactory = controlFactory;
     SetManagedControl(managedControl);
 }
Exemplo n.º 22
0
 protected override void AssertControlDockedInForm(IControlHabanero control, IFormHabanero form)
 {
     System.Windows.Forms.Form winForm = (System.Windows.Forms.Form)form;
     Assert.LessOrEqual(1, winForm.MdiChildren.Length);
     bool found = false;
     foreach (System.Windows.Forms.Form childForm in winForm.MdiChildren)
     {
         Assert.AreEqual(1, childForm.Controls.Count);
         System.Windows.Forms.Control childFormControl = childForm.Controls[0];
         if (childFormControl == control)
         {
             found = true;
             //Assert.AreSame(childForm, winForm.ActiveMdiChild,
             //               "Control found in MDI children, but not the current docked form");
             break;
         }
     }
     Assert.IsTrue(found, "Form was not found");
 }
        /// <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;
        }
 /// <summary>
 /// Sets how the specified control is docked within its parent
 /// </summary>
 protected override void SetupDockOfControl(IControlHabanero control, Position pos)
 {
     Control ctl = (Control) control;
     switch (pos)
     {
         case Position.Centre:
             ctl.Dock = DockStyle.Fill;
             break;
         case Position.North:
             ctl.Dock = DockStyle.Top;
             break;
         case Position.South:
             ctl.Dock = DockStyle.Bottom;
             break;
         case Position.East:
             ctl.Dock = DockStyle.Right;
             break;
         case Position.West:
             ctl.Dock = DockStyle.Left;
             break;
     }
 }
        /// <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 IControlHabanero AddControl(IControlHabanero contentControl, string headingText, int minimumControlHeight, int minimumControlWidth)
        {
            return _controlManager.AddControl(contentControl, headingText, minimumControlHeight, 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);
//            }
//            IGroupBox groupBox = factory.CreateGroupBox(headingText);
//            groupBox.Width = minimumControlWidth + 20;
//            groupBox.Height = minimumControlHeight + 20;
//            BorderLayoutManager layoutManager = factory.CreateBorderLayoutManager(groupBox);
//            layoutManager.BorderSize = 10;
//            layoutManager.AddControl(contentControl);
//
//            ColumnLayoutManager columnLayoutManager = new ColumnLayoutManager(this, factory);
//            this.Width = groupBox.Width + columnLayoutManager.BorderSize*2;
//            this.Height = groupBox.Height + columnLayoutManager.BorderSize*2;
//            columnLayoutManager.AddControl(groupBox);
//            return groupBox;
        }
Exemplo n.º 26
0
 /// <summary>
 /// Retrieves the ToolTip text associated with the specified control
 /// </summary>
 /// <param name="controlHabanero">The Control for which to retrieve the ToolTip text</param>
 public string GetToolTip(IControlHabanero controlHabanero)
 {
     return(base.GetToolTip(controlHabanero.GetControl()));
 }
Exemplo n.º 27
0
//        /// <summary>
//        /// Gets the collection of tab pages in this tab control
//        /// </summary>
//        IControlCollection IGroupControl.ChildControls
//        {
//            get { return ; }
//        }

//        /// <summary>
//        /// Gets or sets the index of the currently selected ChildControl
//        /// </summary>
//        int IGroupControl.SelectedIndex
//        {
//            get { throw new System.NotImplementedException(); }
//            set { throw new System.NotImplementedException(); }
//        }
//
//        /// <summary>
//        /// Gets or sets the currently selected tab page
//        /// </summary>
//        IControlHabanero IGroupControl.SelectedChildControl
//        {
//            get { throw new System.NotImplementedException(); }
//            set { throw new System.NotImplementedException(); }
//        }

        /// <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 control can be.</param>
        /// <returns></returns>
        IControlHabanero IGroupControl.AddControl
            (IControlHabanero contentControl, string headingText, int minimumControlHeight, int minimumControlWidth)
        {
            return(AddControl(contentControl, headingText, minimumControlHeight));
        }
Exemplo n.º 28
0
 protected override void AddControlToForm(IControlHabanero cntrl)
 {
 }
Exemplo n.º 29
0
 /// <summary>
 /// Insert a control at a specified index position
 /// </summary>
 /// <param name="index">The index position at which to insert</param>
 /// <param name="value">The control to insert</param>
 public void Insert(int index, IControlHabanero value)
 {
     _col.Insert(index, value);
 }
Exemplo n.º 30
0
 /// <summary>
 /// Adds a control to the collection
 /// </summary>
 /// <param name="value">The control to add</param>
 /// <returns>Returns the position at which the control was added</returns>
 public void Add(IControlHabanero value)
 {
     _col.Add((Control)value);
 }
Exemplo n.º 31
0
 protected override void AddControlToForm(IControlHabanero cntrl)
 {
     System.Windows.Forms.Form frm = new System.Windows.Forms.Form();
     frm.Controls.Add((System.Windows.Forms.Control)cntrl);
 }
Exemplo n.º 32
0
 /// <summary>
 /// Provides the index position of the control specified
 /// </summary>
 /// <param name="value">The control to search for</param>
 /// <returns>Returns the index position if found, or -1</returns>
 public int IndexOf(IControlHabanero value)
 {
     return(_col.IndexOf(value.GetControl()));
 }
Exemplo n.º 33
0
 ///<summary>
 ///  Constrcutor for <see cref="HabaneroMenu"/>
 ///</summary>
 ///<param name="menuName"></param>
 ///<param name="form"></param>
 ///<param name="controlFactory"></param>
 public HabaneroMenu(string menuName, IControlHabanero form, IControlFactory controlFactory)
 {
     _name = menuName;
     _form = form;
     _controlFactory = controlFactory;
 }
Exemplo n.º 34
0
 /// <summary>
 /// Constructor for an <see cref="Item"/>
 /// </summary>
 /// <param name="parentMenu"></param>
 /// <param name="name"></param>
 /// <param name="form"></param>
 /// <param name="controlFactory"></param>
 public Item(HabaneroMenu parentMenu, string name, IControlHabanero form, IControlFactory controlFactory)
 {
     _parentMenu = parentMenu;
     _name = name;
     _controlFactory = controlFactory;
     _form = form;
 }
Exemplo n.º 35
0
 /// <summary>
 /// Insert a control at a specified index position
 /// </summary>
 /// <param name="index">The index position at which to insert</param>
 /// <param name="value">The control to insert</param>
 public void Insert(int index, IControlHabanero value)
 {
     throw new NotImplementedException("This is not supported for windows");
     //_col.Insert(index, value);
 }
 public ListComboBoxMapperStub(IControlHabanero ctl) : base(ctl, "PropName", false, new ControlFactoryWin())
 {
 }
Exemplo n.º 37
0
 /// <summary>
 /// Constructor to initialise a new layout manager
 /// </summary>
 /// <param name="managedControl">The control to manage</param>
 /// <param name="controlFactory">The control factory used by the layout manager to create controls</param>
 public ColumnLayoutManager(IControlHabanero managedControl, IControlFactory controlFactory)
     : base(managedControl, controlFactory)
 {
     _columnCount = 1;
 }
Exemplo n.º 38
0
 public override IControlHabanero AddControl(IControlHabanero control)
 {
     throw new System.NotImplementedException();
 }
#pragma warning disable 168
        public SimpleFilterStub
            (IControlFactory controlFactory, string propertyName, FilterClauseOperator filterClauseOperator)
#pragma warning restore 168
        {
            _textBox = controlFactory.CreateTextBox();
        }
 /// <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 IControlHabanero AddControl(IControlHabanero contentControl, string headingText, int minimumControlHeight, int minimumControlWidth)
 {
     return(_controlManager.AddControl(contentControl, headingText, minimumControlHeight, minimumControlWidth));
 }
Exemplo n.º 41
0
 /// <summary>
 /// Indicates whether the collection contains the specified control
 /// </summary>
 /// <param name="value">The control to search for</param>
 /// <returns>Returns a boolean indicating whether that control is
 /// found in the collection</returns>
 public bool Contains(IControlHabanero value)
 {
     return(_col.Contains((Control)value));
 }
 protected override void AddControlToForm(IControlHabanero cntrl)
 {
     Gizmox.WebGUI.Forms.Form frm = new Gizmox.WebGUI.Forms.Form();
     frm.Controls.Add((Gizmox.WebGUI.Forms.Control)cntrl);
 }
Exemplo n.º 43
0
 /// <summary>
 /// Provides the index position of the control specified
 /// </summary>
 /// <param name="value">The control to search for</param>
 /// <returns>Returns the index position if found, or -1</returns>
 public int IndexOf(IControlHabanero value)
 {
     return(_col.IndexOf((Control)value));
 }
Exemplo n.º 44
0
 /// <summary>
 /// Creates a new control mapper of a specified type.  If no 'mapperTypeName'
 /// has been specified, an appropriate mapper for standard controls will
 /// be assigned, depending on the type of control.
 /// </summary>
 /// <param name="propertyName">The property name</param>
 /// <param name="ctl">The control to be mapped</param>
 /// <returns>Returns a new object which is a subclass of ControlMapper</returns>
 /// <exception cref="UnknownTypeNameException">An exception is
 /// thrown if the mapperTypeName does not provide a type that is
 /// a subclass of the ControlMapper class.</exception>
 public static IControlMapper Create
     (IControlHabanero ctl, string propertyName)
 {
     return(Create("", "", ctl, propertyName, false, GlobalUIRegistry.ControlFactory));
 }
Exemplo n.º 45
0
 /// <summary>
 /// Removes the specified control from the collection
 /// </summary>
 /// <param name="value">The control to remove</param>
 public void Remove(IControlHabanero value)
 {
     _col.Remove((Control)value);
 }
Exemplo n.º 46
0
        /// <summary>
        /// Creates a new control mapper of a specified type.  If no 'mapperTypeName'
        /// has been specified, an appropriate mapper for standard controls will
        /// be assigned, depending on the type of control.
        /// </summary>
        /// <param name="mapperTypeName">The class name of the mapper type
        /// (e.g. ComboBoxMapper).  The current namespace of this
        /// ControlMapper class will then be prefixed to the name.</param>
        /// <param name="mapperAssembly">The assembly where the mapper is
        /// located</param>
        /// <param name="ctl">The control to be mapped</param>
        /// <param name="propertyName">The property name</param>
        /// <param name="isReadOnly">Whether the control is read-only</param>
        /// <returns>Returns a new object which is a subclass of ControlMapper</returns>
        /// <exception cref="UnknownTypeNameException">An exception is
        /// thrown if the mapperTypeName does not provide a type that is
        /// a subclass of the ControlMapper class.</exception>
        /// <param name="controlFactory">The control factory</param>
        public static IControlMapper Create
            (string mapperTypeName, string mapperAssembly, IControlHabanero ctl,
            string propertyName, bool isReadOnly,
            IControlFactory controlFactory)
        {
            if (string.IsNullOrEmpty(mapperTypeName))
            {
                mapperTypeName = "TextBoxMapper";
            }

            if (mapperTypeName == "TextBoxMapper" && !(ctl is ITextBox))
            {
                if (ctl is IComboBox)
                {
                    mapperTypeName = "LookupComboBoxMapper";
                }
                else if (ctl is ICheckBox)
                {
                    mapperTypeName = "CheckBoxMapper";
                }
                else if (ctl is IDateTimePicker)
                {
                    mapperTypeName = "DateTimePickerMapper";
                }
                else if (ctl is INumericUpDown)
                {
                    mapperTypeName = "NumericUpDownIntegerMapper";
                }
                else if (ctl is IExtendedComboBox)
                {
                    mapperTypeName = "ExtendedComboBoxMapper";
                }
                else if (ctl is IExtendedTextBox)
                {
                    mapperTypeName = "ExtendedTextBox";
                }
                else
                {
                    throw new InvalidXmlDefinitionException
                              (String.Format
                                  ("No suitable 'mapperType' has been provided in the class "
                                  + "definitions for the form control '{0}'.  Either add the "
                                  + "'mapperType' attribute or check that spelling and "
                                  + "capitalisation are correct.",
                                  ctl.Name));
                }
            }

            Type mapperType;

            if (String.IsNullOrEmpty(mapperAssembly))
            {
                string nspace = typeof(ControlMapper).Namespace;
                mapperType = Type.GetType(nspace + "." + mapperTypeName);
            }
            else
            {
                mapperType = TypeLoader.LoadType(mapperAssembly, mapperTypeName);
            }

            IControlMapper controlMapper = Create(mapperType, ctl, propertyName, isReadOnly, controlFactory);

            return(controlMapper);
        }
Exemplo n.º 47
0
 public LayoutManagerStub(IControlHabanero managedControl) : base(managedControl, null)
 {
 }
 ///<summary>
 /// Constructs the <see cref="BorderLayoutManager"/>
 ///</summary>
 ///<param name="managedControl"></param>
 ///<param name="controlFactory"></param>
 public BorderLayoutManagerVWG(IControlHabanero managedControl, IControlFactory controlFactory)
     : base(managedControl, controlFactory)
 {
     _controls  = new IControlHabanero[5];
     _splitters = new bool[5];
 }
Exemplo n.º 49
0
 /// <summary>
 /// Add a control to the layout
 /// </summary>
 /// <param name="control">The control to add</param>
 /// <returns>Returns the control added</returns>
 public abstract IControlHabanero AddControl(IControlHabanero control);
Exemplo n.º 50
0
 /// <summary>
 /// Associates ToolTip text with the specified control
 /// </summary>
 /// <param name="controlHabanero">The Control to associate the ToolTip text with</param>
 /// <param name="toolTipText">The ToolTip text to display when the pointer is on the control</param>
 public void SetToolTip(IControlHabanero controlHabanero, string toolTipText)
 {
     base.SetToolTip(controlHabanero.GetControl(), toolTipText);
 }
Exemplo n.º 51
0
 /// <summary>
 /// Constructor to initialise a new instance of the class
 /// </summary>
 /// <param name="panel">The panel control being managed</param>
 /// <param name="mappers">The control mappers collection</param>
 /// <param name="uiDefName">The UI definition name to use</param>
 /// <param name="firstControlToFocus">The first control to focus on</param>
 public PanelFactoryInfo(IPanel panel, IControlMapperCollection mappers, string uiDefName, IControlHabanero firstControlToFocus)
 {
     _panel               = panel;
     _mappers             = mappers;
     _firstControlToFocus = firstControlToFocus;
     _uiDefName           = uiDefName;
     _formGrids           = new Dictionary <string, IEditableGridControl>();
 }
Exemplo n.º 52
0
 /// <summary>
 /// Adds a control to the collection
 /// </summary>
 /// <param name="value">The control to add</param>
 /// <returns>Returns the position at which the control was added</returns>
 public void Add(IControlHabanero value)
 {
     _col.Add(value.GetControl());
 }
Exemplo n.º 53
0
        private IFormHabanero CreateForm()
        {
            IControlHabanero control = CreateControl();

            return((IFormHabanero)control);
        }
Exemplo n.º 54
0
        /// <summary>
        /// Creates a panel with the controls and dimensions as prescribed
        /// </summary>
        /// <param name="uiFormTab">The UIFormTab object</param>
        /// <returns>Returns the object containing the new panel</returns>
        private IPanelFactoryInfo CreateOnePanel(IUIFormTab uiFormTab)
        {
            if (uiFormTab.UIFormGrid != null)
            {
                return(CreatePanelWithGrid(uiFormTab.UIFormGrid));
            }
            IPanel            panel   = _controlFactory.CreatePanel(_controlFactory);
            IToolTip          toolTip = _controlFactory.CreateToolTip();
            GridLayoutManager manager = new GridLayoutManager(panel, _controlFactory);
            int rowCount = 0;
            int colCount = 0;

            colCount += uiFormTab.Count;
            foreach (UIFormColumn uiFormColumn in uiFormTab)
            {
                if (uiFormColumn.Count > rowCount)
                {
                    rowCount = uiFormColumn.Count;
                }
            }
            const int intNoOfLayoutGridColumnsPerPanel = 3;

            manager.SetGridSize(rowCount, colCount * intNoOfLayoutGridColumnsPerPanel);
            for (int col = 0; col < colCount; col++)
            {
                //Fixing the labels column widths
                manager.FixColumnBasedOnContents(col * intNoOfLayoutGridColumnsPerPanel);
            }

            ControlMapperCollection controlMappers = new ControlMapperCollection();

            controlMappers.BusinessObject = _currentBusinessObject;
            ITextBox temptb = _controlFactory.CreateTextBox();

            for (int row = 0; row < rowCount; row++)
            {
                manager.FixRow(row, temptb.Height);
            }
            manager.FixAllRowsBasedOnContents();
            GridLayoutManager.ControlInfo[,] controls =
                new GridLayoutManager.ControlInfo[rowCount, colCount *intNoOfLayoutGridColumnsPerPanel];
            int currentColumn = 0;

            foreach (UIFormColumn uiFormColumn in uiFormTab)
            {
                int currentRow = 0;
                foreach (UIFormField field in uiFormColumn)
                {
                    bool     isCompulsory;
                    ClassDef classDef = _currentBusinessObject.ClassDef;
                    PropDef  propDef  = (PropDef)field.GetPropDefIfExists(classDef);
                    if (propDef != null)
                    {
                        isCompulsory = propDef.Compulsory;
                    }
                    else
                    {
                        isCompulsory = false;
                    }
                    string labelCaption = field.GetLabel(classDef);
                    //                    BOPropCol boPropCol = _currentBusinessObject.Props;
                    //                    if (boPropCol.Contains(field.PropertyName))
                    //                    {
                    //                        IBOProp boProp = boPropCol[field.PropertyName];
                    //                        if (!boProp.HasDisplayName())
                    //                        {
                    //                            boProp.DisplayName = labelCaption;
                    //                        }
                    //                    }

                    IControlHabanero ctl          = CreateControl(field, _controlFactory);
                    bool             editable     = CheckIfEditable(field, ctl);
                    ILabel           labelControl = _controlFactory.CreateLabel(labelCaption, isCompulsory && editable);
                    controls[currentRow, currentColumn + 0] = new GridLayoutManager.ControlInfo(labelControl);

                    if (ctl is ITextBox && propDef != null)
                    {
                        if (propDef.PropertyType == typeof(bool))
                        {
                            ctl = _controlFactory.CreateCheckBox();
                        }
                        else if (propDef.PropertyType == typeof(string) && propDef.KeepValuePrivate)
                        {
                            ctl = _controlFactory.CreatePasswordTextBox();
                        }
                        else if (field.GetParameterValue("numLines") != null)
                        {
                            int numLines;
                            try
                            {
                                numLines = Convert.ToInt32(field.GetParameterValue("numLines"));
                            }
                            catch (Exception)
                            {
                                throw new InvalidXmlDefinitionException
                                          ("An error " + "occurred while reading the 'numLines' parameter "
                                          + "from the class definitions.  The 'value' "
                                          + "attribute must be a valid integer.");
                            }
                            if (numLines > 1)
                            {
                                ctl = _controlFactory.CreateTextBoxMultiLine(numLines);
                            }
                        }
                    }


                    if (ctl is ITextBox)
                    {
                        if (field.GetParameterValue("isEmail") != null)
                        {
                            string isEmailValue = (string)field.GetParameterValue("isEmail");
                            if (isEmailValue != "true" && isEmailValue != "false")
                            {
                                throw new InvalidXmlDefinitionException
                                          ("An error " + "occurred while reading the 'isEmail' parameter "
                                          + "from the class definitions.  The 'value' "
                                          + "attribute must hold either 'true' or 'false'.");
                            }

                            //bool isEmail = Convert.ToBoolean(isEmailValue);
                            //if (isEmail)
                            //{
                            //    ITextBox tb = (ITextBox) ctl;
                            //    tb.DoubleClick += _emailTextBoxDoubleClickedHandler;
                            //}
                        }
                    }
                    //if (ctl is IDateTimePicker)
                    //{
                    //    IDateTimePicker editor = (IDateTimePicker) ctl;
                    //    editor.Enter += DateTimePickerEnterHandler;
                    //}
                    //if (ctl is INumericUpDown)
                    //{
                    //    INumericUpDown upDown = (INumericUpDown) ctl;
                    //    upDown.Enter += UpDownEnterHandler;
                    //}



                    CheckGeneralParameters(field, ctl);

                    IControlMapper ctlMapper =
                        ControlMapper.Create
                            (field.MapperTypeName, field.MapperAssembly, ctl, field.PropertyName, !editable,
                            _controlFactory);
                    if (ctlMapper is ControlMapper)
                    {
                        ControlMapper controlMapper = (ControlMapper)ctlMapper;
                        controlMapper.SetPropertyAttributes(field.Parameters);
                    }
                    controlMappers.Add(ctlMapper);
                    ctlMapper.BusinessObject = _currentBusinessObject;

                    int colSpan = 1;
                    if (field.GetParameterValue("colSpan") != null)
                    {
                        try
                        {
                            colSpan = Convert.ToInt32(field.GetParameterValue("colSpan"));
                        }
                        catch (Exception)
                        {
                            throw new InvalidXmlDefinitionException
                                      ("An error " + "occurred while reading the 'colSpan' parameter "
                                      + "from the class definitions.  The 'value' " + "attribute must be a valid integer.");
                        }
                    }
                    colSpan = (colSpan - 1) * intNoOfLayoutGridColumnsPerPanel + 1; // must span label columns too

                    int rowSpan = 1;
                    if (field.GetParameterValue("rowSpan") != null)
                    {
                        try
                        {
                            rowSpan = Convert.ToInt32(field.GetParameterValue("rowSpan"));
                        }
                        catch (Exception)
                        {
                            throw new InvalidXmlDefinitionException
                                      ("An error " + "occurred while reading the 'rowSpan' parameter "
                                      + "from the class definitions.  The 'value' " + "attribute must be a valid integer.");
                        }
                    }
                    if (rowSpan == 1)
                    {
                        manager.FixRow(currentRow, ctl.Height);
                    }
                    controls[currentRow, currentColumn + 1] = new GridLayoutManager.ControlInfo(ctl, rowSpan, colSpan);
                    currentRow++;
                    string toolTipText = field.GetToolTipText(classDef);
                    if (!String.IsNullOrEmpty(toolTipText))
                    {
                        toolTip.SetToolTip(labelControl, toolTipText);
                        toolTip.SetToolTip(ctl, toolTipText);
                    }
                    //Hack brett trying to fix prob with dynamic properties
                    ctl.Width = 100;
                }

                currentColumn += 3;
            }
            for (int i = 0; i < rowCount; i++)
            {
                for (int j = 0; j < colCount * intNoOfLayoutGridColumnsPerPanel; j++)
                {
                    if (controls[i, j] == null)
                    {
                        manager.AddControl(null);
                    }
                    else
                    {
                        manager.AddControl(controls[i, j]);
                        controls[i, j].Control.TabIndex = rowCount * j + i;
                    }
                }
            }
            for (int col = 0; col < colCount; col++)
            {
                if (uiFormTab[col].Width > -1)
                {
                    //Fix width of the control column e.g. textbox or combobox.
                    manager.FixColumn(col * intNoOfLayoutGridColumnsPerPanel + 1, uiFormTab[col].Width - manager.GetFixedColumnWidth(col * intNoOfLayoutGridColumnsPerPanel));
                }
                manager.FixColumn(col * intNoOfLayoutGridColumnsPerPanel + 2, 15);
            }

            panel.Height = manager.GetFixedHeightIncludingGaps();
            panel.Width  = manager.GetFixedWidthIncludingGaps();
            IPanelFactoryInfo panelFactoryInfo = new PanelFactoryInfo(panel, controlMappers, _uiDefName, _firstControl);

            panelFactoryInfo.MinimumPanelHeight = panel.Height;
            panelFactoryInfo.MinumumPanelWidth  = panel.Width;
            panelFactoryInfo.ToolTip            = toolTip;
            panelFactoryInfo.PanelTabText       = uiFormTab.Name;
            panelFactoryInfo.UIForm             = _uiForm;
            panelFactoryInfo.UiFormTab          = uiFormTab;
            return(panelFactoryInfo);
        }
 /// <summary>
 /// Constructor to initalise a new layout manager
 /// </summary>
 /// <param name="managedControl">The control to manage (eg. use "this"
 /// if you create the manager inside a form class that you will be
 /// managing)</param>
 /// <param name="controlFactory">The control factory that will be used to create controls</param>
 public BorderLayoutManager(IControlHabanero managedControl, IControlFactory controlFactory)
     : base(managedControl, controlFactory)
 {
     _controls = new IControlHabanero[5];
     _splitters = new bool[5];
 }
Exemplo n.º 56
0
 protected override string GetUnderlyingDockStyleToString(IControlHabanero controlHabanero)
 {
     Gizmox.WebGUI.Forms.Control control = (Gizmox.WebGUI.Forms.Control)controlHabanero;
     return(control.Dock.ToString());
 }
Exemplo n.º 57
0
 /// <summary>
 /// Create a control manager with the single control that it is managing.
 /// </summary>
 /// <param name="control"></param>
 public MenuControlManagerDefault(IControlHabanero control)
 {
     if (control == null) throw new ArgumentNullException("control");
     control.Enabled = true;
     Control = control;
 }
Exemplo n.º 58
0
 /// <summary>
 /// Add a control to the layout
 /// </summary>
 /// <param name="control">The control to add</param>
 /// /// <param name="pos">The position at which to add the control</param>
 /// <param name="includeSplitter">True to include a splitter between the controls</param>
 /// <returns>Returns the control added</returns>
 public abstract IControlHabanero AddControl(IControlHabanero control, Position pos, bool includeSplitter);
 protected abstract void AddControlToForm(IControlHabanero cntrl);
Exemplo n.º 60
0
 /// <summary>
 /// Sets how the specified control is docked within its parent
 /// </summary>
 protected abstract void SetupDockOfControl(IControlHabanero control, Position pos);