I am using the latest JabRef 5 master build:
Java 13.0.2
on Ubuntu 16.04
The value of the entry type field for an entry in the main table is not updating when changing its type by using the dropdown menu of the entry editor. To differentiate this from issue #5905, one can assume, that in the entry editor the tab "biblatex source" is not/never active.
Steps to reproduce the behavior:
_Observation:_ Commonly, the entry type will not change in the main table, even if shortly selecting a different entry in the main table and reselecting the edited one. Sometimes temporarily switching to a different opened library helps, but not always.
Contrarily, other fields in the main table will be updated immediately, when their values get changed.
Subsequent observation (now allows viewing the tab "biblatex source"):
_Observation:_ The library has been modifed (indicated with the star symbol "*"), although no change was conduted.
For both cases, I assume it could be some reference problem.
It's only a display issue: if you change the entry type, save and reload the database the change is correctly reflected.
@tobiasdiez On the one hand, I wanted to address the display issues (in the main table and in the tab "biblatex source", where in the source the entry type sometimes does not get updated), on the other hand, I think it is not only a display issue:
Consider the following:
_Prerequisite:_ Make sure, that in Options -> Preferences -> Entry editor -> "Show BibTeX source by default" is NOT ticked.
_Observation:_ The performed change (namely changing the entry type) has been overwritten to the previous entry type.
This could indicate a reference issue as well. From my perspective, it seems, that the tab "biblatex source" still references to the previous entry (or the changes simply have not been written to the tab "biblatex source") and it "writes back" the contained values, since it is (and must be) quite sensitive to changes.
@calixtus you recently fixed a bug and reused that code editor component. Maybe this is the issue now for the incorrect reference?
That would explain why we did not reuse the control, but recreated every time
Im going to investigate this tomorrow.
I took a look into the code, it's two bugs: one thing is about the source tab, it easily fixed by adding an InvalidationListener to the typeProperty (fix incoming for issue #5905 ).
The other one, this here, is about displaying the changed entry type in the main table.
This bug here could be a simply consequence of the fact that
https://github.com/JabRef/jabref/blob/master/src/main/java/org/jabref/model/entry/BibEntry.java#L940
does not contain type. Thus, changes of the type do not trigger change events (and thus the main table is not updated).
I tried the simple fix idea from @tobiasdiez and added entryType to the observables. However, this has only an impact on the PreviewViewer. The observables are only used in the PrevieViewer.
However, I think we need to have a simliar class like FieldCoumn which handles the entry type or maybe we can extend the fieldColumn. I could not find anything related to the entry type in the MainTable. So I guess this explains it. Because entry type is not a field, it's not updated
I think I found the problem:
Types are displayed as a normal field column. However, https://github.com/JabRef/jabref/blob/6a9c9159949e1f1cbff1bfad09e0ff2a2eda3712/src/main/java/org/jabref/gui/maintable/FieldColumn.java#L51-L52
only includes real fields as dependencies.
https://github.com/JabRef/jabref/blob/6a9c9159949e1f1cbff1bfad09e0ff2a2eda3712/src/main/java/org/jabref/model/entry/BibEntry.java#L917-L920
The display still works as its done via
https://github.com/JabRef/jabref/blob/6a9c9159949e1f1cbff1bfad09e0ff2a2eda3712/src/main/java/org/jabref/gui/maintable/FieldColumn.java#L60
and this includes special handling of types
https://github.com/JabRef/jabref/blob/6a9c9159949e1f1cbff1bfad09e0ff2a2eda3712/src/main/java/org/jabref/model/entry/BibEntry.java#L249-L251
Thus it should be possible to fix this issue by adding a special handling of the type field in
https://github.com/JabRef/jabref/blob/6a9c9159949e1f1cbff1bfad09e0ff2a2eda3712/src/main/java/org/jabref/model/entry/BibEntry.java#L917-L920
Thanks for the hint, adding a check for the entry type in that binding works
I can confirm, that all problems mentioned within this issue are fixed with this commit. :) One very related issue (where I hoped this would fix it as well) is still open: #5905
Most helpful comment
Thanks for the hint, adding a check for the entry type in that binding works