Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 766-Allow-to-add-an-image-in-the-layout-wi…
…thout-declaring-an-image-presenter
- Loading branch information
Showing
70 changed files
with
1,253 additions
and
356 deletions.
There are no files selected for viewing
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
114 changes: 114 additions & 0 deletions
114
src/Spec2-Adapters-Morphic/SpComponentListFastTableDataSource.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,114 @@ | ||
Class { | ||
#name : #SpComponentListFastTableDataSource, | ||
#superclass : #FTDataSource, | ||
#instVars : [ | ||
'model' | ||
], | ||
#category : #'Spec2-Adapters-Morphic-ComponentList' | ||
} | ||
|
||
{ #category : #accessing } | ||
SpComponentListFastTableDataSource >> cellColumn: column row: rowIndex [ | ||
| displayValue cell item | | ||
item := self model presenters at: rowIndex. | ||
cell := FTCellMorph new | ||
cellInset: 5; | ||
yourself. | ||
cell addMorphBack: item buildWithSpec. | ||
^ cell | ||
] | ||
|
||
{ #category : #accessing } | ||
SpComponentListFastTableDataSource >> elementAt: rowIndex [ | ||
|
||
^ self listModel at: rowIndex | ||
] | ||
|
||
{ #category : #accessing } | ||
SpComponentListFastTableDataSource >> elements [ | ||
|
||
^ self model items | ||
] | ||
|
||
{ #category : #accessing } | ||
SpComponentListFastTableDataSource >> headerColumn: column [ | ||
column id ifNil: [ ^ nil ]. | ||
^ FTCellMorph new | ||
listCentering: #center; | ||
addMorph: column id asMorph asReadOnlyMorph; | ||
yourself | ||
] | ||
|
||
{ #category : #accessing } | ||
SpComponentListFastTableDataSource >> listModel [ | ||
^ model model | ||
] | ||
|
||
{ #category : #accessing } | ||
SpComponentListFastTableDataSource >> menuColumn: column row: rowIndex [ | ||
| menuPresenter | | ||
|
||
menuPresenter := self model contextMenu. | ||
menuPresenter ifNil: [ ^ nil ]. | ||
^ SpBindings | ||
value: self model application adapterBindings | ||
during: [ | ||
| m | | ||
m := menuPresenter value. | ||
m isMorph | ||
ifTrue: [ m ] | ||
ifFalse: [ m buildWithSpec ] ] | ||
] | ||
|
||
{ #category : #accessing } | ||
SpComponentListFastTableDataSource >> model [ | ||
^ model | ||
] | ||
|
||
{ #category : #accessing } | ||
SpComponentListFastTableDataSource >> model: anObject [ | ||
model := anObject | ||
] | ||
|
||
{ #category : #accessing } | ||
SpComponentListFastTableDataSource >> newDataSourceMatching: aFTFilter [ | ||
| newElements wrappedItem text newDataSource modelCopy | | ||
|
||
newElements := self elements select: [ :each | | ||
wrappedItem := self model displayValueOf: each. | ||
table columns anySatisfy: [ :column | | ||
text := column transform: wrappedItem. | ||
aFTFilter matches: text]]. | ||
|
||
newDataSource := self copy. | ||
modelCopy := self model copy. | ||
modelCopy prepareForFilteredDataSourceWith: newElements. | ||
newDataSource model: modelCopy. | ||
|
||
^newDataSource | ||
] | ||
|
||
{ #category : #accessing } | ||
SpComponentListFastTableDataSource >> numberOfRows [ | ||
^ model | ||
ifNil: [ 0 ] | ||
ifNotNil: [ model presenters size ] | ||
] | ||
|
||
{ #category : #accessing } | ||
SpComponentListFastTableDataSource >> searchText: aString [ | ||
| search text result | | ||
aString isEmptyOrNil ifTrue: [ ^ #() ]. | ||
result := OrderedCollection new. | ||
search := aString trimBoth asLowercase. | ||
1 to: self numberOfRows do: [ :rowIndex | | ||
text := (self model displayValueAt: rowIndex) contents trimBoth asLowercase. | ||
(text beginsWith: search) | ||
ifTrue: [ result add: rowIndex ] ]. | ||
^ result asArray | ||
] | ||
|
||
{ #category : #'drag and drop' } | ||
SpComponentListFastTableDataSource >> transferFor: passenger from: aMorph [ | ||
^(self model transferFor: passenger from: self table) buildWithSpec | ||
] |
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
38 changes: 38 additions & 0 deletions
38
src/Spec2-Adapters-Morphic/SpMorphicComponentListAdapter.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,38 @@ | ||
Class { | ||
#name : #SpMorphicComponentListAdapter, | ||
#superclass : #SpAbstractMorphicAdapter, | ||
#category : #'Spec2-Adapters-Morphic-ComponentList' | ||
} | ||
|
||
{ #category : #factory } | ||
SpMorphicComponentListAdapter >> buildWidget [ | ||
|
||
| datasource | | ||
datasource := SpComponentListFastTableDataSource new. | ||
datasource model: self model. | ||
widget := FTTableMorph new | ||
dataSource: datasource; | ||
hideColumnHeaders; | ||
hResizing: #spaceFill; | ||
vResizing: #spaceFill; | ||
setBalloonText: self help; | ||
yourself. | ||
self presenter whenPresentersChangedDo: [ widget refresh ]. | ||
^ widget | ||
] | ||
|
||
{ #category : #accessing } | ||
SpMorphicComponentListAdapter >> children [ | ||
|
||
^ self rows collect: [ :row | | cell | | ||
cell := row submorphs first. | ||
cell submorphs first ] | ||
] | ||
|
||
{ #category : #accessing } | ||
SpMorphicComponentListAdapter >> rows [ | ||
|
||
| tableContainer | | ||
tableContainer := self widget submorphs first. | ||
^ tableContainer submorphs | ||
] |
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
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.