C# Класс BrightIdeasSoftware.Generator

The Generator class provides methods to dynamically create columns for an ObjectListView based on the characteristics of a given collection of model objects.

For a given type, a Generator can create columns to match the public properties of that type. The generator can consider all public properties or only those public properties marked with [OLVColumn] attribute.

Наследование: IGenerator
Показать файл Открыть проект

Открытые методы

Метод Описание
GenerateAndReplaceColumns ( ObjectListView olv, Type type, bool allProperties ) : void

Generate columns into the given ObjectListView that come from the given model object type.

GenerateColumns ( Type type ) : IList

Generate a list of OLVColumns based on the public properties of the given type that have a OLVColumn attribute.

GenerateColumns ( Type type, bool allProperties ) : IList

Generate a list of OLVColumns based on the attributes of the given type If allProperties to true, all public properties will have a matching column generated. If allProperties is false, only properties that have a OLVColumn attribute will have a column generated.

GenerateColumns ( ObjectListView olv, IEnumerable enumerable ) : void

Replace all columns of the given ObjectListView with columns generated from the first member of the given enumerable. If the enumerable is empty or null, the ObjectListView will be cleared.

GenerateColumns ( ObjectListView olv, IEnumerable enumerable, bool allProperties ) : void

Replace all columns of the given ObjectListView with columns generated from the first member of the given enumerable. If the enumerable is empty or null, the ObjectListView will be cleared.

GenerateColumns ( ObjectListView olv, Type type ) : void

Generate columns into the given ObjectListView that come from the public properties of the given model object type.

GenerateColumns ( ObjectListView olv, Type type, bool allProperties ) : void

Generate columns into the given ObjectListView that come from the public properties of the given model object type.

MakeColumnFromPropertyDescriptor ( PropertyDescriptor pd ) : OLVColumn

Make a column from the given PropertyDescriptor

PostCreateColumns ( ObjectListView olv ) : void

Post process columns after creating them and adding them to the AllColumns collection.

Защищенные методы

Метод Описание
ConfigurePossibleBooleanColumn ( OLVColumn column, Type propertyType ) : void

Configure the given column to show a checkbox if appropriate

DisplayNameToColumnTitle ( string displayName ) : string

Convert a property name to a displayable title.

GenerateChildrenDelegates ( TreeListView tlv, PropertyInfo pinfo ) : void

Generate CanExpand and ChildrenGetter delegates from the given property.

MakeColumn ( string aspectName, string title, BrightIdeasSoftware.OLVColumnAttribute attr ) : OLVColumn

Create a column.

MakeColumn ( string aspectName, string title, bool editable, Type propertyType, BrightIdeasSoftware.OLVColumnAttribute attr ) : OLVColumn
MakeColumnFromAttribute ( PropertyInfo pinfo, BrightIdeasSoftware.OLVColumnAttribute attr ) : OLVColumn

Create a column from the given PropertyInfo and OLVColumn attribute

MakeColumnFromPropertyInfo ( PropertyInfo pinfo ) : OLVColumn

Make a column from the given PropertyInfo

ReplaceColumns ( ObjectListView olv, IList columns ) : void

Replace all the columns in the given listview with the given list of columns.

TryGenerateChildrenDelegates ( TreeListView tlv, Type type ) : void

If this given type has an property marked with [OLVChildren], make delegates that will traverse that property as the children of an instance of the model

Описание методов

ConfigurePossibleBooleanColumn() защищенный Метод

Configure the given column to show a checkbox if appropriate
protected ConfigurePossibleBooleanColumn ( OLVColumn column, Type propertyType ) : void
column OLVColumn
propertyType System.Type
Результат void

DisplayNameToColumnTitle() защищенный Метод

Convert a property name to a displayable title.
protected DisplayNameToColumnTitle ( string displayName ) : string
displayName string
Результат string

GenerateAndReplaceColumns() публичный Метод

Generate columns into the given ObjectListView that come from the given model object type.
public GenerateAndReplaceColumns ( ObjectListView olv, Type type, bool allProperties ) : void
olv ObjectListView The ObjectListView to modify
type System.Type The model type whose attributes will be considered.
allProperties bool Will columns be generated for properties that are not marked with [OLVColumn].
Результат void

GenerateChildrenDelegates() защищенный Метод

Generate CanExpand and ChildrenGetter delegates from the given property.
protected GenerateChildrenDelegates ( TreeListView tlv, PropertyInfo pinfo ) : void
tlv TreeListView
pinfo System.Reflection.PropertyInfo
Результат void

GenerateColumns() публичный статический Метод

Generate a list of OLVColumns based on the public properties of the given type that have a OLVColumn attribute.
public static GenerateColumns ( Type type ) : IList
type System.Type
Результат IList

GenerateColumns() публичный Метод

Generate a list of OLVColumns based on the attributes of the given type If allProperties to true, all public properties will have a matching column generated. If allProperties is false, only properties that have a OLVColumn attribute will have a column generated.
public GenerateColumns ( Type type, bool allProperties ) : IList
type System.Type
allProperties bool Will columns be generated for properties that are not marked with [OLVColumn].
Результат IList

GenerateColumns() публичный статический Метод

Replace all columns of the given ObjectListView with columns generated from the first member of the given enumerable. If the enumerable is empty or null, the ObjectListView will be cleared.
public static GenerateColumns ( ObjectListView olv, IEnumerable enumerable ) : void
olv ObjectListView The ObjectListView to modify
enumerable IEnumerable The collection whose first element will be used to generate columns.
Результат void

GenerateColumns() публичный статический Метод

Replace all columns of the given ObjectListView with columns generated from the first member of the given enumerable. If the enumerable is empty or null, the ObjectListView will be cleared.
public static GenerateColumns ( ObjectListView olv, IEnumerable enumerable, bool allProperties ) : void
olv ObjectListView The ObjectListView to modify
enumerable IEnumerable The collection whose first element will be used to generate columns.
allProperties bool Will columns be generated for properties that are not marked with [OLVColumn].
Результат void

GenerateColumns() публичный статический Метод

Generate columns into the given ObjectListView that come from the public properties of the given model object type.
public static GenerateColumns ( ObjectListView olv, Type type ) : void
olv ObjectListView The ObjectListView to modify
type System.Type The model type whose attributes will be considered.
Результат void

GenerateColumns() публичный статический Метод

Generate columns into the given ObjectListView that come from the public properties of the given model object type.
public static GenerateColumns ( ObjectListView olv, Type type, bool allProperties ) : void
olv ObjectListView The ObjectListView to modify
type System.Type The model type whose attributes will be considered.
allProperties bool Will columns be generated for properties that are not marked with [OLVColumn].
Результат void

MakeColumn() защищенный Метод

Create a column.
protected MakeColumn ( string aspectName, string title, BrightIdeasSoftware.OLVColumnAttribute attr ) : OLVColumn
aspectName string
title string
attr BrightIdeasSoftware.OLVColumnAttribute
Результат OLVColumn

MakeColumn() защищенный Метод

protected MakeColumn ( string aspectName, string title, bool editable, Type propertyType, BrightIdeasSoftware.OLVColumnAttribute attr ) : OLVColumn
aspectName string
title string
editable bool
propertyType System.Type
attr BrightIdeasSoftware.OLVColumnAttribute
Результат OLVColumn

MakeColumnFromAttribute() защищенный Метод

Create a column from the given PropertyInfo and OLVColumn attribute
protected MakeColumnFromAttribute ( PropertyInfo pinfo, BrightIdeasSoftware.OLVColumnAttribute attr ) : OLVColumn
pinfo System.Reflection.PropertyInfo
attr BrightIdeasSoftware.OLVColumnAttribute
Результат OLVColumn

MakeColumnFromPropertyDescriptor() публичный Метод

Make a column from the given PropertyDescriptor
public MakeColumnFromPropertyDescriptor ( PropertyDescriptor pd ) : OLVColumn
pd System.ComponentModel.PropertyDescriptor
Результат OLVColumn

MakeColumnFromPropertyInfo() защищенный Метод

Make a column from the given PropertyInfo
protected MakeColumnFromPropertyInfo ( PropertyInfo pinfo ) : OLVColumn
pinfo System.Reflection.PropertyInfo
Результат OLVColumn

PostCreateColumns() публичный Метод

Post process columns after creating them and adding them to the AllColumns collection.
public PostCreateColumns ( ObjectListView olv ) : void
olv ObjectListView
Результат void

ReplaceColumns() защищенный Метод

Replace all the columns in the given listview with the given list of columns.
protected ReplaceColumns ( ObjectListView olv, IList columns ) : void
olv ObjectListView
columns IList
Результат void

TryGenerateChildrenDelegates() защищенный Метод

If this given type has an property marked with [OLVChildren], make delegates that will traverse that property as the children of an instance of the model
protected TryGenerateChildrenDelegates ( TreeListView tlv, Type type ) : void
tlv TreeListView
type System.Type
Результат void