C# Class BrightIdeasSoftware.FilterMenuBuilder

Instances of this class know how to build a Filter menu. It is responsible for clustering the values in the target column, build a menu that shows those clusters, and then constructing a filter that will enact the users choices.
Almost all of the methods in this class are declared as "virtual protected" so that subclasses can provide alternative behaviours.
ファイルを表示 Open project: soywiz/cspspemu

Public Properties

Property Type Description
APPLY_LABEL string
CLEAR_ALL_FILTERS_LABEL string
ClearFilteringImage System.Drawing.Bitmap
FILTERING_LABEL string
FilteringImage System.Drawing.Bitmap
SELECT_ALL_LABEL string

Public Methods

Method Description
MakeFilterMenu ( ToolStripDropDown strip, ObjectListView listView, OLVColumn column ) : ToolStripDropDown

Create a Filter menu on the given tool tip for the given column in the given ObjectListView.

This is the main entry point into this class.

Protected Methods

Method Description
ClearAllFilters ( OLVColumn column ) : void

Clear all the filters that are applied to the given column

Cluster ( IClusteringStrategy strategy, ObjectListView listView, OLVColumn column ) : List

Create a collection of clusters that should be presented to the user

CreateFilteringMenuItem ( OLVColumn column, List clusters ) : ToolStripMenuItem

Do the work of making a menu that shows the clusters to the users

EnactFilter ( BrightIdeasSoftware.ToolStripCheckedListBox checkedList, OLVColumn column ) : void

Apply the selected values from the given list as a filter on the given column

HandleItemChecked ( object sender, System.Windows.Forms.ItemCheckEventArgs e ) : void

Handle a user-generated ItemCheck event

HandleSelectAllItem ( System.Windows.Forms.ItemCheckEventArgs e, BrightIdeasSoftware.ToolStripCheckedListBox checkedList, int selectAllIndex ) : void

Handle any checking/unchecking of the Select All option, and keep its checkedness in sync with everything else that is checked.

SortClusters ( IClusteringStrategy strategy, List clusters ) : void

Order the given list of clusters in the manner in which they should be presented to the user.

Private Methods

Method Description
ClusterOneModel ( IClusteringStrategy strategy, ICluster>.NullableDictionary map, object model ) : void
HandleItemCheckedWrapped ( object sender, System.Windows.Forms.ItemCheckEventArgs e ) : void

Wrap a protected section around the real HandleItemChecked method, so that if that method tries to change a "checkedness" of an item, we don't get a recursive stack error. Effectively, this ensure that HandleItemChecked is only called in response to a user action.

Method Details

ClearAllFilters() protected method

Clear all the filters that are applied to the given column
protected ClearAllFilters ( OLVColumn column ) : void
column OLVColumn The column from which filters are to be removed
return void

Cluster() protected method

Create a collection of clusters that should be presented to the user
protected Cluster ( IClusteringStrategy strategy, ObjectListView listView, OLVColumn column ) : List
strategy IClusteringStrategy
listView ObjectListView
column OLVColumn
return List

CreateFilteringMenuItem() protected method

Do the work of making a menu that shows the clusters to the users
protected CreateFilteringMenuItem ( OLVColumn column, List clusters ) : ToolStripMenuItem
column OLVColumn
clusters List
return System.Windows.Forms.ToolStripMenuItem

EnactFilter() protected method

Apply the selected values from the given list as a filter on the given column
protected EnactFilter ( BrightIdeasSoftware.ToolStripCheckedListBox checkedList, OLVColumn column ) : void
checkedList BrightIdeasSoftware.ToolStripCheckedListBox A list in which the checked items should be used as filters
column OLVColumn The column for which a filter should be generated
return void

HandleItemChecked() protected method

Handle a user-generated ItemCheck event
protected HandleItemChecked ( object sender, System.Windows.Forms.ItemCheckEventArgs e ) : void
sender object
e System.Windows.Forms.ItemCheckEventArgs
return void

HandleSelectAllItem() protected method

Handle any checking/unchecking of the Select All option, and keep its checkedness in sync with everything else that is checked.
protected HandleSelectAllItem ( System.Windows.Forms.ItemCheckEventArgs e, BrightIdeasSoftware.ToolStripCheckedListBox checkedList, int selectAllIndex ) : void
e System.Windows.Forms.ItemCheckEventArgs
checkedList BrightIdeasSoftware.ToolStripCheckedListBox
selectAllIndex int
return void

MakeFilterMenu() public method

Create a Filter menu on the given tool tip for the given column in the given ObjectListView.
This is the main entry point into this class.
public MakeFilterMenu ( ToolStripDropDown strip, ObjectListView listView, OLVColumn column ) : ToolStripDropDown
strip System.Windows.Forms.ToolStripDropDown
listView ObjectListView
column OLVColumn
return System.Windows.Forms.ToolStripDropDown

SortClusters() protected method

Order the given list of clusters in the manner in which they should be presented to the user.
protected SortClusters ( IClusteringStrategy strategy, List clusters ) : void
strategy IClusteringStrategy
clusters List
return void

Property Details

APPLY_LABEL public_oe static_oe property

Gets or sets the string that labels the Apply button. Exposed so it can be localized.
public static string APPLY_LABEL
return string

CLEAR_ALL_FILTERS_LABEL public_oe static_oe property

Gets or sets the string that labels the Clear All menu item. Exposed so it can be localized.
public static string CLEAR_ALL_FILTERS_LABEL
return string

ClearFilteringImage public_oe static_oe property

Gets or sets the image that will be placed next to the Clear Filtering menu item
public static Bitmap,System.Drawing ClearFilteringImage
return System.Drawing.Bitmap

FILTERING_LABEL public_oe static_oe property

Gets or sets the string that labels the Filtering menu as a whole.. Exposed so it can be localized.
public static string FILTERING_LABEL
return string

FilteringImage public_oe static_oe property

Gets or sets the image that will be placed next to all "Apply" menu items on the filtering menu
public static Bitmap,System.Drawing FilteringImage
return System.Drawing.Bitmap

SELECT_ALL_LABEL public_oe static_oe property

Gets or sets the string that represents Select All values. If this is set to null or empty, no Select All option will be included. Exposed so it can be localized.
public static string SELECT_ALL_LABEL
return string