Adding files logic for the button has been changed to "add whatever you want to the table without cleanup"

This commit is contained in:
Dmitry Isaenko 2019-03-16 02:43:14 +03:00
parent 4da62b4c07
commit d41401c85e
3 changed files with 34 additions and 54 deletions

View file

@ -128,10 +128,6 @@ public class NSLMainController implements Initializable {
uploadStopBtn.setDisable(false);
previouslyOpenedPath = filesList.get(0).getParent();
}
else{
tableFilesListController.setFiles(null);
uploadStopBtn.setDisable(true);
}
}
/**
* It's button listener when no transmission executes
@ -194,8 +190,8 @@ public class NSLMainController implements Initializable {
/**
* Crunch. Now you see that I'm not a programmer.. This function called from NSTableViewController
* */
public void disableUploadStopBtn(){
uploadStopBtn.setDisable(true);
public void disableUploadStopBtn(boolean disable){
uploadStopBtn.setDisable(disable);
}
/**
* Drag-n-drop support (dragOver consumer)
@ -210,6 +206,10 @@ public class NSLMainController implements Initializable {
* */
@FXML
private void handleDrop(DragEvent event){
if (MediatorControl.getInstance().getTransferActive()) {
event.setDropCompleted(true);
return;
}
List<File> filesDropped = new ArrayList<>();
try {
for (File fileOrDir : event.getDragboard().getFiles()) {
@ -224,20 +224,8 @@ public class NSLMainController implements Initializable {
catch (SecurityException se){
se.printStackTrace();
}
if (!filesDropped.isEmpty()) {
List<File> filesAlreadyInTable;
if ((filesAlreadyInTable = tableFilesListController.getFiles()) != null) {
filesDropped.removeAll(filesAlreadyInTable); // Get what we already have and add new file(s)
if (!filesDropped.isEmpty()) {
filesDropped.addAll(filesAlreadyInTable);
tableFilesListController.setFiles(filesDropped);
}
}
else {
tableFilesListController.setFiles(filesDropped);
uploadStopBtn.setDisable(false);
}
}
if (!filesDropped.isEmpty())
tableFilesListController.setFiles(filesDropped);
event.setDropCompleted(true);
}