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

Dialogstojavafx #3801

Merged
merged 24 commits into from
Mar 5, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
67c489e
convert dialogs to javafx
Siedlerchr Mar 2, 2018
ad502c4
convert open office and other preferences
Siedlerchr Mar 2, 2018
55a985f
Convert entryTypeList and entry customization and shared database
Siedlerchr Mar 2, 2018
bb66b22
And convert some more
Siedlerchr Mar 2, 2018
ce6837f
Merge remote-tracking branch 'upstream/maintable-beta' into dialogsto…
Siedlerchr Mar 3, 2018
86dfdc3
Pass dialogService instead of frame
Siedlerchr Mar 3, 2018
13500fe
entry types list
Siedlerchr Mar 3, 2018
d05d253
create choice dialog
Siedlerchr Mar 3, 2018
f4b84d6
ADd method for returning list in Encodings
Siedlerchr Mar 3, 2018
71b17c2
Convert some more confirmation dialogs
Siedlerchr Mar 3, 2018
469a834
convert some more dialogs
Siedlerchr Mar 3, 2018
6b1ef6f
Merge branch 'maintable-beta' into dialogstojavafx
Siedlerchr Mar 3, 2018
cbb1df3
fix checkstyle and add missing lang keys
Siedlerchr Mar 3, 2018
9e7ff57
fix dialog conditions
Siedlerchr Mar 4, 2018
5b8b745
Merge remote-tracking branch 'upstream/maintable-beta' into dialogsto…
Siedlerchr Mar 4, 2018
9a04aa6
add better title for share db dialog
Siedlerchr Mar 4, 2018
4d1b6e7
Add dialogservice to push to apps
Siedlerchr Mar 4, 2018
74391d4
add new keys
Siedlerchr Mar 4, 2018
44bceed
fix dialog service in push
Siedlerchr Mar 4, 2018
cf82ad3
checkstyle
Siedlerchr Mar 4, 2018
a43a7de
use dialogservice as local variable
Siedlerchr Mar 4, 2018
7d4afe0
pass Dialog service to push dialogs as ctor arg
Siedlerchr Mar 5, 2018
3dc6068
Merge remote-tracking branch 'upstream/maintable-beta' into dialogsto…
Siedlerchr Mar 5, 2018
43d38db
checkstyle
Siedlerchr Mar 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/main/java/org/jabref/gui/DialogService.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ default void showErrorDialogAndWait(Exception exception) {
* @return true if the use clicked "YES" otherwise false
*/
boolean showConfirmationDialogWithOptOutAndWait(String title, String content,
String optOutMessage, Consumer<Boolean> optOutAction);
String optOutMessage, Consumer<Boolean> optOutAction);

/**
* Create and display a new confirmation dialog.
Expand All @@ -142,8 +142,8 @@ boolean showConfirmationDialogWithOptOutAndWait(String title, String content,
* @return true if the use clicked "YES" otherwise false
*/
boolean showConfirmationDialogWithOptOutAndWait(String title, String content,
String okButtonLabel, String cancelButtonLabel,
String optOutMessage, Consumer<Boolean> optOutAction);
String okButtonLabel, String cancelButtonLabel,
String optOutMessage, Consumer<Boolean> optOutAction);

/**
* This will create and display a new dialog of the specified
Expand All @@ -153,7 +153,7 @@ boolean showConfirmationDialogWithOptOutAndWait(String title, String content,
* @return Optional with the pressed Button as ButtonType
*/
Optional<ButtonType> showCustomButtonDialogAndWait(Alert.AlertType type, String title, String content,
ButtonType... buttonTypes);
ButtonType... buttonTypes);

/**
* This will create and display a new dialog showing a custom {@link DialogPane}
Expand Down Expand Up @@ -236,5 +236,4 @@ Optional<ButtonType> showCustomButtonDialogAndWait(Alert.AlertType type, String
*/
boolean showPrintDialog(PrinterJob job);


}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import javax.swing.JOptionPane;
import javax.swing.JTextArea;

import javafx.scene.control.ButtonType;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.ButtonType;

import org.jabref.Globals;
import org.jabref.JabRefExecutorService;
Expand Down
42 changes: 14 additions & 28 deletions src/main/java/org/jabref/gui/openoffice/OpenOfficePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -637,14 +637,11 @@ private boolean checkThatEntriesHaveKeys(List<BibEntry> entries) {
}

// Ask if keys should be generated
String[] options = {Localization.lang("Generate keys"), Localization.lang("Cancel")};

boolean citePressed = frame.getDialogService().showConfirmationDialogAndWait(Localization.lang("Cite"),
Localization.lang("Cannot cite entries without BibTeX keys. Generate keys now?"),
Localization.lang("Generate keys"),
Localization.lang("Cancel"));


BasePanel panel = frame.getCurrentBasePanel();
if (citePressed && (panel != null)) {
// Generate keys
Expand Down Expand Up @@ -672,41 +669,30 @@ private boolean checkThatEntriesHaveKeys(List<BibEntry> entries) {
private void showConnectionLostErrorMessage() {
frame.getDialogService().showErrorDialogAndWait(Localization.lang("Connection lost"),
Localization.lang("Connection to OpenOffice/LibreOffice has been lost. "
+ "Please make sure OpenOffice/LibreOffice is running, and try to reconnect."));
+ "Please make sure OpenOffice/LibreOffice is running, and try to reconnect."));

}

private void reportUndefinedParagraphFormat(UndefinedParagraphFormatException ex) {
//TODO: Javafx does not support html as far as I know
Copy link
Member

Choose a reason for hiding this comment

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

Thats right, but the dialog does not seem to actually need html (the only tag is for the newline, right?)

JOptionPane
.showMessageDialog(
null, "<html>"
+ Localization.lang(
"Your style file specifies the paragraph format '%0', "
+ "which is undefined in your current OpenOffice/LibreOffice document.",
ex.getFormatName())
+ "<br>"
+ Localization
.lang("The paragraph format is controlled by the property 'ReferenceParagraphFormat' or 'ReferenceHeaderParagraphFormat' in the style file.")
+ "</html>",
"", JOptionPane.ERROR_MESSAGE);

frame.getDialogService().showErrorDialogAndWait(Localization.lang("Undefined paragraph format"),
Copy link
Member

Choose a reason for hiding this comment

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

remove todo?

Copy link
Member Author

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 ;)

Localization.lang("Your style file specifies the paragraph format '%0' which is undefined in your current OpenOffice/LibreOffice document.",
ex.getFormatName()) + "\n" +
Localization.lang("The paragraph format is controlled by the property 'ReferenceParagraphFormat' or 'ReferenceHeaderParagraphFormat' in the style file."));

}

private void reportUndefinedCharacterFormat(UndefinedCharacterFormatException ex) {
//TODO: Javafx does not support html as far as I know
Copy link
Member

Choose a reason for hiding this comment

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

see above


JOptionPane
.showMessageDialog(
null, "<html>"
+ Localization.lang(
"Your style file specifies the character format '%0', "
+ "which is undefined in your current OpenOffice/LibreOffice document.",
ex.getFormatName())
+ "<br>"
+ Localization
.lang("The character format is controlled by the citation property 'CitationCharacterFormat' in the style file.")
+ "</html>",
"", JOptionPane.ERROR_MESSAGE);
frame.getDialogService().showErrorDialogAndWait(Localization.lang("Undefined character format"),
Localization.lang(
"Your style file specifies the character format '%0', which is undefined in your current OpenOffice/LibreOffice document.",
ex.getFormatName()) + "\n"
+ Localization.lang("The character format is controlled by the citation property 'CitationCharacterFormat' in the style file.")

);
}

private void showSettingsPopup() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ private void setupDialog() {
.withDefaultExtension(FileType.TERMS)
.withInitialDirectory(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)).build();


browse.addActionListener(e -> {
Optional<Path> file = DefaultTaskExecutor
.runInJavaFXThread(() -> dialogService.showFileSaveDialog(fileDialogConfiguration));
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/logic/l10n/Encodings.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ public class Encodings {
private static List<Charset> encodingsList = Charset.availableCharsets().values().stream().distinct()
.collect(Collectors.toList());

private Encodings() {
}

static {
List<String> encodingsStringList = encodingsList.stream().map(Charset::displayName).distinct()
.collect(Collectors.toList());
Expand All @@ -22,7 +25,4 @@ public static List<Charset> getCharsets() {
return encodingsList;
}

private Encodings() {
}

}