Browse Source

Merge remote-tracking branch 'origin/master'

Yohan Simard 3 years ago
parent
commit
dc32071529
2 changed files with 19 additions and 6 deletions
  1. 5
    0
      NOTES.md
  2. 14
    6
      src/main/java/fr/insa/clavardator/ui/chat/MessageListItemController.java

+ 5
- 0
NOTES.md View File

@@ -19,3 +19,8 @@ Décentralisée ou centralisée sur serveur, au choix
19 19
 * Chaque noeud à une bdd locale -> Serveur SQL qu'on veut (SQLite plus simple)
20 20
 
21 21
 
22
+## Rapport
23
+expliquer l'archi et les choix
24
+expliquer schéma bdd relationnelle
25
+manuel utilisation appli
26
+plus import -> procédure déploiement

+ 14
- 6
src/main/java/fr/insa/clavardator/ui/chat/MessageListItemController.java View File

@@ -13,6 +13,7 @@ import javafx.scene.layout.VBox;
13 13
 import java.awt.*;
14 14
 import java.io.File;
15 15
 import java.io.IOException;
16
+import java.net.URISyntaxException;
16 17
 import java.net.URL;
17 18
 import java.text.DateFormat;
18 19
 import java.util.ResourceBundle;
@@ -41,12 +42,7 @@ public class MessageListItemController implements Initializable {
41 42
 				FileMessage fileMessage = ((FileMessage) message);
42 43
 				text += "\n<" + fileMessage.getFileName() + ">";
43 44
 				button.setOnMouseClicked(event -> {
44
-					Desktop desktop = Desktop.getDesktop();
45
-					try {
46
-						desktop.open(new File(fileMessage.getPath()));
47
-					} catch (IOException e) {
48
-						e.printStackTrace();
49
-					}
45
+					openFile(fileMessage.getPath());
50 46
 				});
51 47
 			}
52 48
 			button.setText(text);
@@ -62,6 +58,18 @@ public class MessageListItemController implements Initializable {
62 58
 		}
63 59
 	}
64 60
 
61
+	public void openFile(String path) {
62
+		if (Desktop.isDesktopSupported()) {
63
+			new Thread(() -> {
64
+				try {
65
+					Desktop.getDesktop().open(new File(path));
66
+				} catch (IOException e) {
67
+					e.printStackTrace();
68
+				}
69
+			}).start();
70
+		}
71
+	}
72
+
65 73
 	/**
66 74
 	 * Removes any style applied to the background
67 75
 	 */

Loading…
Cancel
Save