From 940f328e23ed258cab0774aacad76c6b1fe001a2 Mon Sep 17 00:00:00 2001 From: Eduard Occhipinti Date: Tue, 17 Jan 2023 22:34:56 +0100 Subject: [PATCH 1/2] last fixes --- .../controllers/FXMLEmailController.java | 57 ++++++++----------- .../controllers/FXMLFolderController.java | 4 +- .../controllers/FXMLListEmailController.java | 4 +- .../jmail/client/controllers/FXMLLogin.java | 8 --- .../jmail/client/dialogs/CustomDialog.java | 33 +++++------ .../client/factory/EmailCellFactory.java | 2 +- .../models/client/ResponseFunction.java | 8 --- .../java/jmail/client/views/EmailCell.java | 14 +---- .../java/jmail/client/views/FolderCell.java | 1 - .../main/resources/jmail/client/dialog.fxml | 4 -- .../skin/AutoCompletePopupSkin.java | 13 ++--- .../java/jmail/lib/handlers/LockHandler.java | 12 +--- .../jmail/lib/helpers/SystemIOHelper.java | 7 --- .../jmail/server/handlers/ClientHandler.java | 3 +- 14 files changed, 52 insertions(+), 118 deletions(-) delete mode 100644 client/src/main/java/jmail/client/models/client/ResponseFunction.java diff --git a/client/src/main/java/jmail/client/controllers/FXMLEmailController.java b/client/src/main/java/jmail/client/controllers/FXMLEmailController.java index f37df96..3e28c94 100644 --- a/client/src/main/java/jmail/client/controllers/FXMLEmailController.java +++ b/client/src/main/java/jmail/client/controllers/FXMLEmailController.java @@ -3,11 +3,7 @@ import java.io.IOException; import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.List; -import java.util.UUID; +import java.util.*; import java.util.stream.Collectors; import javafx.application.Platform; import javafx.event.ActionEvent; @@ -109,7 +105,6 @@ public void setMainController(FXMLController mainController) { } private void initListeners() { - DataModel.getInstance() .getCurrentEmailProperty() .addListener((observable, oldValue, newValue) -> Platform.runLater(() -> { @@ -121,11 +116,7 @@ private void initListeners() { logoPane.setVisible(true); } else { - var recsText = - switch (newValue.getRecipients().size()) { - case 0 -> ""; - default -> String.join(";", newValue.getRecipients()); - }; + var recsText = newValue.getRecipients().size() == 0 ? "" : String.join(";", newValue.getRecipients()); // Edit mode subjectField.setText(newValue.getSubject()); @@ -139,27 +130,29 @@ private void initListeners() { toLabel.setText(recsText); // Check if date is today and set the date format accordingly - Calendar today = Calendar.getInstance(); - - Calendar date = Calendar.getInstance(); - date.setTime(newValue.getDate()); - DateFormat df; - if (date.get(Calendar.YEAR) == today.get(Calendar.YEAR) - && date.get(Calendar.DAY_OF_YEAR) == today.get(Calendar.DAY_OF_YEAR)) { - df = new SimpleDateFormat("HH:mm"); - } else { - df = new SimpleDateFormat("dd MMM yy, HH:mm"); - } - dateLabel.setText(df.format(newValue.getDate())); + setDateFormat(newValue, dateLabel); emailPane.setVisible(true); logoPane.setVisible(false); } })); - DataModel.getInstance().isEditingModeProperty().addListener((observable, oldValue, isEditing) -> { - updateLayout(isEditing); - }); + DataModel.getInstance().isEditingModeProperty().addListener((observable, oldValue, isEditing) -> updateLayout(isEditing)); + } + + public static void setDateFormat(Email newValue, Label dateLabel) { + Calendar today = Calendar.getInstance(); + + Calendar date = Calendar.getInstance(); + date.setTime(newValue.getDate()); + DateFormat df; + if (date.get(Calendar.YEAR) == today.get(Calendar.YEAR) + && date.get(Calendar.DAY_OF_YEAR) == today.get(Calendar.DAY_OF_YEAR)) { + df = new SimpleDateFormat("HH:mm"); + } else { + df = new SimpleDateFormat("dd MMM yy, HH:mm"); + } + dateLabel.setText(df.format(newValue.getDate())); } private void initView() { @@ -176,7 +169,7 @@ private void initView() { // Set the logo Platform.runLater(() -> { - Image image = new Image(getClass().getResourceAsStream("/logo-transaprent.png")); + Image image = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/logo-transaprent.png"))); var logo = new ImageView(image); logo.setImage(image); logo.fitHeightProperty().bind(logoPane.heightProperty().divide(2.5)); @@ -200,7 +193,6 @@ private void updateLayout(boolean isEditing) { } @FXML public void buttonReply(ActionEvent e) { - DataModel.getInstance() .getCurrentEmail() .ifPresentOrElse( @@ -208,7 +200,7 @@ private void updateLayout(boolean isEditing) { DataModel.getInstance().setEditingMode(true); var subject = "RE: " + email.getSubject(); - var body = email.getSender() + " wrote: " + email.getBody(); + var body = email.getSender() + " wrote: " + email.getBody() + "\n----------------------------------------\n"; var newEmail = new Email( UUID.randomUUID().toString(), @@ -226,7 +218,6 @@ private void updateLayout(boolean isEditing) { } @FXML public void buttonReplyAll(ActionEvent actionEvent) { - DataModel.getInstance() .getCurrentEmail() .ifPresentOrElse( @@ -237,7 +228,7 @@ private void updateLayout(boolean isEditing) { DataModel.getInstance().getCurrentUser().getEmail(); var subject = "RE: " + email.getSubject(); - var body = email.getSender() + " wrote: " + email.getBody(); + var body = email.getSender() + " wrote: " + email.getBody() + "\n----------------------------------------\n"; var recipients = email.getRecipients().stream() .filter(recipient -> !recipient.equals(userEmail)) .collect(Collectors.toList()); @@ -304,10 +295,10 @@ private void updateLayout(boolean isEditing) { .showAndWait() .ifPresent(response -> { if (response.equals("yes")) { - mainController.deleteEmail(email.fileID(), currFolder, hardDelete); + mainController.deleteEmail(email.fileID(), currFolder, true); } }); - } else mainController.deleteEmail(email.fileID(), currFolder, hardDelete); + } else mainController.deleteEmail(email.fileID(), currFolder, false); } }, () -> LOGGER.info("TrashButton: no email selected")); diff --git a/client/src/main/java/jmail/client/controllers/FXMLFolderController.java b/client/src/main/java/jmail/client/controllers/FXMLFolderController.java index 76ab66f..e001db1 100644 --- a/client/src/main/java/jmail/client/controllers/FXMLFolderController.java +++ b/client/src/main/java/jmail/client/controllers/FXMLFolderController.java @@ -92,9 +92,7 @@ private void initListeners() { .bind(DataModel.getInstance().getCurrentUserProperty().map(u -> u == null ? "" : u.getEmail())); // Update currentFolder model based on selected item - listFolder.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { - DataModel.getInstance().setCurrentFolder(newValue.toLowerCase()); - }); + listFolder.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> DataModel.getInstance().setCurrentFolder(newValue.toLowerCase())); // Update connection status DataModel.getInstance() diff --git a/client/src/main/java/jmail/client/controllers/FXMLListEmailController.java b/client/src/main/java/jmail/client/controllers/FXMLListEmailController.java index 1b9efd6..b248d23 100644 --- a/client/src/main/java/jmail/client/controllers/FXMLListEmailController.java +++ b/client/src/main/java/jmail/client/controllers/FXMLListEmailController.java @@ -135,9 +135,7 @@ public void initListeners() { }); // Quando viene modificato la cartella corrente, viene aggiornato il testo - DataModel.getInstance().getCurrentFolderProperty().addListener((observable, oldValue, newValue) -> { - currentFolder.textProperty().set(newValue.toUpperCase()); - }); + DataModel.getInstance().getCurrentFolderProperty().addListener((observable, oldValue, newValue) -> currentFolder.textProperty().set(newValue.toUpperCase())); } public void initViews() { diff --git a/client/src/main/java/jmail/client/controllers/FXMLLogin.java b/client/src/main/java/jmail/client/controllers/FXMLLogin.java index d26e904..2cb4f1e 100644 --- a/client/src/main/java/jmail/client/controllers/FXMLLogin.java +++ b/client/src/main/java/jmail/client/controllers/FXMLLogin.java @@ -35,13 +35,6 @@ public class FXMLLogin { @FXML private Label connectionLabel; - public FXMLLogin() { - // String css = Main.getResource("style.css").toExternalForm(); - // var scene = Main.primaryStage.getScene(); - // scene.getStylesheets().clear(); - // scene.getStylesheets().add(css); - } - public void initialize() { var fontIcon = new FontIcon("mdi2w-web-box"); fontIcon.setIconColor(Paint.valueOf(ColorPalette.GREEN.getHexValue())); @@ -62,7 +55,6 @@ public void initialize() { @FXML public void buttonLogin(javafx.event.ActionEvent e) { login(UsernameField.getText(), PasswordField.getText()); - // login("emmedeveloper@gmail.com", "emme"); // TODO: Remove this } public void login(String username, String password) { diff --git a/client/src/main/java/jmail/client/dialogs/CustomDialog.java b/client/src/main/java/jmail/client/dialogs/CustomDialog.java index 9991867..c6822ef 100644 --- a/client/src/main/java/jmail/client/dialogs/CustomDialog.java +++ b/client/src/main/java/jmail/client/dialogs/CustomDialog.java @@ -20,9 +20,6 @@ public class CustomDialog extends Dialog { - private ButtonType noBtn; - private ButtonType okBtn; - @FXML private Label messageLabel; @FXML private Label icon; @@ -41,38 +38,40 @@ public CustomDialog(Stage owner, String mode, String title, String message) { FontIcon fontIcon = null; String color = ""; + ButtonType okButton; + ButtonType noButton; switch (mode) { case "error" -> { fontIcon = new FontIcon("mdi2c-close-circle-outline"); fontIcon.setIconColor(Paint.valueOf(ColorPalette.RED.getHexValue())); color = "#FF5555"; - okBtn = new ButtonType("OK", ButtonBar.ButtonData.OK_DONE); - dialogPane.getButtonTypes().add(okBtn); + okButton = new ButtonType("OK", ButtonBar.ButtonData.OK_DONE); + dialogPane.getButtonTypes().add(okButton); } case "info" -> { fontIcon = new FontIcon("mdi2a-alert-circle-outline"); fontIcon.setIconColor(Paint.valueOf(ColorPalette.BLUE.getHexValue())); color = "#1273DE"; - okBtn = new ButtonType("OK", ButtonBar.ButtonData.OK_DONE); - dialogPane.getButtonTypes().add(okBtn); + okButton = new ButtonType("OK", ButtonBar.ButtonData.OK_DONE); + dialogPane.getButtonTypes().add(okButton); } case "confirm" -> { fontIcon = new FontIcon("mdi2c-check-circle-outline"); fontIcon.setIconColor(Paint.valueOf(ColorPalette.GREEN.getHexValue())); color = "#39864F"; - noBtn = new ButtonType("Cancel"); - dialogPane.getButtonTypes().add(noBtn); - okBtn = new ButtonType("Confirm"); - dialogPane.getButtonTypes().add(okBtn); + noButton = new ButtonType("Cancel"); + dialogPane.getButtonTypes().add(noButton); + okButton = new ButtonType("Confirm"); + dialogPane.getButtonTypes().add(okButton); } case "warning" -> { fontIcon = new FontIcon("mdi2a-alert-circle-outline"); fontIcon.setIconColor(Paint.valueOf(ColorPalette.YELLOW.getHexValue())); color = "#FFB86C"; - noBtn = new ButtonType("Cancel"); - dialogPane.getButtonTypes().add(noBtn); - okBtn = new ButtonType("Confirm"); - dialogPane.getButtonTypes().add(okBtn); + noButton = new ButtonType("Cancel"); + dialogPane.getButtonTypes().add(noButton); + okButton = new ButtonType("Confirm"); + dialogPane.getButtonTypes().add(okButton); } } icon.setGraphic(fontIcon); @@ -91,9 +90,7 @@ public CustomDialog(Stage owner, String mode, String title, String message) { return "no"; }); - setOnShowing(dialogEvent -> Platform.runLater(() -> { - messageLabel.requestFocus(); - })); + setOnShowing(dialogEvent -> Platform.runLater(() -> messageLabel.requestFocus())); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/client/src/main/java/jmail/client/factory/EmailCellFactory.java b/client/src/main/java/jmail/client/factory/EmailCellFactory.java index 94aecef..f4e8b5d 100644 --- a/client/src/main/java/jmail/client/factory/EmailCellFactory.java +++ b/client/src/main/java/jmail/client/factory/EmailCellFactory.java @@ -8,7 +8,7 @@ public class EmailCellFactory implements Callback, ListCell> { - private ListView parent; + private final ListView parent; public EmailCellFactory(ListView listEmails) { parent = listEmails; diff --git a/client/src/main/java/jmail/client/models/client/ResponseFunction.java b/client/src/main/java/jmail/client/models/client/ResponseFunction.java deleted file mode 100644 index 092265a..0000000 --- a/client/src/main/java/jmail/client/models/client/ResponseFunction.java +++ /dev/null @@ -1,8 +0,0 @@ -package jmail.client.models.client; - -import jmail.lib.models.ServerResponse; - -@FunctionalInterface -public interface ResponseFunction { - void run(ServerResponse response); -} diff --git a/client/src/main/java/jmail/client/views/EmailCell.java b/client/src/main/java/jmail/client/views/EmailCell.java index c39698f..516204b 100644 --- a/client/src/main/java/jmail/client/views/EmailCell.java +++ b/client/src/main/java/jmail/client/views/EmailCell.java @@ -11,6 +11,7 @@ import javafx.scene.control.ListCell; import javafx.scene.layout.Region; import jmail.client.Main; +import jmail.client.controllers.FXMLEmailController; import jmail.lib.models.Email; public class EmailCell extends ListCell { @@ -63,18 +64,7 @@ public void initListeners() { fromLabel.setText(newValue.getSender()); subjectLabel.setText(newValue.getSubject()); - Calendar today = Calendar.getInstance(); - - Calendar date = Calendar.getInstance(); - date.setTime(newValue.getDate()); - DateFormat df; - if (date.get(Calendar.YEAR) == today.get(Calendar.YEAR) - && date.get(Calendar.DAY_OF_YEAR) == today.get(Calendar.DAY_OF_YEAR)) { - df = new SimpleDateFormat("HH:mm"); - } else { - df = new SimpleDateFormat("dd MMM yy, HH:mm"); - } - dateLabel.setText(df.format(newValue.getDate())); + FXMLEmailController.setDateFormat(newValue, dateLabel); bodyLabel.setText(newValue.getBody()); readMarker.setStyle("-fx-background-color:" + (newValue.getRead() ? "#00000000;" : "#009688FF;")); diff --git a/client/src/main/java/jmail/client/views/FolderCell.java b/client/src/main/java/jmail/client/views/FolderCell.java index 7bebaff..43ea37f 100644 --- a/client/src/main/java/jmail/client/views/FolderCell.java +++ b/client/src/main/java/jmail/client/views/FolderCell.java @@ -51,7 +51,6 @@ protected void updateItem(String item, boolean empty) { } private void initListeners() { - itemProperty().addListener((obs, oldValue, newValue) -> { // Empty cell diff --git a/client/src/main/resources/jmail/client/dialog.fxml b/client/src/main/resources/jmail/client/dialog.fxml index d650673..245beeb 100644 --- a/client/src/main/resources/jmail/client/dialog.fxml +++ b/client/src/main/resources/jmail/client/dialog.fxml @@ -18,8 +18,4 @@ wrapText="true" styleClass="f16" /> - - - \ No newline at end of file diff --git a/lib/src/main/java/jmail/lib/autocompletion/skin/AutoCompletePopupSkin.java b/lib/src/main/java/jmail/lib/autocompletion/skin/AutoCompletePopupSkin.java index a625266..e8ede40 100644 --- a/lib/src/main/java/jmail/lib/autocompletion/skin/AutoCompletePopupSkin.java +++ b/lib/src/main/java/jmail/lib/autocompletion/skin/AutoCompletePopupSkin.java @@ -91,17 +91,14 @@ private void registerEventListener() { suggestionList.setOnKeyPressed(ke -> { switch (ke.getCode()) { - case TAB: - case ENTER: - onSuggestionChosen(suggestionList.getSelectionModel().getSelectedItem()); - break; - case ESCAPE: + case TAB, ENTER -> onSuggestionChosen(suggestionList.getSelectionModel().getSelectedItem()); + case ESCAPE -> { if (control.isHideOnEscape()) { control.hide(); } - break; - default: - break; + } + default -> { + } } }); } diff --git a/lib/src/main/java/jmail/lib/handlers/LockHandler.java b/lib/src/main/java/jmail/lib/handlers/LockHandler.java index eb1c237..c3d77cf 100644 --- a/lib/src/main/java/jmail/lib/handlers/LockHandler.java +++ b/lib/src/main/java/jmail/lib/handlers/LockHandler.java @@ -7,7 +7,8 @@ public class LockHandler { private static final LockHandler instance = new LockHandler(); - /** La chiave del lock รจ l'uuid del'utente TODO: Documentare */ + + /** Key is user's UUID */ private final ConcurrentHashMap lockMap; private LockHandler() { @@ -15,15 +16,6 @@ private LockHandler() { } public static LockHandler getInstance() { - // https://errorprone.info/bugpattern/DoubleCheckedLocking - // https://www.infoworld.com/article/2075306/can-double-checked-locking-be-fixed-.html - // if (instance == null) { - // synchronized (LockHandler.class) { - // if (instance == null) { - // instance = new LockHandler(); - // } - // } - // } return instance; } diff --git a/lib/src/main/java/jmail/lib/helpers/SystemIOHelper.java b/lib/src/main/java/jmail/lib/helpers/SystemIOHelper.java index 7510edd..4da1354 100644 --- a/lib/src/main/java/jmail/lib/helpers/SystemIOHelper.java +++ b/lib/src/main/java/jmail/lib/helpers/SystemIOHelper.java @@ -84,13 +84,6 @@ public static Path getSentEmailPath(String userEmail, String emailID) { return Path.of(getUserSent(userEmail) + "/" + emailID); } - // TODO: take a look at this method later - // public static Boolean userExists(String userEmail) { - // Path user = Paths.get(emailpath); - // File f = new File(Paths.get(String.format("%s\\%s.dat", user, userEmail)).toUri()); - // return f.exists() && !f.isDirectory(); - // } - public static Boolean userExists(String userEmail) { File f = new File(getUserDirectory(userEmail).toUri()); return f.exists() && f.isDirectory(); diff --git a/server/src/main/java/jmail/server/handlers/ClientHandler.java b/server/src/main/java/jmail/server/handlers/ClientHandler.java index 3ded22c..7dc0465 100644 --- a/server/src/main/java/jmail/server/handlers/ClientHandler.java +++ b/server/src/main/java/jmail/server/handlers/ClientHandler.java @@ -19,7 +19,6 @@ public class ClientHandler implements Runnable { private static final Logger LOGGER = LoggerFactory.getLogger(ClientHandler.class.getName()); private final Socket internalSocket; - private BufferedReader reader; private PrintWriter writer; public ClientHandler(Socket clientSocket) { @@ -29,7 +28,7 @@ public ClientHandler(Socket clientSocket) { @Override public void run() { try { - reader = new BufferedReader(new InputStreamReader(internalSocket.getInputStream())); + BufferedReader reader = new BufferedReader(new InputStreamReader(internalSocket.getInputStream())); writer = new PrintWriter(internalSocket.getOutputStream(), true); String request = reader.readLine(); LOGGER.info("Message received from client: " + request); From 4f1480c8ccffa1c3bec4d35bb9251c40481aaf00 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 17 Jan 2023 21:36:07 +0000 Subject: [PATCH 2/2] Apply automatic changes --- .../client/controllers/FXMLEmailController.java | 13 +++++++++---- .../client/controllers/FXMLFolderController.java | 6 +++++- .../client/controllers/FXMLListEmailController.java | 4 +++- .../src/main/java/jmail/client/views/EmailCell.java | 3 --- .../autocompletion/skin/AutoCompletePopupSkin.java | 6 +++--- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/client/src/main/java/jmail/client/controllers/FXMLEmailController.java b/client/src/main/java/jmail/client/controllers/FXMLEmailController.java index 3e28c94..8c9f05f 100644 --- a/client/src/main/java/jmail/client/controllers/FXMLEmailController.java +++ b/client/src/main/java/jmail/client/controllers/FXMLEmailController.java @@ -116,7 +116,8 @@ private void initListeners() { logoPane.setVisible(true); } else { - var recsText = newValue.getRecipients().size() == 0 ? "" : String.join(";", newValue.getRecipients()); + var recsText = + newValue.getRecipients().size() == 0 ? "" : String.join(";", newValue.getRecipients()); // Edit mode subjectField.setText(newValue.getSubject()); @@ -137,7 +138,9 @@ private void initListeners() { } })); - DataModel.getInstance().isEditingModeProperty().addListener((observable, oldValue, isEditing) -> updateLayout(isEditing)); + DataModel.getInstance() + .isEditingModeProperty() + .addListener((observable, oldValue, isEditing) -> updateLayout(isEditing)); } public static void setDateFormat(Email newValue, Label dateLabel) { @@ -200,7 +203,8 @@ private void updateLayout(boolean isEditing) { DataModel.getInstance().setEditingMode(true); var subject = "RE: " + email.getSubject(); - var body = email.getSender() + " wrote: " + email.getBody() + "\n----------------------------------------\n"; + var body = email.getSender() + " wrote: " + email.getBody() + + "\n----------------------------------------\n"; var newEmail = new Email( UUID.randomUUID().toString(), @@ -228,7 +232,8 @@ private void updateLayout(boolean isEditing) { DataModel.getInstance().getCurrentUser().getEmail(); var subject = "RE: " + email.getSubject(); - var body = email.getSender() + " wrote: " + email.getBody() + "\n----------------------------------------\n"; + var body = email.getSender() + " wrote: " + email.getBody() + + "\n----------------------------------------\n"; var recipients = email.getRecipients().stream() .filter(recipient -> !recipient.equals(userEmail)) .collect(Collectors.toList()); diff --git a/client/src/main/java/jmail/client/controllers/FXMLFolderController.java b/client/src/main/java/jmail/client/controllers/FXMLFolderController.java index e001db1..8c5f887 100644 --- a/client/src/main/java/jmail/client/controllers/FXMLFolderController.java +++ b/client/src/main/java/jmail/client/controllers/FXMLFolderController.java @@ -92,7 +92,11 @@ private void initListeners() { .bind(DataModel.getInstance().getCurrentUserProperty().map(u -> u == null ? "" : u.getEmail())); // Update currentFolder model based on selected item - listFolder.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> DataModel.getInstance().setCurrentFolder(newValue.toLowerCase())); + listFolder + .getSelectionModel() + .selectedItemProperty() + .addListener((observable, oldValue, newValue) -> + DataModel.getInstance().setCurrentFolder(newValue.toLowerCase())); // Update connection status DataModel.getInstance() diff --git a/client/src/main/java/jmail/client/controllers/FXMLListEmailController.java b/client/src/main/java/jmail/client/controllers/FXMLListEmailController.java index b248d23..032748d 100644 --- a/client/src/main/java/jmail/client/controllers/FXMLListEmailController.java +++ b/client/src/main/java/jmail/client/controllers/FXMLListEmailController.java @@ -135,7 +135,9 @@ public void initListeners() { }); // Quando viene modificato la cartella corrente, viene aggiornato il testo - DataModel.getInstance().getCurrentFolderProperty().addListener((observable, oldValue, newValue) -> currentFolder.textProperty().set(newValue.toUpperCase())); + DataModel.getInstance().getCurrentFolderProperty().addListener((observable, oldValue, newValue) -> currentFolder + .textProperty() + .set(newValue.toUpperCase())); } public void initViews() { diff --git a/client/src/main/java/jmail/client/views/EmailCell.java b/client/src/main/java/jmail/client/views/EmailCell.java index 516204b..75cda69 100644 --- a/client/src/main/java/jmail/client/views/EmailCell.java +++ b/client/src/main/java/jmail/client/views/EmailCell.java @@ -1,9 +1,6 @@ package jmail.client.views; import java.io.IOException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Calendar; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.control.ContentDisplay; diff --git a/lib/src/main/java/jmail/lib/autocompletion/skin/AutoCompletePopupSkin.java b/lib/src/main/java/jmail/lib/autocompletion/skin/AutoCompletePopupSkin.java index e8ede40..9c1b5a3 100644 --- a/lib/src/main/java/jmail/lib/autocompletion/skin/AutoCompletePopupSkin.java +++ b/lib/src/main/java/jmail/lib/autocompletion/skin/AutoCompletePopupSkin.java @@ -91,14 +91,14 @@ private void registerEventListener() { suggestionList.setOnKeyPressed(ke -> { switch (ke.getCode()) { - case TAB, ENTER -> onSuggestionChosen(suggestionList.getSelectionModel().getSelectedItem()); + case TAB, ENTER -> onSuggestionChosen( + suggestionList.getSelectionModel().getSelectedItem()); case ESCAPE -> { if (control.isHideOnEscape()) { control.hide(); } } - default -> { - } + default -> {} } }); }