Skip to content

Commit ccd465d

Browse files
javier-godoymlopezFC
authored andcommitted
fix: fix double-click in read-only mode
Close #177
1 parent d688b63 commit ccd465d

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/main/java/com/flowingcode/vaadin/addons/twincolgrid/TwinColGrid.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public enum Orientation {
150150
private boolean explicitHeaderRow = true;
151151

152152
private String layoutId;
153-
153+
154154
private static <T> ListDataProvider<T> emptyDataProvider() {
155155
return DataProvider.ofCollection(new LinkedHashSet<>());
156156
}
@@ -339,7 +339,7 @@ private String getLayoutId() {
339339
return this.layoutId = "twincol-" + UUID.randomUUID();
340340
});
341341
}
342-
342+
343343
private HorizontalLayout createHorizontalContainer(boolean reverse) {
344344
buttonContainer = getVerticalButtonContainer();
345345
HorizontalLayout hl;
@@ -928,12 +928,14 @@ public void setMoveItemsByDoubleClick(boolean value) {
928928
side.moveItemsByDoubleClick =
929929
side.grid.addItemDoubleClickListener(
930930
ev -> {
931-
Set<T> item = Collections.singleton(ev.getItem());
932-
if (side == available) {
933-
updateSelection(item, Collections.emptySet(), true);
934-
}
935-
if (side == selection) {
936-
updateSelection(Collections.emptySet(), item, true);
931+
if (!isReadOnly()) {
932+
Set<T> item = Collections.singleton(ev.getItem());
933+
if (side == available) {
934+
updateSelection(item, Collections.emptySet(), true);
935+
}
936+
if (side == selection) {
937+
updateSelection(Collections.emptySet(), item, true);
938+
}
937939
}
938940
});
939941
}

0 commit comments

Comments
 (0)