'From Pharo1.4a of ''16 June 2011'' [Latest update: #14284] on 7 March 2012 at 10:55:38 am'!
MorphTreeModel subclass: #MixedTreeGridExample
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Morphic-MorphTreeWidget-Examples'!

!MixedTreeGridExample commentStamp: 'AlexisParseghian 3/7/2012 10:32' prior: 0!
MixedTreeGridExample new open

This example implements the strictest minimum required to show a multi-column grid with a hierarchical tree in the first column.
#rootItems provides a collection of items to show ; here it's the list of packages in the system. How to show them is provided by the class returned by #rootNodeClassFromItem:. See MixedTreeGridPkgNodeExample for the first level (packages).!

MorphTreeNodeModel subclass: #MixedTreeGridMethodNodeExample
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Morphic-MorphTreeWidget-Examples'!

!MixedTreeGridMethodNodeExample commentStamp: 'AlexisParseghian 3/7/2012 10:47' prior: 0!
Instances of this class are used to display the tabular data in MixedTreeGridExample's tree morph. They correspond to the last level of expansion in the first column's hierarchical view. In opposition to the previous levels' nodes (MixedTreeGridClassNodeExample, MixedTreeGridPkgNodeExample), it is the first column (hierarchical view) that returns nil and the other columns that return a theme-based morph to display in the corresponding column.!

MorphTreeNodeModel subclass: #MixedTreeGridPkgNodeExample
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Morphic-MorphTreeWidget-Examples'!

!MixedTreeGridPkgNodeExample commentStamp: 'AlexisParseghian 3/7/2012 10:38' prior: 0!
Instances of this class are used by MixedTreeGridExample's tree to display its first-level (packages) items. Accessors for all of the columns defined in the tree morph must be implemented but may return nil. 
#childrenItems return the collection of items to display when a given first-level item is expanded : here classes in a given package. #childNodeClassFromItem: returns the class used to display earch item returned by #childrenItem ; this is the nth-level equivalent of #rootItems/#rootNodeClassFromItem:!

MorphTreeNodeModel subclass: #MixedTreeGridClassNodeExample
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Morphic-MorphTreeWidget-Examples'!

!MixedTreeGridClassNodeExample commentStamp: 'AlexisParseghian 3/7/2012 10:44' prior: 0!
Instances of this class are used by MixedTreeGridExample's tree morph to display second-level items (classes) in its first column when a first-level item (package) is expanded.!


!MixedTreeGridExample methodsFor: 'as yet unclassified' stamp: 'AlexisParseghian 3/7/2012 10:33'!
rootItems
	"return a collection of items to show"
	^ PackageOrganizer default packages! !

!MixedTreeGridExample methodsFor: 'as yet unclassified' stamp: 'AlexisParseghian 3/7/2012 10:33'!
rootNodeClassFromItem: anItem
	"return the class used to show each item returned by rootItems"
	^ MixedTreeGridPkgNodeExample! !

!MixedTreeGridExample methodsFor: 'user interface' stamp: 'AlexisParseghian 3/7/2012 01:02'!
open
	(self treeMorph buildContents;
		embeddedInMorphicWindowLabeled: 'Mixed Tree and Grid example') openInWorld.! !

!MixedTreeGridExample methodsFor: 'user interface' stamp: 'AlexisParseghian 3/7/2012 01:19'!
treeMorph
	| tree |
	tree := (MorphTreeMorph on: self)
		columns: {
			MorphTreeColumn new
				rowMorphGetSelector: #hierachyColumn;
				headerButtonLabel: 'Hierarchy' font: nil.
			MorphTreeColumn new
				rowMorphGetSelector: #category;
				headerButtonLabel: 'Category' font: nil.
			MorphTreeColumn new
				rowMorphGetSelector: #methodName;
				headerButtonLabel: 'Selector' font: nil.
			MorphTreeColumn new
				rowMorphGetSelector: #linesCount;
				headerButtonLabel: 'Lines' font: nil
		};
		columnInset: 3.
	^ tree! !


!MixedTreeGridMethodNodeExample methodsFor: 'user interface' stamp: 'AlexisParseghian 3/7/2012 10:51'!
category
	"use theme newTextIn:text: or other theme-provided morphs ; others might not be properly clipped 
	to the column width, and/or respect the tree morph's inset specifications. See instance methods of UITheme
	in package Polymorph-Widgets-Themes for what kind of morphs can be properly shown."
	^ self theme newTextIn: self text: self item category! !

!MixedTreeGridMethodNodeExample methodsFor: 'user interface' stamp: 'AlexisParseghian 3/7/2012 10:47'!
hierachyColumn
	"do not show anything in the hierarchical view at this level"
	^ nil! !

!MixedTreeGridMethodNodeExample methodsFor: 'user interface' stamp: 'AlexisParseghian 3/7/2012 01:39'!
linesCount
	^ self theme newTextIn: self text: self item asString lineCount printString! !

!MixedTreeGridMethodNodeExample methodsFor: 'user interface' stamp: 'AlexisParseghian 3/7/2012 01:34'!
methodName
	^ self theme newTextIn: self text: self item selector! !


!MixedTreeGridPkgNodeExample methodsFor: 'accessing' stamp: 'AlexisParseghian 3/7/2012 01:16'!
childNodeClassFromItem: anItem
	^ MixedTreeGridClassNodeExample! !

!MixedTreeGridPkgNodeExample methodsFor: 'accessing' stamp: 'AlexisParseghian 3/7/2012 01:15'!
childrenItems
	^ self item classes! !

!MixedTreeGridPkgNodeExample methodsFor: 'user interface' stamp: 'AlexisParseghian 3/7/2012 01:19'!
category
	^ nil! !

!MixedTreeGridPkgNodeExample methodsFor: 'user interface' stamp: 'AlexisParseghian 3/7/2012 01:15'!
hierachyColumn
	^ self theme newTextIn: self text: self item packageName! !

!MixedTreeGridPkgNodeExample methodsFor: 'user interface' stamp: 'AlexisParseghian 3/7/2012 01:14'!
linesCount
	^ nil! !

!MixedTreeGridPkgNodeExample methodsFor: 'user interface' stamp: 'AlexisParseghian 3/7/2012 01:13'!
methodName
	^ nil! !


!MixedTreeGridClassNodeExample methodsFor: 'user interface' stamp: 'AlexisParseghian 3/7/2012 01:22'!
category
	^ nil! !

!MixedTreeGridClassNodeExample methodsFor: 'user interface' stamp: 'AlexisParseghian 3/7/2012 01:22'!
hierachyColumn
	^ self theme newTextIn: self text: self item printString! !

!MixedTreeGridClassNodeExample methodsFor: 'user interface' stamp: 'AlexisParseghian 3/7/2012 01:23'!
linesCount
	^ nil! !

!MixedTreeGridClassNodeExample methodsFor: 'user interface' stamp: 'AlexisParseghian 3/7/2012 01:23'!
methodName
	^ nil! !

!MixedTreeGridClassNodeExample methodsFor: 'as yet unclassified' stamp: 'AlexisParseghian 3/7/2012 01:25'!
childNodeClassFromItem: anItem
	^ MixedTreeGridMethodNodeExample! !

!MixedTreeGridClassNodeExample methodsFor: 'as yet unclassified' stamp: 'AlexisParseghian 3/7/2012 01:27'!
childrenItems
	^ self item methods! !


!MixedTreeGridPkgNodeExample reorganize!
('accessing' childNodeClassFromItem: childrenItems)
('user interface' category hierachyColumn linesCount methodName)
!


!MixedTreeGridExample reorganize!
('as yet unclassified' rootItems rootNodeClassFromItem:)
('user interface' open treeMorph)
!

