Skip to content

Commit

Permalink
Revert CHANGELOG. Change checkbox disable/enable logic to use FX bind…
Browse files Browse the repository at this point in the history
… / observable.
  • Loading branch information
sbeitzel committed Nov 3, 2018
1 parent 8dd0800 commit b93b19b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where the list of XMP Exclusion fields in the preferences was not be saved [#4072](https://github.com/JabRef/jabref/issues/4072)
- We fixed an issue where the ArXiv Fetcher did not support HTTP URLs [koppor#328](https://github.com/koppor/jabref/issues/328)
- We fixed an issue where only one PDF file could be imported [#4422](https://github.com/JabRef/jabref/issues/4422)
- We fixed an issue where the preference checkbox for automatically updating the timestamp wasn't properly enabled [#4427](https://github.com/JabRef/jabref/issues/4427)



Expand Down
12 changes: 3 additions & 9 deletions src/main/java/org/jabref/gui/preferences/GeneralTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import org.jabref.model.entry.InternalBibtexFields;
import org.jabref.preferences.JabRefPreferences;

import static javafx.beans.binding.Bindings.not;

class GeneralTab extends Pane implements PrefsTab {

private final CheckBox useOwner;
Expand Down Expand Up @@ -59,10 +61,7 @@ public GeneralTab(DialogService dialogService, JabRefPreferences prefs) {
updateTimeStamp = new CheckBox(Localization.lang("Update timestamp on modification"));
useTimeStamp = new CheckBox(Localization.lang("Mark new entries with addition date") + ". "
+ Localization.lang("Date format") + ':');
if (!useTimeStamp.isSelected()) {
updateTimeStamp.setDisable(true);
}
useTimeStamp.setOnAction(e->setDisableUpdateTimeStamp());
updateTimeStamp.disableProperty().bind(not(useTimeStamp.selectedProperty()));
overwriteOwner = new CheckBox(Localization.lang("Overwrite"));
overwriteTimeStamp = new CheckBox(Localization.lang("If a pasted or imported entry already has the field set, overwrite."));
enforceLegalKeys = new CheckBox(Localization.lang("Enforce legal characters in BibTeX keys"));
Expand Down Expand Up @@ -133,16 +132,11 @@ public Node getBuilder() {
return builder;
}

private void setDisableUpdateTimeStamp() {
updateTimeStamp.setDisable(!useTimeStamp.isSelected());
}

@Override
public void setValues() {
useOwner.setSelected(prefs.getBoolean(JabRefPreferences.USE_OWNER));
overwriteOwner.setSelected(prefs.getBoolean(JabRefPreferences.OVERWRITE_OWNER));
useTimeStamp.setSelected(prefs.getBoolean(JabRefPreferences.USE_TIME_STAMP));
setDisableUpdateTimeStamp();
overwriteTimeStamp.setSelected(prefs.getBoolean(JabRefPreferences.OVERWRITE_TIME_STAMP));
updateTimeStamp.setSelected(prefs.getBoolean(JabRefPreferences.UPDATE_TIMESTAMP));
updateTimeStamp.setSelected(useTimeStamp.isSelected());
Expand Down

1 comment on commit b93b19b

@Siedlerchr
Copy link
Member

Choose a reason for hiding this comment

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

That looks good now. The disable line is no longer needed as the bind observer always triggers on value change

Please sign in to comment.