Skip to content

Commit

Permalink
Merge pull request pharo-spec#1701 from Ducasse/2025-01-18-Bottom
Browse files Browse the repository at this point in the history
P13: Introduce metadata and properties support in SpAbstractPresenter…
  • Loading branch information
Ducasse authored Jan 18, 2025
2 parents 9d2024a + 352ba00 commit b77e044
Showing 1 changed file with 72 additions and 2 deletions.
74 changes: 72 additions & 2 deletions src/Spec2-Core/SpAbstractPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Class {
'owner',
'adapter',
'needRebuild',
'eventHandler'
'eventHandler',
'properties'
],
#category : 'Spec2-Core-Base',
#package : 'Spec2-Core',
Expand Down Expand Up @@ -303,7 +304,9 @@ SpAbstractPresenter >> initialize [

self class initializeSlots: self.
super initialize.
needRebuild := true
needRebuild := true.
"in the future we could use a trait TProperties"
properties := SmallDictionary new.
]

{ #category : 'initialization' }
Expand Down Expand Up @@ -458,12 +461,79 @@ SpAbstractPresenter >> owner: aPresenter [
owner := aPresenter
]

{ #category : 'properties' }
SpAbstractPresenter >> properties [

^ properties
]

{ #category : 'properties' }
SpAbstractPresenter >> propertyAt: aKey [

^ self properties at: aKey
]

{ #category : 'properties' }
SpAbstractPresenter >> propertyAt: aKey ifAbsent: aBlock [
"Answer the property value associated with aKey or, if aKey isn't found, answer the result of evaluating aBlock."

^ properties at: aKey ifAbsent: aBlock
]

{ #category : 'properties' }
SpAbstractPresenter >> propertyAt: aKey ifAbsentPut: aBlock [

^ self properties
at: aKey
ifAbsentPut: aBlock
]

{ #category : 'properties' }
SpAbstractPresenter >> propertyAt: aKey ifPresent: aBlock [

^ self properties
at: aKey
ifPresent: aBlock
]

{ #category : 'properties' }
SpAbstractPresenter >> propertyAt: aKey ifPresent: aBlock ifAbsent: absentBlock [

^ self properties
at: aKey
ifPresent: aBlock
ifAbsent: absentBlock
]

{ #category : 'properties' }
SpAbstractPresenter >> propertyAt: aKey ifPresent: aBlock ifAbsentPut: absentBlock [

^ self properties
at: aKey
ifPresent: aBlock
ifAbsentPut: absentBlock
]

{ #category : 'properties' }
SpAbstractPresenter >> propertyAt: aKey put: aValue [

^ self properties
at: aKey
put: aValue
]

{ #category : 'private - utilities' }
SpAbstractPresenter >> rawValueHolderNamed: aSymbol [

^ (self class slotNamed: aSymbol) rawRead: self.
]

{ #category : 'properties' }
SpAbstractPresenter >> removeProperty: aName [

^ self properties removeKey: aName ifAbsent: [ ]
]

{ #category : 'private - building' }
SpAbstractPresenter >> retrieveLayout: aSelector [
| layout |
Expand Down

0 comments on commit b77e044

Please sign in to comment.