Esempio n. 1
0
        /// <summary>
        /// Creates a panel to display a business object
        /// </summary>
        /// <returns>Returns the panel info object containing the panel</returns>
        public IPanelFactoryInfo CreatePanel()
        {
            IPanelFactoryInfo factoryInfo;

            _firstControl = null;
            if (_uiForm.Count > 1)
            {
                IPanel mainPanel = _controlFactory.CreatePanel(_controlFactory);
                ControlMapperCollection controlMappers = new ControlMapperCollection();
                IDictionary <string, IEditableGridControl> formGrids = new Dictionary <string, IEditableGridControl>();
                ITabControl         tabControl       = _controlFactory.CreateTabControl();
                BorderLayoutManager mainPanelManager = _controlFactory.CreateBorderLayoutManager(mainPanel);
                mainPanelManager.AddControl(tabControl, BorderLayoutManager.Position.Centre);
                foreach (UIFormTab formTab in _uiForm)
                {
                    IPanelFactoryInfo onePanelInfo = CreateOnePanel(formTab);
                    AddControlMappers(onePanelInfo, controlMappers);
                    AddFormGrids(onePanelInfo, formGrids);
                    ITabPage            page    = _controlFactory.CreateTabPage(formTab.Name);
                    BorderLayoutManager manager = _controlFactory.CreateBorderLayoutManager(page);
                    manager.AddControl(onePanelInfo.Panel, BorderLayoutManager.Position.Centre);
                    tabControl.TabPages.Add(page);
                }
                factoryInfo           = new PanelFactoryInfo(mainPanel, controlMappers, _uiDefName, _firstControl);
                factoryInfo.FormGrids = formGrids;
            }
            else
            {
                factoryInfo = CreateOnePanel(_uiForm[0]);
            }
            SetFormPreferredHeight(factoryInfo);
            //TODO_Port AttachTriggers(_uiForm, factoryInfo, _currentBusinessObject);
            return(factoryInfo);
        }
Esempio n. 2
0
        private void ReloadCurrentCollection()
        {
            _tabControl.SelectedIndexChanged -= TabChangedHandler;
            ClearTabPages();
            Dictionary <string, object> list = GetBusinessObjectDisplayValueDictionary();

            foreach (KeyValuePair <string, object> pair in list)
            {
                BusinessObject businessObject = pair.Value as BusinessObject;
                if (businessObject != null)
                {
                    ITabPage page = _controlFactory.CreateTabPage(pair.Key);
                    //page.Text =  ;
                    AddTabPage(page, businessObject);
                }
            }
            //foreach (BusinessObject bo in businessObjectCollection)
            //{
            //    TabPage page = new TabPage(bo.ToString());
            //    //page.Text =  ;
            //    AddTabPage(page, bo);
            //}
            if (_businessObjectCollection.Count > 0)
            {
                _tabControl.SelectedIndex = 0;
            }
            _tabControl.SelectedIndexChanged += TabChangedHandler;
            TabChanged();
        }
Esempio n. 3
0
        /// <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 min width that the content control can be.</param>
        /// <returns></returns>
        public IControlHabanero AddControl(IControlHabanero contentControl, string headingText, int minimumControlHeight, int minimumControlWidth)
        {
            ITabPage childControl = _controlFactory.CreateTabPage(headingText);

            childControl.MinimumSize = new Size(0, 0);
            childControl.ClientSize  = new Size(minimumControlWidth, minimumControlHeight);
            childControl.MinimumSize = childControl.Size;
            //childControl.Width = minimumControlHeight;
            //childControl.Height = minimumControlHeight;
            contentControl.Dock = Base.DockStyle.Fill;
            childControl.Controls.Add(contentControl);
            this.TabPages.Add(childControl);
            return(childControl);
        }
Esempio n. 4
0
//        /// <summary>
//        /// Gets the collection of tab pages in this tab control
//        /// </summary>
//        public IList ChildControls
//        {
//            get
//            {
//                IList list = new List<ITabPage>();
//                for (int pagePos = 0; pagePos < base.TabPages.Count; pagePos++)
//                {
//                    list.Add(base.TabPages[0]);
//                }
//                return list;
//            }
//        }

//
//        public IControlHabanero SelectedChildControl
//        {
//            get { return SelectedTab; }
//            set { SelectedTab = (ITabPage) value;}
//        }

        /// <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 contentControl can be</param>
        /// <returns></returns>
        public 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);
            }
            ITabPage childControl = factory.CreateTabPage(headingText);

            childControl.MinimumSize = new Size(0, 0);
            childControl.ClientSize  = new Size(minimumControlWidth, minimumControlHeight);
            childControl.MinimumSize = childControl.Size;
            //childControl.Width = minimumControlHeight;
            //childControl.Height = minimumControlHeight;
            contentControl.Dock = Habanero.Faces.Base.DockStyle.Fill;
            childControl.Controls.Add(contentControl);
            this.TabPages.Add(childControl);
            return(childControl);
        }
Esempio n. 5
0
        private void AddTabPage(IBusinessObject bo)
        {
            ITabPage page = _controlFactory.CreateTabPage(bo.ToString());

            AddTabPage(page, bo);
        }