Dialogstojavafx#3801
Conversation
tobiasdiez
left a comment
There was a problem hiding this comment.
Thanks for having a look at this! This is a huge step to make the maintable-branch usable without dialogs hiding behind the main window. I have a few comments, but these are generally only minor ones.
| actions.put(Actions.OPEN_URL, new OpenURLAction()); | ||
|
|
||
| actions.put(Actions.MERGE_WITH_FETCHED_ENTRY, new MergeWithFetchedEntryAction(this)); | ||
| actions.put(Actions.MERGE_WITH_FETCHED_ENTRY, new MergeWithFetchedEntryAction(this, frame)); |
There was a problem hiding this comment.
could you please pass the DialogService directly, instead of the frame (makes the dependency clearer).
| try { | ||
| SavePreferences prefs = SavePreferences.loadForSaveFromPreferences(Globals.prefs).withMakeBackup(false) | ||
| .withEncoding(panel.getBibDatabaseContext().getMetaData().getEncoding() | ||
| SavePreferences prefs = SavePreferences.loadForSaveFromPreferences(Globals.prefs) |
There was a problem hiding this comment.
The code style settings still seem to be off. The dots are not aligned (if this is not an artifact of the way github displays the code)
| actions.put(Actions.MOVE_TO_GROUP, new GroupAddRemoveDialog(this, true, true)); | ||
|
|
||
| actions.put(Actions.DOWNLOAD_FULL_TEXT, new FindFullTextAction(this)); | ||
| actions.put(Actions.DOWNLOAD_FULL_TEXT, new FindFullTextAction(frame, this)); |
| entryTypes.addAll(EntryTypes.getAllTypes(bibDatabaseMode)); | ||
|
|
||
| typeComp = new EntryTypeList(entryTypes, bibDatabaseMode); | ||
| typeComp = new EntryTypeList(frame, entryTypes, bibDatabaseMode); |
| JOptionPane.showMessageDialog(null, Localization.lang("Invalid URL") + ": " + ex.getMessage(), | ||
| Localization.lang("Download file"), JOptionPane.ERROR_MESSAGE); | ||
| LOGGER.info("Error while downloading " + "'" + res + "'", ex); | ||
| frame.getDialogService().showErrorDialogAndWait(Localization.lang("Download file"), Localization.lang("Invalid URL") + ": " + ex.getMessage(), ex); |
There was a problem hiding this comment.
This code should display the error message twice if I'm not mistaken.
| Localization.lang("You must enter an integer value in the interval 1025-65535 in the text field for") | ||
| + " '" + Localization.lang("Remote server port") + '\'', | ||
| Localization.lang("Remote server port"), JOptionPane.ERROR_MESSAGE); | ||
| ex); |
There was a problem hiding this comment.
the exception as an argument is unneeded here, since the stack trace is not helpful at all in this situation: the user entered data in the wrong format and this is said already in the error message.
|
|
||
|
|
||
| public GeneralTab(JabRefPreferences prefs) { | ||
| public GeneralTab(JabRefFrame frame, JabRefPreferences prefs) { |
There was a problem hiding this comment.
directly pass the dialogservice pls
| (null, Localization.lang("The chosen date format for new entries is not valid"), | ||
| Localization.lang("Invalid date format"), | ||
| JOptionPane.ERROR_MESSAGE); | ||
| JOptionPane.showMessageDialog(null, Localization.lang("The chosen date format for new entries is not valid"), |
| tabs.add(new NetworkTab(prefs)); | ||
| tabs.add(new AdvancedTab(prefs)); | ||
| tabs.add(new AppearancePrefsTab(prefs)); | ||
| tabs.add(new NetworkTab(frame, prefs)); |
| JFXPanel container = CustomJFXPanel.wrap(new Scene(testPane)); | ||
| container.setPreferredSize(new Dimension(800, 350)); | ||
|
|
||
| //TODO: Add dialog for showing pane |
There was a problem hiding this comment.
This should be easy using
jabref/src/main/java/org/jabref/gui/DialogService.java
Lines 114 to 120 in f7d9678
…javafx * upstream/maintable-beta: Change open last edited dialgo to javafx (#3800)
convert some more dialogs Fix index out of bounds in Entry Table columns Pref Tab
Display charsets in Choices dialog
Extend choice dialog with cancel button and ok button label
| } | ||
| if (answer == JOptionPane.NO_OPTION) { | ||
|
|
||
| // return dialogService.showConfirmationDialogWithOptOutAndWait(title, message, |
| Localization.lang("Are you sure you want to remove the style?"), | ||
| Localization.lang("Remove style"), | ||
| Localization.lang("Cancel")); | ||
| if (!style.isFromResource() && removeStylePressed) { |
There was a problem hiding this comment.
previously the dialog was only shown if style.isFromResource returned false. Is this change of behavior desirable?
There was a problem hiding this comment.
Ah shit, I oversaw that condiation
| removeAction = actionEvent -> getSelectedTermsList().ifPresent(list -> { | ||
|
|
||
| if (!list.isInternalList() && (JOptionPane.showConfirmDialog(diag, | ||
| boolean removeProctedTermsFilePressed = frame.getDialogService().showConfirmationDialogAndWait(Localization.lang("Remove protected terms file"), |
|
|
||
| private static FXDialog createDialogWithOptOut(AlertType type, String title, String content, | ||
| String optOutMessage, Consumer<Boolean> optOutAction) { | ||
| String optOutMessage, Consumer<Boolean> optOutAction) { |
There was a problem hiding this comment.
This seems to be another inconsistency between eclipse and intellj style
There was a problem hiding this comment.
I will investigate that
| Localization.lang("You are already connected to a database using entered connection details."), | ||
| Localization.lang("Warning"), JOptionPane.WARNING_MESSAGE); | ||
|
|
||
| frame.getDialogService().showWarningDialogAndWait(Localization.lang("Warning"), |
…javafx * upstream/maintable-beta: Enable travis build for maintable-beta (#3804)
Remove comment form import insepction dlg
|
|
||
| @Override | ||
| public void pushEntries(BibDatabase database, List<BibEntry> entries, String keys, MetaData metaData) { | ||
| public void pushEntries(BibDatabase database, List<BibEntry> entries, String keys, MetaData metaData, DialogService dialogService) { |
There was a problem hiding this comment.
The dialogService makes more sense as a constructor argument, I think. Probably push it even to AbstractPushToApplication
There was a problem hiding this comment.
I thought so, too, but the concrete subclass of PushToEntries (operation) is just passed as constructur argument as a dependency, so it is not possible
There was a problem hiding this comment.
Sorry, I don't understand what you mean. The push to application action of course only gets the PushToApplicaiton instance without knowing which concrete subclass it is. But this is not a problem as far as I can see since upon initialization each subclass would get a DialogService as a constructor argument.
There was a problem hiding this comment.
The problem is: PushToApplicationAction already gets an instance of the concrete push operation and only calls pushEntries.
And these push-Operations are defined and instantiated here. I can't just pass the DialogService as Constructor arg.
The only thing I could do is to create an additional setter for the Dialog Service
jabref/src/main/java/org/jabref/gui/push/PushToApplications.java
Lines 16 to 20 in fd98056
There was a problem hiding this comment.
Why can't you pass the dialog service as a constructor argument to PushToApplications? It seems the only place where this class is initiated is
where you have a dialog service at your disposal.
and convert some open office dlgs, too
Fix l10n keys
| + "</html>", | ||
| "", JOptionPane.ERROR_MESSAGE); | ||
|
|
||
| frame.getDialogService().showErrorDialogAndWait(Localization.lang("Undefined paragraph format"), |
There was a problem hiding this comment.
You were a second too early ;)
…javafx * upstream/maintable-beta: Remove unused import Add group coloring in maintable as replacement for marked entries (#3769) # Conflicts: # src/main/resources/l10n/JabRef_en.properties
|
Let's merge this before the size escalates ;-). Thanks a lot for your time and good work @Siedlerchr! |
…drop * upstream/maintable-beta: (24 commits) Fixes #3796: Pretend that we have every translation for every key (#3820) adjust line wrapping on column replace open office install selection dialog with choice dialog Wrap error messages in fx executor (because abstract worker is swing thread) Convert swing error dialog in save db action to custom fx dialog Replace swing export dialog in ExportToClipboardAction with fx choices dlg run find fulltext dialog in fx thread fix cut, copy & paste action from toolbar Set resizable for custom dialog with dialog pane convert merge entries dlg to javafx and make action working again checkstyle argh! Update test order -> Execute checkstyle first (#3807) embed cleanup dialog in javafx Fix some non FX Thread issues Main drawback: Cleanup panel is in backgroung due to swing thread) Allow search field to be smaller Fix Codacy Unused Params, Fields (#3753) Dialogstojavafx (#3801) Remove unused import Add group coloring in maintable as replacement for marked entries (#3769) Enable travis build for maintable-beta (#3804) Remove setting of tooltip manually Change open last edited dialgo to javafx (#3800) ... # Conflicts: # src/main/java/org/jabref/gui/maintable/MainTable.java
…tomjfx * upstream/maintable-beta: (28 commits) Fixes #3796: Pretend that we have every translation for every key (#3820) adjust line wrapping on column replace open office install selection dialog with choice dialog Wrap error messages in fx executor (because abstract worker is swing thread) Convert swing error dialog in save db action to custom fx dialog Replace swing export dialog in ExportToClipboardAction with fx choices dlg run find fulltext dialog in fx thread fix cut, copy & paste action from toolbar Set resizable for custom dialog with dialog pane convert merge entries dlg to javafx and make action working again checkstyle argh! Update test order -> Execute checkstyle first (#3807) embed cleanup dialog in javafx Fix some non FX Thread issues Main drawback: Cleanup panel is in backgroung due to swing thread) Allow search field to be smaller Fix Codacy Unused Params, Fields (#3753) Dialogstojavafx (#3801) Remove unused import Add group coloring in maintable as replacement for marked entries (#3769) Enable travis build for maintable-beta (#3804) Remove setting of tooltip manually Change open last edited dialgo to javafx (#3800) ...
I have converted a lot of dialogs to javafx.
I did not test each one.
Some of them are going to be replaced in the near future (e.g. the Strings dialog and the import of files/drag and drop stuff), so I did not convert them.
Dialogs which need special treatment are marked with TODO statements.
Some of the candidates are the ones that integrate html or the preview pane