Skip to content

Commit 108b8f7

Browse files
committed
Fixed drag drop from File Tree
1 parent 032811b commit 108b8f7

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

src/main/java/com/i_comit/server/Client.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public static void getServerSocket() throws IOException {
6868
}
6969
}
7070

71-
public static boolean userRequest(String username) {
71+
public static synchronized boolean userRequest(String username) {
7272
boolean b = true;
7373
try {
7474
getServerSocket();
@@ -80,21 +80,21 @@ public static boolean userRequest(String username) {
8080
ois = new ObjectInputStream(clientSocket.getInputStream());
8181
List<String> message = (List<String>) ois.readObject();
8282
if (message.isEmpty()) {
83-
System.out.println("no files found.");
8483
b = false;
8584
} else {
8685
for (String fileName : message) {
8786
getRecords(username, new File(fileName));
8887
System.out.println("retrieved: " + fileName);
89-
Main.refreshTreeView(Statics.receiveFolder, TreeView.receiveCaretPos);
88+
if (Statics.toolMode == 1) {
89+
Main.refreshTreeView(Statics.receiveFolder, TreeView.receiveCaretPos);
90+
}
9091
GUI.getGB();
9192
}
9293
}
9394
} catch (IOException | ClassNotFoundException | InterruptedException ex) {
9495
System.out.println("host is offline");
9596
b = false;
9697
}
97-
// }
9898
return b;
9999
}
100100

@@ -221,7 +221,7 @@ public static boolean startSession(String username, Main main) {
221221
System.out.println("you have started your session.");
222222
} else {
223223
GUI.t.interrupt();
224-
GUI.labelCutterLoginThread(jAlertLabel, "user is already logged in.", 30, 50, 1500, main);
224+
GUI.labelCutterLoginThread(jAlertLabel, "user is already logged in.", 10, 50, 2000, main);
225225
}
226226
ois.close();
227227
oos.close();

src/main/java/com/i_comit/windows/DragDrop.java

+16-7
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,21 @@ public synchronized void drop(DropTargetDropEvent event) {
6363
if (!fileFormat.isDirectory()) {
6464
treepaths.add(fileFormat.toPath());
6565
if (TreeView.checkFilesAreFromSameFolder(treepaths)) {
66-
if (!b) {
67-
Main.jButton2.setVisible(true);
68-
Main.jProgressBar1.setMaximum(treepaths.size());
69-
jProgressBar1.setString("0% | 0/" + treepaths.size());
70-
AES.AESThread(treepaths, new File(path.replaceAll(fileName, "")), false, 0);
71-
b = true;
66+
if (!fileFormat.getName().endsWith(".i-cc") && !fileFormat.getName().equals("Thumbs.db")) {
67+
if (!b) {
68+
Main.jButton2.setVisible(true);
69+
Main.jProgressBar1.setMaximum(treepaths.size());
70+
jProgressBar1.setString("0% | 0/" + treepaths.size());
71+
AES.AESThread(treepaths, new File(path.replaceAll(fileName, "")), false, 0);
72+
b = true;
73+
}
74+
} else {
75+
GUI.t.interrupt();
76+
if (jTree1.getSelectionPaths().length <= 1) {
77+
GUI.labelCutterThread(Main.jAlertLabel, "dropped file is not valid", 10, 25, 1000, false);
78+
} else {
79+
GUI.labelCutterThread(Main.jAlertLabel, "dropped files are not valid", 10, 25, 1000, false);
80+
}
7281
}
7382
} else {
7483
GUI.t.interrupt();
@@ -133,7 +142,7 @@ public synchronized void drop(DropTargetDropEvent event) {
133142
}
134143
} else {
135144
GUI.t.interrupt();
136-
GUI.labelCutterThread(Main.jAlertLabel, ".i-cc files can't be stored", 10, 25, 1000, false);
145+
GUI.labelCutterThread(Main.jAlertLabel, ".i-cc files are not valid", 10, 25, 1000, false);
137146
}
138147
} else {
139148
if (!filesf.getAbsolutePath().equals(root + masterFolder + "ᴠᴀᴜʟᴛ")

src/main/java/com/i_comit/windows/Main.java

+2
Original file line numberDiff line numberDiff line change
@@ -1313,6 +1313,7 @@ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS
13131313
}
13141314
} else {
13151315
GUI.t.interrupt();
1316+
jAlertLabel.setHorizontalAlignment(LEFT);
13161317
GUI.labelCutterLoginThread(jAlertLabel, "an instance of this app is active.", 20, 40, 1600, this);
13171318
}
13181319
jTextField1.setText("");
@@ -1370,6 +1371,7 @@ private void jPasswordField1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST
13701371
}
13711372
} else {
13721373
GUI.t.interrupt();
1374+
jAlertLabel.setHorizontalAlignment(LEFT);
13731375
GUI.labelCutterLoginThread(jAlertLabel, "an instance of this app is active.", 20, 40, 1600, this);
13741376
}
13751377
} else {

0 commit comments

Comments
 (0)