-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Enhance side pane toggle #1605
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments, but in general LGTM
@@ -67,6 +66,11 @@ public synchronized boolean isComponentVisible(String name) { | |||
} | |||
} | |||
|
|||
/** | |||
* if panel is visible it will be hidden and the other way around |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please start comments with Capital letters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -75,6 +79,21 @@ public synchronized void toggle(String name) { | |||
} | |||
} | |||
|
|||
/** | |||
* if panel is hidden it will be shown and focused |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
/** | ||
* 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo ig -> if
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* @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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice if you could add additional brackets here, that would make it clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I extracted the second condition
@@ -702,6 +712,11 @@ public void componentOpening() { | |||
} | |||
|
|||
@Override | |||
public String getSidePaneName() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to access the name from the SidePaneComponent
.
Sadly you cannot define an abstract static method
Refs koppor#54 |
cbcc4de
to
8f454e7
Compare
# Conflicts: # src/test/java/net/sf/jabref/gui/importer/fetcher/GeneralFetcherTest.java
I tried it: Works good. Code LGTM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor remarks/questions from my side. In general LGTM.
@@ -69,6 +68,11 @@ public void componentClosing() { | |||
} | |||
|
|||
@Override | |||
public String getSidePaneName() { | |||
return NAME; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -1519,8 +1504,8 @@ private void initActions() { | |||
openDatabaseOnlyActions.addAll(Arrays.asList(mergeDatabaseAction, newSubDatabaseAction, save, globalSearch, | |||
saveAs, saveSelectedAs, saveSelectedAsPlain, editModeAction, undo, redo, cut, deleteEntry, copy, paste, mark, markSpecific, unmark, | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rename getAction -> getToggleAction ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
groupsTree.grabFocus(); | ||
} | ||
|
||
public ToggleAction getAction() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make getAction
an abstract method in SidePaneComponent ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, although FileUpdatePanel
doesn't implements it.
public String getName() { | ||
return "OpenOffice/LibreOffice"; | ||
public SidePaneComponent.ToggleAction getAction() { | ||
return sidePane.getToggleAction(); | ||
} | ||
|
||
|
||
private class OOPanel extends SidePaneComponent { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please extract this private class to a new file. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
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.