-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Dialogstojavafx #3801
Dialogstojavafx #3801
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -525,7 +525,7 @@ public void update() { | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please pass the DialogService
directly, instead of the frame (makes the dependency clearer).
fup.scanResultsResolved(true); | ||
} | ||
} | ||
|
||
private void storeTempDatabase() { | ||
JabRefExecutorService.INSTANCE.execute(() -> { | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
@@ -657,7 +657,7 @@ public void update() { | |||
actions.put(Actions.REMOVE_FROM_GROUP, new GroupAddRemoveDialog(this, false, false)); | |||
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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dito
@@ -101,7 +100,7 @@ private void initGui() { | |||
List<String> entryTypes = new ArrayList<>(); | |||
entryTypes.addAll(EntryTypes.getAllTypes(bibDatabaseMode)); | |||
|
|||
typeComp = new EntryTypeList(entryTypes, bibDatabaseMode); | |||
typeComp = new EntryTypeList(frame, entryTypes, bibDatabaseMode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here also
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -64,8 +67,8 @@ public Component getListCellRendererComponent(JList<?> list, Object value, int i | |||
} | |||
} | |||
|
|||
|
|||
public GeneralTab(JabRefPreferences prefs) { | |||
public GeneralTab(JabRefFrame frame, JabRefPreferences prefs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you missed this one ;-)
tabs.add(new NetworkTab(prefs)); | ||
tabs.add(new AdvancedTab(prefs)); | ||
tabs.add(new AppearancePrefsTab(prefs)); | ||
tabs.add(new NetworkTab(frame, prefs)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dialogservice everywhere
@@ -127,13 +130,17 @@ private void setupLogic() { | |||
testPane.setEntry(TestEntry.getTestEntry()); | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be easy using
jabref/src/main/java/org/jabref/gui/DialogService.java
Lines 114 to 120 in f7d9678
/** | |
* This will create and display a new dialog showing a custom {@link DialogPane} | |
* and using custom {@link ButtonType}s. | |
* | |
* @return Optional with the pressed Button as ButtonType | |
*/ | |
Optional<ButtonType> showCustomDialogAndWait(String title, DialogPane contentPane, ButtonType... buttonTypes); |
…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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove these comments
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously the dialog was only shown if style.isFromResource
returned false. Is this change of behavior desirable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah shit, I oversaw that condiation
@@ -254,10 +253,12 @@ private void setupPopupMenu() { | |||
// Create action listener for removing a term file, also used for the remove button | |||
removeAction = actionEvent -> getSelectedTermsList().ifPresent(list -> { | |||
|
|||
if (!list.isInternalList() && (JOptionPane.showConfirmDialog(diag, | |||
boolean removeProctedTermsFilePressed = frame.getDialogService().showConfirmationDialogAndWait(Localization.lang("Remove protected terms file"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
@@ -68,7 +68,7 @@ private static FXDialog createDialog(AlertType type, String title, String conten | |||
} | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be another inconsistency between eclipse and intellj style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a better title?
…javafx * upstream/maintable-beta: Enable travis build for maintable-beta (#3804)
Remove comment form import insepction dlg
@@ -61,11 +63,12 @@ protected void initSettingsPanel() { | |||
} | |||
|
|||
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dialogService
makes more sense as a constructor argument, I think. Probably push it even to AbstractPushToApplication
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
applications = new ArrayList<>(); | |
applications.add(new PushToEmacs()); | |
applications.add(new PushToLyx()); | |
applications.add(new PushToTexmaker()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
pushApplications = new PushToApplications(); |
where you have a dialog service at your disposal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove todo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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