forked from ConesaLab/tappAS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DlgDownloadPackages.java
79 lines (68 loc) · 2.53 KB
/
DlgDownloadPackages.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package tappas;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
import javafx.stage.Stage;
import javafx.stage.Window;
import javafx.util.Callback;
import java.util.HashMap;
import java.util.Optional;
/**
*
* @author Hector del Risco - [email protected] & Pedro Salguero - [email protected]
*/
public class DlgDownloadPackages extends DlgBase {
private boolean res = false;
Button btDownload;
Button btCancel;
public DlgDownloadPackages(Project project, Window window) {
super(project, null);
this.window = window;
}
private void closeButtonAction(){
// get a handle to the stage
Stage stage = (Stage) btCancel.getScene().getWindow();
// do what you have to do
stage.close();
}
public HashMap<String, String> showAndWait(HashMap<String, String> dfltValues) {
if(createDialog("DownloadPackages.fxml", "Do you want to download all R Packages?", true, null)) {
HashMap<String, String> vals = new HashMap<>();
// setup dialog event handlers
dialog.setResultConverter(new Callback<ButtonType, HashMap>() {
@Override
public HashMap call(ButtonType b) {
HashMap<String, String> params = null;
System.out.println(b.getButtonData().toString());
if (b.getButtonData() == ButtonBar.ButtonData.OK_DONE){
params = new HashMap<String, String>();
params.put("Download", "true");
}else{
params = new HashMap<String, String>();
params.put("Download", "false");}
return params;
}
});
//btDownload.setOnAction((ActionEvent actionEvent) -> {
// vals.put("Ok", "true");
// closeButtonAction();
//});
//btDownload.setOnAction((ActionEvent actionEvent) -> {
// closeButtonAction();
//});
// process dialog
Optional<HashMap> result = dialog.showAndWait();
if(result.isPresent())
return result.get();
}
return null;
}
//
// Internal Functions
//
}