From d7d4d437eea25c9d092fac969fb2c1192e434188 Mon Sep 17 00:00:00 2001 From: Pierre Laborde Date: Thu, 18 Jul 2024 16:43:39 +0200 Subject: [PATCH 01/10] Update toplo branch --- .../BaselineOfToploSerialization.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BaselineOfToploSerialization/BaselineOfToploSerialization.class.st b/src/BaselineOfToploSerialization/BaselineOfToploSerialization.class.st index 6dcab74..2bc8a88 100644 --- a/src/BaselineOfToploSerialization/BaselineOfToploSerialization.class.st +++ b/src/BaselineOfToploSerialization/BaselineOfToploSerialization.class.st @@ -29,7 +29,7 @@ BaselineOfToploSerialization >> dependency: spec [ with: [ spec repository: 'github://OpenSmock/Bloc-Serialization:main/src' ]. - spec baseline: 'Toplo' with: [ spec repository: 'github://pharo-graphics/Toplo:master/src' ]. + spec baseline: 'Toplo' with: [ spec repository: 'github://pharo-graphics/Toplo:dev/src' ]. ] From f40b8f1b6e88313f4f68f866ba3a1f3f3bd7e94b Mon Sep 17 00:00:00 2001 From: Yann Le Goff Date: Fri, 19 Jul 2024 11:56:07 +0200 Subject: [PATCH 02/10] remove useless tests --- .../ToCheckbox.extension.st | 2 +- .../ToSerializerTest.class.st | 59 +++++-------------- 2 files changed, 16 insertions(+), 45 deletions(-) diff --git a/src/Toplo-Serialization/ToCheckbox.extension.st b/src/Toplo-Serialization/ToCheckbox.extension.st index 814a0e8..b70acb8 100644 --- a/src/Toplo-Serialization/ToCheckbox.extension.st +++ b/src/Toplo-Serialization/ToCheckbox.extension.st @@ -8,7 +8,7 @@ ToCheckbox >> stonPostReferenceResolution [ self checked: aCheckValue. self userData removeKey: #stonChecked ]. self userData at: #stonGroup ifPresent: [ :aGroup | - aGroup add: self. + aGroup register: self. self userData removeKey: #stonGroup ] ] diff --git a/src/Toplo-Serialization/ToSerializerTest.class.st b/src/Toplo-Serialization/ToSerializerTest.class.st index ed5c15f..4bf2775 100644 --- a/src/Toplo-Serialization/ToSerializerTest.class.st +++ b/src/Toplo-Serialization/ToSerializerTest.class.st @@ -260,17 +260,17 @@ ToSerializerTest >> testToCheckbox4 [ button1 := ToCheckbox new id: #button1; labelText: 'button1'; - addToGroup: group; + registerInGroup: group; yourself. button2 := ToCheckbox new id: #button2; labelText: 'button2'; - addToGroup: group; + registerInGroup: group; yourself. button3 := ToCheckbox new id: #button3; labelText: 'button3'; - addToGroup: group; + registerInGroup: group; yourself. pane addChildren: { button1. @@ -294,13 +294,17 @@ ToSerializerTest >> testToCheckbox4 [ assert: (element childAt: 2) group equals: (element childAt: 3) group. self - assert: (element childAt: 1) group buttons size equals: 3. - self - assert: ((element childAt: 1) group buttons includes: (element childAt: 1)). - self - assert: ((element childAt: 1) group buttons includes: (element childAt: 2)). - self - assert: ((element childAt: 1) group buttons includes: (element childAt: 3)). ] + assert: (element childAt: 1) group registeredCheckables size + equals: 3. + self assert: + ((element childAt: 1) group registeredCheckables includes: + (element childAt: 1)). + self assert: + ((element childAt: 1) group registeredCheckables includes: + (element childAt: 2)). + self assert: + ((element childAt: 1) group registeredCheckables includes: + (element childAt: 3)) ] ] { #category : #tests } @@ -344,39 +348,6 @@ ToSerializerTest >> testTooltip1 [ { #category : #tests } ToSerializerTest >> testTooltip2 [ - | origin tooltip | - tooltip := BlElement new id: #tooltip; yourself. - origin := ToElement new tooltipContent: tooltip; yourself. - - self - test: origin - on: [ :element | self assert: element hasTooltip. - element newTooltipWindowEvent: nil. - self assert: element hasOpenedTooltip. - self assert: ((element currentTooltipWindow childAt: 1 ) childAt: 1) id equals: #tooltip - ] -] - -{ #category : #tests } -ToSerializerTest >> testTooltip3 [ - - | origin | - origin := ToElement new - tooltipText: 'hello tooltip'; - yourself. - - self test: origin on: [ :element | - self assert: element hasTooltip. - element newTooltipWindowEvent: nil. - self assert: element hasOpenedTooltip. - self - assert: ((element currentTooltipWindow childAt: 1) childAt: 1) text asString - equals: 'hello tooltip' ] -] - -{ #category : #tests } -ToSerializerTest >> testTooltip4 [ - | origin | origin := ToElement new tooltipText: 'hello tooltip'; @@ -389,7 +360,7 @@ ToSerializerTest >> testTooltip4 [ ] { #category : #tests } -ToSerializerTest >> testTooltip5 [ +ToSerializerTest >> testTooltip3 [ | origin | origin := ToElement new From ad84e3d5cd1d1085a4f5e393aeaeadc5265d9c29 Mon Sep 17 00:00:00 2001 From: Yann Le Goff Date: Fri, 19 Jul 2024 14:26:01 +0200 Subject: [PATCH 03/10] Project setup --- .../ToButton.extension.st | 4 +-- .../ToCheckableGroup.extension.st | 6 ++-- .../ToCheckbox.extension.st | 4 +-- .../ToElement.extension.st | 34 +++++++++++++++++++ .../ToImage.extension.st | 4 +-- .../ToLabel.extension.st | 4 +-- .../ToLabeledIcon.extension.st | 4 +-- src/Toplo-Serialization-STON/package.st | 1 + .../BlElement.extension.st | 30 ++++++++++++++++ .../TToCheckable.extension.st | 11 ++++++ .../TToElementWithLabeledIcon.extension.st | 25 ++++++++++++++ .../TToElementWithTooltip.extension.st | 8 +++++ .../TToEnableable.extension.st | 8 +++++ .../ToCheckableGroup.extension.st | 8 +++++ .../ToImage.extension.st | 8 +++++ .../ToLabel.extension.st | 8 +++++ .../ToObservableCollection.extension.st | 10 ++++++ src/Toplo-Serialization-Stash/package.st | 1 + .../ToElementWithLeafForTesting.class.st | 2 +- .../ToSerializerTest.class.st | 2 +- src/Toplo-Serialization-Tests/package.st | 1 + .../ToElement.extension.st | 33 ------------------ 22 files changed, 168 insertions(+), 48 deletions(-) rename src/{Toplo-Serialization => Toplo-Serialization-STON}/ToButton.extension.st (86%) rename src/{Toplo-Serialization => Toplo-Serialization-STON}/ToCheckableGroup.extension.st (79%) rename src/{Toplo-Serialization => Toplo-Serialization-STON}/ToCheckbox.extension.st (87%) create mode 100644 src/Toplo-Serialization-STON/ToElement.extension.st rename src/{Toplo-Serialization => Toplo-Serialization-STON}/ToImage.extension.st (82%) rename src/{Toplo-Serialization => Toplo-Serialization-STON}/ToLabel.extension.st (81%) rename src/{Toplo-Serialization => Toplo-Serialization-STON}/ToLabeledIcon.extension.st (86%) create mode 100644 src/Toplo-Serialization-STON/package.st create mode 100644 src/Toplo-Serialization-Stash/BlElement.extension.st create mode 100644 src/Toplo-Serialization-Stash/TToCheckable.extension.st create mode 100644 src/Toplo-Serialization-Stash/TToElementWithLabeledIcon.extension.st create mode 100644 src/Toplo-Serialization-Stash/TToElementWithTooltip.extension.st create mode 100644 src/Toplo-Serialization-Stash/TToEnableable.extension.st create mode 100644 src/Toplo-Serialization-Stash/ToCheckableGroup.extension.st create mode 100644 src/Toplo-Serialization-Stash/ToImage.extension.st create mode 100644 src/Toplo-Serialization-Stash/ToLabel.extension.st create mode 100644 src/Toplo-Serialization-Stash/ToObservableCollection.extension.st create mode 100644 src/Toplo-Serialization-Stash/package.st rename src/{Toplo-Serialization => Toplo-Serialization-Tests}/ToElementWithLeafForTesting.class.st (61%) rename src/{Toplo-Serialization => Toplo-Serialization-Tests}/ToSerializerTest.class.st (99%) create mode 100644 src/Toplo-Serialization-Tests/package.st diff --git a/src/Toplo-Serialization/ToButton.extension.st b/src/Toplo-Serialization-STON/ToButton.extension.st similarity index 86% rename from src/Toplo-Serialization/ToButton.extension.st rename to src/Toplo-Serialization-STON/ToButton.extension.st index fa51548..a08217b 100644 --- a/src/Toplo-Serialization/ToButton.extension.st +++ b/src/Toplo-Serialization-STON/ToButton.extension.st @@ -1,6 +1,6 @@ Extension { #name : #ToButton } -{ #category : #'*Toplo-Serialization' } +{ #category : #'*Toplo-Serialization-STON' } ToButton >> stonPostReferenceResolution [ super stonPostReferenceResolution. @@ -10,7 +10,7 @@ ToButton >> stonPostReferenceResolution [ self userData removeKey: #stonLabeledIcon ] ] -{ #category : #'*Toplo-Serialization' } +{ #category : #'*Toplo-Serialization-STON' } ToButton >> stonUserDataOn: aIdentityDictionary [ super stonUserDataOn: aIdentityDictionary. diff --git a/src/Toplo-Serialization/ToCheckableGroup.extension.st b/src/Toplo-Serialization-STON/ToCheckableGroup.extension.st similarity index 79% rename from src/Toplo-Serialization/ToCheckableGroup.extension.st rename to src/Toplo-Serialization-STON/ToCheckableGroup.extension.st index c50aaeb..25d64e7 100644 --- a/src/Toplo-Serialization/ToCheckableGroup.extension.st +++ b/src/Toplo-Serialization-STON/ToCheckableGroup.extension.st @@ -1,13 +1,13 @@ Extension { #name : #ToCheckableGroup } -{ #category : #'*Toplo-Serialization' } +{ #category : #'*Toplo-Serialization-STON' } ToCheckableGroup >> fromSton: stonReader [ stonReader parseMapDo: [ :key :value | key = #checkingStrategy ifTrue: [ self checkingStrategy: value ] ] ] -{ #category : #'*Toplo-Serialization' } +{ #category : #'*Toplo-Serialization-STON' } ToCheckableGroup >> stonOn: stonWriter [ stonWriter writeObject: self streamMap: [ :dictionary | @@ -15,7 +15,7 @@ ToCheckableGroup >> stonOn: stonWriter [ at: #checkingStrategy put: self checkingStrategy ] ] -{ #category : #'*Toplo-Serialization' } +{ #category : #'*Toplo-Serialization-STON' } ToCheckableGroup >> stonProcessSubObjects: block [ self diff --git a/src/Toplo-Serialization/ToCheckbox.extension.st b/src/Toplo-Serialization-STON/ToCheckbox.extension.st similarity index 87% rename from src/Toplo-Serialization/ToCheckbox.extension.st rename to src/Toplo-Serialization-STON/ToCheckbox.extension.st index b70acb8..c836aa4 100644 --- a/src/Toplo-Serialization/ToCheckbox.extension.st +++ b/src/Toplo-Serialization-STON/ToCheckbox.extension.st @@ -1,6 +1,6 @@ Extension { #name : #ToCheckbox } -{ #category : #'*Toplo-Serialization' } +{ #category : #'*Toplo-Serialization-STON' } ToCheckbox >> stonPostReferenceResolution [ super stonPostReferenceResolution. @@ -12,7 +12,7 @@ ToCheckbox >> stonPostReferenceResolution [ self userData removeKey: #stonGroup ] ] -{ #category : #'*Toplo-Serialization' } +{ #category : #'*Toplo-Serialization-STON' } ToCheckbox >> stonUserDataOn: aIdentityDictionary [ super stonUserDataOn: aIdentityDictionary. diff --git a/src/Toplo-Serialization-STON/ToElement.extension.st b/src/Toplo-Serialization-STON/ToElement.extension.st new file mode 100644 index 0000000..559982c --- /dev/null +++ b/src/Toplo-Serialization-STON/ToElement.extension.st @@ -0,0 +1,34 @@ +Extension { #name : #ToElement } + +{ #category : #'*Toplo-Serialization-STON' } +ToElement >> stonPostReferenceResolution [ + + super stonPostReferenceResolution. + self userData at: #tooltipContent ifPresent: [ :anElement | + self tooltipContent: anElement. + self userData removeKey: #tooltipContent ]. +] + +{ #category : #'*Toplo-Serialization-STON' } +ToElement >> stonUserDataOn: aIdentityDictionary [ + + super stonUserDataOn: aIdentityDictionary. + "TToEnableable" + self userData + at: #enabled + ifPresent: [ :id | aIdentityDictionary at: #enabled put: id ]. + + "TToElementWithTooltip" + self hasTooltip ifTrue: [ + aIdentityDictionary + at: #tooltipContent + put: (self rawTooltipWindowManager builder asContext tempAt: 3). + self userData at: #tooltipPopupDelay ifPresent: [ :aDuration | + aIdentityDictionary at: #tooltipPopupDelay put: aDuration ]. + self userData + at: #closeTooltipWindowOnMouseLeave + ifPresent: [ :aBoolean | + aIdentityDictionary + at: #closeTooltipWindowOnMouseLeave + put: aBoolean ] ] +] diff --git a/src/Toplo-Serialization/ToImage.extension.st b/src/Toplo-Serialization-STON/ToImage.extension.st similarity index 82% rename from src/Toplo-Serialization/ToImage.extension.st rename to src/Toplo-Serialization-STON/ToImage.extension.st index 243d3b6..9267d32 100644 --- a/src/Toplo-Serialization/ToImage.extension.st +++ b/src/Toplo-Serialization-STON/ToImage.extension.st @@ -1,6 +1,6 @@ Extension { #name : #ToImage } -{ #category : #'*Toplo-Serialization' } +{ #category : #'*Toplo-Serialization-STON' } ToImage >> stonPostReferenceResolution [ super stonPostReferenceResolution. @@ -9,7 +9,7 @@ ToImage >> stonPostReferenceResolution [ self userData removeKey: #stonInnerImage ] ] -{ #category : #'*Toplo-Serialization' } +{ #category : #'*Toplo-Serialization-STON' } ToImage >> stonUserDataOn: aIdentityDictionary [ super stonUserDataOn: aIdentityDictionary. diff --git a/src/Toplo-Serialization/ToLabel.extension.st b/src/Toplo-Serialization-STON/ToLabel.extension.st similarity index 81% rename from src/Toplo-Serialization/ToLabel.extension.st rename to src/Toplo-Serialization-STON/ToLabel.extension.st index edb1ead..27bc8e0 100644 --- a/src/Toplo-Serialization/ToLabel.extension.st +++ b/src/Toplo-Serialization-STON/ToLabel.extension.st @@ -1,6 +1,6 @@ Extension { #name : #ToLabel } -{ #category : #'*Toplo-Serialization' } +{ #category : #'*Toplo-Serialization-STON' } ToLabel >> stonPostReferenceResolution [ super stonPostReferenceResolution. @@ -9,7 +9,7 @@ ToLabel >> stonPostReferenceResolution [ self userData removeKey: #stonToLabelText ] ] -{ #category : #'*Toplo-Serialization' } +{ #category : #'*Toplo-Serialization-STON' } ToLabel >> stonUserDataOn: aIdentityDictionary [ super stonUserDataOn: aIdentityDictionary. diff --git a/src/Toplo-Serialization/ToLabeledIcon.extension.st b/src/Toplo-Serialization-STON/ToLabeledIcon.extension.st similarity index 86% rename from src/Toplo-Serialization/ToLabeledIcon.extension.st rename to src/Toplo-Serialization-STON/ToLabeledIcon.extension.st index 611a663..2094127 100644 --- a/src/Toplo-Serialization/ToLabeledIcon.extension.st +++ b/src/Toplo-Serialization-STON/ToLabeledIcon.extension.st @@ -1,6 +1,6 @@ Extension { #name : #ToLabeledIcon } -{ #category : #'*Toplo-Serialization' } +{ #category : #'*Toplo-Serialization-STON' } ToLabeledIcon >> stonPostReferenceResolution [ super stonPostReferenceResolution. @@ -12,7 +12,7 @@ ToLabeledIcon >> stonPostReferenceResolution [ self userData removeKey: #stonToImage ] ] -{ #category : #'*Toplo-Serialization' } +{ #category : #'*Toplo-Serialization-STON' } ToLabeledIcon >> stonUserDataOn: aIdentityDictionary [ super stonUserDataOn: aIdentityDictionary. diff --git a/src/Toplo-Serialization-STON/package.st b/src/Toplo-Serialization-STON/package.st new file mode 100644 index 0000000..08c03fe --- /dev/null +++ b/src/Toplo-Serialization-STON/package.st @@ -0,0 +1 @@ +Package { #name : #'Toplo-Serialization-STON' } diff --git a/src/Toplo-Serialization-Stash/BlElement.extension.st b/src/Toplo-Serialization-Stash/BlElement.extension.st new file mode 100644 index 0000000..30afb42 --- /dev/null +++ b/src/Toplo-Serialization-Stash/BlElement.extension.st @@ -0,0 +1,30 @@ +Extension { #name : #BlElement } + +{ #category : #'*Toplo-Serialization-Stash' } +BlElement >> allSetterAndGettersForMyStashAllStamps [ + + + self allStamps isEmpty ifTrue: [ ^ { } ]. + ^ self toStyleStore stampIndex allProperties collect: [ :assoc | | setter getter | + setter := [ :element | 'addStamp: <1p> withValue:' expandMacrosWith: assoc value name ]. + getter := [ :element | assoc value value ]. + setter -> getter + ] + + +] + +{ #category : #'*Toplo-Serialization-Stash' } +BlElement >> allSetterAndGettersForMyStashAllTokens [ + + + self ensuredToStyleStore. + self toStyleStore tokenPropertyIndex isEmpty ifTrue: [ ^ { } ]. + ^ self toStyleStore tokenPropertyIndex allProperties collect: [ :assoc | | setter getter | + setter := [ :element | 'addTokenNamed: <1p> withValue:' expandMacrosWith: assoc value name ]. + getter := [ :element | assoc value value ]. + setter -> getter + ] + + +] diff --git a/src/Toplo-Serialization-Stash/TToCheckable.extension.st b/src/Toplo-Serialization-Stash/TToCheckable.extension.st new file mode 100644 index 0000000..57d45f1 --- /dev/null +++ b/src/Toplo-Serialization-Stash/TToCheckable.extension.st @@ -0,0 +1,11 @@ +Extension { #name : #TToCheckable } + +{ #category : #'*Toplo-Serialization-Stash' } +TToCheckable >> allSetterAndGettersOfTraitForMyStash: aToElement [ + + | settersAndGetters | + settersAndGetters := OrderedCollection new. + settersAndGetters add: #checked. + settersAndGetters add: #group. + ^ settersAndGetters +] diff --git a/src/Toplo-Serialization-Stash/TToElementWithLabeledIcon.extension.st b/src/Toplo-Serialization-Stash/TToElementWithLabeledIcon.extension.st new file mode 100644 index 0000000..9f66a7a --- /dev/null +++ b/src/Toplo-Serialization-Stash/TToElementWithLabeledIcon.extension.st @@ -0,0 +1,25 @@ +Extension { #name : #TToElementWithLabeledIcon } + +{ #category : #'*Toplo-Serialization-Stash' } +TToElementWithLabeledIcon >> allSetterAndGettersOfTraitForMyStash: aToElement [ + + | settersAndGetters | + settersAndGetters := OrderedCollection new. + aToElement isStartToEnd ifTrue: [ settersAndGetters add: (#beStartToEnd -> nil) onlySetOnStash ]. + aToElement isEndToStart ifTrue: [ settersAndGetters add: (#beEndToStart -> nil) onlySetOnStash ]. + + aToElement isVertical ifTrue: [ settersAndGetters add: (#isVertical -> nil) onlySetOnStash ]. + aToElement isHorizontal ifTrue: [ settersAndGetters add: (#isHorizontal -> nil) onlySetOnStash ]. + + settersAndGetters add: #endAlignment. + settersAndGetters add: #endElement. + settersAndGetters add: #endInterspace. + settersAndGetters add: #flexible. + settersAndGetters add: #icon. + settersAndGetters add: #iconContainerHeight. + settersAndGetters add: #iconContainerWidth. + settersAndGetters add: #label. + settersAndGetters add: #startAlignment. + settersAndGetters add: #startInterspace. + ^ settersAndGetters +] diff --git a/src/Toplo-Serialization-Stash/TToElementWithTooltip.extension.st b/src/Toplo-Serialization-Stash/TToElementWithTooltip.extension.st new file mode 100644 index 0000000..e9b36c7 --- /dev/null +++ b/src/Toplo-Serialization-Stash/TToElementWithTooltip.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #TToElementWithTooltip } + +{ #category : #'*Toplo-Serialization-Stash' } +TToElementWithTooltip >> allSetterAndGettersOfTraitForMyStash: aToElement [ + + self hasTooltip ifFalse: [ ^ { } ]. + ^ { #tooltipBuilder. #closeTooltipWindowOnMouseLeave . #tooltipPopupDelay } +] diff --git a/src/Toplo-Serialization-Stash/TToEnableable.extension.st b/src/Toplo-Serialization-Stash/TToEnableable.extension.st new file mode 100644 index 0000000..db1ccc9 --- /dev/null +++ b/src/Toplo-Serialization-Stash/TToEnableable.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #TToEnableable } + +{ #category : #'*Toplo-Serialization-Stash' } +TToEnableable >> allSetterAndGettersOfTraitForMyStash: aToElement [ + + aToElement isEnabled ifTrue: [ ^ { } ]. + ^ { #enabled: -> #isEnabled } +] diff --git a/src/Toplo-Serialization-Stash/ToCheckableGroup.extension.st b/src/Toplo-Serialization-Stash/ToCheckableGroup.extension.st new file mode 100644 index 0000000..41749ff --- /dev/null +++ b/src/Toplo-Serialization-Stash/ToCheckableGroup.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #ToCheckableGroup } + +{ #category : #'*Toplo-Serialization-Stash' } +ToCheckableGroup >> stashAccessorsForCheckableGroup [ + + + ^ { #registerAll: -> #registeredCheckables } +] diff --git a/src/Toplo-Serialization-Stash/ToImage.extension.st b/src/Toplo-Serialization-Stash/ToImage.extension.st new file mode 100644 index 0000000..4c00232 --- /dev/null +++ b/src/Toplo-Serialization-Stash/ToImage.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #ToImage } + +{ #category : #'*Toplo-Serialization-Stash' } +ToImage >> stashAccessorsForInnerImage [ + + + ^ { #innerImage } +] diff --git a/src/Toplo-Serialization-Stash/ToLabel.extension.st b/src/Toplo-Serialization-Stash/ToLabel.extension.st new file mode 100644 index 0000000..6d7abbf --- /dev/null +++ b/src/Toplo-Serialization-Stash/ToLabel.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #ToLabel } + +{ #category : #'*Toplo-Serialization-Stash' } +ToLabel >> stashAccessorsForText [ + + + ^ { #text } +] diff --git a/src/Toplo-Serialization-Stash/ToObservableCollection.extension.st b/src/Toplo-Serialization-Stash/ToObservableCollection.extension.st new file mode 100644 index 0000000..7e1c023 --- /dev/null +++ b/src/Toplo-Serialization-Stash/ToObservableCollection.extension.st @@ -0,0 +1,10 @@ +Extension { #name : #ToObservableCollection } + +{ #category : #'*Toplo-Serialization-Stash' } +ToObservableCollection >> asStashObject [ + + ^ StashCollection new + object: collection; + classType: collection class; + yourself +] diff --git a/src/Toplo-Serialization-Stash/package.st b/src/Toplo-Serialization-Stash/package.st new file mode 100644 index 0000000..bbf378b --- /dev/null +++ b/src/Toplo-Serialization-Stash/package.st @@ -0,0 +1 @@ +Package { #name : #'Toplo-Serialization-Stash' } diff --git a/src/Toplo-Serialization/ToElementWithLeafForTesting.class.st b/src/Toplo-Serialization-Tests/ToElementWithLeafForTesting.class.st similarity index 61% rename from src/Toplo-Serialization/ToElementWithLeafForTesting.class.st rename to src/Toplo-Serialization-Tests/ToElementWithLeafForTesting.class.st index 5298bf3..7aea649 100644 --- a/src/Toplo-Serialization/ToElementWithLeafForTesting.class.st +++ b/src/Toplo-Serialization-Tests/ToElementWithLeafForTesting.class.st @@ -1,5 +1,5 @@ Class { #name : #ToElementWithLeafForTesting, #superclass : #ToElement, - #category : #'Toplo-Serialization-cases-test' + #category : #'Toplo-Serialization-Tests' } diff --git a/src/Toplo-Serialization/ToSerializerTest.class.st b/src/Toplo-Serialization-Tests/ToSerializerTest.class.st similarity index 99% rename from src/Toplo-Serialization/ToSerializerTest.class.st rename to src/Toplo-Serialization-Tests/ToSerializerTest.class.st index 4bf2775..01dc65a 100644 --- a/src/Toplo-Serialization/ToSerializerTest.class.st +++ b/src/Toplo-Serialization-Tests/ToSerializerTest.class.st @@ -1,7 +1,7 @@ Class { #name : #ToSerializerTest, #superclass : #BlocSerializationTests, - #category : #'Toplo-Serialization-cases-test' + #category : #'Toplo-Serialization-Tests' } { #category : #tests } diff --git a/src/Toplo-Serialization-Tests/package.st b/src/Toplo-Serialization-Tests/package.st new file mode 100644 index 0000000..e602d51 --- /dev/null +++ b/src/Toplo-Serialization-Tests/package.st @@ -0,0 +1 @@ +Package { #name : #'Toplo-Serialization-Tests' } diff --git a/src/Toplo-Serialization/ToElement.extension.st b/src/Toplo-Serialization/ToElement.extension.st index cd6f056..ce4ddb4 100644 --- a/src/Toplo-Serialization/ToElement.extension.st +++ b/src/Toplo-Serialization/ToElement.extension.st @@ -6,36 +6,3 @@ ToElement >> shouldSerializedChildren [ ^ (self class == ToElement) ] - -{ #category : #'*Toplo-Serialization' } -ToElement >> stonPostReferenceResolution [ - - super stonPostReferenceResolution. - self userData at: #tooltipContent ifPresent: [ :anElement | - self tooltipContent: anElement. - self userData removeKey: #tooltipContent ]. -] - -{ #category : #'*Toplo-Serialization' } -ToElement >> stonUserDataOn: aIdentityDictionary [ - - super stonUserDataOn: aIdentityDictionary. - "TToEnableable" - self userData - at: #enabled - ifPresent: [ :id | aIdentityDictionary at: #enabled put: id ]. - - "TToElementWithTooltip" - self hasTooltip ifTrue: [ - aIdentityDictionary - at: #tooltipContent - put: (self rawTooltipWindowManager builder asContext tempAt: 3). - self userData at: #tooltipPopupDelay ifPresent: [ :aDuration | - aIdentityDictionary at: #tooltipPopupDelay put: aDuration ]. - self userData - at: #closeTooltipWindowOnMouseLeave - ifPresent: [ :aBoolean | - aIdentityDictionary - at: #closeTooltipWindowOnMouseLeave - put: aBoolean ] ] -] From 88d2ddeb317f1a5c4dd54fda76ec28344eaa1813 Mon Sep 17 00:00:00 2001 From: Yann LE GOFF <34318678+Nyan11@users.noreply.github.com> Date: Fri, 19 Jul 2024 14:45:54 +0200 Subject: [PATCH 04/10] Update .smalltalk.ston --- .smalltalk.ston | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.smalltalk.ston b/.smalltalk.ston index 8f38e8e..0ccc019 100644 --- a/.smalltalk.ston +++ b/.smalltalk.ston @@ -7,6 +7,6 @@ SmalltalkCISpec { } ], #testing : { - #packages : [ 'Toplo-Serialization.*' ] + #packages : [ 'Toplo-Serialization*' ] } } From 81d4a25cd133e34d4080c7607522770648dea99a Mon Sep 17 00:00:00 2001 From: Yann LE GOFF <34318678+Nyan11@users.noreply.github.com> Date: Fri, 19 Jul 2024 14:46:17 +0200 Subject: [PATCH 05/10] Update .smalltalk.ston --- .smalltalk.ston | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.smalltalk.ston b/.smalltalk.ston index 0ccc019..e3cadd7 100644 --- a/.smalltalk.ston +++ b/.smalltalk.ston @@ -7,6 +7,6 @@ SmalltalkCISpec { } ], #testing : { - #packages : [ 'Toplo-Serialization*' ] + #packages : [ 'Toplo-Serialization-Tests' ] } } From ffab2103a58e75e2b89f862f27c0ed735e81758f Mon Sep 17 00:00:00 2001 From: Yann Le Goff Date: Fri, 19 Jul 2024 14:50:29 +0200 Subject: [PATCH 06/10] fix baseline --- .../BaselineOfToploSerialization.class.st | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/BaselineOfToploSerialization/BaselineOfToploSerialization.class.st b/src/BaselineOfToploSerialization/BaselineOfToploSerialization.class.st index 2bc8a88..23c8801 100644 --- a/src/BaselineOfToploSerialization/BaselineOfToploSerialization.class.st +++ b/src/BaselineOfToploSerialization/BaselineOfToploSerialization.class.st @@ -12,9 +12,17 @@ BaselineOfToploSerialization >> baseline: spec [ self dependency: spec. "project packages" + self dependency: spec. + + "project packages" + spec package: 'Toplo-Serialization-STON'. + spec package: 'Toplo-Serialization-Stash'. + spec package: 'Toplo-Serialization' with: [ + spec requires: #( 'Toplo' 'Bloc-Serialization' 'Toplo-Serialization-STON' 'Toplo-Serialization-Stash' + 'Ston' 'StashSerialization' ) ]. spec - package: 'Toplo-Serialization' - ] + package: 'Toplo-Serialization-Tests' + with: [ spec requires: #( 'Toplo-Serialization' ) ] ] ] { #category : #baselines } From dba596736a9753c0796379b968bb8e21f5ec7297 Mon Sep 17 00:00:00 2001 From: Yann LE GOFF <34318678+Nyan11@users.noreply.github.com> Date: Fri, 19 Jul 2024 14:55:35 +0200 Subject: [PATCH 07/10] Update .smalltalk.ston --- .smalltalk.ston | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.smalltalk.ston b/.smalltalk.ston index e3cadd7..4905f3d 100644 --- a/.smalltalk.ston +++ b/.smalltalk.ston @@ -5,8 +5,5 @@ SmalltalkCISpec { #directory : 'src', #platforms : [ #pharo ] } - ], - #testing : { - #packages : [ 'Toplo-Serialization-Tests' ] - } + ] } From fe9251cb67ddef6f1e34f24f7f2c7fd2ceb1339b Mon Sep 17 00:00:00 2001 From: Yann Le Goff Date: Fri, 19 Jul 2024 14:56:55 +0200 Subject: [PATCH 08/10] fix --- .../BaselineOfToploSerialization.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BaselineOfToploSerialization/BaselineOfToploSerialization.class.st b/src/BaselineOfToploSerialization/BaselineOfToploSerialization.class.st index 23c8801..bd446c9 100644 --- a/src/BaselineOfToploSerialization/BaselineOfToploSerialization.class.st +++ b/src/BaselineOfToploSerialization/BaselineOfToploSerialization.class.st @@ -18,7 +18,7 @@ BaselineOfToploSerialization >> baseline: spec [ spec package: 'Toplo-Serialization-STON'. spec package: 'Toplo-Serialization-Stash'. spec package: 'Toplo-Serialization' with: [ - spec requires: #( 'Toplo' 'Bloc-Serialization' 'Toplo-Serialization-STON' 'Toplo-Serialization-Stash' + spec requires: #( 'Toplo' 'BlocSerialization' 'Toplo-Serialization-STON' 'Toplo-Serialization-Stash' 'Ston' 'StashSerialization' ) ]. spec package: 'Toplo-Serialization-Tests' From 04c7603f2d1be87d376702225d635486f0636470 Mon Sep 17 00:00:00 2001 From: Yann Le Goff Date: Mon, 22 Jul 2024 09:13:22 +0200 Subject: [PATCH 09/10] update baseline and dependencies --- .../BaselineOfToploSerialization.class.st | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/BaselineOfToploSerialization/BaselineOfToploSerialization.class.st b/src/BaselineOfToploSerialization/BaselineOfToploSerialization.class.st index bd446c9..2a03308 100644 --- a/src/BaselineOfToploSerialization/BaselineOfToploSerialization.class.st +++ b/src/BaselineOfToploSerialization/BaselineOfToploSerialization.class.st @@ -13,13 +13,14 @@ BaselineOfToploSerialization >> baseline: spec [ "project packages" self dependency: spec. - + "project packages" spec package: 'Toplo-Serialization-STON'. spec package: 'Toplo-Serialization-Stash'. spec package: 'Toplo-Serialization' with: [ - spec requires: #( 'Toplo' 'BlocSerialization' 'Toplo-Serialization-STON' 'Toplo-Serialization-Stash' - 'Ston' 'StashSerialization' ) ]. + spec requires: + #( 'Toplo' 'BlocSerialization' 'Toplo-Serialization-STON' + 'Toplo-Serialization-Stash' ) ]. spec package: 'Toplo-Serialization-Tests' with: [ spec requires: #( 'Toplo-Serialization' ) ] ] @@ -28,16 +29,12 @@ BaselineOfToploSerialization >> baseline: spec [ { #category : #baselines } BaselineOfToploSerialization >> dependency: spec [ - spec - baseline: 'Ston' - with: [ spec repository: 'github://svenvc/ston/repository' ]. - spec baseline: #BlocSerialization with: [ spec repository: 'github://OpenSmock/Bloc-Serialization:main/src' ]. - spec baseline: 'Toplo' with: [ spec repository: 'github://pharo-graphics/Toplo:dev/src' ]. - - + spec + baseline: 'Toplo' + with: [ spec repository: 'github://pharo-graphics/Toplo:dev/src' ] ] From fa11cb4b3e28b9009a661423858858957e259f89 Mon Sep 17 00:00:00 2001 From: Yann Le Goff Date: Mon, 22 Jul 2024 10:27:54 +0200 Subject: [PATCH 10/10] Fix checkable --- .../ToButton.extension.st | 23 ++++++++++-- .../ToCheckbox.extension.st | 3 +- .../TToCheckable.extension.st | 1 + .../ToButton.extension.st | 9 +++++ .../ToSerializerTest.class.st | 35 +++++++++++++++++++ 5 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 src/Toplo-Serialization-Stash/ToButton.extension.st diff --git a/src/Toplo-Serialization-STON/ToButton.extension.st b/src/Toplo-Serialization-STON/ToButton.extension.st index a08217b..ab49373 100644 --- a/src/Toplo-Serialization-STON/ToButton.extension.st +++ b/src/Toplo-Serialization-STON/ToButton.extension.st @@ -4,10 +4,22 @@ Extension { #name : #ToButton } ToButton >> stonPostReferenceResolution [ super stonPostReferenceResolution. + + "LabeledIcon" self userData at: #stonLabeledIcon ifPresent: [ :anElement | (self class slotNamed: #labeledIcon) write: anElement to: self. self addChild: anElement. - self userData removeKey: #stonLabeledIcon ] + self userData removeKey: #stonLabeledIcon ]. + + "Checkable" + self userData at: #stonIsCheckable ifAbsent: [ ^ self ]. + self beCheckable. + self userData at: #stonChecked ifPresent: [ :aCheckValue | + self checked: aCheckValue. + self userData removeKey: #stonChecked ]. + self userData at: #stonGroup ifPresent: [ :aGroup | + aGroup register: self. + self userData removeKey: #stonGroup ] ] { #category : #'*Toplo-Serialization-STON' } @@ -17,5 +29,12 @@ ToButton >> stonUserDataOn: aIdentityDictionary [ "LabeledIcon" (self class usesTrait: TToElementWithLabeledIcon) ifTrue: [ - aIdentityDictionary at: #stonLabeledIcon put: self labeledIcon ] + aIdentityDictionary at: #stonLabeledIcon put: self labeledIcon ]. + + "Checkable" + self isCheckable ifFalse: [ ^ self ]. + aIdentityDictionary at: #stonIsCheckable put: self isCheckable. + aIdentityDictionary at: #stonChecked put: self isChecked. + self group ifNotNil: [ + aIdentityDictionary at: #stonGroup put: self group ] ] diff --git a/src/Toplo-Serialization-STON/ToCheckbox.extension.st b/src/Toplo-Serialization-STON/ToCheckbox.extension.st index c836aa4..af9e30f 100644 --- a/src/Toplo-Serialization-STON/ToCheckbox.extension.st +++ b/src/Toplo-Serialization-STON/ToCheckbox.extension.st @@ -17,5 +17,6 @@ ToCheckbox >> stonUserDataOn: aIdentityDictionary [ super stonUserDataOn: aIdentityDictionary. aIdentityDictionary at: #stonChecked put: self checked. - self group ifNotNil: [ aIdentityDictionary at: #stonGroup put: self group. ] + self group ifNotNil: [ + aIdentityDictionary at: #stonGroup put: self group ] ] diff --git a/src/Toplo-Serialization-Stash/TToCheckable.extension.st b/src/Toplo-Serialization-Stash/TToCheckable.extension.st index 57d45f1..2df4b58 100644 --- a/src/Toplo-Serialization-Stash/TToCheckable.extension.st +++ b/src/Toplo-Serialization-Stash/TToCheckable.extension.st @@ -4,6 +4,7 @@ Extension { #name : #TToCheckable } TToCheckable >> allSetterAndGettersOfTraitForMyStash: aToElement [ | settersAndGetters | + self isCheckable ifFalse: [ ^ { } ]. settersAndGetters := OrderedCollection new. settersAndGetters add: #checked. settersAndGetters add: #group. diff --git a/src/Toplo-Serialization-Stash/ToButton.extension.st b/src/Toplo-Serialization-Stash/ToButton.extension.st new file mode 100644 index 0000000..3ecfe1e --- /dev/null +++ b/src/Toplo-Serialization-Stash/ToButton.extension.st @@ -0,0 +1,9 @@ +Extension { #name : #ToButton } + +{ #category : #'*Toplo-Serialization-Stash' } +ToButton >> stashToButtonCheckable [ + + + self isCheckable ifFalse: [ ^ { } ]. + ^ { (#beCheckable -> self) onlySetOnStash } +] diff --git a/src/Toplo-Serialization-Tests/ToSerializerTest.class.st b/src/Toplo-Serialization-Tests/ToSerializerTest.class.st index 01dc65a..bbefa76 100644 --- a/src/Toplo-Serialization-Tests/ToSerializerTest.class.st +++ b/src/Toplo-Serialization-Tests/ToSerializerTest.class.st @@ -191,6 +191,41 @@ ToSerializerTest >> testToButton4 [ equals: nil ] ] +{ #category : #tests } +ToSerializerTest >> testToButton5 [ + + | origin | + origin := ToButton new. + + self test: origin on: [ :element | + self deny: element isCheckable ] +] + +{ #category : #tests } +ToSerializerTest >> testToButton6 [ + + | origin | + origin := ToButton new + beCheckable; + yourself. + + self test: origin on: [ :element | self assert: element isCheckable. + self deny: element isChecked ] +] + +{ #category : #tests } +ToSerializerTest >> testToButton7 [ + + | origin | + origin := ToButton new + beCheckable; + check; + yourself. + + self test: origin on: [ :element | self assert: element isCheckable. + self assert: element isChecked ] +] + { #category : #tests } ToSerializerTest >> testToCheckbox1 [