Skip to content

Commit

Permalink
Simplified modelChanged code
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Nov 16, 2024
1 parent 4d437b2 commit c0c478f
Show file tree
Hide file tree
Showing 17 changed files with 51 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ OPBPMNValidationController >> getValidations [

^ (self packageOrganizer packageNamed: 'OpenPonk-BPMN-Validation')
definedClasses select: [ :class |
class tags asSet includes: 'Validation-Classes' ]
class packageTag name = 'Validation-Classes' ]
]

{ #category : 'as yet unclassified' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@ OPBPMNValidationControllerTest >> testGetValidatedObjects [

{ #category : 'tests' }
OPBPMNValidationControllerTest >> testGetValidations [

| controller validations |
controller := OPBPMNValidationController new.
validations := controller getValidations.
self assert: (validations isKindOf: Collection).
self assert: (validations isEmpty) equals: false.

self assert: (validations allSatisfy: [ :validationClass | validationClass tags asSet includes: 'Validation-Classes'. ]) equals: true.
self assert: validations isEmpty equals: false.

self
assert: (validations allSatisfy: [ :validationClass |
validationClass packageTag name = 'Validation-Classes' ])
equals: true
]

{ #category : 'tests' }
Expand Down
8 changes: 4 additions & 4 deletions repository/OpenPonk-BPMN/OPBPMNActivityController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@ OPBPMNActivityController >> buildEditorForm: aForm [
selectItem: self model type;
whenSelectedItemChangedDo: [ :newValue |
self model type: newValue.
self diagramElement modelChanged ].
self modelChanged ].
(aForm addCheckbox: 'Is Call Activity?')
state: self model isCallActivity;
whenChangedDo: [ :val |
self model isCallActivity: val.
self diagramElement modelChanged ].
self modelChanged ].
self model type = OPBPMNNodeType Service
| (self model type = OPBPMNNodeType Send)
ifTrue: [
(aForm addText: 'Executable attribute')
text: self model executableAttribute;
whenTextChangedDo: [ :newValue |
self model executableAttribute: newValue asString.
self diagramElement modelChanged ].
self modelChanged ].
(aForm addText: 'Executable attribute value')
text: self model executableAttributeValue;
whenTextChangedDo: [ :newValue |
self model executableAttributeValue: newValue asString.
self diagramElement modelChanged ] ]
self modelChanged ] ]
ifFalse: [ self model executableAttribute: nil ]
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ OPBPMNBoundaryEventController >> buildEditorForm: aForm [
selectItem: self model type;
whenSelectedItemChangedDo: [ :newValue |
self model type: newValue.
self diagramElement modelChanged ].
self modelChanged ].
(aForm addCheckbox: 'Is Non-Interrupting')
state: self model isNonInterrupting;
whenChangedDo: [ :val |
self model isNonInterrupting: val.
self diagramElement modelChanged ].
self modelChanged ].
]

{ #category : 'connecting' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ OPBPMNCollapsedSubProcessController >> buildEditorForm: aForm [
selectItem: self model type;
whenSelectedItemChangedDo: [ :newValue |
self model type: newValue.
self diagramElement modelChanged ].
self modelChanged ].
(aForm addCheckbox: 'Is Call Activity?')
state: self model isCallActivity;
whenChangedDo: [ :val |
self model isCallActivity: val.
self diagramElement modelChanged ].
self modelChanged ].

(aForm addButton: 'Add Boundary Event') action: [
anEvent := OPBPMNBoundaryEventController new
Expand All @@ -41,15 +41,15 @@ OPBPMNCollapsedSubProcessController >> buildEditorForm: aForm [
"self diagramElement addBoundaryEvent: anEvent"
RSLocation new
stick: anEvent diagramElement roassalShape
on: self diagramElement roassalShape;
on: self roassalShape;
bottom;
right;
offset: -1 @ 22.
self diagramElement roassalShape
when: RSShapeRemovedEvent
do: [ anEvent diagramElement roassalShape remove ]
do: [ anEvent roassalShape remove ]
for: self ].
self diagramElement modelChanged
self modelChanged
]

{ #category : 'connecting' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ OPBPMNDataObjectController >> buildEditorForm: aForm [
selectItem: self model type;
whenSelectedItemChangedDo: [ :newValue |
self model type: newValue.
self diagramElement modelChanged ].
self modelChanged ].
]

{ #category : 'connecting' }
Expand Down
2 changes: 1 addition & 1 deletion repository/OpenPonk-BPMN/OPBPMNEdgeControllerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ OPBPMNEdgeControllerTest >> testFigureRefresh [
label := controller diagramElement ownedElements first.
self assert: label roassalShape text equals: ''.
controller model name: 'new name'.
controller diagramElement modelChanged.
controller modelChanged.
self assert: label roassalShape text equals: 'new name'
]
6 changes: 3 additions & 3 deletions repository/OpenPonk-BPMN/OPBPMNEndEventController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ OPBPMNEndEventController >> buildEditorForm: aForm [
selectItem: self model type;
whenSelectedItemChangedDo: [ :newValue |
self model type: newValue.
self diagramElement modelChanged ].
self modelChanged ].
self model type = OPBPMNNodeType Send
ifTrue: [
(aForm addText: 'Executable attribute')
text: self model executableAttribute;
whenTextChangedDo: [ :newValue |
self model executableAttribute: newValue asString.
self diagramElement modelChanged ].
self modelChanged ].
(aForm addText: 'Executable attribute value')
text: self model executableAttributeValue;
whenTextChangedDo: [ :newValue |
self model executableAttributeValue: newValue asString.
self diagramElement modelChanged ] ]
self modelChanged ] ]
ifFalse: [ self model executableAttribute: nil ]
]

Expand Down
2 changes: 1 addition & 1 deletion repository/OpenPonk-BPMN/OPBPMNFlowController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ OPBPMNFlowController >> buildEditorForm: aForm [
selectItem: self model type;
whenSelectedItemChangedDo: [ :newValue |
self model type: newValue.
self diagramElement modelChanged ].
self modelChanged ].
]

{ #category : 'accessing' }
Expand Down
4 changes: 2 additions & 2 deletions repository/OpenPonk-BPMN/OPBPMNGatewayController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ OPBPMNGatewayController >> buildEditorForm: aForm [
displayIcon: [ :type | self model typeIconFor: type ];
display: [ :type | type asString ];
selectItem: self model type;
whenSelectedItemChangedDo: [ :newValue |
whenSelectedItemChangedDo: [ :newValue |
self model type: newValue.
self diagramElement modelChanged ]
self modelChanged ]
]

{ #category : 'connecting' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,24 @@ OPBPMNIntermediateEventController >> buildEditorForm: aForm [
selectItem: self model timerType;
whenSelectedItemChangedDo: [ :newValue |
self model timerType: newValue.
self diagramElement modelChanged ].
self modelChanged ].
(aForm addText: 'Timer value')
text: self model timerValue;
whenTextChangedDo: [ :newValue |
self model timerValue: newValue asString.
self diagramElement modelChanged ] ].
self modelChanged ] ].
self model type = OPBPMNNodeType Send
ifTrue: [
(aForm addText: 'Executable attribute')
text: self model executableAttribute;
whenTextChangedDo: [ :newValue |
self model executableAttribute: newValue asString.
self diagramElement modelChanged ].
self modelChanged ].
(aForm addText: 'Executable attribute value')
text: self model executableAttributeValue;
whenTextChangedDo: [ :newValue |
self model executableAttributeValue: newValue asString.
self diagramElement modelChanged ] ]
self modelChanged ] ]
ifFalse: [ self model executableAttribute: nil ]
]

Expand Down
2 changes: 1 addition & 1 deletion repository/OpenPonk-BPMN/OPBPMNNodeController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ OPBPMNNodeController >> buildEditorForm: aForm [
text: self model name;
whenTextChangedDo: [ :newValue |
self model name: newValue asString.
self diagramElement modelChanged ]
self modelChanged ]
]

{ #category : 'announcements' }
Expand Down
2 changes: 1 addition & 1 deletion repository/OpenPonk-BPMN/OPBPMNNodeControllerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ OPBPMNNodeControllerTest >> testFigureRefresh [
self assert:
(controller roassalShape propertyAt: #RSLabeled) text = ''.
controller model name: 'new name'.
controller diagramElement modelChanged.
controller modelChanged.
text := (controller roassalShape propertyAt: #RSLabeled) text.
self assert:
((text last: 8) = 'new name' or: [ (text first: 8) = 'new name' ])
Expand Down
14 changes: 7 additions & 7 deletions repository/OpenPonk-BPMN/OPBPMNPoolController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ OPBPMNPoolController >> buildEditorForm: aForm [
super buildEditorForm: aForm.
(aForm addTextInput: 'Lanes')
text: self model lanes asString;
whenTextChangedDo: [ :newValue |
whenTextChangedDo: [ :newValue |
self model lanes: (newValue asString asInteger ifNil: [ 1 ]).
self model laneNamesFitToLanesCount.
self diagramElement modelChanged ].
self modelChanged ].

self model lanes > 1 ifTrue: [
1 to: self model lanes do: [ :i |
(aForm addTextInput: 'Lane ', i asString)
self model lanes > 1 ifTrue: [
1 to: self model lanes do: [ :i |
(aForm addTextInput: 'Lane ' , i asString)
text: (self model laneNames at: i) asString;
whenTextChangedDo: [ :newValue |
whenTextChangedDo: [ :newValue |
self model laneNamesAt: i put: newValue.
self diagramElement modelChanged ] ] ]
self modelChanged ] ] ]
]

{ #category : 'connecting' }
Expand Down
7 changes: 3 additions & 4 deletions repository/OpenPonk-BPMN/OPBPMNPoolControllerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ OPBPMNPoolControllerTest >> testFigureRefresh [
controller
createDiagramElement;
renderDiagramElement.
self assert:
(controller diagramElement label text) = ''.
self assert: controller diagramElement label text = ''.
controller model name: 'new name'.
controller diagramElement modelChanged.
text := (controller diagramElement label text).
controller modelChanged.
text := controller diagramElement label text.
self assert:
((text last: 8) = 'new name' or: [ (text first: 8) = 'new name' ])
]
8 changes: 4 additions & 4 deletions repository/OpenPonk-BPMN/OPBPMNStartEventController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ OPBPMNStartEventController >> buildEditorForm: aForm [
selectItem: self model type;
whenSelectedItemChangedDo: [ :newValue |
self model type: newValue.
self diagramElement modelChanged ].
self modelChanged ].
(aForm addCheckbox: 'Is Non-Interrupting')
state: self model isNonInterrupting;
whenChangedDo: [ :val |
self model isNonInterrupting: val.
self diagramElement modelChanged ].
self modelChanged ].

self model type = OPBPMNNodeType Timer ifTrue: [
(aForm addDroplist: 'Timer type')
Expand All @@ -33,12 +33,12 @@ OPBPMNStartEventController >> buildEditorForm: aForm [
selectItem: self model timerType;
whenSelectedItemChangedDo: [ :newValue |
self model timerType: newValue.
self diagramElement modelChanged ].
self modelChanged ].
(aForm addText: 'Timer value')
text: self model timerValue;
whenTextChangedDo: [ :newValue |
self model timerValue: newValue asString.
self diagramElement modelChanged ] ]
self modelChanged ] ]
]

{ #category : 'connecting' }
Expand Down
9 changes: 4 additions & 5 deletions repository/OpenPonk-BPMN/OPBPMNSubProcessController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,15 @@ OPBPMNSubProcessController >> buildEditorForm: aForm [
yourself.
"self diagramElement addBoundaryEvent: anEvent"
RSLocation new
stick: anEvent diagramElement roassalShape
on: self diagramElement roassalShape;
stick: anEvent roassalShape on: self roassalShape;
bottom;
right;
offset: -5 @ 20.
self diagramElement roassalShape
self roassalShape
when: RSShapeRemovedEvent
do: [ anEvent diagramElement roassalShape remove ]
do: [ anEvent roassalShape remove ]
for: self ].
self diagramElement modelChanged
self modelChanged
]

{ #category : 'forms' }
Expand Down

0 comments on commit c0c478f

Please sign in to comment.