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

Reimplement custom entry types dialog #5799

Merged
merged 57 commits into from
Feb 19, 2020
Merged

Reimplement custom entry types dialog #5799

merged 57 commits into from
Feb 19, 2020

Conversation

Siedlerchr
Copy link
Member

@Siedlerchr Siedlerchr commented Dec 30, 2019

Fixes #4719

Very early draft.
Field Type should be radio button to switch between optional/required

TODO:

  • Add check for empty fields and types (prevent them with validator)

grafik

@tobiasdiez
Copy link
Member

Cool that you worked on this!

As a suggestion, I would not follow the original design very closely. Instead of having different lists for required and optional fields, I would add one big list of all fields with a checkbox toggling between required/optional.

@Siedlerchr
Copy link
Member Author

Thanks for the idea, that indeed sounds more practical. Maybe a radio button column.

* upstream/master:
  Add select all buttons to change dialog (#5803)
  Squashed 'src/main/resources/csl-locales/' changes from 9785a6e358..a3e8843f75
  Squashed 'src/main/resources/csl-styles/' changes from 49a1841..b2fbe15
  Fix CSL update
  Add new authors
  Remove ACM Fetcher in one more check
  Adapt WebFetchersTest
  Disable ACM Fetcher
  Try to fix branch name on cleanup pr action
  Remove obsolete class (#5801)
  Try to use right ref
  Run tests only once at pull requets
  Add ignored dependency
  Fix "&" on previews (#5786)
  [WIP] Batch Insert entries (#5691)
@Siedlerchr
Copy link
Member Author

Question which just came to my mind: Do we allow changing the default entry types and their fields? e.g. Removing a field from an entry type like article?
@koppor

@tobiasdiez
Copy link
Member

Yes, it was possible to add/remove fields from the built-in entry types.

@Siedlerchr
Copy link
Member Author

@tobiasdiez What is the preferred way to add new Fields to a an existing entry type?
I saw the EntryTypesManager with the addCustomOrModifiedType but I am not sure if this is the right approach

@tobiasdiez
Copy link
Member

Yes that methods sounds right. I vaguely remember that the complete entry type had to be "replaced" instead of only specifying the added/removed fields. Easiest way is probably to look at the original code.

@tobiasdiez
Copy link
Member

This looks really nice and is leagues above the original dialog in terms of user friendliness. Good job!

@Siedlerchr
Copy link
Member Author

Still a few things to do, especially saving and removing all the fields back to the db and the prefs, But at least adding to the gui already works (without any further effects)

@Siedlerchr
Copy link
Member Author

@tobiasdiez Do you have an idea why the TableView content has these "empty" fields when I change between a list with more and fewer fields?

TableView is bound bidirecitonal to the fieldsForTypeProperty
this.fieldsForTypeProperty = new SimpleListProperty<>(existingFieldsForType);

        EasyBind.subscribe(selectedEntryTypesProperty, type -> {
            if (type != null) {
                List<FieldViewModel> typesForField = typesWithField.get(type);
                existingFieldsForType.setAll(typesForField);
            }
        });

grafik

Code proudly reused from calixtus implementation in the preferences
@tobiasdiez
Copy link
Member

The table view is programmed in such a way that always the complete visible table is filled with rows. Thus, even if there is no data
https://github.com/JabRef/jabref/pull/5799/files#diff-6f6e1e1c919b9cd2136e6a4b1d7d684aR78
creates the toggle buttons. Moreover, rows are reused (i.e. not re-created).

I think it should suffice to add the check item != null to https://github.com/JabRef/jabref/pull/5799/files#diff-acc3954e085edb6f809d80a9c419f431R26 and perhaps add an else statement with setGraphic(null).

@Siedlerchr
Copy link
Member Author

Thanks! That worked!

* upstream/master:
  Fix for multiple error messages in messed up source editor (#5823)
  change to jdk 13
  Fix obsolete "
  Remove obsolete TOC
  Fix hostname
add delete from lists
…tomizeEntrydlg

* 'customizeEntrydlg' of github.com:JabRef/jabref:
  increase width
  move reloading custom entry types from pref to apply
  add missing l10n
  fix l10n
  add changelog fix typo
  refactor and pass entrytypes manager as ctor param move RadioButtonCell to util use common fields instead of all
  TableView is now properly updated when radio button is toggled
  Add commit handler TODO: commit event is not propagated somehow
@systemoperator
Copy link
Contributor

@Siedlerchr One little remark: Hovering the dustbin icon of e.g. the field "DOI" states "Remove field from entry type DOI", which is not appropriate.

* upstream/master:
  ide-setup updated (#5915)
  Added update method to typePropertyListeners (#5917)
  Bump mariadb-java-client from 2.5.3 to 2.5.4 (#5914)
  Bump org.beryx.jlink from 2.17.0 to 2.17.1 (#5913)
@Siedlerchr
Copy link
Member Author

@systemoperator One question, does the table update properly ( I am referring to the other bug) if you add a new type, add a new field/remove a new field?

@Siedlerchr
Copy link
Member Author

@burrbull All errors fixed.

@systemoperator
Copy link
Contributor

systemoperator commented Feb 4, 2020

@Siedlerchr Concerning updating the table, everything works perfectly. But when I add a new entry type, then I firstly get an exception:

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
	at javafx.fxml/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1787)
	at javafx.fxml/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1670)
	at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
[...]

and afterwards I get another exception:

java.lang.NullPointerException
	at java.base/java.util.AbstractCollection.addAll(AbstractCollection.java:335)
	at javafx.base/javafx.collections.ModifiableObservableListBase.addAll(ModifiableObservableListBase.java:99)
	at javafx.base/javafx.collections.ModifiableObservableListBase.setAll(ModifiableObservableListBase.java:88)
[...]

and then the entry shows up in the table.

Subsequenty, when I delete a newly inserted entry type, then sometimes a null pointer exception occurs:

java.lang.NullPointerException
	at java.base/java.util.AbstractCollection.addAll(AbstractCollection.java:335)
	at javafx.base/javafx.collections.ModifiableObservableListBase.addAll(ModifiableObservableListBase.java:99)
	at javafx.base/javafx.collections.ModifiableObservableListBase.setAll(ModifiableObservableListBase.java:88)
	at org.jabref/org.jabref.gui.customentrytypes.CustomEntryTypeDialogViewModel.lambda$new$2(CustomEntryTypeDialogViewModel.java:91)
	at easybind@1.0.3/org.fxmisc.easybind.EasyBind.lambda$subscribe$12(EasyBind.java:263)
[...]

And when I select another entry type and simply click on the newly added entry type there is another null pointer exception.

@systemoperator
Copy link
Contributor

systemoperator commented Feb 4, 2020

Oh, I have not seen, that it was already mentioned previously.

@Siedlerchr
Copy link
Member Author

Ah thanks. I thought I had fixed this already. Probably forgot to commit this on my other pc. Just fixed it. Will take a bit until the binaries are updated.

@systemoperator
Copy link
Contributor

Testing the fixed one: Some corner cases:

  • Adding several entry types without any name (or at least two types with the same name): Exceptions occur, when deleting them.
  • Adding several (or sometimes just one) new fields without any name: Exception

@Siedlerchr
Copy link
Member Author

That's one thing I want to prevent. Empty fields and empty entry types won't be allowed. Will add a validator that in the next days.

Just wanted to be curious about the table updating refreshing. The main difference between the other table for external file types and this one is that I created a viewModel for the table and I think in the other dialog the ExternalFileType is directly used.

@systemoperator
Copy link
Contributor

systemoperator commented Feb 4, 2020

Sounds good. Empty types should not be allowed as well as types with the same name.

@systemoperator
Copy link
Contributor

systemoperator commented Feb 4, 2020

That's one thing I want to prevent. Empty fields and empty entry types won't be allowed. Will add a validator that in the next days.

Just wanted to be curious about the table updating refreshing. The main difference between the other table for external file types and this one is that I created a viewModel for the table and I think in the other dialog the ExternalFileType is directly used.

Concerning the external file types: Maybe the problem is, that there is a type hierarchy involved and the table uses the interface ExternalFileType. Basically, all cases could be covered with just one ExternalFileType as well. (#5902)

* upstream/master:
  Update open OpenOfficePanel to show buttons in three rows of three. (#5789)
  update to javafx 13.02 (#5921)
  Update JDK14 from EA 30 to EA 34 (#5910)
@koppor
Copy link
Member

koppor commented Feb 19, 2020

There will be a follow-up PR to fix one small issue

eigentlich fehlt nur noch ein check, dass man keinen doppelten typ/field angeben muss.
Aber der wird eh nicht gespeichert bzw ist dann beim reload nicht dabei.
Ansonsten ist es soweit fertig

@koppor koppor merged commit 58f1db5 into master Feb 19, 2020
@koppor koppor deleted the customizeEntrydlg branch February 19, 2020 09:05
@koppor koppor removed the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Feb 19, 2020
Siedlerchr added a commit that referenced this pull request Feb 19, 2020
* upstream/master:
  followup fix
  Fixfetcher (#5948)
  Bump byte-buddy-parent from 1.10.7 to 1.10.8 (#5952)
  Added MenuButtons to IntegrityCheckDialog (#5955)
  Reimplement custom entry types dialog (#5799)
  Bump unirest-java from 3.4.03 to 3.5.00 (#5953)
  MySQL: Allow public key retrieval (#5909)
  Restructure and improve docs for setting up IntelliJ (#5960)
  Change syntax for Oracle multi-row insert SQL statement (#5837)
  Bump classgraph from 4.8.62 to 4.8.64 (#5954)
  Squashed 'src/main/resources/csl-styles/' changes from c531528..9e81857
  Fix not escaping special characters in search pattern (#5938)
Siedlerchr added a commit that referenced this pull request Mar 6, 2020
* upstream/master:
  Try to fix linux pdf opening again (#5945)
  [WIP] Initial work on DBMSProcessor batch entry insertion into ENTRY table (#5814)
  followup fix
  Fixfetcher (#5948)
  Bump byte-buddy-parent from 1.10.7 to 1.10.8 (#5952)
  Added MenuButtons to IntegrityCheckDialog (#5955)
  Reimplement custom entry types dialog (#5799)
  Bump unirest-java from 3.4.03 to 3.5.00 (#5953)
  MySQL: Allow public key retrieval (#5909)
  Restructure and improve docs for setting up IntelliJ (#5960)
  Change syntax for Oracle multi-row insert SQL statement (#5837)
koppor pushed a commit that referenced this pull request Jan 15, 2022
5563ccc Update american-society-for-microbiology.csl (#5842)
19ab80f Merge pull request #5843 from POBrien333/patch-1002
d4a6c6d double trouble
424f7fe in-text >> superscript for T&F ACS style
605253c Merge pull request #5837 from POBrien333/patch-998
eb5417d Merge pull request #5838 from alessandro-gentilini/patch-1
7d2d3f5 Fix typo
9f557b5 Re-indent CSL styles
f587e60 polyglot style
3a3fe2c Create journal-fur-kulturpflanzen-journal-of-cultivated-plants.csl
cb24633 Merge pull request #5826 from dstark/patch-7
2590a6c Merge pull request #5833 from POBrien333/patch-997
5b2481e Create nist-techpubs-jres.csl (#5756)
d2a1a49 Re-indent CSL styles
42c51d1 Update tyndale-bulletin.csl
8dae693 rework style
070586b Localize IEEE dates (#5835)
588fbfe Hopefully fix sorting in CSE author-date (#5834)
1291d72 Update physiotherapy-theory-and-practice.csl
1a64076 New Style for "Neue Kriminalpolitik (Deutsch)" (#5586)
eac93a0 Create physiotherapy-theory-and-practice.csl
2e7a9f6 Merge pull request #5832 from POBrien333/patch-996
4dfad5f Update administrative-science-quarterly.csl
f56db0f Merge pull request #5829 from benthamite/patch-1
526b0b3 Update effective-altruism-wiki.csl
e5b11eb Update effective-altruism-wiki.csl
f2a7301 Update effective-altruism-wiki.csl
5b166c2 Update university-of-roehampton-harvard.csl (#5831)
b231514 Update european-society-of-cardiology.csl (#5519)
dbd902c Re-indent CSL styles
fe8892b Update effective-altruism-wiki.csl
734fa7d Update effective-altruism-wiki.csl
2430a32 Create effective-altruism-wiki.csl
a5101b6 update modern-pathology.csl (#5828)
16f77c8 Update tyndale-bulletin.csl
ea8804e Create the-korean-journal-of-mycology.csl (#5822)
22d8be0 Patch 3 (#5825)
0220ba2 Create jcom.csl (#5819)
cd7b72b Create taylor-and-francis-council-of-science-editors-numeric.csl (#5824)
0033383 Create gomis-senegalese-medicine-thesis.csl (#5774)
b221bcc Create mycobiology.csl (#5821)
d7056f9 Re-indent CSL styles
04ae08b Update tyndale-bulletin.csl
24bd577 Re-indent CSL styles
e08d431 clean up logging
f6ac2a6 Update tyndale-bulletin.csl
e4c07f8 this should be the PR repo name
7f9936c fetch pull request from originating repo
f232f51 Update tyndale-bulletin.csl
e2ae4fc Update tyndale-bulletin.csl
f09f8db Update Sheldon to csl-styles 2.0
a4d7dec re-indent style
a903664 sheldon
7db75fc sheldon
f08dc96 sheldon
35b8bfa sheldon
04e28ca pull req checkout
9c9d061 pull req checkout
9249490 sheldon reindent
9792be6 sheldon reindent
3bced06 reindent & commit
7cc9735 Update styles README and GitHub Actions with 1.0.2 information (#5803)
205c4ea remaining dependents
9458056 fix broken styles
07ba7af fix dependents
e2e7842 Fix term hacks for transition to CSL 1.0.2 (#5801)
5c8c5e9 Replace "sub verbo" with "sub-verbo" (#5799)
7ec637c Fix CSL styles
bcd3054 update to csl/citeproc-ruby 2.0
ec13830 bundle update

git-subtree-dir: buildres/csl/csl-styles
git-subtree-split: 5563ccc
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.

Re-implement "Customize entry types" dialog
7 participants