Enhance side pane toggle#1605
Conversation
|
@simonharrer how should the toggle for the preview panel and the entry editor work in your opinion? |
3ed9ae8 to
8509239
Compare
|
#1525 is merged. Will there be updates on this PR? |
960467f to
b3e48c4
Compare
|
I took this issue to myself and coded a quick solution. OpenOffice/LibreOffice is now able to be toggled. |
5532df6 to
99da73c
Compare
99da73c to
482db82
Compare
64781e9 to
6d60cd6
Compare
6d60cd6 to
0de22f1
Compare
tschechlovdev
left a comment
There was a problem hiding this comment.
Some minor comments, but in general LGTM
| } | ||
|
|
||
| /** | ||
| * if panel is visible it will be hidden and the other way around |
There was a problem hiding this comment.
Please start comments with Capital letters.
| } | ||
|
|
||
| /** | ||
| * if panel is hidden it will be shown and focused |
| /** | ||
| * if panel is hidden it will be shown and focused | ||
| * if panel is visible but not focused it will be focused | ||
| * ig panel is visible and focused it will be hidden |
| * @param name name of the panel | ||
| */ | ||
| public synchronized void toggleThreeWay(String name){ | ||
| if (isComponentVisible(name) && Globals.getFocusListener().getFocused() == components.get(name)) { |
There was a problem hiding this comment.
Would be nice if you could add additional brackets here, that would make it clearer.
There was a problem hiding this comment.
I extracted the second condition
| valueChanged(null); | ||
| } | ||
|
|
||
| @Override |
There was a problem hiding this comment.
Hm why do you set NAME as public static final and add this get method? Isn't this unnecessary then?
There was a problem hiding this comment.
I need to access the name from the SidePaneComponent.
Sadly you cannot define an abstract static method
|
Refs JabRef#54 |
cbcc4de to
8f454e7
Compare
# Conflicts: # src/test/java/net/sf/jabref/gui/importer/fetcher/GeneralFetcherTest.java
|
I tried it: Works good. Code LGTM. |
tobiasdiez
left a comment
There was a problem hiding this comment.
Just some minor remarks/questions from my side. In general LGTM.
| } | ||
|
|
||
| @Override | ||
| public String getSidePaneName() { |
There was a problem hiding this comment.
Can one simply return "fileUpdate" here and replace all references to NAME with calls to getSidePaneName?
Applies also to the other side panes.
One probably needs to recode getComponent to not use the name but the class (as a generic version <T> T getComponent(Class<T> clazz))
There was a problem hiding this comment.
I used the static NAME to change the state of the side panels without having an object of it at hand.
I changed the SidePaneManager to manage the side panels in a generic way.
| unmarkAll, rankSubMenu, editEntry, selectAll, copyKey, copyCiteKey, copyKeyAndTitle, copyKeyAndLink, editPreamble, editStrings, | ||
| toggleGroups, makeKeyAction, normalSearch, generalFetcher.getAction(), mergeEntries, cleanupEntries, exportToClipboard, replaceAll, | ||
| sendAsEmail, downloadFullText, writeXmpAction, optMenuItem, findUnlinkedFiles, addToGroup, removeFromGroup, | ||
| groupSelector.getAction(), makeKeyAction, normalSearch, generalFetcher.getAction(), mergeEntries, cleanupEntries, exportToClipboard, replaceAll, |
There was a problem hiding this comment.
Maybe rename getAction -> getToggleAction ?
| groupsTree.grabFocus(); | ||
| } | ||
|
|
||
| public ToggleAction getAction() { |
There was a problem hiding this comment.
Make getAction an abstract method in SidePaneComponent ?
There was a problem hiding this comment.
Done, although FileUpdatePanel doesn't implements it.
| } | ||
|
|
||
|
|
||
| private class OOPanel extends SidePaneComponent { |
There was a problem hiding this comment.
Can you please extract this private class to a new file. Thanks.
|
|
|
Code looks good to me now (thanks for the quick changes!). I'll merge it in. |
* upstream/master: (24 commits) hotfix NPE in the main table (#2158) Enhance side pane toggle (#1605) Added gray background text to authors field to assist newcomers (#2147) Rewrite google scholar fetcher to new infrastructure (#2101) Found entries will be shown when dropping a pdf with xmp meta data (#2150) Japanese translation (#2155) Add shortcuts to context menu (#2131) [WIP] Doi resolution ignore (#2154) Fix DuplicationChecker and key generator (#2151) just close popup on first ESC keep entry in sight Fix isSharedDatabaseAlreadyPresent check. don't change entry after search if editing an entry (#2129) Change download URL to downloads.jabref.org (#2145) fix switching edited textfield in the entry editor with TAB (#2138) Update me.champeau.gradle.jmh' version from 0.3.0 to 0.3.1 Update install4j plugin from 6.1.2 to 6.1.3 Remove gradle plugin com.github.youribonnaffe.gradle.format as it is deprecated and the config uses a non-existing file Update gradle from 3.0 to 3.1 Fix changing the font size not working when importing preferences (#2069) ... # Conflicts: # src/main/java/net/sf/jabref/gui/externalfiles/DroppedFileHandler.java # src/main/java/net/sf/jabref/gui/importer/fetcher/GoogleScholarFetcher.java
I improved the SidePanes toggle functionality. As described by @simonharrer at #1225 (comment) the components should be shown, get focused if shown but not focused and closed when shown and focused.
Done for:
Bonus:
Update:
The panes extending the SidePaneComponent have implemented toggle functionality. To finish the task i depend on @mairdl 's PR: #1525 and his work on the group functionality. To make the toggle visible on the groupsSelector, the tree needs to be focusable and @mairdl is implementing it. Also the OOPanel depends on having a hotkey since the three phase toggling does not make sense when toggling using the mouse (you could click the panel right away instead of the menu item). So this PR will be on hold (hopefully) just for some days.