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

[WIP] Conversion of Preferences/preview to mvvm #5062

Merged
merged 27 commits into from
Jul 17, 2019

Conversation

calixtus
Copy link
Member

@calixtus calixtus commented Jun 16, 2019

follow-up to #5033

This is my first shot on the PreviewTab in the Preferences and it has been a real nightmare. What started as an i-thought-so-easy-sunday-morning-project became a horrorstory of listViews, impossible bindings and codeAreas. codeArea? Yes. Syntax-highlighting is real fancy. But there are questions left.

  1. Can I use the syntax-highlighting-stuff of RichTextFX, or to be more precise: The sample, the creators of RichTextFX credited (see the method computeHighlighting )

  2. What does PreviewCycle do, what should it do?

  3. What should the default-button do?

The store-logic somehow copied from the original PreviewTab

previewtab


  • Change in CHANGELOG.md described
  • Tests created for changes
  • Manually tested changed features in running JabRef
  • Screenshots added in PR description (for bigger UI changes)
  • Ensured that the git commit message is a good one
  • Check documentation status (Issue created for outdated help page at help.jabref.org?)

@calixtus calixtus mentioned this pull request Jun 16, 2019
24 tasks
@Siedlerchr
Copy link
Member

Siedlerchr commented Jun 17, 2019

First of all thanks for your efforts.
The preview tab in the preferences allows you to modify the default HTML ("Preview") layout for the entry editor. Only that. The CSL styles are coming from an external library and can't be modified inside JabRef. They are just converted to html for displaying.
Preview cycle method allows you to cycle through the styles in the entry editor preview panel defined in the list on the right.
I think it's F9, e.g. you have default "Preview" style selected and "IEEE" as second style in the right and ACM as thrid
Now in the preview panel in the entry editor you can cycle between the two in the defined order. e..g. Preview -> IEEE -> ACM -> Preview

Default button should reset the html code you entered or modified to the default hard codes one.

@Siedlerchr
Copy link
Member

Furthermore the position of the current selected preview Style is stored in n the prefs. This info is used for the preview cycle function. Complex stuff 😈


/**
* This was originally created by Carlos Martins (github: @cemarins )
* Can this be used here? (BSD-2clause License)
Copy link
Member

Choose a reason for hiding this comment

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

Yep. BSD2-clause aka FreeBSD is compatible

Copy link
Member Author

Choose a reason for hiding this comment

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

So I can cut the comment? Where do I give credit to him?

Copy link
Member

@Siedlerchr Siedlerchr Jun 17, 2019

Choose a reason for hiding this comment

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

I would suggest extending the javadoc comment, e.g. author copyright, and link to the code
Not sure if you need the whole Disclaimer or licence text.
https://opensource.org/licenses/BSD-2-Clause
That should be enough. We already link to the library in our external-libraries.txt file
@koppor knows more about this licence stuff

Copy link
Member

@koppor koppor Jun 20, 2019 via email

Choose a reason for hiding this comment

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

@tobiasdiez
Copy link
Member

That tab is indeed very confusing. A few suggestions (depending on how much time you want to invest):

  • Move the "Default" button below the source code (because it is not connected to the list) and rename it to "Reset to default"
  • Move to the "up/down" buttons directly in the row of the item as e.g here
    image. In some dialogs we already provide a similar item-wise functionality if you want to have a look at the code. Alternatively/in addition support drag and drop to reorder
  • Make the "Test/Edit source" feature similar to how editing works here on github: have a tab with the rendered preview and one to edit the source.

@Siedlerchr
Copy link
Member

Drag and drop reorder is implemented in the general tab for moving files up and down as far as I remember

@calixtus
Copy link
Member Author

Thanks for the comments, i will look into it and resurface the next days again.

@calixtus
Copy link
Member Author

calixtus commented Jun 19, 2019

I got the code-editor and the Preview now in the layout, as @tobiasdiez suggested, but there are still many issues. E.g. there is something wrong with the PreviewViewer: I can change the source for the default 'Preview', but it wont use the changed source in the PreviewViewer until I completly reload the class, even in the MainTable-Preview-View. Also the defaul-button now does not work at all, I think these two issues are connected.

previewtab

previewtab2

previewtab3

previewtab4

Next I'm going to look into the drag'n'drop-stuff. Just wanted you to know, I am still on it. But I got little time these days to work on it.

@tobiasdiez
Copy link
Member

It should work if you call PreviewViewer.setLayout with the updated layout.

@calixtus
Copy link
Member Author

Thanks, that did the trick on the PreviewPane in the Preferences. Code is somehow ugly with typecasting all around, but i did not had a better quick solution.
Still on my ToDo-List:

  • Default button - I think it would be nice not just to have the standard-TextBasedPreviewLayout, but others too (maybe let the user create one). so the default button should not be hardcoded. But I think this goes beyond this PR, so i will hardwire it for now.
  • Multiple Selection is broken
  • Drag'n'drop or per line-move-arrows. I think of it. Creating arrows would imply changing the ChosenListView to a Table or to fill the ListEntries with HBoxes of the entries and the arrows. Let's see,
    Suggestions?

@Siedlerchr
Copy link
Member

If you adapt the html preview, it's stored in prefs. And under the hood the preview works similar or is similar to the custom html export styles

@Siedlerchr
Copy link
Member

Multiple selection is normally handled via the selection model property. Must be explicitly set

@calixtus
Copy link
Member Author

calixtus commented Jun 25, 2019

I implemented basic drag'n'drop between the two lists, fixed the issues around multiple selection, yet there are still some problems.

  • the context-menu. This drives me crazy, I really don't know what to do about this:
    preview_context
  • the size of the PreviewPane is too large, always, I cannot resize it.

About removing the buttons: this would also take away the ability to control this tab by keyboard. Opinions?

I'm thinking of moving things to the viewModel, but honestly, the longer I work on this, I get more and more confused about what has to go to the viewModel and what to the view. Does somebody have a clear view (😁) about this? Thanks

I am still working on sorting in the chosenListView. How do I get the index, where the user drops the items? I need general drop-action in the listview, so the user can drop an item in the empty space. Can I add an additional drop-action to the CellFactory or does this interfere with the general drop-action?

Also Im thinking of a proper way to bind the isEditableProperty.

@calixtus
Copy link
Member Author

Just to remind of this PR, it would be great to have some feedback on the two issues mentioned above: the displaced icons in the ContextMenu and the internal size of the webpane. the size of the webpane is not that big thing, if there is no solution, the user just has to scroll a little bit more to the right. Not perfect, but ... meh...
If there is no solution on the displaced menuicons, I can remove the icons completly.
Besides that, I think everything else is ready to review...

Copy link
Member

@Siedlerchr Siedlerchr left a comment

Choose a reason for hiding this comment

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

lgtm!
About the icons and the web pane, no idea. I would vote to merge this PR now as is and then create an issue/addtional PR to see if we can fix the icon stuff and the webview

@Siedlerchr
Copy link
Member

Could you please add a screensehot on the misplaced menu items?

@calixtus
Copy link
Member Author

displaced icons

unresizeable webpane

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.

The code looks good to me. Nice job!

I don't really have an idea of how to fix the two display issues. The dropdown derives some css properties from the original control, which sometimes leads to surprises. But I couldn't identify what css property could result in the display error for the icons. You can use Scenic View to debug for a bit, but I wouldn't spend too much time into it. From my side, we can merge also the current version.

@calixtus
Copy link
Member Author

Ok, I tried to debug the css-issues a little bit, but I could not figure it out, so i removed the icons. Of course, this is not a solution for the problem, but nobody will ever notice. ;-)
On the other hand, I was finally able to reset the size of the previewPane. Turns out, I had to cast it to a PreviewViewer-Class first.
I also made some minor refactoring on the ViewModel: Instead of testing if the value of the SelectionModelProperty is null I made them an instance of NoSelectionModel as the default value.
Should be ready to merge.

@calixtus
Copy link
Member Author

Could not resist refactoring a little bit more... 😅

@Siedlerchr
Copy link
Member

I am merging then ;)

@Siedlerchr Siedlerchr merged commit b094bc6 into JabRef:master Jul 17, 2019
@calixtus calixtus deleted the preferences_preview_mvvm branch July 17, 2019 14:13
@calixtus
Copy link
Member Author

So this was fun again, at least in the beginning and in the end. In the middle it really hurt.
Before I can work on other tabs, I really have to get my "Lizenz"-thesis done. So it could take about a month, I really have to restrain myself here. 😢 But I will continue, I really don't like leaving things half-done.

Feel free to work on the other tabs. I think, before we start reordering everything, we should convert everything first to mvvm, because otherwise it will become a bit confusing, what is already moved to another prefTab etc.

@Siedlerchr
Copy link
Member

Thanks for your great work and your interest! Regarding your thesis, I think you are not alone. You can ask other JabRef devs about how working on JabRef provides a nice distraction from finishing a thesis.... 😈
I think the other tabs should not be that complex

@koppor
Copy link
Member

koppor commented Oct 1, 2019

@calixtus We hope you finished your thesis. Feel free to rejoin for #hacktoberfest.

github-actions bot pushed a commit to RamonG92/jabref that referenced this pull request Oct 15, 2020
5297abd Delete wirtschaftsuniversitat-wien-interdisziplinares-institut-fur-verhaltenswissenschaftlich-orientiertes-management.csl (JabRef#5023)
4b95fd1 New style - german-yearbook-of-international-law.csl (JabRef#5052)
c74218d Update iso690-full-note-cs.csl (JabRef#5062)
e72fb75 Update associacao-brasileira-de-normas-tecnicas-ufrgs.csl (JabRef#5058)
a440a12 Ann. Rev. Astron.: Remove form="short" for URL
325772c Create european-journal-of-theology.csl (JabRef#5055)
7643924 Update society-of-biblical-literature-fullnote-bibliography.csl (JabRef#5022)
15e8a12 Update RCN-Harvard based on feedback
b9a37b7 Update harvard-university-of-westminster.csl (JabRef#5044)
7826be2 New version of the style for the History Department at the University of Lausanne (JabRef#5050)
a0c044d Reindent/reorder (JabRef#5054)

git-subtree-dir: src/main/resources/csl-styles
git-subtree-split: 5297abd
github-actions bot pushed a commit to CaptainDaVinci/jabref that referenced this pull request Oct 15, 2020
5297abd Delete wirtschaftsuniversitat-wien-interdisziplinares-institut-fur-verhaltenswissenschaftlich-orientiertes-management.csl (JabRef#5023)
4b95fd1 New style - german-yearbook-of-international-law.csl (JabRef#5052)
c74218d Update iso690-full-note-cs.csl (JabRef#5062)
e72fb75 Update associacao-brasileira-de-normas-tecnicas-ufrgs.csl (JabRef#5058)
a440a12 Ann. Rev. Astron.: Remove form="short" for URL
325772c Create european-journal-of-theology.csl (JabRef#5055)
7643924 Update society-of-biblical-literature-fullnote-bibliography.csl (JabRef#5022)
15e8a12 Update RCN-Harvard based on feedback
b9a37b7 Update harvard-university-of-westminster.csl (JabRef#5044)
7826be2 New version of the style for the History Department at the University of Lausanne (JabRef#5050)
a0c044d Reindent/reorder (JabRef#5054)

git-subtree-dir: src/main/resources/csl-styles
git-subtree-split: 5297abd
github-actions bot pushed a commit to Xuanxuan-Zou/jabref that referenced this pull request Oct 15, 2020
5297abd Delete wirtschaftsuniversitat-wien-interdisziplinares-institut-fur-verhaltenswissenschaftlich-orientiertes-management.csl (JabRef#5023)
4b95fd1 New style - german-yearbook-of-international-law.csl (JabRef#5052)
c74218d Update iso690-full-note-cs.csl (JabRef#5062)
e72fb75 Update associacao-brasileira-de-normas-tecnicas-ufrgs.csl (JabRef#5058)
a440a12 Ann. Rev. Astron.: Remove form="short" for URL
325772c Create european-journal-of-theology.csl (JabRef#5055)
7643924 Update society-of-biblical-literature-fullnote-bibliography.csl (JabRef#5022)
15e8a12 Update RCN-Harvard based on feedback
b9a37b7 Update harvard-university-of-westminster.csl (JabRef#5044)
7826be2 New version of the style for the History Department at the University of Lausanne (JabRef#5050)
a0c044d Reindent/reorder (JabRef#5054)

git-subtree-dir: src/main/resources/csl-styles
git-subtree-split: 5297abd
github-actions bot pushed a commit to dimitra-karadima/jabref that referenced this pull request Oct 15, 2020
5297abd Delete wirtschaftsuniversitat-wien-interdisziplinares-institut-fur-verhaltenswissenschaftlich-orientiertes-management.csl (JabRef#5023)
4b95fd1 New style - german-yearbook-of-international-law.csl (JabRef#5052)
c74218d Update iso690-full-note-cs.csl (JabRef#5062)
e72fb75 Update associacao-brasileira-de-normas-tecnicas-ufrgs.csl (JabRef#5058)
a440a12 Ann. Rev. Astron.: Remove form="short" for URL
325772c Create european-journal-of-theology.csl (JabRef#5055)
7643924 Update society-of-biblical-literature-fullnote-bibliography.csl (JabRef#5022)
15e8a12 Update RCN-Harvard based on feedback
b9a37b7 Update harvard-university-of-westminster.csl (JabRef#5044)
7826be2 New version of the style for the History Department at the University of Lausanne (JabRef#5050)
a0c044d Reindent/reorder (JabRef#5054)

git-subtree-dir: src/main/resources/csl-styles
git-subtree-split: 5297abd
github-actions bot pushed a commit to felixbohnacker/jabref that referenced this pull request Oct 15, 2020
5297abd Delete wirtschaftsuniversitat-wien-interdisziplinares-institut-fur-verhaltenswissenschaftlich-orientiertes-management.csl (JabRef#5023)
4b95fd1 New style - german-yearbook-of-international-law.csl (JabRef#5052)
c74218d Update iso690-full-note-cs.csl (JabRef#5062)
e72fb75 Update associacao-brasileira-de-normas-tecnicas-ufrgs.csl (JabRef#5058)
a440a12 Ann. Rev. Astron.: Remove form="short" for URL
325772c Create european-journal-of-theology.csl (JabRef#5055)
7643924 Update society-of-biblical-literature-fullnote-bibliography.csl (JabRef#5022)
15e8a12 Update RCN-Harvard based on feedback
b9a37b7 Update harvard-university-of-westminster.csl (JabRef#5044)
7826be2 New version of the style for the History Department at the University of Lausanne (JabRef#5050)
a0c044d Reindent/reorder (JabRef#5054)

git-subtree-dir: src/main/resources/csl-styles
git-subtree-split: 5297abd
github-actions bot pushed a commit to ShikunXiong/jabref that referenced this pull request Oct 15, 2020
5297abd Delete wirtschaftsuniversitat-wien-interdisziplinares-institut-fur-verhaltenswissenschaftlich-orientiertes-management.csl (JabRef#5023)
4b95fd1 New style - german-yearbook-of-international-law.csl (JabRef#5052)
c74218d Update iso690-full-note-cs.csl (JabRef#5062)
e72fb75 Update associacao-brasileira-de-normas-tecnicas-ufrgs.csl (JabRef#5058)
a440a12 Ann. Rev. Astron.: Remove form="short" for URL
325772c Create european-journal-of-theology.csl (JabRef#5055)
7643924 Update society-of-biblical-literature-fullnote-bibliography.csl (JabRef#5022)
15e8a12 Update RCN-Harvard based on feedback
b9a37b7 Update harvard-university-of-westminster.csl (JabRef#5044)
7826be2 New version of the style for the History Department at the University of Lausanne (JabRef#5050)
a0c044d Reindent/reorder (JabRef#5054)

git-subtree-dir: src/main/resources/csl-styles
git-subtree-split: 5297abd
github-actions bot pushed a commit to eetian/jabref that referenced this pull request Oct 15, 2020
5297abd Delete wirtschaftsuniversitat-wien-interdisziplinares-institut-fur-verhaltenswissenschaftlich-orientiertes-management.csl (JabRef#5023)
4b95fd1 New style - german-yearbook-of-international-law.csl (JabRef#5052)
c74218d Update iso690-full-note-cs.csl (JabRef#5062)
e72fb75 Update associacao-brasileira-de-normas-tecnicas-ufrgs.csl (JabRef#5058)
a440a12 Ann. Rev. Astron.: Remove form="short" for URL
325772c Create european-journal-of-theology.csl (JabRef#5055)
7643924 Update society-of-biblical-literature-fullnote-bibliography.csl (JabRef#5022)
15e8a12 Update RCN-Harvard based on feedback
b9a37b7 Update harvard-university-of-westminster.csl (JabRef#5044)
7826be2 New version of the style for the History Department at the University of Lausanne (JabRef#5050)
a0c044d Reindent/reorder (JabRef#5054)

git-subtree-dir: src/main/resources/csl-styles
git-subtree-split: 5297abd
github-actions bot pushed a commit that referenced this pull request Oct 15, 2020
5297abd Delete wirtschaftsuniversitat-wien-interdisziplinares-institut-fur-verhaltenswissenschaftlich-orientiertes-management.csl (#5023)
4b95fd1 New style - german-yearbook-of-international-law.csl (#5052)
c74218d Update iso690-full-note-cs.csl (#5062)
e72fb75 Update associacao-brasileira-de-normas-tecnicas-ufrgs.csl (#5058)
a440a12 Ann. Rev. Astron.: Remove form="short" for URL
325772c Create european-journal-of-theology.csl (#5055)
7643924 Update society-of-biblical-literature-fullnote-bibliography.csl (#5022)
15e8a12 Update RCN-Harvard based on feedback
b9a37b7 Update harvard-university-of-westminster.csl (#5044)
7826be2 New version of the style for the History Department at the University of Lausanne (#5050)
a0c044d Reindent/reorder (#5054)

git-subtree-dir: src/main/resources/csl-styles
git-subtree-split: 5297abd
github-actions bot pushed a commit to dextep/jabref that referenced this pull request Oct 15, 2020
5297abd Delete wirtschaftsuniversitat-wien-interdisziplinares-institut-fur-verhaltenswissenschaftlich-orientiertes-management.csl (JabRef#5023)
4b95fd1 New style - german-yearbook-of-international-law.csl (JabRef#5052)
c74218d Update iso690-full-note-cs.csl (JabRef#5062)
e72fb75 Update associacao-brasileira-de-normas-tecnicas-ufrgs.csl (JabRef#5058)
a440a12 Ann. Rev. Astron.: Remove form="short" for URL
325772c Create european-journal-of-theology.csl (JabRef#5055)
7643924 Update society-of-biblical-literature-fullnote-bibliography.csl (JabRef#5022)
15e8a12 Update RCN-Harvard based on feedback
b9a37b7 Update harvard-university-of-westminster.csl (JabRef#5044)
7826be2 New version of the style for the History Department at the University of Lausanne (JabRef#5050)
a0c044d Reindent/reorder (JabRef#5054)

git-subtree-dir: src/main/resources/csl-styles
git-subtree-split: 5297abd
github-actions bot pushed a commit to graffaner/jabref that referenced this pull request Oct 15, 2020
5297abd Delete wirtschaftsuniversitat-wien-interdisziplinares-institut-fur-verhaltenswissenschaftlich-orientiertes-management.csl (JabRef#5023)
4b95fd1 New style - german-yearbook-of-international-law.csl (JabRef#5052)
c74218d Update iso690-full-note-cs.csl (JabRef#5062)
e72fb75 Update associacao-brasileira-de-normas-tecnicas-ufrgs.csl (JabRef#5058)
a440a12 Ann. Rev. Astron.: Remove form="short" for URL
325772c Create european-journal-of-theology.csl (JabRef#5055)
7643924 Update society-of-biblical-literature-fullnote-bibliography.csl (JabRef#5022)
15e8a12 Update RCN-Harvard based on feedback
b9a37b7 Update harvard-university-of-westminster.csl (JabRef#5044)
7826be2 New version of the style for the History Department at the University of Lausanne (JabRef#5050)
a0c044d Reindent/reorder (JabRef#5054)

git-subtree-dir: src/main/resources/csl-styles
git-subtree-split: 5297abd
github-actions bot pushed a commit to NikodemKch/jabref-1 that referenced this pull request Oct 15, 2020
5297abd Delete wirtschaftsuniversitat-wien-interdisziplinares-institut-fur-verhaltenswissenschaftlich-orientiertes-management.csl (JabRef#5023)
4b95fd1 New style - german-yearbook-of-international-law.csl (JabRef#5052)
c74218d Update iso690-full-note-cs.csl (JabRef#5062)
e72fb75 Update associacao-brasileira-de-normas-tecnicas-ufrgs.csl (JabRef#5058)
a440a12 Ann. Rev. Astron.: Remove form="short" for URL
325772c Create european-journal-of-theology.csl (JabRef#5055)
7643924 Update society-of-biblical-literature-fullnote-bibliography.csl (JabRef#5022)
15e8a12 Update RCN-Harvard based on feedback
b9a37b7 Update harvard-university-of-westminster.csl (JabRef#5044)
7826be2 New version of the style for the History Department at the University of Lausanne (JabRef#5050)
a0c044d Reindent/reorder (JabRef#5054)

git-subtree-dir: src/main/resources/csl-styles
git-subtree-split: 5297abd
github-actions bot pushed a commit to joe9111/jabref that referenced this pull request Oct 15, 2020
5297abd Delete wirtschaftsuniversitat-wien-interdisziplinares-institut-fur-verhaltenswissenschaftlich-orientiertes-management.csl (JabRef#5023)
4b95fd1 New style - german-yearbook-of-international-law.csl (JabRef#5052)
c74218d Update iso690-full-note-cs.csl (JabRef#5062)
e72fb75 Update associacao-brasileira-de-normas-tecnicas-ufrgs.csl (JabRef#5058)
a440a12 Ann. Rev. Astron.: Remove form="short" for URL
325772c Create european-journal-of-theology.csl (JabRef#5055)
7643924 Update society-of-biblical-literature-fullnote-bibliography.csl (JabRef#5022)
15e8a12 Update RCN-Harvard based on feedback
b9a37b7 Update harvard-university-of-westminster.csl (JabRef#5044)
7826be2 New version of the style for the History Department at the University of Lausanne (JabRef#5050)
a0c044d Reindent/reorder (JabRef#5054)

git-subtree-dir: src/main/resources/csl-styles
git-subtree-split: 5297abd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants