DataFrame icon indicating copy to clipboard operation
DataFrame copied to clipboard

Extract DataFramePresenter into a class that can be reused

Open olekscode opened this issue 2 years ago • 0 comments

To inspect a DataFrame, we create a Spec table:

inspectionItems: aBuilder
	<inspectorPresentationOrder: 0 title: 'DataFrame'>

	| table |
	table := aBuilder newTable.

	table addColumn: (SpIndexTableColumn new
		title: '#';
		sortFunction: #yourself ascending;
		beNotExpandable;
		yourself).

	(self columnNames) doWithIndex: [ :headerName :columnIndex |
		table addColumn: (SpStringTableColumn
			title: headerName
			evaluated: [ :rowWithName | rowWithName at: columnIndex + 1 ]) ].

	table items: self asArrayOfRowsWithName.

	^ table

It would be nice to extract this table into a separate class DataFramePresenter that could be reused in different applications to display data frames. In future, we could make this presenter cooler by adding more features (filtering, sorting, searching, etc.)

olekscode avatar Jun 01 '23 20:06 olekscode