Skip to content

Commit

Permalink
Merge 25460e5
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Oct 3, 2024
2 parents bc36359 + 25460e5 commit 7527ae9
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 37 deletions.
71 changes: 43 additions & 28 deletions repository/OpenPonk-FSM/OPFsmSimulator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -294,36 +294,51 @@ OPFsmSimulator >> stopButton [
{ #category : 'events' }
OPFsmSimulator >> watchRecognizer: aRecognizer [

aRecognizer when: OPFsmRecognizerEvent do: [ :ann |
aRecognizer isInputEmpty ifFalse: [
nextButton enable.
runButton enable ].
aRecognizer isPathEmpty ifFalse: [ backButton enable ].
(ann isKindOf: OPFsmRecognizerFailure) not & ann place isState
ifTrue: [
aRecognizer
when: OPFsmRecognizerEvent
do: [ :ann |
aRecognizer isInputEmpty ifFalse: [
nextButton enable.
runButton enable ].
aRecognizer isPathEmpty ifFalse: [ backButton enable ].
(ann isKindOf: OPFsmRecognizerFailure) not & ann place isState
ifTrue: [
self letterPanel
changeBoxAt: aRecognizer inputPosition - 1
to: #success ].
ann place isTransition ifTrue: [
self letterPanel
changeBoxAt: aRecognizer inputPosition - 1
to: #success ].
ann place isTransition ifTrue: [
to: #processed ] ]
for: self.
aRecognizer
when: OPFsmRecognizerSuccess
do: [ :ann |
OPFsmFigureHighlighter
highlightNode: (diagramController roassalShapeForModel: ann place)
with: Color green ]
for: self.
aRecognizer
when: OPFsmRecognizerFailure
do: [ :ann |
OPFsmFigureHighlighter
highlightNode: (diagramController roassalShapeForModel: ann place)
with: Color red.
self letterPanel
changeBoxAt: aRecognizer inputPosition - 1
to: #processed ] ].
aRecognizer when: OPFsmRecognizerSuccess do: [ :ann |
OPFsmFigureHighlighter
highlightNode: (diagramController roassalShapeForModel: ann place)
with: Color green ].
aRecognizer when: OPFsmRecognizerFailure do: [ :ann |
OPFsmFigureHighlighter
highlightNode: (diagramController roassalShapeForModel: ann place)
with: Color red.
self letterPanel
changeBoxAt: aRecognizer inputPosition - 1
to: #failure ].
aRecognizer when: OPFsmRecognizerLeave do: [ :ann |
OPFsmFigureHighlighter unhighlight:
(diagramController roassalShapeForModel: ann place) ].
aRecognizer when: OPFsmRecognizerEnter do: [ :ann |
OPFsmFigureHighlighter
highlight: (diagramController roassalShapeForModel: ann place)
with: Color orange ]
to: #failure ]
for: self.
aRecognizer
when: OPFsmRecognizerLeave
do: [ :ann |
OPFsmFigureHighlighter unhighlight:
(diagramController roassalShapeForModel: ann place) ]
for: self.
aRecognizer
when: OPFsmRecognizerEnter
do: [ :ann |
OPFsmFigureHighlighter
highlight: (diagramController roassalShapeForModel: ann place)
with: Color orange ]
for: self
]
7 changes: 4 additions & 3 deletions repository/OpenPonk-FSM/OPFsmStateController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ Class {
#tag : 'Controllers'
}

{ #category : 'hooks' }
{ #category : 'forms' }
OPFsmStateController >> buildEditorForm: aForm [

super buildEditorForm: aForm.
(aForm addCheckbox: 'Final')
state: self model isFinal;
whenChangedDo: [ :newValue |
whenChangedDo: [ :newValue |
self model isFinal: newValue.
self refreshFigure ]
self diagramElement modelChanged ]
]

{ #category : 'construction' }
Expand Down
4 changes: 2 additions & 2 deletions repository/OpenPonk-FSM/OPFsmTerminalPanelAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ OPFsmTerminalPanelAdapter >> buildWidget [
yourself.
self model
whenRecognizerStateChangedDo: [ :event |
morph changeBoxAt: event inputPosition to: event inputState ];
whenDataChangedDo: [ :event | morph data: event data ].
morph changeBoxAt: event inputPosition to: event inputState ] for: self;
whenDataChangedDo: [ :event | morph data: event data ] for: self.
^ morph
]
14 changes: 10 additions & 4 deletions repository/OpenPonk-FSM/OPFsmTerminalPanelPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,19 @@ OPFsmTerminalPanelPresenter >> data: aString [
]

{ #category : 'event handling' }
OPFsmTerminalPanelPresenter >> whenDataChangedDo: aBlock [
OPFsmTerminalPanelPresenter >> whenDataChangedDo: aBlock for: aSubscriber [

self announcer when: OPFsmTerminalDataChanged do: aBlock
self announcer
when: OPFsmTerminalDataChanged
do: aBlock
for: aSubscriber
]

{ #category : 'event handling' }
OPFsmTerminalPanelPresenter >> whenRecognizerStateChangedDo: aBlock [
OPFsmTerminalPanelPresenter >> whenRecognizerStateChangedDo: aBlock for: aSubscriber [

self announcer when: OPFsmTerminalRecognizerStateChanged do: aBlock
self announcer
when: OPFsmTerminalRecognizerStateChanged
do: aBlock
for: aSubscriber
]

0 comments on commit 7527ae9

Please sign in to comment.