C# Class BrightIdeasSoftware.DataSourceAdapter

A helper class that translates DataSource events for an ObjectListView
Inheritance: IDisposable
Exibir arquivo Open project: soywiz/cspspemu Class Usage Examples

Public Methods

Method Description
DataSourceAdapter ( ObjectListView olv ) : System

Make a DataSourceAdapter

Dispose ( ) : void

Release all the resources used by this instance

Dispose ( bool fromUser ) : void

Release all the resources used by this instance

Protected Methods

Method Description
BindDataSource ( ) : void
BindListView ( ObjectListView olv ) : void
ChangePosition ( int index ) : void

Change the control's position (which is it's currently selected row) to the n'th row in the dataset

ConfigureColumn ( OLVColumn column, PropertyDescriptor property ) : void

Configure the given column to show the given property. The title and aspect name of the column are already filled in.

CreateColumnsFromSource ( ) : void

Create columns for the listview based on what properties are available in the data source

This method will create columns if there is not already a column displaying that property.

CreateMissingAspectGettersAndPutters ( ) : void

Generate aspect getters and putters for any columns that are missing them (and for which we have enough information to actually generate a getter)

CurrencyManagerListChanged ( object sender, ListChangedEventArgs e ) : void

CurrencyManager ListChanged event handler. Deals with fine-grained changes to list items.

It's actually difficult to deal with these changes in a fine-grained manner. If our listview is grouped, then any change may make a new group appear or an old group disappear. It is rarely enough to simply update the affected row.

HandleCurrencyManagerMetaDataChanged ( object sender, EventArgs e ) : void

The CurrencyManager calls this if the data source looks different. We just reload everything.

CHECK: Do we need this if we are handle ListChanged metadata events?

HandleCurrencyManagerPositionChanged ( object sender, EventArgs e ) : void

Called by the CurrencyManager when the currently selected item changes. We update the ListView selection so that we stay in sync with any other controls bound to the same source.

HandleListChangedItemAdded ( ListChangedEventArgs e ) : void

Handle an ItemAdded event.

HandleListChangedItemChanged ( ListChangedEventArgs e ) : void

Handle ItemChanged event. This is triggered when a single item has changed, so just refresh that one item.

Even in this simple case, we should probably rebuild the list. For example, the change could put the item into its own new group.

HandleListChangedItemDeleted ( ListChangedEventArgs e ) : void

Handle the ItemDeleted event

HandleListChangedItemMoved ( ListChangedEventArgs e ) : void

Handle ItemMoved event

HandleListChangedMetadataChanged ( ListChangedEventArgs e ) : void

Handle PropertyDescriptor* events

HandleListChangedReset ( ListChangedEventArgs e ) : void

Handle the Reset event

HandleListViewBindingContextChanged ( object sender, EventArgs e ) : void

Handle a change to the BindingContext of our ListView.

HandleListViewFreezing ( object sender, BrightIdeasSoftware.FreezeEventArgs e ) : void

Handle the frozenness of our ListView changing.

HandleListViewSelectedIndexChanged ( object sender, EventArgs e ) : void

Handle the selection changing in our ListView. We need to tell our currency manager about the new position.

InitializeDataSource ( ) : void

The data source for this control has changed. Reconfigure the control for the new source

RebindDataSource ( ) : void

Our data source has changed. Figure out how to handle the new source

RebindDataSource ( bool forceDataInitialization ) : void

Our data source has changed. Figure out how to handle the new source

SetListContents ( ) : void

Take the contents of the currently bound list and put them into the control

ShouldCreateColumn ( PropertyDescriptor property ) : bool

Decide if a new column should be added to the control to display the given property

UnbindDataSource ( ) : void
UnbindListView ( ObjectListView olv ) : void

Method Details

BindDataSource() protected method

protected BindDataSource ( ) : void
return void

BindListView() protected method

protected BindListView ( ObjectListView olv ) : void
olv ObjectListView
return void

ChangePosition() protected method

Change the control's position (which is it's currently selected row) to the n'th row in the dataset
protected ChangePosition ( int index ) : void
index int The index of the row to be selected
return void

ConfigureColumn() protected method

Configure the given column to show the given property. The title and aspect name of the column are already filled in.
protected ConfigureColumn ( OLVColumn column, PropertyDescriptor property ) : void
column OLVColumn
property System.ComponentModel.PropertyDescriptor
return void

CreateColumnsFromSource() protected method

Create columns for the listview based on what properties are available in the data source

This method will create columns if there is not already a column displaying that property.

protected CreateColumnsFromSource ( ) : void
return void

CreateMissingAspectGettersAndPutters() protected method

Generate aspect getters and putters for any columns that are missing them (and for which we have enough information to actually generate a getter)
protected CreateMissingAspectGettersAndPutters ( ) : void
return void

CurrencyManagerListChanged() protected method

CurrencyManager ListChanged event handler. Deals with fine-grained changes to list items.
It's actually difficult to deal with these changes in a fine-grained manner. If our listview is grouped, then any change may make a new group appear or an old group disappear. It is rarely enough to simply update the affected row.
protected CurrencyManagerListChanged ( object sender, ListChangedEventArgs e ) : void
sender object
e System.ComponentModel.ListChangedEventArgs
return void

DataSourceAdapter() public method

Make a DataSourceAdapter
public DataSourceAdapter ( ObjectListView olv ) : System
olv ObjectListView
return System

Dispose() public method

Release all the resources used by this instance
public Dispose ( ) : void
return void

Dispose() public method

Release all the resources used by this instance
public Dispose ( bool fromUser ) : void
fromUser bool
return void

HandleCurrencyManagerMetaDataChanged() protected method

The CurrencyManager calls this if the data source looks different. We just reload everything.
CHECK: Do we need this if we are handle ListChanged metadata events?
protected HandleCurrencyManagerMetaDataChanged ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void

HandleCurrencyManagerPositionChanged() protected method

Called by the CurrencyManager when the currently selected item changes. We update the ListView selection so that we stay in sync with any other controls bound to the same source.
protected HandleCurrencyManagerPositionChanged ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void

HandleListChangedItemAdded() protected method

Handle an ItemAdded event.
protected HandleListChangedItemAdded ( ListChangedEventArgs e ) : void
e System.ComponentModel.ListChangedEventArgs
return void

HandleListChangedItemChanged() protected method

Handle ItemChanged event. This is triggered when a single item has changed, so just refresh that one item.
Even in this simple case, we should probably rebuild the list. For example, the change could put the item into its own new group.
protected HandleListChangedItemChanged ( ListChangedEventArgs e ) : void
e System.ComponentModel.ListChangedEventArgs
return void

HandleListChangedItemDeleted() protected method

Handle the ItemDeleted event
protected HandleListChangedItemDeleted ( ListChangedEventArgs e ) : void
e System.ComponentModel.ListChangedEventArgs
return void

HandleListChangedItemMoved() protected method

Handle ItemMoved event
protected HandleListChangedItemMoved ( ListChangedEventArgs e ) : void
e System.ComponentModel.ListChangedEventArgs
return void

HandleListChangedMetadataChanged() protected method

Handle PropertyDescriptor* events
protected HandleListChangedMetadataChanged ( ListChangedEventArgs e ) : void
e System.ComponentModel.ListChangedEventArgs
return void

HandleListChangedReset() protected method

Handle the Reset event
protected HandleListChangedReset ( ListChangedEventArgs e ) : void
e System.ComponentModel.ListChangedEventArgs
return void

HandleListViewBindingContextChanged() protected method

Handle a change to the BindingContext of our ListView.
protected HandleListViewBindingContextChanged ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void

HandleListViewFreezing() protected method

Handle the frozenness of our ListView changing.
protected HandleListViewFreezing ( object sender, BrightIdeasSoftware.FreezeEventArgs e ) : void
sender object
e BrightIdeasSoftware.FreezeEventArgs
return void

HandleListViewSelectedIndexChanged() protected method

Handle the selection changing in our ListView. We need to tell our currency manager about the new position.
protected HandleListViewSelectedIndexChanged ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void

InitializeDataSource() protected method

The data source for this control has changed. Reconfigure the control for the new source
protected InitializeDataSource ( ) : void
return void

RebindDataSource() protected method

Our data source has changed. Figure out how to handle the new source
protected RebindDataSource ( ) : void
return void

RebindDataSource() protected method

Our data source has changed. Figure out how to handle the new source
protected RebindDataSource ( bool forceDataInitialization ) : void
forceDataInitialization bool
return void

SetListContents() protected method

Take the contents of the currently bound list and put them into the control
protected SetListContents ( ) : void
return void

ShouldCreateColumn() protected method

Decide if a new column should be added to the control to display the given property
protected ShouldCreateColumn ( PropertyDescriptor property ) : bool
property System.ComponentModel.PropertyDescriptor
return bool

UnbindDataSource() protected method

protected UnbindDataSource ( ) : void
return void

UnbindListView() protected method

protected UnbindListView ( ObjectListView olv ) : void
olv ObjectListView
return void