-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Pharo13' into 1670-Introduce-a-common-stCommand-superclass
- Loading branch information
Showing
69 changed files
with
1,204 additions
and
220 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
src/Spec2-Adapters-Morphic-ListView/SpMorphicColumnViewAdapter.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
Class { | ||
#name : 'SpMorphicColumnViewAdapter', | ||
#superclass : 'SpMorphicTableAdapter', | ||
#category : 'Spec2-Adapters-Morphic-ListView', | ||
#package : 'Spec2-Adapters-Morphic-ListView' | ||
} | ||
|
||
{ #category : 'factory' } | ||
SpMorphicColumnViewAdapter >> addModelTo: tableMorph [ | ||
|
||
"no search on column view (it has to be provided elsewhere)" | ||
tableMorph disableFunction. | ||
|
||
self model columns do: [ :each | | ||
tableMorph addColumn: (self newColumnFrom: each) ]. | ||
self ensureAtLeastOneColumnIn: tableMorph. | ||
|
||
self isResizable | ||
ifTrue: [ tableMorph beResizable ] | ||
ifFalse: [ tableMorph beNotResizable ]. | ||
|
||
tableMorph setMultipleSelection: self model isMultipleSelection. | ||
|
||
self refreshShowColumnHeaders. | ||
self refreshWidgetSelection. | ||
|
||
self presenter whenModelChangedDo: [ self refreshModel ]. | ||
self presenter whenColumnsChangedDo: [ self refreshColumnsInWidget ]. | ||
|
||
tableMorph setBalloonText: self help. | ||
|
||
self configureScrolling. | ||
|
||
tableMorph | ||
onAnnouncement: FTSelectionChanged | ||
send: #selectionChanged: | ||
to: self; | ||
onAnnouncement: FTStrongSelectionChanged | ||
send: #strongSelectionChanged: | ||
to: self. | ||
|
||
tableMorph dataSource: self newDataSource. | ||
|
||
self presenter whenSearchEnabledChangedDo: [ | ||
self updateSearch ] | ||
] | ||
|
||
{ #category : 'testing' } | ||
SpMorphicColumnViewAdapter >> isResizable [ | ||
|
||
^ self presenter isResizable | ||
] | ||
|
||
{ #category : 'private - factory' } | ||
SpMorphicColumnViewAdapter >> newColumnFrom: aColumnViewColumn [ | ||
|
||
^ (SpMorphicColumnViewColumn on: aColumnViewColumn) | ||
width: aColumnViewColumn width; | ||
yourself | ||
] | ||
|
||
{ #category : 'private - factory' } | ||
SpMorphicColumnViewAdapter >> newDataSource [ | ||
|
||
^ SpMorphicColumnViewDataSource new | ||
model: self presenter; | ||
yourself | ||
] |
30 changes: 30 additions & 0 deletions
30
src/Spec2-Adapters-Morphic-ListView/SpMorphicColumnViewColumn.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Class { | ||
#name : 'SpMorphicColumnViewColumn', | ||
#superclass : 'SpMorphicTableColumn', | ||
#category : 'Spec2-Adapters-Morphic-ListView', | ||
#package : 'Spec2-Adapters-Morphic-ListView' | ||
} | ||
|
||
{ #category : 'private' } | ||
SpMorphicColumnViewColumn >> bindAction [ | ||
|
||
^ self model bindAction | ||
] | ||
|
||
{ #category : 'testing' } | ||
SpMorphicColumnViewColumn >> isExpandable [ | ||
|
||
^ self model isExpand | ||
] | ||
|
||
{ #category : 'accessing' } | ||
SpMorphicColumnViewColumn >> model: aColumnViewColumn [ | ||
|
||
model := aColumnViewColumn | ||
] | ||
|
||
{ #category : 'private' } | ||
SpMorphicColumnViewColumn >> setupAction [ | ||
|
||
^ self model setupAction | ||
] |
45 changes: 45 additions & 0 deletions
45
src/Spec2-Adapters-Morphic-ListView/SpMorphicColumnViewDataSource.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
Class { | ||
#name : 'SpMorphicColumnViewDataSource', | ||
#superclass : 'SpMorphicTableDataSource', | ||
#instVars : [ | ||
'rowHeights' | ||
], | ||
#category : 'Spec2-Adapters-Morphic-ListView', | ||
#package : 'Spec2-Adapters-Morphic-ListView' | ||
} | ||
|
||
{ #category : 'accessing' } | ||
SpMorphicColumnViewDataSource >> cellColumn: column row: rowIndex [ | ||
| cell contentPresenter contentMorph | | ||
|
||
cell := FTCellMorph new. | ||
|
||
contentPresenter := column setupAction value: self model. | ||
column bindAction | ||
value: contentPresenter | ||
value: (self elementAt: rowIndex). | ||
|
||
contentMorph := contentPresenter build. | ||
|
||
"register for height" | ||
rowHeights at: rowIndex put: contentMorph height. | ||
|
||
self setHeaderColumnLazyProperties: column. | ||
|
||
^ cell addMorphBack: contentMorph | ||
] | ||
|
||
{ #category : 'initialization' } | ||
SpMorphicColumnViewDataSource >> initialize [ | ||
|
||
super initialize. | ||
rowHeights := Dictionary new | ||
] | ||
|
||
{ #category : 'accessing' } | ||
SpMorphicColumnViewDataSource >> rowHeight: index [ | ||
|
||
^ rowHeights | ||
at: index | ||
ifAbsent: [ super rowHeight: index ] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/Spec2-Adapters-Morphic-ListView/SpMorphicTreeColumnViewAdapter.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Class { | ||
#name : 'SpMorphicTreeColumnViewAdapter', | ||
#superclass : 'SpMorphicTreeTableAdapter', | ||
#category : 'Spec2-Adapters-Morphic-ListView', | ||
#package : 'Spec2-Adapters-Morphic-ListView' | ||
} | ||
|
||
{ #category : 'private - factory' } | ||
SpMorphicTreeColumnViewAdapter >> newColumnFrom: aTableColumn [ | ||
|
||
^ (SpMorphicColumnViewColumn on: aTableColumn) | ||
width: aTableColumn width; | ||
yourself | ||
] | ||
|
||
{ #category : 'private - factory' } | ||
SpMorphicTreeColumnViewAdapter >> newDataSource [ | ||
|
||
^ SpMorphicTreeColumnViewDataSource new | ||
model: self model; | ||
rootItem: (self rootForItems: self model roots); | ||
childrenBlock: [ :data :item | self model childrenFor: data ]; | ||
yourself | ||
] |
57 changes: 57 additions & 0 deletions
57
src/Spec2-Adapters-Morphic-ListView/SpMorphicTreeColumnViewDataSource.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
Class { | ||
#name : 'SpMorphicTreeColumnViewDataSource', | ||
#superclass : 'SpMorphicTreeTableDataSource', | ||
#instVars : [ | ||
'rowHeights' | ||
], | ||
#category : 'Spec2-Adapters-Morphic-ListView', | ||
#package : 'Spec2-Adapters-Morphic-ListView' | ||
} | ||
|
||
{ #category : 'accessing' } | ||
SpMorphicTreeColumnViewDataSource >> cellColumn: column row: rowIndex [ | ||
| cell item contentPresenter contentMorph | | ||
|
||
item := self elementAt: rowIndex. | ||
|
||
cell := FTIndentedCellMorph new. | ||
(self isFirstColumn: column) ifTrue: [ | ||
cell indentBy: (self cellIndentFor: item). | ||
cell addMorphBack: (self buttonFor: item) ]. | ||
|
||
contentPresenter := column setupAction value: self model. | ||
column bindAction | ||
value: contentPresenter | ||
value: item data. | ||
|
||
contentMorph := contentPresenter build. | ||
|
||
"register for height" | ||
rowHeights at: rowIndex put: contentMorph height. | ||
|
||
self setHeaderColumnLazyProperties: column. | ||
|
||
^ cell addMorphBack: contentMorph | ||
] | ||
|
||
{ #category : 'initialization' } | ||
SpMorphicTreeColumnViewDataSource >> initialize [ | ||
|
||
super initialize. | ||
rowHeights := Dictionary new | ||
] | ||
|
||
{ #category : 'accessing' } | ||
SpMorphicTreeColumnViewDataSource >> rowHeight: index [ | ||
|
||
^ rowHeights | ||
at: index | ||
ifAbsent: [ super rowHeight: index ] | ||
] | ||
|
||
{ #category : 'testing' } | ||
SpMorphicTreeColumnViewDataSource >> shouldDisplayExpandableArrowFor: item [ | ||
|
||
^ (self canDisplayChildrenOf: item) | ||
and: [ item hasChildren ] | ||
] |
85 changes: 85 additions & 0 deletions
85
src/Spec2-Adapters-Morphic-ListView/SpMorphicTreeListViewAdapter.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
Class { | ||
#name : 'SpMorphicTreeListViewAdapter', | ||
#superclass : 'SpMorphicTreeAdapter', | ||
#category : 'Spec2-Adapters-Morphic-ListView', | ||
#package : 'Spec2-Adapters-Morphic-ListView' | ||
} | ||
|
||
{ #category : 'factory' } | ||
SpMorphicTreeListViewAdapter >> addModelTo: tableMorph [ | ||
|
||
tableMorph addColumn: (self newColumnFrom: self defaultColumn). | ||
|
||
self presenter selection isMultipleSelection ifTrue: [ | ||
tableMorph beMultipleSelection ]. | ||
|
||
self isShowingColumnHeaders | ||
ifTrue: [ tableMorph showColumnHeaders ] | ||
ifFalse: [ tableMorph hideColumnHeaders ]. | ||
|
||
self isSearchEnabled | ||
ifTrue: [ tableMorph enableSearch ] | ||
ifFalse: [ tableMorph disableFunction ]. | ||
|
||
tableMorph setBalloonText: self model help. | ||
|
||
tableMorph dataSource: self newDataSource. | ||
|
||
self presenter selection isEmpty | ||
ifFalse: [ self updateSelectionOf: tableMorph ]. | ||
|
||
self presenter whenSelectionChangedDo: [ | ||
self updateSelectionOf: tableMorph ]. | ||
|
||
self presenter whenRootsChangedDo: [ | ||
tableMorph selectIndexes: #(). | ||
tableMorph dataSource: self newDataSource ]. | ||
|
||
tableMorph | ||
onAnnouncement: FTSelectionChanged | ||
send: #selectionChanged: | ||
to: self; | ||
onAnnouncement: FTStrongSelectionChanged | ||
send: #strongSelectionChanged: | ||
to: self | ||
] | ||
|
||
{ #category : 'factory' } | ||
SpMorphicTreeListViewAdapter >> defaultColumn [ | ||
|
||
^ SpColumnViewColumn new | ||
title: self presenter headerTitle; | ||
setup: self presenter setupAction; | ||
bind: self presenter bindAction; | ||
yourself | ||
] | ||
|
||
{ #category : 'testing' } | ||
SpMorphicTreeListViewAdapter >> isResizable [ | ||
|
||
^ false | ||
] | ||
|
||
{ #category : 'testing' } | ||
SpMorphicTreeListViewAdapter >> isShowingColumnHeaders [ | ||
|
||
^ self presenter hasHeaderTitle | ||
] | ||
|
||
{ #category : 'private - factory' } | ||
SpMorphicTreeListViewAdapter >> newColumnFrom: aTableColumn [ | ||
|
||
^ (SpMorphicColumnViewColumn on: aTableColumn) | ||
width: aTableColumn width; | ||
yourself | ||
] | ||
|
||
{ #category : 'private - factory' } | ||
SpMorphicTreeListViewAdapter >> newDataSource [ | ||
|
||
^ SpMorphicTreeColumnViewDataSource new | ||
model: self model; | ||
rootItem: (self rootForItems: self model roots); | ||
childrenBlock: [ :data :item | self model childrenFor: data ]; | ||
yourself | ||
] |
13 changes: 0 additions & 13 deletions
13
src/Spec2-Adapters-Morphic/MorphicAPartTreeTableAdapter.class.st
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.