Skip to content

Commit

Permalink
Merge pull request #143 from OpenSmock/Issue_0130
Browse files Browse the repository at this point in the history
Issue 0130
  • Loading branch information
labordep authored Jan 3, 2024
2 parents b432492 + e718dfa commit 2ace04b
Show file tree
Hide file tree
Showing 13 changed files with 525 additions and 168 deletions.
34 changes: 34 additions & 0 deletions src/Pyramid-Bloc/PyramidAbstractColumnsBuilder.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Class {
#name : #PyramidAbstractColumnsBuilder,
#superclass : #Object,
#instVars : [
'editor'
],
#category : #'Pyramid-Bloc-plugin-tree-library'
}

{ #category : #testing }
PyramidAbstractColumnsBuilder class >> isAbstract [

^ self == PyramidAbstractColumnsBuilder
]

{ #category : #'as yet unclassified' }
PyramidAbstractColumnsBuilder >> buildOn: aPyramidTreePlugin [
"aPyramidTreePlugin addColumns: { }"
self shouldBeImplemented

]

{ #category : #accessing }
PyramidAbstractColumnsBuilder >> editor [

editor ifNil: [ Error signal: 'Editor should not be nil.' ].
^ editor
]

{ #category : #accessing }
PyramidAbstractColumnsBuilder >> editor: anObject [

editor := anObject
]
32 changes: 17 additions & 15 deletions src/Pyramid-Bloc/PyramidLibraryPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,26 @@ Class {
'addButton',
'idGenerator'
],
#classVars : [
'IdGenerator'
],
#category : #'Pyramid-Bloc-plugin-tree-library'
}

{ #category : #accessing }
PyramidLibraryPresenter class >> idGenerator [
PyramidLibraryPresenter class >> makeIdGenerator [
^ Generator on: [ :generator |
| index |
index := 1.
[
Character alphabet do: [ :each |
| next suffix |
next := each asUppercase asString.
suffix := index = 1
ifTrue: [ '' ]
ifFalse: [ index asString ].
generator yield: next , suffix ].
index := index + 1 ] repeat ].
| index |
index := 1.
[
Character alphabet do: [ :each |
| next suffix |
next := each asUppercase asString.
suffix := index = 1
ifTrue: [ '' ]
ifFalse: [ index asString ].
generator yield: next , suffix ].
index := index + 1 ] repeat ]
]

{ #category : #initialization }
Expand Down Expand Up @@ -92,7 +95,7 @@ PyramidLibraryPresenter >> defaultLayout [
expand: false;
yourself)
width: 300;
yourself)
yourself); yourself
]

{ #category : #accessing }
Expand All @@ -109,6 +112,7 @@ PyramidLibraryPresenter >> editor: aPyramidEditor [
{ #category : #accessing }
PyramidLibraryPresenter >> idGenerator [

idGenerator ifNil: [ idGenerator := self class makeIdGenerator ].
^ idGenerator
]

Expand All @@ -121,8 +125,6 @@ PyramidLibraryPresenter >> idGenerator: anObject [
{ #category : #initialization }
PyramidLibraryPresenter >> initializePresenters [

idGenerator := self class idGenerator.

addButton := SpButtonPresenter new
label: self buttonLabel;
action: [ self buttonAction ];
Expand Down
81 changes: 81 additions & 0 deletions src/Pyramid-Bloc/PyramidPluginTestModeTest.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
Class {
#name : #PyramidPluginTestModeTest,
#superclass : #TestCase,
#instVars : [
'plugin',
'spacePlugin',
'editor'
],
#category : #'Pyramid-Bloc-plugin-testmode'
}

{ #category : #accessing }
PyramidPluginTestModeTest >> editor [
^ editor
]

{ #category : #accessing }
PyramidPluginTestModeTest >> plugin [

^ plugin
]

{ #category : #running }
PyramidPluginTestModeTest >> setUp [

super setUp.

plugin := PyramidPluginTestMode new.
spacePlugin := PyramidSpacePlugin new.
editor := PyramidEditorBuilder new plugins: { plugin . spacePlugin }; build.
]

{ #category : #tests }
PyramidPluginTestModeTest >> testIsTestOnGoing [

self assert: self plugin isTestOnGoing not.
self plugin switchToTestMode.
self assert: self plugin isTestOnGoing.
self plugin switchToTestMode.
self assert: self plugin isTestOnGoing not.
]

{ #category : #tests }
PyramidPluginTestModeTest >> testSwitchToTestMode [

| element elementThatReceiveEvent |
element := BlElement new
size: 500 asPoint;
background: Color blue;
addEventHandler: (BlEventHandler
on: BlPrimaryClickEvent
do: [ :evt | ]);
yourself.
self plugin elementAtEvents addEventHandler: (BlEventHandler
on: BlPrimaryClickEvent
do: [ :evt | ]).
self editor projectModel firstLevelElements add: element.

self plugin elementAtMain forceLayout.
elementThatReceiveEvent := self plugin elementAtMain
findMouseEventTargetAt:
10 asPoint
+ self plugin currentTransformTranslation.
self deny: elementThatReceiveEvent equals: element.

self plugin switchToTestMode.
self plugin elementAtMain forceLayout.
elementThatReceiveEvent := self plugin elementAtMain
findMouseEventTargetAt:
10 asPoint
+ self plugin currentTransformTranslation.
self assert: elementThatReceiveEvent equals: element.

self plugin switchToTestMode.
self plugin elementAtMain forceLayout.
elementThatReceiveEvent := self plugin elementAtMain
findMouseEventTargetAt:
10 asPoint
+ self plugin currentTransformTranslation.
self deny: elementThatReceiveEvent equals: element
]
94 changes: 94 additions & 0 deletions src/Pyramid-Bloc/PyramidTreeBaseColumnsBuilder.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
Class {
#name : #PyramidTreeBaseColumnsBuilder,
#superclass : #PyramidAbstractColumnsBuilder,
#category : #'Pyramid-Bloc-plugin-tree-library'
}

{ #category : #'as yet unclassified' }
PyramidTreeBaseColumnsBuilder >> buildOn: aPyramidTreePlugin [

aPyramidTreePlugin addColumns: { self nameAndTypeColumn . self hashColumn . self zIndexColumn . self visibilityColumn }
]

{ #category : #accessing }
PyramidTreeBaseColumnsBuilder >> hashColumn [

^ SpStringTableColumn new
title: 'Hash';
evaluated: [ :aBlElement |
aBlElement identityHash printString ];
displayColor: [ :aBlElement | Color gray ];
width: 60;
yourself
]

{ #category : #accessing }
PyramidTreeBaseColumnsBuilder >> nameAndTypeColumn [

^ SpCompositeTableColumn new
title: 'Elements';
addColumn:
(SpImageTableColumn evaluated: [ :aBlElement | aBlElement asIcon ]);
addColumn: (SpStringTableColumn new
title: 'Identifier';
evaluated: [ :aBlElement |
aBlElement elementId isNoId
ifTrue: [ '@\no name\' ]
ifFalse: [ aBlElement id asSymbol ] ];
yourself);
addColumn: (SpStringTableColumn new
title: 'Class';
evaluated: [ :aBlElement | aBlElement class name ];
displayColor: [ :aBlElement | Color gray ];
displayItalic: [ :aBlElement | true ];
yourself);
yourself
]

{ #category : #initialization }
PyramidTreeBaseColumnsBuilder >> setVisibility: aBlVisibility of: aBlElement onEditor: aPyramidEditor [

aPyramidEditor propertiesManager commandExecutor
use: PyramidVisibilityCommand new
on: { aBlElement }
with: aBlVisibility
]

{ #category : #accessing }
PyramidTreeBaseColumnsBuilder >> visibilityColumn [

^ SpCompositeTableColumn new
title: 'Visibility';
width: 80;
addColumn: (SpImageTableColumn evaluated: [ :aBlElement |
aBlElement
allParentsDetect: [ :parent | parent isVisible not ]
ifFound: [ :parent | self iconNamed: #uncommentedClass ]
ifNone: [ self iconNamed: #blank16 ] ]);
addColumn: (SpImageTableColumn evaluated: [ :aBlElement |
aBlElement visibility asIcon ]);
addColumn: (SpLinkTableColumn new
title: 'Visible';
url: [ :aBlElement | '' ];
action: [ :aBlElement |
self
setVisibility: aBlElement visibility nextVisibilityForTree
of: aBlElement
onEditor: self editor ];
evaluated: [ :aBlElement | aBlElement visibility asString ];
yourself);
yourself
]

{ #category : #accessing }
PyramidTreeBaseColumnsBuilder >> zIndexColumn [

^ SpStringTableColumn new
title: 'z';
evaluated: [ :aBlElement |
aBlElement elevation elevation = 0
ifTrue: [ '' ]
ifFalse: [ aBlElement elevation elevation printString ] ];
width: 16;
yourself
]
Loading

0 comments on commit 2ace04b

Please sign in to comment.