private void CreateGridColumns(IGrid grid)
        {
            try
            {
                grid.BeginInit();

                grid.Columns.Clear();

                foreach (GridColumnInfo info in ADInfoBll.Instance.GetGridColumnInfos(grid.GridName))
                {
                    // 有些列是要设置值但不可见的,例如Id
                    //if (!Authority.AuthorizeByRule(info.ColumnVisible))
                    //    continue;

                    switch (info.GridColumnType)
                    {
                    case GridColumnType.Normal:
                    {
                        Xceed.Grid.Column column;
                        if (grid.Columns[info.GridColumnName] != null)
                        {
                            throw new ArgumentException("there have already exist column " + info.GridColumnName);
                        }
                        else
                        {
                            column = new Xceed.Grid.Column(info.GridColumnName, GridColumnInfoHelper.CreateType(info));
                        }

                        UnBoundGridExtention.SetColumnProperties(column, info, grid);

                        GridFactory.CreateCellViewerManager(column, info, this.ControlManager.DisplayManager);

                        bool readOnly = Authority.AuthorizeByRule(info.ReadOnly);
                        if (!readOnly)
                        {
                            GridFactory.CreateCellEditorManager(column, info, this.ControlManager.DisplayManager);
                        }

                        grid.Columns.Add(column);
                    }
                    break;

                    default:
                        break;
                        //default:
                        //    throw new InvalidOperationException("Invalide gridcolumnType of " + info.GridColumnType + " in " + info.Name);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithNotify(ex);
            }
            finally
            {
                grid.EndInit();
            }
        }
        private void CreateGridColumns(IGrid grid)
        {
            try
            {
                grid.BeginInit();

                grid.Columns.Clear();

                foreach (GridColumnInfo info in ADInfoBll.Instance.GetGridColumnInfos(grid.GridName))
                {
                    // 有些列是要设置值但不可见的,例如Id
                    //if (!Authority.AuthorizeByRule(info.ColumnVisible))
                    //    continue;

                    switch (info.GridColumnType)
                    {
                        case GridColumnType.Normal:
                            {
                                Xceed.Grid.Column column;
                                if (grid.Columns[info.GridColumnName] != null)
                                {
                                    throw new ArgumentException("there have already exist column " + info.GridColumnName);
                                }
                                else
                                {
                                    column = new Xceed.Grid.Column(info.GridColumnName, GridColumnInfoHelper.CreateType(info));
                                }

                                UnBoundGridExtention.SetColumnProperties(column, info, grid);

                                GridFactory.CreateCellViewerManager(column, info, this.ControlManager.DisplayManager);

                                bool readOnly = Authority.AuthorizeByRule(info.ReadOnly);
                                if (!readOnly)
                                {
                                    GridFactory.CreateCellEditorManager(column, info, this.ControlManager.DisplayManager);
                                }

                                grid.Columns.Add(column);
                            }
                            break;
                        default:
                            break;
                        //default:
                        //    throw new InvalidOperationException("Invalide gridcolumnType of " + info.GridColumnType + " in " + info.Name);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithNotify(ex);
            }
            finally
            {
                grid.EndInit();
            }
        }
示例#3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="column"></param>
 /// <param name="info"></param>
 public static void CreateCellEditorManager(Xceed.Grid.Column column, GridColumnInfo info, IDisplayManager dm)
 {
     try
     {
         Xceed.Grid.Editors.CellEditorManager editor = ControlFactory.CreateCellEditorManager(dm.Name,
                                                                                              info.CellEditorManager, info.CellEditorManagerParam, GridColumnInfoHelper.CreateType(info), (string)ParamCreatorHelper.TryGetParam(info.CellEditorManagerParamFilter),
                                                                                              info.CellViewerManagerParam);
         if (editor != null)
         {
             column.CellEditorManager = editor;
         }
     }
     catch (Exception ex)
     {
         throw new ArgumentException("GridColumnInfo of " + info.Name + " is Invalid when CreateCellEditorManager!", ex);
     }
 }
示例#4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="column"></param>
        /// <param name="info"></param>
        public static void CreateCellViewerManager(Xceed.Grid.Column column, GridColumnInfo info, IDisplayManager dm)
        {
            try
            {
                Xceed.Grid.Viewers.CellViewerManager viewer = ControlFactory.CreateCellViewerManager(dm.Name,
                                                                                                     info.CellViewerManager, info.CellViewerManagerParam, GridColumnInfoHelper.CreateType(info));
                if (viewer != null)
                {
                    column.CellViewerManager = viewer;

                    System.Collections.IComparer comp = ControlFactory.CreateColumnDataComparer(
                        info.CellViewerManager, info.CellViewerManagerParam, GridColumnInfoHelper.CreateType(info));
                    if (comp != null)
                    {
                        column.DataComparer = comp;
                    }
                }
            }
            catch (Exception ex)
            {
                throw new ArgumentException("GridColumnInfo of " + info.Name + " is Invalid when CreateCellViewerManager!", ex);
            }
        }
示例#5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="template"></param>
 public MyColumn(Xceed.Grid.Column template)
     : base(template)
 {
 }
示例#6
0
 protected override Xceed.Grid.Cell CreateCell(Xceed.Grid.Column parentColumn)
 {
     return(new SpaceDataCell(parentColumn));
 }
示例#7
0
 public SpaceDataCell(Xceed.Grid.Column parentColumn)
     : base(parentColumn)
 {
 }