Skip to content

Commit

Permalink
Accomodating OP core changes, code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Jan 1, 2025
1 parent d487ade commit 0fb1926
Show file tree
Hide file tree
Showing 41 changed files with 564 additions and 530 deletions.
10 changes: 6 additions & 4 deletions Pharo/OpenPonk-ERD/ManifestOpenPonkERD.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser
"
Class {
#name : #ManifestOpenPonkERD,
#superclass : #PackageManifest,
#category : #'OpenPonk-ERD-Manifest'
#name : 'ManifestOpenPonkERD',
#superclass : 'PackageManifest',
#category : 'OpenPonk-ERD-Manifest',
#package : 'OpenPonk-ERD',
#tag : 'Manifest'
}

{ #category : #'code-critics' }
{ #category : 'code-critics' }
ManifestOpenPonkERD class >> ruleBadMessageRule2V1FalsePositive [

<ignoreForCoverage>
Expand Down
16 changes: 9 additions & 7 deletions Pharo/OpenPonk-ERD/OPErd.class.st
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
Class {
#name : #OPErd,
#superclass : #OPModelObject,
#category : #'OpenPonk-ERD-Models'
#name : 'OPErd',
#superclass : 'OPModelObject',
#category : 'OpenPonk-ERD-Models',
#package : 'OpenPonk-ERD',
#tag : 'Models'
}

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

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

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

{ #category : #testing }
{ #category : 'testing' }
OPErd >> transitions [
^ elements select: [ :each | each isTransition ]
]
18 changes: 10 additions & 8 deletions Pharo/OpenPonk-ERD/OPErdAbstractNodeShape.class.st
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
Class {
#name : #OPErdAbstractNodeShape,
#superclass : #OPBoundNode,
#name : 'OPErdAbstractNodeShape',
#superclass : 'OPBoundNode',
#instVars : [
'adornmentCreationBlock'
],
#category : #'OpenPonk-ERD-DiagramElements'
#category : 'OpenPonk-ERD-DiagramElements',
#package : 'OpenPonk-ERD',
#tag : 'DiagramElements'
}

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

adornmentCreationBlock := aBlock
]

{ #category : #rendering }
{ #category : 'rendering' }
OPErdAbstractNodeShape >> renderShapeDetails [

self roassalShape
Expand All @@ -24,7 +26,7 @@ OPErdAbstractNodeShape >> renderShapeDetails [
super renderShapeDetails
]

{ #category : #interactions }
{ #category : 'interactions' }
OPErdAbstractNodeShape >> selectableInteraction [

| selectableInteraction |
Expand All @@ -42,13 +44,13 @@ OPErdAbstractNodeShape >> selectableInteraction [
^ selectableInteraction
]

{ #category : #interactions }
{ #category : 'interactions' }
OPErdAbstractNodeShape >> shouldBePositionableByUser [

^ true
]

{ #category : #interactions }
{ #category : 'interactions' }
OPErdAbstractNodeShape >> shouldBeResizableByUser [

^ true
Expand Down
34 changes: 18 additions & 16 deletions Pharo/OpenPonk-ERD/OPErdAttribute.class.st
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
Class {
#name : #OPErdAttribute,
#superclass : #OPErdNode,
#name : 'OPErdAttribute',
#superclass : 'OPErdNode',
#instVars : [
'isDerived',
'isMultivalued',
'isKey'
],
#category : #'OpenPonk-ERD-Models'
#category : 'OpenPonk-ERD-Models',
#package : 'OpenPonk-ERD',
#tag : 'Models'
}

{ #category : #associating }
{ #category : 'associating' }
OPErdAttribute >> beDerived [
self isDerived: true
]

{ #category : #associating }
{ #category : 'associating' }
OPErdAttribute >> beKey [
self isKey: true
]

{ #category : #associating }
{ #category : 'associating' }
OPErdAttribute >> beMultivalued [
self isMultivalued: true
]

{ #category : #accessing }
{ #category : 'accessing' }
OPErdAttribute >> beNormal [
self isDerived: false.
self isMultivalued: false.
self isKey: false
]

{ #category : #associating }
{ #category : 'associating' }
OPErdAttribute >> graphmlType [
self isDerived
ifTrue: [ ^ #derived ]
Expand All @@ -42,48 +44,48 @@ OPErdAttribute >> graphmlType [
ifFalse: [ ^ #regularAttribute ] ] ]
]

{ #category : #associating }
{ #category : 'associating' }
OPErdAttribute >> initialize [
super initialize.
isDerived := false.
isMultivalued := false.
isKey := false
]

{ #category : #associating }
{ #category : 'associating' }
OPErdAttribute >> isDerived [
^ isDerived
]

{ #category : #accessing }
{ #category : 'accessing' }
OPErdAttribute >> isDerived: aBoolean [
isDerived := aBoolean.
self changed
]

{ #category : #associating }
{ #category : 'associating' }
OPErdAttribute >> isKey [
^ isKey
]

{ #category : #accessing }
{ #category : 'accessing' }
OPErdAttribute >> isKey: aBoolean [
isKey := aBoolean.
self changed
]

{ #category : #associating }
{ #category : 'associating' }
OPErdAttribute >> isMultivalued [
^ isMultivalued
]

{ #category : #accessing }
{ #category : 'accessing' }
OPErdAttribute >> isMultivalued: aBoolean [
isMultivalued := aBoolean.
self changed
]

{ #category : #associating }
{ #category : 'associating' }
OPErdAttribute >> isNormal [
^ (isDerived & isMultivalued & isKey) not
]
48 changes: 26 additions & 22 deletions Pharo/OpenPonk-ERD/OPErdAttributeController.class.st
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Class {
#name : #OPErdAttributeController,
#superclass : #OPErdNodeController,
#category : #'OpenPonk-ERD-Controllers'
#name : 'OPErdAttributeController',
#superclass : 'OPErdNodeController',
#category : 'OpenPonk-ERD-Controllers',
#package : 'OpenPonk-ERD',
#tag : 'Controllers'
}

{ #category : #forms }
{ #category : 'forms' }
OPErdAttributeController >> buildEditorForm: aForm [

super buildEditorForm: aForm.
Expand Down Expand Up @@ -39,47 +41,49 @@ OPErdAttributeController >> buildEditorForm: aForm [
self diagramController updateCanvas.
]

{ #category : #connecting }
{ #category : 'connecting' }
OPErdAttributeController >> canBeSourceFor: aController [
^ (aController class == OPErdTransitionController)

]

{ #category : #connecting }
{ #category : 'connecting' }
OPErdAttributeController >> canBeTargetFor: aController [
^ (aController class == OPErdTransitionController)
ifTrue: [ ^ self sourceIsValid: aController source model ]
ifFalse: [ ^ false ]

]

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
OPErdAttributeController >> derivedValidation [

| inc out |
self model incoming isEmpty
ifTrue: [ inc := true ]
ifFalse: [ inc := self model incoming allSatisfy:
[ :each | self validDerivedSources includes: each source class] ].

self model outgoing isEmpty
ifTrue: [ out := true ]
ifFalse: [ out := self model outgoing includesAny: self validDerivedTargets ].
(inc & out) ifTrue: [ ^ true ].
inc := self model incoming isEmpty
ifTrue: [ true ]
ifFalse: [
self model incoming allSatisfy: [ :each |
self validDerivedSources includes: each source class ] ].
out := self model outgoing isEmpty
ifTrue: [ true ]
ifFalse: [
self model outgoing includesAny: self validDerivedTargets ].
inc & out ifTrue: [ ^ true ].
^ false
]

{ #category : #construction }
{ #category : 'construction' }
OPErdAttributeController >> diagramElementClass [

^ OPErdAttributeShape
]

{ #category : #accessing }
{ #category : 'accessing' }
OPErdAttributeController >> modelClass [
^ OPErdAttribute
]

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
OPErdAttributeController >> sourceIsValid: aModel [
(aModel class == self modelClass)
ifTrue: [ ^ ((aModel uuid ~~ self model uuid) and:
Expand All @@ -88,18 +92,18 @@ OPErdAttributeController >> sourceIsValid: aModel [
ifFalse: [ ^ self validSources includes: aModel class ]
]

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
OPErdAttributeController >> validDerivedSources [
^ { OPErdEntity.
OPErdRelation. }
]

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
OPErdAttributeController >> validDerivedTargets [
^ { OPErdEntity. }
]

{ #category : #'accessing - DirectedRelationship' }
{ #category : 'accessing - DirectedRelationship' }
OPErdAttributeController >> validSources [
"does not include self to avoid self -> self connections if not allowed"
^ { OPErdEntity.
Expand Down
22 changes: 12 additions & 10 deletions Pharo/OpenPonk-ERD/OPErdAttributeShape.class.st
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
Class {
#name : #OPErdAttributeShape,
#superclass : #OPErdAbstractNodeShape,
#name : 'OPErdAttributeShape',
#superclass : 'OPErdAbstractNodeShape',
#instVars : [
'label',
'border',
'innerEllipse'
],
#category : #'OpenPonk-ERD-DiagramElements'
#category : 'OpenPonk-ERD-DiagramElements',
#package : 'OpenPonk-ERD',
#tag : 'DiagramElements'
}

{ #category : #rendering }
{ #category : 'rendering' }
OPErdAttributeShape >> renderBasicShape [

^ RSEllipse new
Expand All @@ -23,7 +25,7 @@ OPErdAttributeShape >> renderBasicShape [
yourself.
]

{ #category : #rendering }
{ #category : 'rendering' }
OPErdAttributeShape >> renderShapeDetails [

super renderShapeDetails.
Expand Down Expand Up @@ -71,36 +73,36 @@ OPErdAttributeShape >> renderShapeDetails [
for: self
]

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
OPErdAttributeShape >> updateBorder [
border
radius: (self roassalShape radius);
height: (self roassalShape height);
width: (self roassalShape width).
]

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
OPErdAttributeShape >> updateDetails [
self updateBorder.
self updateInnerEllipse.
self updateLabel
]

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
OPErdAttributeShape >> updateInnerEllipse [
innerEllipse
radius: (self roassalShape radius - 3);
width: (self roassalShape width - 7);
height: (self roassalShape height - 7).
]

{ #category : #'as yet unclassified' }
{ #category : 'as yet unclassified' }
OPErdAttributeShape >> updateLabel [
label
width: self roassalShape width.
]

{ #category : #rendering }
{ #category : 'rendering' }
OPErdAttributeShape >> updateRenderFromModel [

label text: self modelElement name.
Expand Down
Loading

0 comments on commit 0fb1926

Please sign in to comment.