Skip to content

Commit aa045c5

Browse files
author
Jeanette Winzenburg
committed
8272118: ListViewSkin et al: must not cancel edit on scrolling
Reviewed-by: aghaisas, kcr
1 parent 5bd72a7 commit aa045c5

File tree

6 files changed

+566
-28
lines changed

6 files changed

+566
-28
lines changed

modules/javafx.controls/src/main/java/javafx/scene/control/skin/ListViewSkin.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,6 @@ public ListViewSkin(final ListView<T> control) {
217217
getChildren().add(flow);
218218

219219
EventHandler<MouseEvent> ml = event -> {
220-
// RT-15127: cancel editing on scroll. This is a bit extreme
221-
// (we are cancelling editing on touching the scrollbars).
222-
// This can be improved at a later date.
223-
if (control.getEditingIndex() > -1) {
224-
control.edit(-1);
225-
}
226-
227220
// This ensures that the list maintains the focus, even when the vbar
228221
// and hbar controls inside the flow are clicked. Without this, the
229222
// focus border will not be shown when the user interacts with the

modules/javafx.controls/src/main/java/javafx/scene/control/skin/TableViewSkin.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,6 @@ public TableViewSkin(final TableView<T> control) {
9898
flow.setCellFactory(flow -> createCell());
9999

100100
EventHandler<MouseEvent> ml = event -> {
101-
// RT-15127: cancel editing on scroll. This is a bit extreme
102-
// (we are cancelling editing on touching the scrollbars).
103-
// This can be improved at a later date.
104-
if (control.getEditingCell() != null) {
105-
control.edit(-1, null);
106-
}
107-
108101
// This ensures that the table maintains the focus, even when the vbar
109102
// and hbar controls inside the flow are clicked. Without this, the
110103
// focus border will not be shown when the user interacts with the

modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeTableViewSkin.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,6 @@ public TreeTableViewSkin(final TreeTableView<T> control) {
144144
setRoot(getSkinnable().getRoot());
145145

146146
EventHandler<MouseEvent> ml = event -> {
147-
// RT-15127: cancel editing on scroll. This is a bit extreme
148-
// (we are cancelling editing on touching the scrollbars).
149-
// This can be improved at a later date.
150-
if (control.getEditingCell() != null) {
151-
control.edit(-1, null);
152-
}
153-
154147
// This ensures that the table maintains the focus, even when the vbar
155148
// and hbar controls inside the flow are clicked. Without this, the
156149
// focus border will not be shown when the user interacts with the

modules/javafx.controls/src/main/java/javafx/scene/control/skin/TreeViewSkin.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,6 @@ public TreeViewSkin(final TreeView control) {
166166
setRoot(getSkinnable().getRoot());
167167

168168
EventHandler<MouseEvent> ml = event -> {
169-
// RT-15127: cancel editing on scroll. This is a bit extreme
170-
// (we are cancelling editing on touching the scrollbars).
171-
// This can be improved at a later date.
172-
if (control.getEditingItem() != null) {
173-
control.edit(null);
174-
}
175-
176169
// This ensures that the tree maintains the focus, even when the vbar
177170
// and hbar controls inside the flow are clicked. Without this, the
178171
// focus border will not be shown when the user interacts with the

modules/javafx.controls/src/shims/java/javafx/scene/control/skin/VirtualFlowShim.java

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@
2424
*/
2525
package javafx.scene.control.skin;
2626

27+
import java.util.List;
28+
2729
import com.sun.javafx.scene.control.VirtualScrollBar;
2830
import javafx.collections.ObservableList;
2931
import javafx.scene.Node;
3032
import javafx.scene.control.IndexedCell;
3133
import javafx.scene.control.ScrollBar;
34+
import javafx.scene.control.Skin;
3235
import javafx.scene.layout.StackPane;
3336

3437
public class VirtualFlowShim<T extends IndexedCell> extends VirtualFlow<T> {
@@ -110,6 +113,36 @@ public void addLeadingCells(int currentIndex, double startOffset) {
110113

111114
//------------------- statics --------------------
112115

116+
/**
117+
* Returns the VirtualFlow managed by the given skin.
118+
*/
119+
public static <T extends IndexedCell<?>> VirtualFlow<T> getVirtualFlow(Skin<?> skin) {
120+
return ((VirtualContainerBase<?, T>) skin).getVirtualFlow();
121+
}
122+
123+
/**
124+
* Returns the list of cells displayed in the viewport of the flow.
125+
*
126+
* @see VirtualFlow#getCells()
127+
*/
128+
public static <T extends IndexedCell<?>> List<T> getCells(VirtualFlow<T> flow) {
129+
return flow.getCells();
130+
}
131+
132+
/**
133+
* Returns the vertical scrollbar of the given flow.
134+
*/
135+
public static ScrollBar getVBar(VirtualFlow<?> flow) {
136+
return flow.getVbar();
137+
}
138+
139+
/**
140+
* Returns the horizontal scrollbar of the given flow.
141+
*/
142+
public static ScrollBar getHBar(VirtualFlow<?> flow) {
143+
return flow.getHbar();
144+
}
145+
113146
public static <T> T cells_getFirst(VirtualFlow.ArrayLinkedList<T> list) {
114147
return list.getFirst();
115148
}

0 commit comments

Comments
 (0)