-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoadInterfaceController.java
More file actions
74 lines (57 loc) · 1.69 KB
/
Copy pathLoadInterfaceController.java
File metadata and controls
74 lines (57 loc) · 1.69 KB
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
package parameter;
import java.io.File;
import application.MainInterface_Controller;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
public class LoadInterfaceController {
@FXML
private TextField TextLinkToFile;
@FXML
private Button BrowseButton;
@FXML
private Button SaveButton;
@FXML
private Button CancelButton;
@FXML
private Label ErrorOutput;
private File f;
private MainInterface_Controller application;
@FXML
void PressBrowse(ActionEvent event) {
FileChooser fileChooser = new FileChooser();
fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("xml files (*.xml)", "*.xml"));
File file = fileChooser.showSaveDialog(null);
this.f = file;
this.TextLinkToFile.setText(file.toString());
}
@FXML
void PressCancellButton(ActionEvent event) {
Stage stage = (Stage) this.CancelButton.getScene().getWindow();
stage.close();
}
@FXML
void PressSaveButton(ActionEvent event) {
// Check for error
if (this.f == null) {
this.ErrorOutput.setText("You must enter an input file !");
} else {
this.application.Overlay.getChildren().clear();
LoadFile.LoadXML(this.f, this.application);
Stage stage = (Stage) this.CancelButton.getScene().getWindow();
stage.close();
}
}
/**
* Function to initialize the interface
*
* @param app (MainInterface_Controller) : Link to the main application
*/
public void init_interface(MainInterface_Controller app) {
this.application = app;
}
}