Skip to content

Commit

Permalink
ToMultiSelectElement: more consistent fake node implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
plantec committed Sep 30, 2024
1 parent 0af0f42 commit b75ff29
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 25 deletions.
1 change: 1 addition & 0 deletions src/Toplo-Examples/ToSandBox.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -1729,6 +1729,7 @@ ToSandBox class >> example_SelectAntDesignIconMultiFiltrable [
('Select icons' asRopedText foreground: Color red).

select inputTextField requestFocus.
select inspect.
select openInSpace
]

Expand Down
7 changes: 0 additions & 7 deletions src/Toplo-Widget-List/ToBarNodeManager.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ Class {
#category : #'Toplo-Widget-List-Core-BarElement'
}

{ #category : #'instance creation' }
ToBarNodeManager >> buildFakeNode: aFakeNode inHolder: anHolder [

nodeBuilder cull: aFakeNode cull: fakeDataItem cull: anHolder
]

{ #category : #initialization }
ToBarNodeManager >> constraintFakeNode: aNode [

Expand All @@ -37,7 +31,6 @@ ToBarNodeManager >> constraintFakeNode: aNode [
ToBarNodeManager >> constraintNode: aNode [

| bar |
aNode isFake ifTrue: [ ^ self ].
bar := aNode holder listElement.
aNode constraintsDo: [ :c |
c horizontal fitContent.
Expand Down
2 changes: 1 addition & 1 deletion src/Toplo-Widget-List/ToInnerBarElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ ToInnerBarElement >> installFakeNode [
" add the fake node (to keep a constant minimum size ).
Pay attention to add the fake node ** before ** the fake node building "
self scrollableElement addFakeNode: fakeNode.
self nodeManager buildFakeNode: fakeNode inHolder: holder.
self nodeManager buildNode: fakeNode inHolder: holder.



Expand Down
2 changes: 1 addition & 1 deletion src/Toplo-Widget-Segmented/ToSegmentedNodeManager.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ToSegmentedNodeManager >> defaultNodeFactory [
{ #category : #initialization }
ToSegmentedNodeManager >> unbuildNode: aNode [

aNode isFake ifFalse: [ aNode checkableElement unregisterFromGroup ].
aNode checkableElement unregisterFromGroup.
aNode checkableElement removeFromParent.
super unbuildNode: aNode
]
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
Class {
#name : #ToAbstractMultiSelectDataItem,
#name : #ToAbstractMultiSelectItem,
#superclass : #Object,
#category : #'Toplo-Widget-Select-Multi'
}

{ #category : #'node building' }
ToAbstractMultiSelectDataItem >> buildNode: aNode inHolder: aNodeHolder withManager: aNodeManager [
ToAbstractMultiSelectItem >> buildNode: aNode inHolder: aNodeHolder withManager: aNodeManager [

self subclassResponsibility
]

{ #category : #accessing }
ToAbstractMultiSelectDataItem >> indexes [
ToAbstractMultiSelectItem >> indexes [

^ self subclassResponsibility
]

{ #category : #testing }
ToAbstractMultiSelectDataItem >> isComposite [
ToAbstractMultiSelectItem >> isComposite [

^ false
]

{ #category : #accessing }
ToAbstractMultiSelectDataItem >> items [
ToAbstractMultiSelectItem >> items [

^ self subclassResponsibility
]

{ #category : #accessing }
ToAbstractMultiSelectDataItem >> nodesCount [
ToAbstractMultiSelectItem >> nodesCount [

^ self subclassResponsibility
]
10 changes: 9 additions & 1 deletion src/Toplo-Widget-Select/ToMultiSelectBarNodeManager.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ToMultiSelectBarNodeManager >> defaultCompositeNodeBuilder [
{ #category : #initialization }
ToMultiSelectBarNodeManager >> defaultFakeDataItem [

^ ToMultiSelectItem index: 0
^ ToMultiSelectFakeItem new
]

{ #category : #initialization }
Expand Down Expand Up @@ -69,6 +69,14 @@ ToMultiSelectBarNodeManager >> defaultNodeFactory [
^ [ :holder | ToMultiSelectBarNode new ]
]

{ #category : #accessing }
ToMultiSelectBarNodeManager >> fakeDataItem: aDataItem [

fakeDataItem := ToMultiSelectFakeItem new
dataItem: aDataItem;
yourself
]

{ #category : #initialization }
ToMultiSelectBarNodeManager >> initialize [

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Class {
#name : #ToMultiSelectCompositeItem,
#superclass : #ToAbstractMultiSelectDataItem,
#superclass : #ToAbstractMultiSelectItem,
#instVars : [
'indexes',
'content',
Expand Down
50 changes: 50 additions & 0 deletions src/Toplo-Widget-Select/ToMultiSelectFakeItem.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Class {
#name : #ToMultiSelectFakeItem,
#superclass : #ToAbstractMultiSelectItem,
#instVars : [
'dataItem'
],
#category : #'Toplo-Widget-Select-Multi'
}

{ #category : #'instance creation' }
ToMultiSelectFakeItem class >> index: anIndex [

^ self new index: anIndex; yourself
]

{ #category : #'node building' }
ToMultiSelectFakeItem >> buildNode: aNode inHolder: aNodeHolder withManager: aNodeManager [

aNodeManager nodeBuilder value: aNode value: dataItem value: aNodeHolder
]

{ #category : #accessing }
ToMultiSelectFakeItem >> dataItem [

^ dataItem
]

{ #category : #accessing }
ToMultiSelectFakeItem >> dataItem: aDataItem [

dataItem := aDataItem
]

{ #category : #accessing }
ToMultiSelectFakeItem >> indexes [

^ { }
]

{ #category : #accessing }
ToMultiSelectFakeItem >> items [

^ { }
]

{ #category : #accessing }
ToMultiSelectFakeItem >> nodesCount [

^ 0
]
16 changes: 8 additions & 8 deletions src/Toplo-Widget-Select/ToMultiSelectItem.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Class {
#name : #ToMultiSelectItem,
#superclass : #ToAbstractMultiSelectDataItem,
#superclass : #ToAbstractMultiSelectItem,
#instVars : [
'index',
'pickOrder'
Expand All @@ -25,43 +25,43 @@ ToMultiSelectItem >> buildNode: aNode inHolder: aNodeHolder withManager: aNodeMa
aNode removeFromBar ]
]

{ #category : #accessing }
{ #category : #'as yet unclassified' }
ToMultiSelectItem >> index [

^ index
]

{ #category : #accessing }
{ #category : #'as yet unclassified' }
ToMultiSelectItem >> index: anInteger [

index := anInteger
]

{ #category : #accessing }
{ #category : #'as yet unclassified' }
ToMultiSelectItem >> indexes [

^ Array with: index
]

{ #category : #accessing }
{ #category : #'as yet unclassified' }
ToMultiSelectItem >> items [

^ { self }
]

{ #category : #accessing }
{ #category : #'as yet unclassified' }
ToMultiSelectItem >> nodesCount [

^ 1
]

{ #category : #accessing }
{ #category : #'as yet unclassified' }
ToMultiSelectItem >> pickOrder [

^ pickOrder
]

{ #category : #accessing }
{ #category : #'as yet unclassified' }
ToMultiSelectItem >> pickOrder: anInteger [

pickOrder := anInteger
Expand Down

0 comments on commit b75ff29

Please sign in to comment.