1
1
/*
2
- * Copyright (c) 2011, 2019 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2011, 2020 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -146,20 +146,20 @@ public TableViewBehaviorBase(C control) {
146
146
new KeyMapping (PAGE_UP , e -> scrollUp ()),
147
147
new KeyMapping (PAGE_DOWN , e -> scrollDown ()),
148
148
149
- new KeyMapping (LEFT , e -> selectLeftCell ()),
150
- new KeyMapping (KP_LEFT , e -> selectLeftCell ()),
151
- new KeyMapping (RIGHT , e -> selectRightCell ()),
152
- new KeyMapping (KP_RIGHT , e -> selectRightCell ()),
149
+ new KeyMapping (LEFT , e -> { if ( isRTL ()) selectRightCell (); else selectLeftCell (); } ),
150
+ new KeyMapping (KP_LEFT ,e -> { if ( isRTL ()) selectRightCell (); else selectLeftCell (); } ),
151
+ new KeyMapping (RIGHT , e -> { if ( isRTL ()) selectLeftCell (); else selectRightCell (); } ),
152
+ new KeyMapping (KP_RIGHT , e -> { if ( isRTL ()) selectLeftCell (); else selectRightCell (); } ),
153
153
154
154
new KeyMapping (UP , e -> selectPreviousRow ()),
155
155
new KeyMapping (KP_UP , e -> selectPreviousRow ()),
156
156
new KeyMapping (DOWN , e -> selectNextRow ()),
157
157
new KeyMapping (KP_DOWN , e -> selectNextRow ()),
158
158
159
- new KeyMapping (LEFT , FocusTraversalInputMap :: traverseLeft ),
160
- new KeyMapping (KP_LEFT , FocusTraversalInputMap :: traverseLeft ),
161
- new KeyMapping (RIGHT , FocusTraversalInputMap :: traverseRight ),
162
- new KeyMapping (KP_RIGHT , FocusTraversalInputMap :: traverseRight ),
159
+ new KeyMapping (LEFT , e -> { if ( isRTL ()) focusTraverseRight (); else focusTraverseLeft (); } ),
160
+ new KeyMapping (KP_LEFT , e -> { if ( isRTL ()) focusTraverseRight (); else focusTraverseLeft (); } ),
161
+ new KeyMapping (RIGHT , e -> { if ( isRTL ()) focusTraverseLeft (); else focusTraverseRight (); } ),
162
+ new KeyMapping (KP_RIGHT , e -> { if ( isRTL ()) focusTraverseLeft (); else focusTraverseRight (); } ),
163
163
new KeyMapping (UP , FocusTraversalInputMap ::traverseUp ),
164
164
new KeyMapping (KP_UP , FocusTraversalInputMap ::traverseUp ),
165
165
new KeyMapping (DOWN , FocusTraversalInputMap ::traverseDown ),
@@ -178,17 +178,17 @@ public TableViewBehaviorBase(C control) {
178
178
new KeyMapping (new KeyBinding (SPACE ).shift (), e -> selectAllToFocus (false )),
179
179
new KeyMapping (new KeyBinding (SPACE ).shortcut ().shift (), e -> selectAllToFocus (true )),
180
180
181
- new KeyMapping (new KeyBinding (LEFT ).shift (), e -> alsoSelectLeftCell ()),
182
- new KeyMapping (new KeyBinding (KP_LEFT ).shift (), e -> alsoSelectLeftCell ()),
183
- new KeyMapping (new KeyBinding (RIGHT ).shift (), e -> alsoSelectRightCell ()),
184
- new KeyMapping (new KeyBinding (KP_RIGHT ).shift (), e -> alsoSelectRightCell ()),
181
+ new KeyMapping (new KeyBinding (LEFT ).shift (), e -> { if ( isRTL ()) alsoSelectRightCell (); else alsoSelectLeftCell (); } ),
182
+ new KeyMapping (new KeyBinding (KP_LEFT ).shift (), e -> { if ( isRTL ()) alsoSelectRightCell (); else alsoSelectLeftCell (); } ),
183
+ new KeyMapping (new KeyBinding (RIGHT ).shift (), e -> { if ( isRTL ()) alsoSelectLeftCell (); else alsoSelectRightCell (); } ),
184
+ new KeyMapping (new KeyBinding (KP_RIGHT ).shift (), e -> { if ( isRTL ()) alsoSelectLeftCell (); else alsoSelectRightCell (); } ),
185
185
186
186
new KeyMapping (new KeyBinding (UP ).shortcut (), e -> focusPreviousRow ()),
187
187
new KeyMapping (new KeyBinding (DOWN ).shortcut (), e -> focusNextRow ()),
188
- new KeyMapping (new KeyBinding (RIGHT ).shortcut (), e -> focusRightCell ()),
189
- new KeyMapping (new KeyBinding (KP_RIGHT ).shortcut (), e -> focusRightCell ()),
190
- new KeyMapping (new KeyBinding (LEFT ).shortcut (), e -> focusLeftCell ()),
191
- new KeyMapping (new KeyBinding (KP_LEFT ).shortcut (), e -> focusLeftCell ()),
188
+ new KeyMapping (new KeyBinding (RIGHT ).shortcut (), e -> { if ( isRTL ()) focusLeftCell (); else focusRightCell (); } ),
189
+ new KeyMapping (new KeyBinding (KP_RIGHT ).shortcut (), e -> { if ( isRTL ()) focusLeftCell (); else focusRightCell (); } ),
190
+ new KeyMapping (new KeyBinding (LEFT ).shortcut (), e -> { if ( isRTL ()) focusRightCell (); else focusLeftCell (); } ),
191
+ new KeyMapping (new KeyBinding (KP_LEFT ).shortcut (), e -> { if ( isRTL ()) focusRightCell (); else focusLeftCell (); } ),
192
192
193
193
new KeyMapping (new KeyBinding (A ).shortcut (), e -> selectAll ()),
194
194
new KeyMapping (new KeyBinding (HOME ).shortcut (), e -> focusFirstRow ()),
@@ -198,8 +198,8 @@ public TableViewBehaviorBase(C control) {
198
198
199
199
new KeyMapping (new KeyBinding (UP ).shortcut ().shift (), e -> discontinuousSelectPreviousRow ()),
200
200
new KeyMapping (new KeyBinding (DOWN ).shortcut ().shift (), e -> discontinuousSelectNextRow ()),
201
- new KeyMapping (new KeyBinding (LEFT ).shortcut ().shift (), e -> discontinuousSelectPreviousColumn ()),
202
- new KeyMapping (new KeyBinding (RIGHT ).shortcut ().shift (), e -> discontinuousSelectNextColumn ()),
201
+ new KeyMapping (new KeyBinding (LEFT ).shortcut ().shift (), e -> { if ( isRTL ()) discontinuousSelectNextColumn (); else discontinuousSelectPreviousColumn (); } ),
202
+ new KeyMapping (new KeyBinding (RIGHT ).shortcut ().shift (), e -> { if ( isRTL ()) discontinuousSelectPreviousColumn (); else discontinuousSelectNextColumn (); } ),
203
203
new KeyMapping (new KeyBinding (PAGE_UP ).shortcut ().shift (), e -> discontinuousSelectPageUp ()),
204
204
new KeyMapping (new KeyBinding (PAGE_DOWN ).shortcut ().shift (), e -> discontinuousSelectPageDown ()),
205
205
new KeyMapping (new KeyBinding (HOME ).shortcut ().shift (), e -> discontinuousSelectAllToFirstRow ()),
@@ -1309,4 +1309,12 @@ protected void discontinuousSelectAllToLastRow() {
1309
1309
1310
1310
if (onMoveToLastCell != null ) onMoveToLastCell .run ();
1311
1311
}
1312
+
1313
+ private EventHandler <KeyEvent > focusTraverseLeft () {
1314
+ return FocusTraversalInputMap ::traverseLeft ;
1315
+ }
1316
+
1317
+ private EventHandler <KeyEvent > focusTraverseRight () {
1318
+ return FocusTraversalInputMap ::traverseRight ;
1319
+ }
1312
1320
}
0 commit comments