-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #143 from OpenSmock/Issue_0130
Issue 0130
- Loading branch information
Showing
13 changed files
with
525 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
] |
Oops, something went wrong.