Skip to content

Commit

Permalink
Merge 77fb5d2
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Oct 28, 2024
2 parents fba1543 + 77fb5d2 commit 1490067
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Class {
OPPetriNetArcController >> internalSubscribeTo: aModel [

super internalSubscribeTo: aModel.
aModel when: OPElementRemoved send: #removeController to: self
aModel weakWhen: OPElementRemoved send: #removeControllerAndDiagramElement to: self
]

{ #category : 'testing' }
Expand All @@ -21,7 +21,6 @@ OPPetriNetArcController >> isHideable [
{ #category : 'destruction' }
OPPetriNetArcController >> removeModel [

self model announcer unsubscribe: self.
self diagramController model remove: self model.
super removeModel
]
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ OPPetriNetNodeController >> diagramElementClass [
OPPetriNetNodeController >> internalSubscribeTo: aModel [

super internalSubscribeTo: aModel.
aModel when: OPElementRemoved send: #removeController to: self
aModel weakWhen: OPElementRemoved send: #removeControllerAndDiagramElement to: self
]

{ #category : 'testing' }
Expand All @@ -66,7 +66,6 @@ OPPetriNetNodeController >> isHideable [
{ #category : 'destruction' }
OPPetriNetNodeController >> removeModel [

self model announcer unsubscribe: self.
self diagramController model remove: self model.
super removeModel
]
18 changes: 7 additions & 11 deletions repository/OpenPonk-PetriNets/OPPetriNetPTPlaceController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,14 @@ OPPetriNetPTPlaceController >> diagramElementClass [
^ OPPetriNetPTPlaceShape
]

{ #category : 'construction' }
OPPetriNetPTPlaceController >> internalSubscribeTo: aModel [

super internalSubscribeTo: aModel.
aModel weakWhen: OPPlaceTokensChanged send: #modelChanged to: self
]

{ #category : 'hooks' }
OPPetriNetPTPlaceController >> modelClass [
^ OPPetriNetPTPlace
]

{ #category : 'construction' }
OPPetriNetPTPlaceController >> renderDiagramElement [

super renderDiagramElement.
model
when: OPPlaceTokensChanged
do: [ self diagramElement modelChanged ]
for: self.
^ self roassalShape
]
7 changes: 7 additions & 0 deletions repository/OpenPonk-PetriNets/OPPetriNetPlayClicked.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Class {
#name : 'OPPetriNetPlayClicked',
#superclass : 'Announcement',
#category : 'OpenPonk-PetriNets-Announcements',
#package : 'OpenPonk-PetriNets',
#tag : 'Announcements'
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,24 @@ OPPetriNetTransitionController >> hookDiagramElement [

super hookDiagramElement.

diagramElement whenPlayClickedDo: [
OPPetriNetSimulationGUI stepSimulatorOfController: self ]
self diagramElement whenPlayClickedSend: #playClicked to: self
]

{ #category : 'hooks' }
OPPetriNetTransitionController >> modelClass [
^ OPPetriNetTransition
]

{ #category : 'rendering' }
OPPetriNetTransitionController >> playClicked [

OPPetriNetSimulationGUI stepSimulatorOfController: self
]

{ #category : 'rendering' }
OPPetriNetTransitionController >> unhookDiagramElement [

super unhookDiagramElement.

self diagramElement unsubscribe: self
]
24 changes: 16 additions & 8 deletions repository/OpenPonk-PetriNets/OPPetriNetTransitionShape.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,23 @@ Class {
#name : 'OPPetriNetTransitionShape',
#superclass : 'OPPetriNetNodeShape',
#instVars : [
'playClickedBlock'
'announcer'
],
#category : 'OpenPonk-PetriNets-Shapes',
#package : 'OpenPonk-PetriNets',
#tag : 'Shapes'
}

{ #category : 'hooks' }
OPPetriNetTransitionShape >> initialize [
{ #category : 'accessing' }
OPPetriNetTransitionShape >> announcer [

super initialize.
playClickedBlock := [ ]
^ announcer ifNil: [ announcer := Announcer new ]
]

{ #category : 'hooks' }
OPPetriNetTransitionShape >> playClicked [

playClickedBlock value
self announcer announce: OPPetriNetPlayClicked
]

{ #category : 'hooks' }
Expand Down Expand Up @@ -70,8 +69,17 @@ OPPetriNetTransitionShape >> selectableInteraction [
^ selectableInteraction
]

{ #category : 'subscription' }
OPPetriNetTransitionShape >> unsubscribe: aReceiver [

^ self announcer unsubscribe: aReceiver
]

{ #category : 'hooks' }
OPPetriNetTransitionShape >> whenPlayClickedDo: aBlock [
OPPetriNetTransitionShape >> whenPlayClickedSend: aSelector to: anObject [

playClickedBlock := aBlock
^ self announcer
when: OPPetriNetPlayClicked
send: aSelector
to: anObject
]

0 comments on commit 1490067

Please sign in to comment.