|
1 | 1 | package com.vaadin.flow.uitest.ui; |
2 | 2 |
|
| 3 | +import com.vaadin.flow.component.Direction; |
3 | 4 | import com.vaadin.flow.component.html.Div; |
4 | 5 | import com.vaadin.flow.component.html.IFrame; |
5 | 6 | import com.vaadin.flow.component.html.Input; |
| 7 | +import com.vaadin.flow.component.html.Label; |
6 | 8 | import com.vaadin.flow.component.html.NativeButton; |
7 | 9 | import com.vaadin.flow.router.BeforeEnterEvent; |
8 | 10 | import com.vaadin.flow.router.Route; |
@@ -78,6 +80,32 @@ public void beforeEnter(BeforeEnterEvent event) { |
78 | 80 | .info(currentUrl.toString()); |
79 | 81 | })); |
80 | 82 | })); |
| 83 | + |
| 84 | + Label directionLbl = new Label(); |
| 85 | + directionLbl.setId("direction-value"); |
| 86 | + add(directionLbl); |
| 87 | + |
| 88 | + Div fetchDirectionButton = new Div(); |
| 89 | + fetchDirectionButton.setId("fetch-direction"); |
| 90 | + fetchDirectionButton.setText("Fetch Page Direction"); |
| 91 | + fetchDirectionButton.addClickListener( |
| 92 | + e -> getUI().ifPresent(ui -> ui.getPage().fetchPageDirection( |
| 93 | + direction -> directionLbl.setText(direction.name())))); |
| 94 | + add(fetchDirectionButton); |
| 95 | + |
| 96 | + Div setRTLDirectionButton = new Div(); |
| 97 | + setRTLDirectionButton.setId("set-RTL-direction"); |
| 98 | + setRTLDirectionButton.setText("Set RTL Direction"); |
| 99 | + setRTLDirectionButton.addClickListener(e -> getUI() |
| 100 | + .ifPresent(ui -> ui.setDirection(Direction.RIGHT_TO_LEFT))); |
| 101 | + add(setRTLDirectionButton); |
| 102 | + |
| 103 | + Div setLTRDirectionButton = new Div(); |
| 104 | + setLTRDirectionButton.setId("set-LTR-direction"); |
| 105 | + setLTRDirectionButton.setText("Set LTR Direction"); |
| 106 | + setLTRDirectionButton.addClickListener(e -> getUI() |
| 107 | + .ifPresent(ui -> ui.setDirection(Direction.LEFT_TO_RIGHT))); |
| 108 | + add(setLTRDirectionButton); |
81 | 109 | } |
82 | 110 |
|
83 | 111 | } |
0 commit comments