protected ColumnMetamodelBase(string name, string caption, int width, ColumnWidthMode widthMode) { this.Name = name; this.Caption = caption; this.Width = width; this.IsFixedWidth = widthMode == ColumnWidthMode.Fixed; }
public static PropertyColumnMetamodel Create(LambdaExpression property, int width, ColumnWidthMode widthMode, FilterMetamodel filterMetamodel) { var name = ObjectHelper.GetPropertyName(property); var caption = AttributesHelper.GetPropertyDisplayName(property) ?? property.Name; // TODO: maybe better to provide explicite caption parameter? return new PropertyColumnMetamodel(name, caption, width, widthMode, property.ReturnType, filterMetamodel); }
public GridMetamodelBuilder <TGridModel> AddDefaultSortColumn <TColumn>( Expression <Func <TGridModel, TColumn> > property, SortMode sortMode, int width = 150, ColumnWidthMode widthMode = ColumnWidthMode.Auto, FilterOperator filterOperator = FilterOperator.Auto) { this.defaultSortSettings = new SortConfiguration(ObjectHelper.GetPropertyName(property), sortMode); return(this.AddDataColumn(property, width, widthMode, filterOperator)); }
public GridMetamodelBuilder <TGridModel> AddActionColumn <TController>( Expression <Func <TController, ActionResult> > action, string caption, int width = 150, ColumnWidthMode widthMode = ColumnWidthMode.Auto) where TController : Controller { string controllerName = ControllerHelper.GetName <TController>(); string actionName = ControllerHelper.GetActionName(action); var column = new ActionColumnMetamodel(controllerName, actionName, actionName, caption, width, widthMode); this.columns.Add(column); return(this); }
public GridMetamodelBuilder <TGridModel> AddDataColumn <TColumn>( Expression <Func <TGridModel, TColumn> > property, int width = 150, ColumnWidthMode widthMode = ColumnWidthMode.Auto, FilterOperator filterOperator = FilterOperator.Auto) { var filterMetamodel = new FilterMetamodel(filterOperator, null); if (filterOperator == FilterOperator.Auto) { filterMetamodel = AutoResolveFilterConfigurationForColumn <TColumn>(); } var column = PropertyColumnMetamodel.Create(property, width, widthMode, filterMetamodel); this.columns.Add(column); return(this); }
//public void SetHeader(HeaderType hType, string[] labels) { // header = new GridCell[labels.Length]; // headerType = hType; // for (int i = 0; i < labels.Length; i++) { // header[i] = new GridCell(() => { return labels[i]; }); // } //} public void SetColumnSizes(ColumnWidthMode mode, float[] sizes) { switch (columnWidthMode) { case ColumnWidthMode.ManualFixed: columnWidths = sizes; break; case ColumnWidthMode.ManualWeighted: columnWidths = new float[sizes.Length]; columnWeights = new float[sizes.Length]; float weightSum = 0f; for (int i = 0; i < sizes.Length; i++) { weightSum += sizes[i]; } for (int i = 0; i < sizes.Length; i++) { columnWeights[i] = sizes[i] / weightSum; } break; case ColumnWidthMode.AutoFit: columnWidths = new float[sizes.Length]; for (int x = 0; x < countWidth; x++) { float maxWidth = 0f; for (int y = 0; y < countHeight; y++) { float width = grid[y, x].Width(); if (width > maxWidth) { maxWidth = width; } } columnWidths[x] = maxWidth; } break; default: break; } }
public static PropertyColumnMetamodel Create(LambdaExpression property, int width, ColumnWidthMode widthMode, FilterMetamodel filterMetamodel) { var name = ObjectHelper.GetPropertyName(property); var caption = AttributesHelper.GetPropertyDisplayName(property) ?? property.Name; // TODO: maybe better to provide explicite caption parameter? return(new PropertyColumnMetamodel(name, caption, width, widthMode, property.ReturnType, filterMetamodel)); }
public PropertyColumnMetamodel(string name, string caption, int width, ColumnWidthMode widthMode, Type propertyType, FilterMetamodel filter) : base(name, caption, width, widthMode) { this.PropertyType = propertyType; this.Filter = filter; }
public ActionColumnMetamodel(string controllerName, string actionName, string name, string caption, int width, ColumnWidthMode widthMode) : base(name, caption, width, widthMode) { this.ControllerName = controllerName; this.ActionName = actionName; }
/// <summary> /// Constructs a new ColumnDefinition instance with the given header, width mode, an minimum width. /// </summary> public ColumnDefinition(string header, ColumnWidthMode widthMode, int minWidth) { Header = header; WidthMode = widthMode; MinWidth = minWidth; }
/// <summary> /// Constructs a new ColumnDefinition instance with the given header and width mode. /// </summary> public ColumnDefinition(string header, ColumnWidthMode widthMode) : this(header, widthMode, 0) { }