Skip to content

Commit

Permalink
Updates for Pharo 12
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed May 7, 2024
1 parent 830b09e commit d32c651
Show file tree
Hide file tree
Showing 46 changed files with 487 additions and 395 deletions.
20 changes: 11 additions & 9 deletions repository/OpenPonk-FSM/OPControllerOfFsmTest.class.st
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
Class {
#name : #OPControllerOfFsmTest,
#superclass : #OPElementControllerTest,
#category : #'OpenPonk-FSM-Tests'
#name : 'OPControllerOfFsmTest',
#superclass : 'OPElementControllerTest',
#category : 'OpenPonk-FSM-Tests',
#package : 'OpenPonk-FSM',
#tag : 'Tests'
}

{ #category : #testing }
{ #category : 'testing' }
OPControllerOfFsmTest class >> isAbstract [
"Override to true if a TestCase subclass is Abstract and should not have
TestCase instances built from it"

^ self name = #OPControllerOfFsmTest
]

{ #category : #accessing }
{ #category : 'accessing' }
OPControllerOfFsmTest >> controllerClass [
^ self subclassResponsibility
]

{ #category : #accessing }
{ #category : 'accessing' }
OPControllerOfFsmTest >> diagramControllerClass [

^ OPFsmController
]

{ #category : #accessing }
{ #category : 'accessing' }
OPControllerOfFsmTest >> diagramModelClass [
^ OPFsm
]

{ #category : #accessing }
{ #category : 'accessing' }
OPControllerOfFsmTest >> modelClass [
^ self subclassResponsibility
]

{ #category : #tests }
{ #category : 'tests' }
OPControllerOfFsmTest >> testModelClass [
self assert: controller modelClass equals: self modelClass
]
16 changes: 9 additions & 7 deletions repository/OpenPonk-FSM/OPFsm.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,29 @@ A DCFsm is the class representing FSM diagram.
"
Class {
#name : #OPFsm,
#superclass : #OPModelObject,
#category : #'OpenPonk-FSM-Models'
#name : 'OPFsm',
#superclass : 'OPModelObject',
#category : 'OpenPonk-FSM-Models',
#package : 'OpenPonk-FSM',
#tag : 'Models'
}

{ #category : #testing }
{ #category : 'testing' }
OPFsm >> isState [
^ false
]

{ #category : #testing }
{ #category : 'testing' }
OPFsm >> isTransition [
^ false
]

{ #category : #accessing }
{ #category : 'accessing' }
OPFsm >> states [
^ elements select: [ :each | each isState ]
]

{ #category : #accessing }
{ #category : 'accessing' }
OPFsm >> transitions [
^ elements select: [ :each | each isTransition ]
]
14 changes: 8 additions & 6 deletions repository/OpenPonk-FSM/OPFsmAbstractStateShape.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
I am a base class for FSM vertex figures and I provide basic adornment behavior.
"
Class {
#name : #OPFsmAbstractStateShape,
#superclass : #OPBoundNode,
#name : 'OPFsmAbstractStateShape',
#superclass : 'OPBoundNode',
#instVars : [
'adornmentCreationBlock'
],
#category : #'OpenPonk-FSM-Shapes'
#category : 'OpenPonk-FSM-Shapes',
#package : 'OpenPonk-FSM',
#tag : 'Shapes'
}

{ #category : #accessing }
{ #category : 'accessing' }
OPFsmAbstractStateShape >> adornmentCreationBlock: aBlock [

adornmentCreationBlock := aBlock
]

{ #category : #hooks }
{ #category : 'hooks' }
OPFsmAbstractStateShape >> selectableInteraction [

^ OPRSSelectable highlightAdornments: [ :builder |
Expand All @@ -30,7 +32,7 @@ OPFsmAbstractStateShape >> selectableInteraction [
adornmentCreationBlock value: builder ]
]

{ #category : #rendering }
{ #category : 'rendering' }
OPFsmAbstractStateShape >> shouldBePositionableByUser [

^ true
Expand Down
22 changes: 12 additions & 10 deletions repository/OpenPonk-FSM/OPFsmController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ A DCFsmController is a diagram controller for FSM.
"
Class {
#name : #OPFsmController,
#superclass : #OPDiagramController,
#name : 'OPFsmController',
#superclass : 'OPDiagramController',
#instVars : [
'persistenceManager'
],
#category : #'OpenPonk-FSM-Controllers'
#category : 'OpenPonk-FSM-Controllers',
#package : 'OpenPonk-FSM',
#tag : 'Controllers'
}

{ #category : #userinterface }
{ #category : 'userinterface' }
OPFsmController >> applyLayout: anAlgorithm [

| figures edges |
Expand All @@ -23,18 +25,18 @@ OPFsmController >> applyLayout: anAlgorithm [
anAlgorithm on: figures asGroup edges: edges asGroup
]

{ #category : #testing }
{ #category : 'testing' }
OPFsmController >> canBeTargetFor: aController [
^ (super canBeTargetFor: aController)
or: [ aController isKindOf: OPFsmVertexController ]
]

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
OPFsmController >> commonModelClassPrefix [
^ 'OPFsm'
]

{ #category : #accessing }
{ #category : 'accessing' }
OPFsmController >> controllerFactory [
^ super controllerFactory
register: OPFsmInitialStateController forModel: OPFsmInitialState;
Expand All @@ -44,12 +46,12 @@ OPFsmController >> controllerFactory [
forModel: OPFsmIncomingTransition
]

{ #category : #accessing }
{ #category : 'accessing' }
OPFsmController >> elementsToShowInside [
^ model elements
]

{ #category : #initialization }
{ #category : 'initialization' }
OPFsmController >> initializePalette: aPalette [
aPalette
newCreationTool: 'Initial state'
Expand All @@ -66,7 +68,7 @@ OPFsmController >> initializePalette: aPalette [
icon: OPCoreIcons opFsmTransitionIcon
]

{ #category : #'controllers management' }
{ #category : 'controllers management' }
OPFsmController >> newControllerFor: aModel [
"IncomingTransition identifies itself as transition, but is not"

Expand Down
16 changes: 9 additions & 7 deletions repository/OpenPonk-FSM/OPFsmExamples.class.st
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Class {
#name : #OPFsmExamples,
#superclass : #Object,
#category : #'OpenPonk-FSM-Examples'
#name : 'OPFsmExamples',
#superclass : 'Object',
#category : 'OpenPonk-FSM-Examples',
#package : 'OpenPonk-FSM',
#tag : 'Examples'
}

{ #category : #examples }
{ #category : 'examples' }
OPFsmExamples class >> exampleDecimal [

| project fsm initial z b c d k isDigit |
Expand Down Expand Up @@ -46,7 +48,7 @@ OPFsmExamples class >> exampleDecimal [
(OPWorkbench openProject: project) showAllElementsInAllDiagrams
]

{ #category : #examples }
{ #category : 'examples' }
OPFsmExamples class >> exampleDivisibility [

| project fsm initial zero one two |
Expand Down Expand Up @@ -76,7 +78,7 @@ OPFsmExamples class >> exampleDivisibility [
(OPWorkbench openProject: project) showAllElementsInAllDiagrams
]

{ #category : #examples }
{ #category : 'examples' }
OPFsmExamples class >> exampleEmpty [

| project fsm |
Expand All @@ -86,7 +88,7 @@ OPFsmExamples class >> exampleEmpty [
(OPWorkbench openProject: project) showAllElementsInAllDiagrams
]

{ #category : #menu }
{ #category : 'menu' }
OPFsmExamples class >> menuCommandOn: aBuilder [

<worldMenu>
Expand Down
20 changes: 11 additions & 9 deletions repository/OpenPonk-FSM/OPFsmFigureHighlighter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,22 @@ Hightlight and unhighlight fsm figures.
FSM Figures.
"
Class {
#name : #OPFsmFigureHighlighter,
#superclass : #Object,
#category : #'OpenPonk-FSM-Shapes'
#name : 'OPFsmFigureHighlighter',
#superclass : 'Object',
#category : 'OpenPonk-FSM-Shapes',
#package : 'OpenPonk-FSM',
#tag : 'Shapes'
}

{ #category : #'api - highlight' }
{ #category : 'api - highlight' }
OPFsmFigureHighlighter class >> highlight: aShapedObject with: aColor [
aShapedObject isNode
ifTrue: [ self highlightNode: aShapedObject with: aColor ].
aShapedObject isLine
ifTrue: [ self highlightLine: aShapedObject with: aColor ]
]

{ #category : #'api - highlight' }
{ #category : 'api - highlight' }
OPFsmFigureHighlighter class >> highlightLine: aLine with: aColor [

self unhighlightNode: aLine.
Expand All @@ -32,7 +34,7 @@ OPFsmFigureHighlighter class >> highlightLine: aLine with: aColor [
aLine signalUpdate
]

{ #category : #'api - highlight' }
{ #category : 'api - highlight' }
OPFsmFigureHighlighter class >> highlightNode: aNode with: aColor [

self unhighlightNode: aNode.
Expand All @@ -41,23 +43,23 @@ OPFsmFigureHighlighter class >> highlightNode: aNode with: aColor [
aNode signalUpdate
]

{ #category : #'api - unhighlight' }
{ #category : 'api - unhighlight' }
OPFsmFigureHighlighter class >> unhighlight: aShapedObject [
aShapedObject isNode
ifTrue: [ self unhighlightNode: aShapedObject ].
aShapedObject isLine
ifTrue: [ self unhighlightLine: aShapedObject ]
]

{ #category : #'api - unhighlight' }
{ #category : 'api - unhighlight' }
OPFsmFigureHighlighter class >> unhighlightLine: aLine [

aLine shape color: (aLine propertyAt: self name ifAbsent: [ ^ self ]).
aLine removePropertyAt: self name.
aLine signalUpdate
]

{ #category : #'api - unhighlight' }
{ #category : 'api - unhighlight' }
OPFsmFigureHighlighter class >> unhighlightNode: aNode [

aNode shape borderColor:
Expand Down
10 changes: 6 additions & 4 deletions repository/OpenPonk-FSM/OPFsmFinalStateController.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
A DCFsmFinalStateController is a controller for the final state in FSM.
"
Class {
#name : #OPFsmFinalStateController,
#superclass : #OPFsmStateController,
#category : #'OpenPonk-FSM-Controllers'
#name : 'OPFsmFinalStateController',
#superclass : 'OPFsmStateController',
#category : 'OpenPonk-FSM-Controllers',
#package : 'OpenPonk-FSM',
#tag : 'Controllers'
}

{ #category : #accessing }
{ #category : 'accessing' }
OPFsmFinalStateController >> createModelIn: aParentModel [

^ (super createModelIn: aParentModel)
Expand Down
16 changes: 9 additions & 7 deletions repository/OpenPonk-FSM/OPFsmGraphML.class.st
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Class {
#name : #OPFsmGraphML,
#superclass : #Object,
#category : 'OpenPonk-FSM-Serialization'
#name : 'OPFsmGraphML',
#superclass : 'Object',
#category : 'OpenPonk-FSM-Serialization',
#package : 'OpenPonk-FSM',
#tag : 'Serialization'
}

{ #category : #export }
{ #category : 'export' }
OPFsmGraphML >> export: aModel [
^ (MustacheTemplate on: self template)
value:
Expand All @@ -20,7 +22,7 @@ OPFsmGraphML >> export: aModel [
with: #graphmlType -> each graphmlType ]))} asDictionary
]

{ #category : #import }
{ #category : 'import' }
OPFsmGraphML >> import: aXml [
| model doc graph graphData node nodeData edge edgeData nodes |
doc := XMLDOMParser parse: aXml.
Expand Down Expand Up @@ -60,7 +62,7 @@ OPFsmGraphML >> import: aXml [
^ model
]

{ #category : #import }
{ #category : 'import' }
OPFsmGraphML >> nodeForType: aType [
aType = #initial
ifTrue: [ ^ OPFsmInitialState new ].
Expand All @@ -71,7 +73,7 @@ OPFsmGraphML >> nodeForType: aType [
^ OPFsmState new
]

{ #category : #export }
{ #category : 'export' }
OPFsmGraphML >> template [
<script: '(XMLDOMParser parse: self new template) inspect'>
^ '<?xml version="1.0" encoding="UTF-8"?>
Expand Down
Loading

0 comments on commit d32c651

Please sign in to comment.