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

Enhance side pane toggle #1605

Merged
merged 8 commits into from
Oct 12, 2016
Merged

Conversation

Braunch
Copy link
Contributor

@Braunch Braunch commented Jul 19, 2016

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:

  • GroupSelector
  • GeneralFetcher
  • OpenOfficePanel

Bonus:

  • EntryEditor/PreviewPanel

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.

@Braunch
Copy link
Contributor Author

Braunch commented Jul 19, 2016

@simonharrer how should the toggle for the preview panel and the entry editor work in your opinion?
Since the preview has nothing to focus the three phase toggle is not suitable here. For the entry editor on the other hand, I can imagine using the three phases. Any opinions on that (from anyone of course, just refering to @simonharrer because it was him to mention the idea in the first place)?

@Braunch Braunch force-pushed the enhanceSidePaneToggle branch 3 times, most recently from 3ed9ae8 to 8509239 Compare July 26, 2016 13:47
@Braunch Braunch mentioned this pull request Aug 8, 2016
@koppor
Copy link
Member

koppor commented Sep 12, 2016

#1525 is merged. Will there be updates on this PR?

@chriba chriba force-pushed the enhanceSidePaneToggle branch 2 times, most recently from 960467f to b3e48c4 Compare September 27, 2016 10:43
@chriba
Copy link
Contributor

chriba commented Sep 27, 2016

I took this issue to myself and coded a quick solution.

OpenOffice/LibreOffice is now able to be toggled.

Copy link
Contributor

@tschechlovdev tschechlovdev left a 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
Copy link
Contributor

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.

Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above.

Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo ig -> if

Copy link
Contributor

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)) {
Copy link
Contributor

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.

Copy link
Contributor

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() {
Copy link
Contributor

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?

Copy link
Contributor

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

@tschechlovdev tschechlovdev added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Sep 28, 2016
@koppor koppor changed the title [WIP] Enhance side pane toggle Enhance side pane toggle Sep 28, 2016
@koppor
Copy link
Member

koppor commented Oct 10, 2016

Refs koppor#54

# Conflicts:
#	src/test/java/net/sf/jabref/gui/importer/fetcher/GeneralFetcherTest.java
@koppor
Copy link
Member

koppor commented Oct 11, 2016

I tried it: Works good. Code LGTM.

Copy link
Member

@tobiasdiez tobiasdiez left a 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;
Copy link
Member

@tobiasdiez tobiasdiez Oct 11, 2016

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))

Copy link
Contributor

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,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe rename getAction -> getToggleAction ?

Copy link
Contributor

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() {
Copy link
Member

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 ?

Copy link
Contributor

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 {
Copy link
Member

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

done

@koppor koppor removed the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Oct 11, 2016
@tobiasdiez tobiasdiez added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Oct 11, 2016
@chriba
Copy link
Contributor

chriba commented Oct 11, 2016

When a subclass does NOT implement an abstract method, how should I mark it?
Nevermind, the UnsupportedOperationException seems a good option.

@tobiasdiez
Copy link
Member

Code looks good to me now (thanks for the quick changes!). I'll merge it in.

@tobiasdiez tobiasdiez merged commit 56b9a67 into JabRef:master Oct 12, 2016
@chriba chriba deleted the enhanceSidePaneToggle branch October 12, 2016 11:36
Siedlerchr added a commit that referenced this pull request Oct 13, 2016
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keybinding status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers type: enhancement ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants