Skip to content

Commit

Permalink
working on ToSelect/ToListElementSieve
Browse files Browse the repository at this point in the history
  • Loading branch information
plantec committed Feb 17, 2024
1 parent 8539135 commit 1549866
Show file tree
Hide file tree
Showing 27 changed files with 269 additions and 95 deletions.
8 changes: 5 additions & 3 deletions src/Toplo-Examples/ToSandBox.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -985,12 +985,13 @@ ToSandBox class >> example_MonoNotFiltrable [
select data addAll: self statesOfAmerica.



select strategy: ToSingleSelectStrategy new.
select mode: ToSelectReadOnlyMode new.
select placeholderText: ('Select a state' asRopedText foreground: Color red).
select placeholderText:
('Select a state' asRopedText foreground: Color red).
select listElement nodeBuilder: [ :node :holder |
node addChild: (ToLabel text: holder data asString) hMatchParent ].
node addChild: (ToLabel text: holder dataItem asString) hMatchParent ].
innerWindow := ToInnerWindow new.
select windowManager anchorRoot: innerWindow root.
select width: 300.
Expand All @@ -1017,6 +1018,7 @@ ToSandBox class >> example_MultiFiltrable [
select width: 300.
select position: 50 @ 50.
innerWindow pane addChild: select.
innerWindow height: 500.
innerWindow openInSpace
]

Expand Down
7 changes: 6 additions & 1 deletion src/Toplo-Tests/TToElementWithContextMenuTest.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Class {
#name : #TToElementWithContextMenuTest,
#superclass : #ToTestCaseWithSpace,
#superclass : #ToParameterizedHostTest,
#category : #'Toplo-Tests-Core'
}

Expand All @@ -17,6 +17,7 @@ TToElementWithContextMenuTest >> testContextMenu [
ttwin := e newContextMenuEvent: nil.
self assert: e currentContextMenu identicalTo: ttwin.
ttwin popupEvent: (BlMouseDownEvent new position: 0@0).
self waitTestingSpaces.
self assert: ttwin root firstChild identicalTo: tt.
self assert: ttwin element identicalTo: e.
self assert: (e eventDispatcher hasEventHandlerSuchThat: [ :eh |
Expand All @@ -41,6 +42,7 @@ TToElementWithContextMenuTest >> testContextMenuAddItem [
self assert: ttwin isClosed.
self assert: ttwin root hasChildren.
ttwin popupEvent: (BlMouseDownEvent new position: 0@0).
self waitTestingSpaces.
self assert: ttwin isOpened.
self assert: ttwin root hasChildren.
self assert: e contextMenuWindowManager currentWindow notNil.
Expand Down Expand Up @@ -88,6 +90,7 @@ TToElementWithContextMenuTest >> testContextMenuCanPopupIfElementInSpace [
self assert: ttwin root hasChildren.
space root addChild: e.
ttwin popupEvent: (BlMouseDownEvent new position: 0@0).
self waitTestingSpaces.
self assert: ttwin isOpened.
self assert: ttwin root hasChildren.
self assert: e contextMenuWindowManager currentWindow notNil.
Expand All @@ -110,6 +113,7 @@ TToElementWithContextMenuTest >> testContextMenuContent [
self assert: e hasContextMenu.
ttwin := e newContextMenuEvent: (BlMouseDownEvent new).
ttwin popupEvent: (BlMouseDownEvent new position: 0@0).
self waitTestingSpaces.
self assert: ttwin root firstChild notNil.
e contextMenuContent: nil.
self assert: e currentContextMenu isNil.
Expand Down Expand Up @@ -149,6 +153,7 @@ TToElementWithContextMenuTest >> testContextMenuWindowManager [
self assert: e rawContextMenuWindowManager notNil.
ttwin := e newContextMenuEvent: nil.
ttwin popupEvent: (BlMouseDownEvent new position: 0@0).
self waitTestingSpaces.
self assert: e contextMenuWindowManager currentWindow notNil.
self assert: e contextMenuWindowManager element identicalTo: e.
ttwin close.
Expand Down
5 changes: 5 additions & 0 deletions src/Toplo-Tests/ToAnchoredWindowManagerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ ToAnchoredWindowManagerTest >> testCloseWindow [
windowManager onInstalledIn: e.
win := windowManager newWindowEvent: nil.
win popup.
self waitTestingSpaces.
self assert: win isOpened.
win close.
self assert: win isClosed
Expand All @@ -133,6 +134,7 @@ ToAnchoredWindowManagerTest >> testCurrentWindow [
win := windowManager newWindowEvent: nil.
self assert: windowManager currentWindow identicalTo: win.
win popup.
self waitTestingSpaces.
self assert: windowManager currentWindow identicalTo: win.
win close.
self assert: windowManager currentWindow isNil
Expand Down Expand Up @@ -217,6 +219,7 @@ ToAnchoredWindowManagerTest >> testElement [
self assert: win element equals: e.

win popup.
self waitTestingSpaces.
self assert: openEventFromWindow notNil.
self assert: openEventFromWindow currentTarget equals: win.
self assert: openEventFromWidget notNil.
Expand Down Expand Up @@ -258,6 +261,7 @@ ToAnchoredWindowManagerTest >> testElementEventHandlerClass [
windowManager onInstalledIn: e.
win := windowManager newWindowEvent: nil.
win popup.
self waitTestingSpaces.
self assert: win element equals: e.
self assert: (e eventDispatcher hasEventHandlerSuchThat: [ :eh |
eh isKindOf: ToAnchorEventHandler ]).
Expand All @@ -283,6 +287,7 @@ ToAnchoredWindowManagerTest >> testHasWindow [
win := windowManager newWindowEvent: nil.
self assert: windowManager hasWindow.
win popup.
self waitTestingSpaces.
self assert: windowManager hasWindow.
win close.
self deny: windowManager hasWindow
Expand Down
4 changes: 4 additions & 0 deletions src/Toplo-Tests/ToAnchoredWindowTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ ToAnchoredWindowTest >> testClosedEventClass [
do: [ :event | closeEvent := event ]).
self assert: closeEvent isNil.
win popup.
self waitTestingSpaces.
win close.
" need to wait space pulsing "
self waitTestingSpaces.
Expand Down Expand Up @@ -94,6 +95,7 @@ ToAnchoredWindowTest >> testDispatchClosedEvent [
on: win closedEventClass
do: [ :event | closedEventReceivedByElement := event ]).
win popup.
self waitTestingSpaces.
win close.
self waitTestingSpaces.
self assert: closedEventReceivedByWin notNil.
Expand Down Expand Up @@ -252,6 +254,7 @@ ToAnchoredWindowTest >> testPopup [
windowHandler onInstalledIn: e.
win := windowHandler newWindowEvent: nil.
win popup.
self waitTestingSpaces.
self assert: win isOpened.
self assert: win parent notNil
]
Expand Down Expand Up @@ -315,6 +318,7 @@ ToAnchoredWindowTest >> testPopupEventNotInSpace [
self assert: openEventFromWidget isNil.
space root addChild: e.
win popup.
self waitTestingSpaces.
win close.
self assert: closeEventFromWindow notNil.
self assert: closeEventFromWidget notNil
Expand Down
5 changes: 5 additions & 0 deletions src/Toplo-Tests/ToElementWithPopupEventHandlerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ ToElementWithPopupEventHandlerTest >> testMouseDownOutsideEvent [

windowManager onInstalledIn: e.
BlSpace simulateMouseDownOn: e.
self waitTestingSpaces.
self assert: windowManager currentWindow notNil.
self assert: windowManager currentWindow isOpened.
closed := false.
Expand Down Expand Up @@ -95,6 +96,7 @@ ToElementWithPopupEventHandlerTest >> testMouseDownOutsideEventWithAutoCloseWith

windowManager onInstalledIn: e.
BlSpace simulateMouseDownOn: e.
self waitTestingSpaces.
self assert: windowManager currentWindow notNil.
self assert: windowManager currentWindow isOpened.
closed := false.
Expand Down Expand Up @@ -125,6 +127,7 @@ ToElementWithPopupEventHandlerTest >> testMouseUpEvent [

windowManager onInstalledIn: e.
BlSpace simulateMouseDownOn: e.
self waitTestingSpaces.
self assert: windowManager currentWindow notNil.
self assert: windowManager currentWindow isOpened.
closed := false.
Expand Down Expand Up @@ -156,6 +159,7 @@ ToElementWithPopupEventHandlerTest >> testMouseUpOutsideEvent [

windowManager onInstalledIn: e.
BlSpace simulateMouseDownOn: e.
self waitTestingSpaces.
self assert: windowManager currentWindow notNil.
self assert: windowManager currentWindow isOpened.
closed := false.
Expand Down Expand Up @@ -188,6 +192,7 @@ ToElementWithPopupEventHandlerTest >> testMouseUpOutsideEventWithAutoCloseWithDo

windowManager onInstalledIn: e.
BlSpace simulateMouseDownOn: e.
self waitTestingSpaces.
self assert: windowManager currentWindow notNil.
self assert: windowManager currentWindow isOpened.
closed := false.
Expand Down
1 change: 1 addition & 0 deletions src/Toplo-Tests/ToOverlayWindowManagerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ToOverlayWindowManagerTest >> testElementEventHandlerClass [
windowManager onInstalledIn: e.
win := windowManager newWindowEvent: nil.
win popup.
self waitTestingSpaces.
self assert: win element equals: e.
self assert: (e eventDispatcher hasEventHandlerSuchThat: [ :eh |
eh isKindOf: ToOverlayedEventHandler ]).
Expand Down
11 changes: 11 additions & 0 deletions src/Toplo-Tests/ToPopupWindowManagerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ ToPopupWindowManagerTest >> testAutoClosePickOutsideEventClass [

windowManager onInstalledIn: e.
BlSpace simulateMouseDownOn: e.
self waitTestingSpaces.
self assert: windowManager currentWindow notNil.
self assert: windowManager currentWindow isOpened.
closed := false.
Expand Down Expand Up @@ -64,6 +65,7 @@ ToPopupWindowManagerTest >> testAutoClosePickOutsideEventClass2 [

windowManager onInstalledIn: e.
BlSpace simulateMouseDownOn: e.
self waitTestingSpaces.
self assert: windowManager currentWindow notNil.
self assert: windowManager currentWindow isOpened.
closed := false.
Expand Down Expand Up @@ -93,6 +95,7 @@ ToPopupWindowManagerTest >> testAutoClosePickOutsideEventClass3 [

windowManager onInstalledIn: e.
BlSpace simulateMouseDownOn: e.
self waitTestingSpaces.
self assert: windowManager currentWindow notNil.
self assert: windowManager currentWindow isOpened.
closed := false.
Expand Down Expand Up @@ -122,6 +125,7 @@ ToPopupWindowManagerTest >> testAutoClosePickOutsideEventClass4 [

windowManager onInstalledIn: e.
BlSpace simulateMouseDownOn: e.
self waitTestingSpaces.
self assert: windowManager currentWindow notNil.
self assert: windowManager currentWindow isOpened.
closed := false.
Expand Down Expand Up @@ -159,6 +163,7 @@ ToPopupWindowManagerTest >> testElementEventHandlerClass [
windowManager onInstalledIn: e.
win := windowManager newWindowEvent: nil.
win popup.
self waitTestingSpaces.
self assert: win element equals: e.
self assert: (e eventDispatcher hasEventHandlerSuchThat: [ :eh |
eh isKindOf: ToElementWithPopupEventHandler ]).
Expand All @@ -183,6 +188,7 @@ ToPopupWindowManagerTest >> testMouseDownInElementEvent [

windowManager onInstalledIn: e.
BlSpace simulateMouseDownOn: e.
self waitTestingSpaces.
self assert: windowManager currentWindow notNil.
self assert: windowManager currentWindow isOpened
]
Expand All @@ -200,6 +206,7 @@ ToPopupWindowManagerTest >> testMouseUpInElementEvent [

windowManager onInstalledIn: e.
BlSpace simulateMouseDownOn: e.
self waitTestingSpaces.
self assert: windowManager currentWindow notNil.
self assert: windowManager currentWindow isOpened.
closed := false.
Expand All @@ -226,6 +233,7 @@ ToPopupWindowManagerTest >> testMouseUpInElementEventAfterLongDelayShouldCloseWi

windowManager onInstalledIn: e.
BlSpace simulateMouseDownOn: e.
self waitTestingSpaces.
self assert: windowManager currentWindow notNil.
self assert: windowManager currentWindow isOpened.
closed := false.
Expand All @@ -252,6 +260,7 @@ ToPopupWindowManagerTest >> testNoAutoCloseEvenAfterLongDelay [

windowManager onInstalledIn: e.
BlSpace simulateMouseDownOn: e.
self waitTestingSpaces.
self assert: windowManager currentWindow notNil.
self assert: windowManager currentWindow isOpened.
closed := false.
Expand Down Expand Up @@ -284,6 +293,7 @@ ToPopupWindowManagerTest >> testUsePrimaryMouseButton [
event := BlMouseDownEvent primary.
event position: e bounds inSpace center.
BlSpace simulateEvent: event on: e.
self waitTestingSpaces.
self assert: windowManager currentWindow notNil.
self assert: windowManager currentWindow isOpened
]
Expand Down Expand Up @@ -321,6 +331,7 @@ ToPopupWindowManagerTest >> testUseSecondaryMouseButton [
event := BlMouseDownEvent secondary.
event position: e bounds inSpace center.
BlSpace simulateEvent: event on: e.
self waitTestingSpaces.
self assert: windowManager currentWindow notNil.
self assert: windowManager currentWindow isOpened
]
Expand Down
10 changes: 10 additions & 0 deletions src/Toplo-Tests/ToPopupWindowTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,17 @@ ToPopupWindowTest >> testPopupOpenCloseWithMouseDownDelayUp [

" mouse down immediately followed by a mouse up -> the popup should stay opened"
BlSpace simulateMouseDownOn: e.
self waitTestingSpaces.
self assert: windowHandler currentWindow isOpened.
BlSpace simulateMouseUpOn: e.
self waitTestingSpaces.
self assert: windowHandler currentWindow isOpened.

BlSpace simulateMouseDownOn: e.
self waitTestingSpaces.
self assert: windowHandler currentWindow isNil.
BlSpace simulateMouseUpOn: e.
self waitTestingSpaces.
self assert: windowHandler currentWindow isNil
]

Expand All @@ -87,10 +91,12 @@ ToPopupWindowTest >> testPopupOpenCloseWithMouseDownDelayUp2 [

" mouse down then wait a delay then a mouse up -> the popup should be closed"
BlSpace simulateMouseDownOn: e.
self waitTestingSpaces.
self assert: windowHandler currentWindow notNil.
self assert: windowHandler currentWindow isOpened.
(windowHandler autoCloseOnMouseUpDelay + 1 milliSecond) wait.
BlSpace simulateMouseUpOn: e.
self waitTestingSpaces.
" window is closed on mouse-up "
self assert: windowHandler currentWindow isNil
]
Expand All @@ -112,8 +118,10 @@ ToPopupWindowTest >> testPopupOpenCloseWithMouseDownOutside [

" mouse down immediately followed by a mouse up -> the popup should stay opened"
BlSpace simulateMouseDownOn: e.
self waitTestingSpaces.
self assert: windowHandler currentWindow isOpened.
BlSpace simulateMouseUpOn: e.
self waitTestingSpaces.
self assert: windowHandler currentWindow isOpened.

closed := false.
Expand All @@ -123,6 +131,7 @@ ToPopupWindowTest >> testPopupOpenCloseWithMouseDownOutside [
BlSpace simulateMouseMoveOutside: windowHandler currentWindow.
BlSpace simulateMouseDownOn: space root.
BlSpace simulateMouseUpOn: space root.
self waitTestingSpaces.
self assert: closed.
self assert: windowHandler currentWindow isNil
]
Expand All @@ -145,6 +154,7 @@ ToPopupWindowTest >> testPopupOpenCloseWithMouseUpOutsideAssociateElement [
" mouse down on widget then up on popup"
self waitTestingSpaces.
BlSpace simulateMouseDownOn: e.
self waitTestingSpaces.
self assert: windowHandler currentWindow isOpened.
self waitTestingSpaces.
BlSpace simulateMouseUpOn: windowHandler currentWindow.
Expand Down
8 changes: 5 additions & 3 deletions src/Toplo-Tests/ToTooltipWindowTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ A ToTooltipWindowTest is a test class for testing the behavior of ToTooltipWindo
"
Class {
#name : #ToTooltipWindowTest,
#superclass : #ToTestCaseWithSpace,
#superclass : #ToParameterizedHostTest,
#category : #'Toplo-Tests-Core-Tooltip'
}

Expand All @@ -17,11 +17,13 @@ ToTooltipWindowTest >> testContent [
windowHandler := e tooltipWindowManager.
self assert: (windowHandler isKindOf: ToTooltipWindowManager).
space root addChild: e.
"self waitTestingSpaces."
self waitTestingSpaces.

BlSpace simulateMouseMoveInside: e.
self waitTestingSpaces.
(windowHandler popupDelay + 100 milliSecond ) wait.
space pulse.
self waitTestingSpaces.

self assert: (windowHandler currentWindow root firstChild isKindOf: ToLabel) .
self assert: windowHandler currentWindow root firstChild text asString equals: 'Tooltip content' .
^ windowHandler currentWindow
Expand Down
6 changes: 6 additions & 0 deletions src/Toplo-Widget-List/TToListElementDecorator.trait.st
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ TToListElementDecorator >> scrollToIndexAtTop: anIndex [
self next scrollToIndexAtTop: anIndex
]

{ #category : #'t - infinite accessing' }
TToListElementDecorator >> stopScroll [

self next stopScroll
]

{ #category : #'t - infinite accessing' }
TToListElementDecorator >> withRowNumbers [

Expand Down

0 comments on commit 1549866

Please sign in to comment.