protected WarningColumn(WarningColumn template)
     : base(template)
 {
     this.m_warningName = template.m_warningName;
     Initialize();
 }
示例#2
0
        internal static void CreateUnBoundGrid(this IBoundGrid 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.NoColumn:
                        break;

                    case GridColumnType.CheckColumn:
                    {
                        CheckColumn column = grid.AddCheckColumn(info.GridColumnName);
                        SetColumnProperties(column, info, grid);
                    }
                    break;

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

                        SetColumnProperties(column, info, grid);

                        GridFactory.CreateCellViewerManager(column, info, grid.DisplayManager);
                        bool readOnly = Authority.AuthorizeByRule(info.ReadOnly);
                        if (readOnly)
                        {
                            column.ReadOnly = readOnly;
                        }
                        else
                        {
                            GridFactory.CreateCellEditorManager(column, info, grid.DisplayManager);
                        }

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

                    case GridColumnType.WarningColumn:
                    {
                        Columns.WarningColumn column = new Columns.WarningColumn(info.GridColumnName, info.PropertyName);
                        grid.Columns.Add(column);
                    }
                    break;

                    case GridColumnType.StatColumn:
                    {
                        Xceed.Grid.Column column = new Xceed.Grid.Column(info.GridColumnName, GridColumnInfoHelper.CreateType(info));
                        SetColumnProperties(column, info, grid);
                        GridFactory.CreateCellViewerManager(column, info, grid.DisplayManager);
                        column.ReadOnly = true;
                        grid.Columns.Add(column);
                    }
                    break;

                    case GridColumnType.ExpressionColumn:
                    {
                        Xceed.Grid.Column column = new Xceed.Grid.Column(info.GridColumnName, GridColumnInfoHelper.CreateType(info));
                        SetColumnProperties(column, info, grid);
                        GridFactory.CreateCellViewerManager(column, info, grid.DisplayManager);
                        bool readOnly = Authority.AuthorizeByRule(info.ReadOnly);
                        if (readOnly)
                        {
                            column.ReadOnly = readOnly;
                        }
                        else
                        {
                            GridFactory.CreateCellEditorManager(column, info, grid.DisplayManager);
                        }
                        grid.Columns.Add(column);
                    }
                    break;

                    case GridColumnType.ImageColumn:
                    {
                        Xceed.Grid.Column column = new Xceed.Grid.Column(info.GridColumnName, typeof(System.Drawing.Image));
                        SetColumnProperties(column, info, grid);
                        column.ReadOnly = true;
                        column.MaxWidth = 72;
                        grid.Columns.Add(column);
                    }
                    break;

                    case GridColumnType.SplitColumn:
                    {
                        Xceed.Grid.Column column = new Xceed.Grid.Column(info.GridColumnName, typeof(string));
                        SetColumnProperties(column, info, grid);
                        column.ReadOnly  = true;
                        column.BackColor = System.Drawing.Color.LightGray;
                        column.Title     = " ";
                        column.MaxWidth  = 5;
                        column.Width     = 5;
                        grid.Columns.Add(column);
                    }
                    break;

                    case GridColumnType.UnboundColumn:
                    {
                        Xceed.Grid.Column column = new Xceed.Grid.Column(info.GridColumnName, GridColumnInfoHelper.CreateType(info));
                        SetColumnProperties(column, info, grid);

                        GridFactory.CreateCellViewerManager(column, info, grid.DisplayManager);
                        bool readOnly = Authority.AuthorizeByRule(info.ReadOnly);
                        if (readOnly)
                        {
                            column.ReadOnly = readOnly;
                        }
                        else
                        {
                            GridFactory.CreateCellEditorManager(column, info, grid.DisplayManager);
                        }

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

                    case GridColumnType.IndexColumn:
                    {
                        Xceed.Grid.Column column = new Xceed.Grid.Column(info.GridColumnName, typeof(int));
                        SetColumnProperties(column, info, grid);
                        column.ReadOnly = true;

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

                    default:
                        throw new NotSupportedException("Invalide gridcolumnType of " + info.GridColumnType + " in " + info.Name);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionProcess.ProcessWithNotify(ex);
            }
            finally
            {
                grid.EndInit();
            }

            grid.CreateSumRow();
            grid.CreateGroups();
            grid.CreateEvents();

            grid.BoundGridHelper.CreateColumnManageRowEvent();
            grid.SetColumnManagerRowHorizontalAlignment();
            grid.CreateMultiColumnHeaderColumnManagerRow();
        }