Beispiel #1
0
        /// <summary>
        /// Creates a panel with a grid containing the business object
        /// information
        /// </summary>
        /// <param name="formGrid">The grid to fill</param>
        /// <returns>Returns the object containing the panel</returns>
        private PanelFactoryInfo CreatePanelWithGrid(IUIFormGrid formGrid)
        {
            IEditableGridControl myGrid = _controlFactory.CreateEditableGridControl();

            BusinessObject  bo              = _currentBusinessObject;
            ClassDef        classDef        = bo.ClassDef;
            DataSetProvider dataSetProvider = myGrid.Grid.DataSetProvider as DataSetProvider;

            if (dataSetProvider != null)
            {
                dataSetProvider.ObjectInitialiser =
                    new RelationshipObjectInitialiser(bo, (RelationshipDef)classDef.GetRelationship(formGrid.RelationshipName),
                                                      formGrid.CorrespondingRelationshipName);
            }
            IBusinessObjectCollection collection =
                bo.Relationships.GetRelatedCollection(formGrid.RelationshipName);

            myGrid.SetBusinessObjectCollection(collection);

            myGrid.Dock = DockStyle.Fill;
            IPanel panel = _controlFactory.CreatePanel(formGrid.RelationshipName, _controlFactory);

            panel.Controls.Add(myGrid);

            PanelFactoryInfo panelFactoryInfo = new PanelFactoryInfo(panel);

            panelFactoryInfo.FormGrids.Add(formGrid.RelationshipName, myGrid);
            return(panelFactoryInfo);
        }
        ///<summary>
        /// Constrcutor for the <see cref="StaticDataEditorManager"/>
        ///</summary>
        ///<param name="staticDataEditor"></param>
        ///<param name="controlFactory"></param>
        public StaticDataEditorManager(IStaticDataEditor staticDataEditor, IControlFactory controlFactory)
        {
            _staticDataEditor = staticDataEditor;
            this._controlFactory = controlFactory;
            _items = new Dictionary<string, IClassDef>();
            _treeView = _controlFactory.CreateTreeView("TreeView");
            _treeView.Width = 200;
            _gridControl = _controlFactory.CreateEditableGridControl();
            BorderLayoutManager layoutManager = _controlFactory.CreateBorderLayoutManager(_staticDataEditor);
            layoutManager.AddControl(_gridControl, BorderLayoutManager.Position.Centre);
            layoutManager.AddControl(_treeView, BorderLayoutManager.Position.West);
            _treeView.AfterSelect += ((sender, e) => SelectItem(e.Node.Text));
            _treeView.BeforeSelect += _treeView_OnBeforeSelect;
            _gridControl.Enabled = false;
            _gridControl.FilterControl.Visible = false;

        }
Beispiel #3
0
        ///<summary>
        /// Constrcutor for the <see cref="StaticDataEditorManager"/>
        ///</summary>
        ///<param name="staticDataEditor"></param>
        ///<param name="controlFactory"></param>
        public StaticDataEditorManager(IStaticDataEditor staticDataEditor, IControlFactory controlFactory)
        {
            _staticDataEditor    = staticDataEditor;
            this._controlFactory = controlFactory;
            _items          = new Dictionary <string, IClassDef>();
            _treeView       = _controlFactory.CreateTreeView("TreeView");
            _treeView.Width = 200;
            _gridControl    = _controlFactory.CreateEditableGridControl();
            BorderLayoutManager layoutManager = _controlFactory.CreateBorderLayoutManager(_staticDataEditor);

            layoutManager.AddControl(_gridControl, BorderLayoutManager.Position.Centre);
            layoutManager.AddControl(_treeView, BorderLayoutManager.Position.West);
            _treeView.AfterSelect             += ((sender, e) => SelectItem(e.Node.Text));
            _treeView.BeforeSelect            += _treeView_OnBeforeSelect;
            _gridControl.Enabled               = false;
            _gridControl.FilterControl.Visible = false;
        }