diff --git a/src/Spec2-Adapters-Morphic/SpMorphicTreeTableDataSource.class.st b/src/Spec2-Adapters-Morphic/SpMorphicTreeTableDataSource.class.st index fbaab1ca..c1859a6e 100644 --- a/src/Spec2-Adapters-Morphic/SpMorphicTreeTableDataSource.class.st +++ b/src/Spec2-Adapters-Morphic/SpMorphicTreeTableDataSource.class.st @@ -69,14 +69,16 @@ SpMorphicTreeTableDataSource >> collapsePath: aPath [ (self itemAtPath: aPath) ifNotNil:[ :aNode | aNode collapseAll. - self tableRefresh ] + self tableRefresh. + self model selection selectPath: aPath ] ] { #category : 'accessing' } -SpMorphicTreeTableDataSource >> expandPath: anArray [ +SpMorphicTreeTableDataSource >> expandPath: aPath [ - self expandPath: anArray root: self rootItem children. - self tableRefresh + self expandPath: aPath root: self rootItem children. + self tableRefresh. + self model selection selectPath: aPath ] { #category : 'accessing' } diff --git a/src/Spec2-Core/SpAbstractTreePresenter.class.st b/src/Spec2-Core/SpAbstractTreePresenter.class.st index b11982c2..8f3d20b9 100644 --- a/src/Spec2-Core/SpAbstractTreePresenter.class.st +++ b/src/Spec2-Core/SpAbstractTreePresenter.class.st @@ -208,6 +208,7 @@ SpAbstractTreePresenter >> initialize [ verticalAlignment := SpVerticalAlignment new. self withScrollBars. + self registerActions. self registerEvents ] diff --git a/src/Spec2-Core/SpWindowPresenter.class.st b/src/Spec2-Core/SpWindowPresenter.class.st index f09b6bef..0fcb2bd2 100644 --- a/src/Spec2-Core/SpWindowPresenter.class.st +++ b/src/Spec2-Core/SpWindowPresenter.class.st @@ -322,7 +322,7 @@ SpWindowPresenter >> initialize [ { #category : 'initialization' } SpWindowPresenter >> initializeWindow [ - + self presenter initializeWindow: self ] diff --git a/src/Spec2-ListView/SpTreeColumnViewPresenter.class.st b/src/Spec2-ListView/SpTreeColumnViewPresenter.class.st index fd4bd30e..6596ae3e 100644 --- a/src/Spec2-ListView/SpTreeColumnViewPresenter.class.st +++ b/src/Spec2-ListView/SpTreeColumnViewPresenter.class.st @@ -26,7 +26,7 @@ SpTreeColumnViewPresenter class >> adapterName [ SpTreeColumnViewPresenter class >> example [ ^ self new - application: (SpApplication new useBackend: #Gtk); + application: SpApplication new; addColumnTitle: 'Class' setup: [ :aPresenter | aPresenter newLabel ] bind: [ :aPresenter :aClass | aPresenter label: aClass name ]; @@ -217,6 +217,19 @@ SpTreeColumnViewPresenter >> isShowingColumnHeaders [ ^ showColumnHeaders ] +{ #category : 'initialization' } +SpTreeColumnViewPresenter >> registerActions [ + + super registerActions. + self ensureInternalActions + addShortcutWith: [ :action | action + shortcutKey: KeyboardKey right asKeyCombination | KeyboardKey space asKeyCombination; + action: [ self expandPath: self selection selectedPath ] ]; + addShortcutWith: [ :action | action + shortcutKey: KeyboardKey left asKeyCombination; + action: [ self collapsePath: self selection selectedPath ] ] +] + { #category : 'api' } SpTreeColumnViewPresenter >> showColumnHeaders [ "Show column headers" diff --git a/src/Spec2-ListView/SpTreeListViewPresenter.class.st b/src/Spec2-ListView/SpTreeListViewPresenter.class.st index 9fd33db0..5b63cdce 100644 --- a/src/Spec2-ListView/SpTreeListViewPresenter.class.st +++ b/src/Spec2-ListView/SpTreeListViewPresenter.class.st @@ -28,7 +28,7 @@ SpTreeListViewPresenter class >> example [ "This example show the simples list view you can make: A list with a label" self new - application: (SpApplication new useBackend: #Gtk); + application: SpApplication new; items: { Object }; children: [ :aClass | aClass subclasses ]; setup: [ :aPresenter | aPresenter newLabel ]; @@ -235,7 +235,6 @@ SpTreeListViewPresenter >> initialize [ self beSingleSelection. self activateOnDoubleClick. - self registerActions. self initializeItemFactory ] @@ -247,6 +246,19 @@ SpTreeListViewPresenter >> initializeItemFactory [ self bind: [ :aPresenter :anObject | aPresenter label: anObject asString ] ] +{ #category : 'initialization' } +SpTreeListViewPresenter >> registerActions [ + + super registerActions. + self ensureInternalActions + addShortcutWith: [ :action | action + shortcutKey: KeyboardKey right asKeyCombination | KeyboardKey space asKeyCombination; + action: [ self expandPath: self selection selectedPath ] ]; + addShortcutWith: [ :action | action + shortcutKey: KeyboardKey left asKeyCombination; + action: [ self collapsePath: self selection selectedPath ] ] +] + { #category : 'initialization' } SpTreeListViewPresenter >> registerEvents [