From 8bc4d41926ea94434d9493b6856bc74537d98f63 Mon Sep 17 00:00:00 2001 From: Pierre Laborde Date: Thu, 16 Nov 2023 15:31:51 +0100 Subject: [PATCH 1/3] Prepare #109. Cleaning and refactoring --- src/Pyramid-Bloc/PyramidTreePlugin.class.st | 16 +++++++-------- .../PyramidTreePresenter.class.st | 20 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Pyramid-Bloc/PyramidTreePlugin.class.st b/src/Pyramid-Bloc/PyramidTreePlugin.class.st index 81fbcdd6..520f6497 100644 --- a/src/Pyramid-Bloc/PyramidTreePlugin.class.st +++ b/src/Pyramid-Bloc/PyramidTreePlugin.class.st @@ -12,7 +12,7 @@ Class { #category : #'Pyramid-Bloc-plugin-tree-library' } -{ #category : #'as yet unclassified' } +{ #category : #private } PyramidTreePlugin class >> columnNameAndType: aPyramidTreePlugin [ ^ SpCompositeTableColumn new @@ -46,7 +46,7 @@ PyramidTreePlugin class >> columnNameAndType: aPyramidTreePlugin [ yourself ] -{ #category : #'as yet unclassified' } +{ #category : #private } PyramidTreePlugin class >> columnVisibility: aPyramidTreePlugin [ ^ SpCompositeTableColumn new @@ -73,7 +73,7 @@ PyramidTreePlugin class >> columnVisibility: aPyramidTreePlugin [ yourself ] -{ #category : #'as yet unclassified' } +{ #category : #private } PyramidTreePlugin class >> columnZIndex: aPyramidTreePlugin [ ^ SpStringTableColumn new @@ -109,8 +109,8 @@ PyramidTreePlugin >> addPanelsOn: aPyramidSimpleWindow [ aPyramidSimpleWindow at: #tabLeft addItem: [ :builder | builder makeTab: self treePresenter - label: 'Tree' - icon: (self iconNamed: #catalog) + label: 'Elements tree' + icon: (self iconNamed: #hierarchy) order: 1 ]. aPyramidSimpleWindow @@ -176,19 +176,19 @@ PyramidTreePlugin >> initializeTreeColumns [ self treePresenter updateTree ] -{ #category : #'as yet unclassified' } +{ #category : #private } PyramidTreePlugin >> libraryPresenterForElement [ ^ libraryPresenterForElement ] -{ #category : #'as yet unclassified' } +{ #category : #private } PyramidTreePlugin >> libraryPresenterForRoot [ ^ libraryPresenterForRoot ] -{ #category : #'as yet unclassified' } +{ #category : #private } PyramidTreePlugin >> menuAddAndDeleteOn: aBuilder [ aBuilder diff --git a/src/Pyramid-Bloc/PyramidTreePresenter.class.st b/src/Pyramid-Bloc/PyramidTreePresenter.class.st index 0dc85a12..81c1b951 100644 --- a/src/Pyramid-Bloc/PyramidTreePresenter.class.st +++ b/src/Pyramid-Bloc/PyramidTreePresenter.class.st @@ -15,7 +15,7 @@ Class { #category : #'Pyramid-Bloc-plugin-tree-library' } -{ #category : #'as yet unclassified' } +{ #category : #private } PyramidTreePresenter >> actionAddNewElement [ (PyramidPopoverFactory makeWithPresenter: self libraryPresenterForRoot @@ -23,13 +23,13 @@ PyramidTreePresenter >> actionAddNewElement [ position: SpPopoverPosition right) popup ] -{ #category : #'as yet unclassified' } +{ #category : #private } PyramidTreePresenter >> actionEditorMenu [ ^ self editorMenuBuilder menuFor: self projectModel selection. ] -{ #category : #'as yet unclassified' } +{ #category : #private } PyramidTreePresenter >> actionSelectionChanged: aCollection [ self projectModel ifNil: [ ^ self ]. @@ -124,27 +124,27 @@ PyramidTreePresenter >> projectModel: anObject [ ] -{ #category : #'as yet unclassified' } +{ #category : #private } PyramidTreePresenter >> pyramidElementsChanged [ self updateRoots. self selectionHaveChanged ifTrue: [ self updateSelection ]. ] -{ #category : #'as yet unclassified' } +{ #category : #private } PyramidTreePresenter >> pyramidRootsChanged [ self updateRoots . self updateSelection ] -{ #category : #'as yet unclassified' } +{ #category : #private } PyramidTreePresenter >> pyramidSelectionChanged [ self updateSelection ] -{ #category : #'as yet unclassified' } +{ #category : #private } PyramidTreePresenter >> selectionHaveChanged [ self tree selectedItems size = self projectModel selection size ifFalse: [ @@ -174,7 +174,7 @@ PyramidTreePresenter >> tree [ ^ tree ] -{ #category : #'as yet unclassified' } +{ #category : #private } PyramidTreePresenter >> updateRoots [ self shouldUpdateSelection: false. @@ -182,7 +182,7 @@ PyramidTreePresenter >> updateRoots [ self tree roots: self projectModel roots asArray ] ensure: [ self shouldUpdateSelection: true ] ] -{ #category : #'as yet unclassified' } +{ #category : #private } PyramidTreePresenter >> updateSelection [ self projectModel ifNil: [ ^ self ]. @@ -195,7 +195,7 @@ PyramidTreePresenter >> updateSelection [ ensure: [ self shouldUpdateSelection: true ] ] -{ #category : #'as yet unclassified' } +{ #category : #private } PyramidTreePresenter >> updateTree [ self tree columns: { }. From 2419a1023e668c8a32d0e443f80f3ec7a30774f9 Mon Sep 17 00:00:00 2001 From: Pierre Laborde Date: Thu, 16 Nov 2023 15:53:19 +0100 Subject: [PATCH 2/3] Reorganize columns --- src/Pyramid-Bloc/PyramidTreePlugin.class.st | 37 +++++++++++-------- .../PyramidTreePresenter.class.st | 17 +++++---- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/Pyramid-Bloc/PyramidTreePlugin.class.st b/src/Pyramid-Bloc/PyramidTreePlugin.class.st index 520f6497..f861a61e 100644 --- a/src/Pyramid-Bloc/PyramidTreePlugin.class.st +++ b/src/Pyramid-Bloc/PyramidTreePlugin.class.st @@ -16,21 +16,13 @@ Class { PyramidTreePlugin class >> columnNameAndType: aPyramidTreePlugin [ ^ SpCompositeTableColumn new - " sortFunction: PyramidElementIdSortFunction new;" - title: 'Elements'; + title: 'Element'; + addColumn: (SpImageTableColumn evaluated: [ :aBlElement | aBlElement asIcon ]); - addColumn: (SpStringTableColumn new - title: 'Class'; - evaluated: [ :aBlElement | aBlElement class name ]; - yourself); - addColumn: (SpStringTableColumn new - title: 'Identity'; - evaluated: [ :aBlElement | aBlElement identityHash printString ]; - displayColor: [ :aBlElement | Color gray ]; - yourself); - addColumn: (SpStringTableColumn new - title: 'Identifier'; + + addColumn: (SpStringTableColumn new + title: 'Id'; beEditable; onAcceptEdition: [ :aBlElement :newIdString | self @@ -43,6 +35,18 @@ PyramidTreePlugin class >> columnNameAndType: aPyramidTreePlugin [ ifFalse: [ aBlElement id asSymbol ] ]; displayColor: [ :aBlElement | Smalltalk ui theme textColor ]; yourself); + + addColumn: (SpStringTableColumn new + title: 'Class'; + evaluated: [ :aBlElement | aBlElement class name ]; + yourself); + + addColumn: (SpStringTableColumn new + title: 'Hash num'; + evaluated: [ :aBlElement | aBlElement identityHash printString ]; + displayColor: [ :aBlElement | Color gray ]; + yourself); + yourself ] @@ -50,7 +54,7 @@ PyramidTreePlugin class >> columnNameAndType: aPyramidTreePlugin [ PyramidTreePlugin class >> columnVisibility: aPyramidTreePlugin [ ^ SpCompositeTableColumn new - title: 'Visibility'; + title: ''; "no title" "sortFunction: PyramidVisibilitySortFunction new;" width: 80; addColumn: (SpImageTableColumn evaluated: [ :aBlElement | @@ -77,7 +81,7 @@ PyramidTreePlugin class >> columnVisibility: aPyramidTreePlugin [ PyramidTreePlugin class >> columnZIndex: aPyramidTreePlugin [ ^ SpStringTableColumn new - title: 'z'; + title: 'Z'; "sortFunction: PyramidElevationSortFunction new;" evaluated: [ :aBlElement | aBlElement elevation elevation printString ]; @@ -149,7 +153,8 @@ PyramidTreePlugin >> initialize [ libraryPresenterForRoot: self libraryPresenterForRoot; yourself. - self initializeTreeColumns. + + self initializeTreeColumns ] { #category : #initialization } diff --git a/src/Pyramid-Bloc/PyramidTreePresenter.class.st b/src/Pyramid-Bloc/PyramidTreePresenter.class.st index 81c1b951..382ef464 100644 --- a/src/Pyramid-Bloc/PyramidTreePresenter.class.st +++ b/src/Pyramid-Bloc/PyramidTreePresenter.class.st @@ -17,10 +17,11 @@ Class { { #category : #private } PyramidTreePresenter >> actionAddNewElement [ -(PyramidPopoverFactory - makeWithPresenter: self libraryPresenterForRoot - relativeTo: self buttonAddToRoots - position: SpPopoverPosition right) popup + + (PyramidPopoverFactory + makeWithPresenter: self libraryPresenterForRoot + relativeTo: self buttonAddToRoots + position: SpPopoverPosition right) popup ] { #category : #private } @@ -76,24 +77,24 @@ PyramidTreePresenter >> editorMenuBuilder: anObject [ PyramidTreePresenter >> initializePresenters [ shouldUpdateSelection := true. + tree := SpTreeTablePresenter new beMultipleSelection; beResizable; roots: { }; children: [ :each | each children ]; contextMenu: [ self actionEditorMenu ]; - whenSelectionChangedDo: [ :selection | - self actionSelectionChanged: selection ]; + whenSelectionChangedDo: [ :selection | self actionSelectionChanged: selection ]; expandAll. columns := OrderedCollection new. buttonAddToRoots := SpButtonPresenter new - label: 'Add new element'; + label: 'Add element'; icon: (self iconNamed: #add); action: [ self actionAddNewElement ]; help: - 'Add a new element on the roots of the design.'; + 'Add a new element in the current Space root of the project.'; yourself ] From d04cff72f70ab9177f4754dfa96329aa58edffca Mon Sep 17 00:00:00 2001 From: Pierre Laborde Date: Thu, 16 Nov 2023 15:56:07 +0100 Subject: [PATCH 3/3] Update tooltip --- src/Pyramid-Bloc/PyramidTreePresenter.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Pyramid-Bloc/PyramidTreePresenter.class.st b/src/Pyramid-Bloc/PyramidTreePresenter.class.st index 382ef464..a4db4a49 100644 --- a/src/Pyramid-Bloc/PyramidTreePresenter.class.st +++ b/src/Pyramid-Bloc/PyramidTreePresenter.class.st @@ -94,7 +94,7 @@ PyramidTreePresenter >> initializePresenters [ icon: (self iconNamed: #add); action: [ self actionAddNewElement ]; help: - 'Add a new element in the current Space root of the project.'; + 'Add a new element instance in the current Space root.'; yourself ]