public GridRendererContext(
            ImutableGridRendererContext imutableGridRendererContext,
            IRendererTreeBuilder rendererTreeBuilder,
            ITableDataSet tableDataSet)
        {
            if (imutableGridRendererContext is null)
            {
                throw new ArgumentNullException(nameof(imutableGridRendererContext));
            }

            GridConfiguration            = imutableGridRendererContext.GridConfiguration;
            GridItemProperties           = imutableGridRendererContext.GridItemProperties;
            GridItemCollectionProperties = imutableGridRendererContext.GridEntityConfiguration.ClrTypeCollectionProperties;
            CssClasses                  = imutableGridRendererContext.CssClasses;
            PropertyValueAccessor       = imutableGridRendererContext.GetPropertyValueAccessor;
            RendererTreeBuilder         = rendererTreeBuilder ?? throw new ArgumentNullException(nameof(RendererTreeBuilder));
            RequestRerenderNotification = imutableGridRendererContext.RequestRerenderNotification;
            TableDataSet                = tableDataSet ?? throw new ArgumentNullException(nameof(tableDataSet));

            TableDataSet.GroupingOptions.SetConfiguration(GridConfiguration?.GroupingOptions);
            TableDataSet.GroupingOptions.GroupableProperties = this.GridItemProperties.ToList();

            this.gridEntityConfiguration = imutableGridRendererContext.GridEntityConfiguration;
            this.valueFormatters         = imutableGridRendererContext.ValueFormatters;
            this.specialColumnValues     = imutableGridRendererContext.SpecialColumnValues;
            this.firstColumnName         = GridItemProperties.First().Name;
            this.lastColumnName          = GridItemProperties.Last().Name;
        }
        public GridRendererContext(
            ImutableGridRendererContext imutableGridRendererContext,
            IRendererTreeBuilder rendererTreeBuilder,
            ITableDataSet tableDataSet,
            ISpecialColumnFragmentsCollection specialColumnFragmentsCollection,
            FlexGridContext flexGridContext)
        {
            if (imutableGridRendererContext is null)
            {
                throw new ArgumentNullException(nameof(imutableGridRendererContext));
            }

            RendererTreeBuilder = rendererTreeBuilder ?? throw new ArgumentNullException(nameof(RendererTreeBuilder));
            TableDataSet        = tableDataSet ?? throw new ArgumentNullException(nameof(tableDataSet));
            FlexGridContext     = flexGridContext ?? throw new ArgumentNullException(nameof(flexGridContext));

            GridConfiguration            = imutableGridRendererContext.GridConfiguration;
            GridItemProperties           = imutableGridRendererContext.GridItemProperties;
            GridItemCollectionProperties = imutableGridRendererContext.GridEntityConfiguration.ClrTypeCollectionProperties;
            CssClasses            = imutableGridRendererContext.CssClasses;
            PropertyValueAccessor = imutableGridRendererContext.GetPropertyValueAccessor;

            gridEntityConfiguration = imutableGridRendererContext.GridEntityConfiguration;
            valueFormatters         = imutableGridRendererContext.ValueFormatters;
            columnRendererFragments = specialColumnFragmentsCollection
                                      .Merge(gridEntityConfiguration, imutableGridRendererContext.ColumnRendererFragments);
            columnEditRendererBuilders = specialColumnFragmentsCollection
                                         .Merge(gridEntityConfiguration, imutableGridRendererContext.ColumnEditRendererBuilders);

            firstColumnName = GridItemProperties.First().Name;
            lastColumnName  = GridItemProperties.Last().Name;
            NumberOfColumns = GridItemProperties.Count +
                              (imutableGridRendererContext.InlineEditItemIsAllowed() || imutableGridRendererContext.CreateItemIsAllowed() ? 1 : 0) +
                              (GridConfiguration.IsMasterTable ? 1 : 0);
        }
예제 #3
0
        public GridRendererContext(
            ImutableGridRendererContext imutableGridRendererContext,
            RenderTreeBuilder renderTreeBuilder,
            ITableDataSet tableDataSet)
        {
            if (imutableGridRendererContext is null)
            {
                throw new ArgumentNullException(nameof(imutableGridRendererContext));
            }

            GridItemProperties           = imutableGridRendererContext.GridItemProperties;
            CssClasses                   = imutableGridRendererContext.CssClasses;
            GridConfiguration            = new GridAnotations(imutableGridRendererContext.GridEntityConfiguration);
            TableDataSet                 = tableDataSet ?? throw new ArgumentNullException(nameof(tableDataSet));
            this.gridEntityConfiguration = imutableGridRendererContext.GridEntityConfiguration;
            this.propertyValueAccessor   = imutableGridRendererContext.GetPropertyValueAccessor;
            this.valueFormatters         = imutableGridRendererContext.ValueFormatters;
            this.renderTreeBuilder       = renderTreeBuilder ?? throw new ArgumentNullException(nameof(renderTreeBuilder));
            this.firstColumnName         = GridItemProperties.First().Name;
        }
예제 #4
0
        private ImutableGridRendererContext GetImutableGridRendererContext(Type dataSetItemType)
        {
            if (imutableRendererContextCache.TryGetValue(dataSetItemType, out var imutableGridRendererContext))
            {
                return(imutableGridRendererContext);
            }

            var gridConfiguration = GridConfigurationProvider.FindGridEntityConfigurationByType(dataSetItemType);

            propertyValueAccessorCache.AddPropertyAccessor(dataSetItemType, new TypeWrapper(dataSetItemType, logger));

            imutableGridRendererContext = new ImutableGridRendererContext(
                gridConfiguration,
                propertyValueAccessorCache.GetPropertyAccesor(dataSetItemType),
                currentUserPermission);

            imutableGridRendererContext.InitializeGridProperties(dataSetItemType.GetProperties().ToList());
            imutableRendererContextCache.Add(dataSetItemType, imutableGridRendererContext);

            return(imutableGridRendererContext);
        }
        private ImutableGridRendererContext GetImutableGridRendererContext(Type dataSetItemType)
        {
            if (imutableRendererContextCache.TryGetValue(dataSetItemType, out var imutableGridRendererContext))
            {
                return(imutableGridRendererContext);
            }

            var gridConfiguration = gridConfigurationProvider.FindGridConfigurationByType(dataSetItemType) ?? NullEntityType.Instance;
            var gridCssClasses    = gridConfiguration?.CssClasses() ?? new DefaultGridCssClasses();

            imutableGridRendererContext = new ImutableGridRendererContext(
                gridConfiguration,
                dataSetItemType.GetProperties().ToList(),
                new TypeWrapper(dataSetItemType),
                gridCssClasses
                );

            imutableRendererContextCache.Add(dataSetItemType, imutableGridRendererContext);

            return(imutableGridRendererContext);
        }