Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue 9863 - Change Tab selection order #9907

Merged
merged 14 commits into from
Jun 10, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We added a new Integrity check for unscaped ampersands. [koppor#585](https://github.com/koppor/jabref/issues/585)
- We added support for parsing `$\backslash$` in file paths (as exported by Mendeley). [forum#3470](https://discourse.jabref.org/t/mendeley-bib-import-with-linked-files/3470)
- We added the possibility to automatically fetch entries when an ISBN is pasted on the main table. [#9864](https://github.com/JabRef/jabref/issues/9864)
- We added key binding to focus on groups <kbd>Shift</kbd> + <kbd>Tab</kbd> [#9863](https://github.com/JabRef/jabref/issues/9863)

### Changed

Expand Down Expand Up @@ -53,6 +54,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We moved the option to run JabRef in memory stick mode into the preferences dialog toolbar. [#9866](https://github.com/JabRef/jabref/pull/9866)
- In case the library contains empty entries, they are not written to disk. [#8645](https://github.com/JabRef/jabref/issues/8645)
- The formatter `remove_unicode_ligatures` is now called `replace_unicode_ligatures`. [#9890](https://github.com/JabRef/jabref/pull/9890)
- The key binding to focus on entry table is changed to <kbd>Tab</kbd> [#9863](https://github.com/JabRef/jabref/issues/9863)

### Fixed

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,10 @@ private void initKeyBindings() {
getCurrentLibraryTab().getMainTable().requestFocus();
event.consume();
break;
case FOCUS_GROUP_LIST:
sidePane.getSidePaneComponent(SidePaneType.GROUPS).requestFocus();
event.consume();
break;
case NEXT_LIBRARY:
tabbedPane.getSelectionModel().selectNext();
event.consume();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/jabref/gui/StateManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@
import javafx.collections.ObservableMap;
import javafx.concurrent.Task;
import javafx.scene.Node;
import javafx.scene.control.TreeTableView;
import javafx.util.Pair;

import org.jabref.gui.edit.automaticfiededitor.LastAutomaticFieldEditorEdit;
import org.jabref.gui.groups.GroupNodeViewModel;
import org.jabref.gui.sidepane.SidePaneType;
import org.jabref.gui.util.BackgroundTask;
import org.jabref.gui.util.CustomLocalDragboard;
Expand Down Expand Up @@ -235,4 +237,5 @@ public List<String> getLastSearchHistory(int size) {
public void clearSearchHistory() {
searchHistory.clear();
}

}
5 changes: 5 additions & 0 deletions src/main/java/org/jabref/gui/groups/GroupTreeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -609,4 +609,9 @@ public void execute() {
}
}
}

/**
* Focus on GroupTree
*/
public void requestFocusGroupTree() { groupTree.requestFocus(); }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the checkstyle issue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkstyle issue fixed

}
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/keyboard/KeyBinding.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public enum KeyBinding {
FILE_LIST_EDITOR_MOVE_ENTRY_DOWN("File list editor, move entry down", Localization.lang("File list editor, move entry down"), "ctrl+DOWN", KeyBindingCategory.VIEW),
FILE_LIST_EDITOR_MOVE_ENTRY_UP("File list editor, move entry up", Localization.lang("File list editor, move entry up"), "ctrl+UP", KeyBindingCategory.VIEW),
FIND_UNLINKED_FILES("Search for unlinked local files", Localization.lang("Search for unlinked local files"), "shift+F7", KeyBindingCategory.QUALITY),
FOCUS_ENTRY_TABLE("Focus entry table", Localization.lang("Focus entry table"), "alt+1", KeyBindingCategory.VIEW),
FOCUS_ENTRY_TABLE("Focus entry table", Localization.lang("Focus entry table"), "TAB", KeyBindingCategory.VIEW),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is changed to match the Tasks of focusing on entry table after pressing tab from the pull request #9863

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it still possible to navigate away from the entry table? I would see tab as cycling though different ui components: Main menu entries, groups, main table, entry editor, ...

It should be possible to focus these elements using quick shortcut. Alr+1 was such a shortcut.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a bit of a misunderstanding of the issue:
Tab and Shift Tab are coming from the operating system and mean:
Tab: Forward navigation between controls
Shift + Tab: Backwards navigation between controls

The guy means: If you have the entry editor open, pressing shift + tab should navigate to the group. And if your focus is on the group; Navigation with tab should go forward to the
But I think this might be difficult. It depends on the order of the Nodes in the javafx scencegraph. Focus model etc.
I would rather add two extra shortcuts (like you did), but with separate shortcuts: like alt+1 or alt+2

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Siedlerchr, we can use alt + 1 to focus on the entry table (like before) and alt + 2 to focus on the group list

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the reporter @DvP17 at #9863 really meant a proper Tab cycling order. I agree, however, that this is very difficult to implement. A workaround using Alt+1 and Alt+2 is OK for me.

Note that the hotkey system was revised at #1525. Updated at #1605.

Keys - new Keys - old Function
F7 alt + f Automatically set file links
F8 ctrl + shift + F7 Cleanup entries
alt + 1 ctrl + shift + E Focus entry table
alt + 2 ctrl + F9 Toggle entry/preview editor
alt + 3 ctrl + shift + G Toggle groups
alt + 4 F5 web search
alt + 0 - Open Openoffice/LibreOffice connection
ctrl + shift + F7 ctrl + f4 Synchronize file links
ctrl + shift R - Technical report
- alt + P Print entry preview
- ctrl + alt + T Hide/show toolbar
- ctrl+P Edit preamble

Maybe, we should think about propr key binding defaults. Alt+Number is used for both toggle and focus in the implementation of 2016.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that we have a blog article on a revised hotkey system in 2016: https://blog.jabref.org/2016/08/15/HotkeyRevision/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alt +1 and alt +2 are no longer used

FOCUS_GROUP_LIST("Focus group list", Localization.lang("Focus group list"), "shift+TAB", KeyBindingCategory.VIEW),
HELP("Help", Localization.lang("Help"), "F1", KeyBindingCategory.FILE),
IMPORT_INTO_CURRENT_DATABASE("Import into current library", Localization.lang("Import into current library"), "ctrl+I", KeyBindingCategory.FILE),
IMPORT_INTO_NEW_DATABASE("Import into new library", Localization.lang("Import into new library"), "ctrl+alt+I", KeyBindingCategory.FILE),
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/jabref/gui/sidepane/SidePane.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,8 @@ public BooleanBinding paneVisibleBinding(SidePaneType pane) {
public SimpleCommand getToggleCommandFor(SidePaneType sidePane) {
return new TogglePaneAction(stateManager, sidePane, preferencesService.getSidePanePreferences());
}

public SidePaneComponent getSidePaneComponent(SidePaneType type) {
return viewModel.getSidePaneComponent(type);
}
}
10 changes: 10 additions & 0 deletions src/main/java/org/jabref/gui/sidepane/SidePaneComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import javafx.scene.layout.VBox;

import org.jabref.gui.actions.SimpleCommand;
import org.jabref.gui.groups.GroupTreeView;
import org.jabref.gui.icon.IconTheme;
import org.jabref.logic.l10n.Localization;

Expand Down Expand Up @@ -71,4 +72,13 @@ private Node createHeaderView() {
protected void addExtraButtonToHeader(Button button, int position) {
this.buttonContainer.getChildren().add(position, button);
}

public void requestFocus() {
for (Node child : getChildren()) {
if (child instanceof GroupTreeView) {
((GroupTreeView) child).requestFocusGroupTree();
break;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Casting can be omitted by the new pattern matching feature of java

Suggested change
for (Node child : getChildren()) {
if (child instanceof GroupTreeView) {
((GroupTreeView) child).requestFocusGroupTree();
break;
}
}
for (Node child : getChildren()) {
if (child instanceof GroupTreeView groupTreeView) {
groupTreeView.requestFocusGroupTree();
break;
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

casting has been replaced by pattern matching

}
}
1 change: 1 addition & 0 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,7 @@ Entry\ editor,\ previous\ panel\ 2=Entry editor, previous panel 2
File\ list\ editor,\ move\ entry\ down=File list editor, move entry down
File\ list\ editor,\ move\ entry\ up=File list editor, move entry up
Focus\ entry\ table=Focus entry table
Focus\ group\ list=Focus group list
Import\ into\ current\ library=Import into current library
Import\ into\ new\ library=Import into new library
New\ article=New article
Expand Down