-
-
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
Merged
Merged
Enhance side pane toggle #1605
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0de22f1
enhance toggle behaviour
chriba 8f454e7
fix issues
chriba 9e07cee
Merge remote-tracking branch 'jabref/master' into enhanceSidePaneToggle
chriba 2317d85
make getToggleAction abstract
chriba 7c5179a
make SideComponentManager generic
chriba b339cd1
extract OOPanel
chriba 00f255b
fix compile error
chriba f6564a8
change method not implemented exception
chriba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,11 +190,7 @@ public class JabRefFrame extends JFrame implements OutputPrinter { | |
// for the name and message strings. | ||
|
||
/* References to the toggle buttons in the toolbar */ | ||
// the groups interface | ||
public JToggleButton groupToggle; | ||
private JToggleButton previewToggle; | ||
private JToggleButton fetcherToggle; | ||
|
||
|
||
private final OpenDatabaseAction open = new OpenDatabaseAction(this, true); | ||
private final EditModeAction editModeAction = new EditModeAction(); | ||
|
@@ -351,11 +347,6 @@ public void actionPerformed(ActionEvent e) { | |
} | ||
}); | ||
|
||
private final Action toggleGroups = enableToggle(new GeneralAction(Actions.TOGGLE_GROUPS, | ||
Localization.menuTitle("Toggle groups interface"), | ||
Localization.lang("Toggle groups interface"), | ||
Globals.getKeyPrefs().getKey(KeyBinding.TOGGLE_GROUPS_INTERFACE), | ||
IconTheme.JabRefIcon.TOGGLE_GROUPS.getIcon())); | ||
private final AbstractAction addToGroup = new GeneralAction(Actions.ADD_TO_GROUP, Localization.lang("Add to group") + ELLIPSES); | ||
private final AbstractAction removeFromGroup = new GeneralAction(Actions.REMOVE_FROM_GROUP, | ||
Localization.lang("Remove from group") + ELLIPSES); | ||
|
@@ -394,8 +385,6 @@ public void actionPerformed(ActionEvent e) { | |
Localization.lang("Will write XMP-metadata to the PDFs linked from selected entries."), | ||
Globals.getKeyPrefs().getKey(KeyBinding.WRITE_XMP)); | ||
|
||
private JMenuItem optMenuItem; | ||
|
||
private final AbstractAction openFolder = new GeneralAction(Actions.OPEN_FOLDER, | ||
Localization.menuTitle("Open folder"), Localization.lang("Open folder"), | ||
Globals.getKeyPrefs().getKey(KeyBinding.OPEN_FOLDER)); | ||
|
@@ -481,7 +470,7 @@ public void actionPerformed(ActionEvent e) { | |
private PushToApplications pushApplications; | ||
|
||
private GeneralFetcher generalFetcher; | ||
|
||
private OpenOfficePanel openOfficePanel; | ||
private GroupSelector groupSelector; | ||
|
||
private int previousTabCount = -1; | ||
|
@@ -661,9 +650,10 @@ public void windowClosing(WindowEvent e) { | |
|
||
currentBasePanel.getPreviewPanel().updateLayout(); | ||
|
||
groupToggle.setSelected(sidePaneManager.isComponentVisible("groups")); | ||
groupSelector.getAction().setSelected(sidePaneManager.isComponentVisible(GroupSelector.NAME)); | ||
previewToggle.setSelected(Globals.prefs.getPreviewPreferences().isPreviewPanelEnabled()); | ||
fetcherToggle.setSelected(sidePaneManager.isComponentVisible(generalFetcher.getTitle())); | ||
generalFetcher.getAction().setSelected(sidePaneManager.isComponentVisible(GeneralFetcher.NAME)); | ||
openOfficePanel.getAction().setSelected(sidePaneManager.isComponentVisible(OpenOfficePanel.NAME)); | ||
Globals.getFocusListener().setFocused(currentBasePanel.getMainTable()); | ||
setWindowTitle(); | ||
editModeAction.initName(); | ||
|
@@ -723,10 +713,10 @@ private void initSidePane() { | |
sidePaneManager = new SidePaneManager(this); | ||
|
||
groupSelector = new GroupSelector(this, sidePaneManager); | ||
openOfficePanel = new OpenOfficePanel(this, sidePaneManager); | ||
generalFetcher = new GeneralFetcher(this, sidePaneManager); | ||
|
||
generalFetcher = new GeneralFetcher(sidePaneManager, this); | ||
|
||
sidePaneManager.register("groups", groupSelector); | ||
sidePaneManager.register(groupSelector); | ||
} | ||
|
||
/** | ||
|
@@ -1237,12 +1227,12 @@ private void fillMenu() { | |
search.addSeparator(); | ||
search.add(new JCheckBoxMenuItem(generalFetcher.getAction())); | ||
if (prefs.getBoolean(JabRefPreferences.WEB_SEARCH_VISIBLE)) { | ||
sidePaneManager.register(generalFetcher.getTitle(), generalFetcher); | ||
sidePaneManager.show(generalFetcher.getTitle()); | ||
sidePaneManager.register(generalFetcher); | ||
sidePaneManager.show(GeneralFetcher.NAME); | ||
} | ||
mb.add(search); | ||
|
||
groups.add(new JCheckBoxMenuItem(toggleGroups)); | ||
groups.add(new JCheckBoxMenuItem(groupSelector.getAction())); | ||
groups.addSeparator(); | ||
groups.add(addToGroup); | ||
groups.add(removeFromGroup); | ||
|
@@ -1283,7 +1273,7 @@ private void fillMenu() { | |
view.addSeparator(); | ||
view.add(new JCheckBoxMenuItem(toggleToolbar)); | ||
view.add(new JCheckBoxMenuItem(enableToggle(generalFetcher.getAction()))); | ||
view.add(new JCheckBoxMenuItem(toggleGroups)); | ||
view.add(new JCheckBoxMenuItem(groupSelector.getAction())); | ||
view.add(new JCheckBoxMenuItem(togglePreview)); | ||
view.add(getNextPreviewStyleAction()); | ||
view.add(getPreviousPreviewStyleAction()); | ||
|
@@ -1324,10 +1314,7 @@ private void fillMenu() { | |
|
||
tools.add(newSubDatabaseAction); | ||
tools.add(writeXmpAction); | ||
OpenOfficePanel otp = OpenOfficePanel.getInstance(); | ||
otp.init(this, sidePaneManager); | ||
optMenuItem = otp.getMenuItem(); | ||
tools.add(optMenuItem); | ||
tools.add(new JCheckBoxMenuItem(openOfficePanel.getAction())); | ||
tools.add(pushExternalButton.getMenuAction()); | ||
tools.addSeparator(); | ||
tools.add(openFolder); | ||
|
@@ -1485,14 +1472,12 @@ private void createToolBar() { | |
} | ||
tlb.addSeparator(); | ||
|
||
fetcherToggle = new JToggleButton(generalFetcher.getAction()); | ||
tlb.addJToggleButton(fetcherToggle); | ||
tlb.addJToggleButton(new JToggleButton(generalFetcher.getAction())); | ||
|
||
previewToggle = new JToggleButton(togglePreview); | ||
tlb.addJToggleButton(previewToggle); | ||
|
||
groupToggle = new JToggleButton(toggleGroups); | ||
tlb.addJToggleButton(groupToggle); | ||
tlb.addJToggleButton(new JToggleButton(groupSelector.getAction())); | ||
|
||
tlb.addSeparator(); | ||
|
||
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
sendAsEmail, downloadFullText, writeXmpAction, openOfficePanel.getAction(), findUnlinkedFiles, addToGroup, removeFromGroup, | ||
moveToGroup, autoLinkFile, resolveDuplicateKeys, openUrl, openFolder, openFile, togglePreview, | ||
dupliCheck, autoSetFile, newEntryAction, newSpec, customizeAction, plainTextImport, getMassSetField(), getManageKeywords(), | ||
pushExternalButton.getMenuAction(), closeDatabaseAction, getNextPreviewStyleAction(), getPreviousPreviewStyleAction(), checkIntegrity, | ||
|
@@ -2381,10 +2366,6 @@ public GroupSelector getGroupSelector() { | |
return groupSelector; | ||
} | ||
|
||
public void setFetcherToggle(boolean enabled) { | ||
fetcherToggle.setSelected(enabled); | ||
} | ||
|
||
public void setPreviewToggle(boolean enabled) { | ||
previewToggle.setSelected(enabled); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 toNAME
with calls togetSidePaneName
?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.