# HG changeset patch # User Gerald Klix (speedy) # Date 1685636504 -7200 # Thu Jun 01 18:21:44 2023 +0200 # Node ID 76df65042c49875157328da1d57202c7b422572d # Parent e29ace551e811cc6022436124f18840149bd564e SUM: Added a secondary action that filters by one state. diff --git a/haver/office/NuMach.pck.st b/haver/office/NuMach.pck.st --- a/haver/office/NuMach.pck.st +++ b/haver/office/NuMach.pck.st @@ -1,8 +1,8 @@ -'From Haver 6.0 [latest update: #5832] on 1 June 2023 at 5:50:19 pm'! +'From Haver 6.0 [latest update: #5832] on 1 June 2023 at 6:20:16 pm'! 'Description NuMach is a very simple to list. Hopefully it will serve as a base for something more elaborate.'! -!provides: 'NuMach' 1 20! +!provides: 'NuMach' 1 21! !requires: 'Cuis-Base' 60 5780 nil! !requires: 'FacetsMorphs' 1 3 nil! !requires: 'IdGeneration' 1 0 nil! @@ -65,7 +65,7 @@ !classDefinition: (Modules>>#NuMach>>#TodoItemContainerMorph) category: 'NuMach-Morphs'! (Modules>>#NuMach>>#AbstractItemMorph) subclass: #TodoItemContainerMorph - instanceVariableNames: 'subItemsMorph filteredStates' + instanceVariableNames: 'subItemsMorph filterButtonsPanel filteredStates' classVariableNames: '' poolDictionaries: '' category: 'NuMach-Morphs' @@ -898,11 +898,11 @@ super initialize. isTopLevel := false! ! -!(Modules>>#NuMach>>#TodoItemContainerMorph) methodsFor: 'GUI building' stamp: 'KLG 6/1/2023 15:29:27'! +!(Modules>>#NuMach>>#TodoItemContainerMorph) methodsFor: 'GUI building' stamp: 'KLG 6/1/2023 18:13:57'! buildMorphicWidget "Build me." - | morphToAdd subItemsPanel filterButtonsPanel | + | morphToAdd subItemsPanel | filterButtonsPanel := LayoutMorph newRow. self model state model statesDo: [ :state | filterButtonsPanel @@ -911,7 +911,13 @@ contents: state displayString target: self selector: #visible:state: - arguments: { state }) ]. + arguments: { state } :: + secondarySelector: #visible:onlyThisState:; + setBalloonText: + 'If on, show items in state ', state displayString italic, + `String newLineString, String newLineString`, + 'Description:' bold, `String newLineString`, + state description) ]. self addMorph: filterButtonsPanel fixedHeight: Theme current buttonPaneHeight. subItemsMorph := DetailsMorph newColumn. morphToAdd := self isTopLevel @@ -1012,6 +1018,27 @@ visible: (filteredStates includes: subMorph model state) not ] ] ! ! +!(Modules>>#NuMach>>#TodoItemContainerMorph) methodsFor: 'filtering' stamp: 'KLG 6/1/2023 18:15:40'! +visible: aVisibleFlag onlyThisState: aState + "Filter aState according to aVisibleFlag. All other states if the negated visibility state." + + | comparsionOperator | + "D: Transcript cr; show: self; show: ' visible: '; show: aVisibleFlag; show: ' onlyThisState: '; show:aState." + aVisibleFlag + ifTrue: [ + filteredStates := Set new. + self model state model statesDo: [ :state | + state = aState ifFalse: [ + filteredStates add: state ] ] ] + ifFalse: [ filteredStates := Set with: aState ]. + self showSubItemsAccordingToFilter. + comparsionOperator := aVisibleFlag ifTrue: [ #= ] ifFalse: [ #~= ]. + filterButtonsPanel submorphsDo: [ :filterButton | + filterButton + isOn: (filterButton arguments first + perform: comparsionOperator + with: aState) ]! ! + !(Modules>>#NuMach>>#TodoItemContainerMorph) methodsFor: 'filtering' stamp: 'KLG 6/1/2023 17:45:31'! visible: aVisibleFlag state: aState "Add or remove aState form the set of filtered states."