Skip to content

Commit

Permalink
additional methods to editable table columns
Browse files Browse the repository at this point in the history
  • Loading branch information
tomooda committed Mar 27, 2024
1 parent 9289c19 commit 491155b
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions src/ReMobidyc-Spec2/SpMorphicTableCellBuilder.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,62 @@ SpMorphicTableCellBuilder >> visitRMDPossessionalAgentDropListColumn: aDropListT
self addCellMorph: morph column: aDropListTableColumn
]

{ #category : #'*ReMobidyc-Spec2' }
SpMorphicTableCellBuilder >> visitRMDSyntaxColumn: aTableColumn [

| content item |
item := self item.

content := aTableColumn readObject: item.
"add properties"
content := self
addAlignmentColumn: aTableColumn
item: item
to: content.
content := self addColorColumn: aTableColumn item: item to: content.
content := self addItalicColumn: aTableColumn item: item to: content.
content := self addBoldColumn: aTableColumn item: item to: content.
content := self
addUnderlineColumn: aTableColumn
item: item
to: content.

aTableColumn isEditable
ifTrue: [
self visitRMDSyntaxColumnEditable: aTableColumn on: content ]
ifFalse: [ "add cell"
self addCell: content column: aTableColumn.
"add background (this is a special case of properties,
since background needs to be applied to the cell and not to the text)"
self
addBackgroundColorColumn: aTableColumn
item: item
toMorph: cell ]
]

{ #category : #'*ReMobidyc-Spec2' }
SpMorphicTableCellBuilder >> visitRMDSyntaxColumnEditable: aTableColumn on: content [

| presenter morph |
presenter := self dataSource model newTextInput
addStyle: 'compact';
text: content;
yourself.

"add cell"
morph := presenter build.
aTableColumn textChangedAction ifNotNil: [ :action |
presenter whenTextChangedDo: [ :text |
action cull: self item cull: text cull: morph ] ].
aTableColumn acceptAction ifNotNil: [ :action |
presenter whenSubmitDo: [ :text | action cull: self item cull: text ].
morph announcer
when: MorphLostFocus
do: [ action cull: self item cull: morph text ] ].
presenter adapter applyStyle.
self addCellMorph: morph column: aTableColumn
]

{ #category : #'*ReMobidyc-Spec2' }
SpMorphicTableCellBuilder >> visitRMDVariableOperatorDropListColumn: aDropListTableColumn [

Expand Down

0 comments on commit 491155b

Please sign in to comment.