annotate KinaMine-Galaxy-7-7/src/kinamine/KinaMineGUIController.java @ 0:67635b462045 draft

Uploaded
author jfb
date Tue, 20 Feb 2018 14:31:15 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
67635b462045 Uploaded
jfb
parents:
diff changeset
1 /**
67635b462045 Uploaded
jfb
parents:
diff changeset
2 *****************************************************************************
67635b462045 Uploaded
jfb
parents:
diff changeset
3 * <p>
67635b462045 Uploaded
jfb
parents:
diff changeset
4 * Copyright (c) Regents of the University of Minnesota. All Rights Reserved.
67635b462045 Uploaded
jfb
parents:
diff changeset
5 * <p>
67635b462045 Uploaded
jfb
parents:
diff changeset
6 * Author: Kevin Murray University of Minnesota - (murra668@umn.edu)
67635b462045 Uploaded
jfb
parents:
diff changeset
7 * <p>
67635b462045 Uploaded
jfb
parents:
diff changeset
8 *****************************************************************************
67635b462045 Uploaded
jfb
parents:
diff changeset
9 */
67635b462045 Uploaded
jfb
parents:
diff changeset
10 package kinamine;
67635b462045 Uploaded
jfb
parents:
diff changeset
11
67635b462045 Uploaded
jfb
parents:
diff changeset
12 import java.io.File;
67635b462045 Uploaded
jfb
parents:
diff changeset
13 import java.net.URL;
67635b462045 Uploaded
jfb
parents:
diff changeset
14 import java.util.ArrayList;
67635b462045 Uploaded
jfb
parents:
diff changeset
15 import java.util.ResourceBundle;
67635b462045 Uploaded
jfb
parents:
diff changeset
16 import javafx.event.ActionEvent;
67635b462045 Uploaded
jfb
parents:
diff changeset
17 import javafx.fxml.FXML;
67635b462045 Uploaded
jfb
parents:
diff changeset
18 import javafx.fxml.Initializable;
67635b462045 Uploaded
jfb
parents:
diff changeset
19 import javafx.geometry.Pos;
67635b462045 Uploaded
jfb
parents:
diff changeset
20 import javafx.scene.Scene;
67635b462045 Uploaded
jfb
parents:
diff changeset
21 import javafx.scene.control.Button;
67635b462045 Uploaded
jfb
parents:
diff changeset
22 import javafx.scene.control.Label;
67635b462045 Uploaded
jfb
parents:
diff changeset
23 import javafx.scene.control.TextField;
67635b462045 Uploaded
jfb
parents:
diff changeset
24 import javafx.scene.layout.VBox;
67635b462045 Uploaded
jfb
parents:
diff changeset
25 import javafx.stage.DirectoryChooser;
67635b462045 Uploaded
jfb
parents:
diff changeset
26 import javafx.stage.FileChooser;
67635b462045 Uploaded
jfb
parents:
diff changeset
27 import javafx.stage.FileChooser.ExtensionFilter;
67635b462045 Uploaded
jfb
parents:
diff changeset
28 import javafx.stage.Modality;
67635b462045 Uploaded
jfb
parents:
diff changeset
29 import javafx.stage.Stage;
67635b462045 Uploaded
jfb
parents:
diff changeset
30
67635b462045 Uploaded
jfb
parents:
diff changeset
31 /**
67635b462045 Uploaded
jfb
parents:
diff changeset
32 * Controller class for KinaMine GUI. Implements ActionEvents for GUI FXML frame
67635b462045 Uploaded
jfb
parents:
diff changeset
33 * - built in Scene Builder.
67635b462045 Uploaded
jfb
parents:
diff changeset
34 *
67635b462045 Uploaded
jfb
parents:
diff changeset
35 * @version 1.0
67635b462045 Uploaded
jfb
parents:
diff changeset
36 * @author murra668
67635b462045 Uploaded
jfb
parents:
diff changeset
37 */
67635b462045 Uploaded
jfb
parents:
diff changeset
38 public class KinaMineGUIController implements Initializable {
67635b462045 Uploaded
jfb
parents:
diff changeset
39
67635b462045 Uploaded
jfb
parents:
diff changeset
40 /**
67635b462045 Uploaded
jfb
parents:
diff changeset
41 * Textfields for Peptide Report path, FASTA Database path, Output
67635b462045 Uploaded
jfb
parents:
diff changeset
42 * Directory, FDR Score and Output Group Name.
67635b462045 Uploaded
jfb
parents:
diff changeset
43 */
67635b462045 Uploaded
jfb
parents:
diff changeset
44 @FXML
67635b462045 Uploaded
jfb
parents:
diff changeset
45 private TextField pepPath, fastaPath, outPath, fdrScore, outGroup;
67635b462045 Uploaded
jfb
parents:
diff changeset
46
67635b462045 Uploaded
jfb
parents:
diff changeset
47 /** Debug */
67635b462045 Uploaded
jfb
parents:
diff changeset
48 private boolean debug;
67635b462045 Uploaded
jfb
parents:
diff changeset
49
67635b462045 Uploaded
jfb
parents:
diff changeset
50 /** Location of last directory visited. */
67635b462045 Uploaded
jfb
parents:
diff changeset
51 @FXML
67635b462045 Uploaded
jfb
parents:
diff changeset
52 File lastDirectory;
67635b462045 Uploaded
jfb
parents:
diff changeset
53
67635b462045 Uploaded
jfb
parents:
diff changeset
54 /**
67635b462045 Uploaded
jfb
parents:
diff changeset
55 * Handles ActionEvent of pepBrowseButton being pressed. Opens file browser
67635b462045 Uploaded
jfb
parents:
diff changeset
56 * for selection of peptide report tabular file. Stores location of the pep
67635b462045 Uploaded
jfb
parents:
diff changeset
57 * report in the PepPath Textfield.
67635b462045 Uploaded
jfb
parents:
diff changeset
58 *
67635b462045 Uploaded
jfb
parents:
diff changeset
59 * @param event
67635b462045 Uploaded
jfb
parents:
diff changeset
60 */
67635b462045 Uploaded
jfb
parents:
diff changeset
61 @FXML
67635b462045 Uploaded
jfb
parents:
diff changeset
62 public void pepSearchClicked(ActionEvent event) {
67635b462045 Uploaded
jfb
parents:
diff changeset
63
67635b462045 Uploaded
jfb
parents:
diff changeset
64 /** Creates new FileChooser. */
67635b462045 Uploaded
jfb
parents:
diff changeset
65 final FileChooser fileChooser = new FileChooser();
67635b462045 Uploaded
jfb
parents:
diff changeset
66
67635b462045 Uploaded
jfb
parents:
diff changeset
67 /** Creates new ExtensionFilter for selection of tabular file. */
67635b462045 Uploaded
jfb
parents:
diff changeset
68 ExtensionFilter filter
67635b462045 Uploaded
jfb
parents:
diff changeset
69 = new ExtensionFilter("Tabular", "*.tabular", "*.txt");
67635b462045 Uploaded
jfb
parents:
diff changeset
70
67635b462045 Uploaded
jfb
parents:
diff changeset
71 /** Configures FileChooser with parameters and last directory. */
67635b462045 Uploaded
jfb
parents:
diff changeset
72 configFileChooser(fileChooser, lastDirectory, filter);
67635b462045 Uploaded
jfb
parents:
diff changeset
73
67635b462045 Uploaded
jfb
parents:
diff changeset
74 /** Opens FileChooser window. */
67635b462045 Uploaded
jfb
parents:
diff changeset
75 final File selectedFile
67635b462045 Uploaded
jfb
parents:
diff changeset
76 = fileChooser.showOpenDialog(KinaMine.stage);
67635b462045 Uploaded
jfb
parents:
diff changeset
77
67635b462045 Uploaded
jfb
parents:
diff changeset
78 /**
67635b462045 Uploaded
jfb
parents:
diff changeset
79 * If the selected file is non-null, set the text of the pepPath
67635b462045 Uploaded
jfb
parents:
diff changeset
80 * TextField to the absolute path of the file. Update last directory.
67635b462045 Uploaded
jfb
parents:
diff changeset
81 */
67635b462045 Uploaded
jfb
parents:
diff changeset
82 if (selectedFile != null) {
67635b462045 Uploaded
jfb
parents:
diff changeset
83 lastDirectory = new File(selectedFile.getParent());
67635b462045 Uploaded
jfb
parents:
diff changeset
84 pepPath.setText(selectedFile.getAbsolutePath());
67635b462045 Uploaded
jfb
parents:
diff changeset
85
67635b462045 Uploaded
jfb
parents:
diff changeset
86 }
67635b462045 Uploaded
jfb
parents:
diff changeset
87 }
67635b462045 Uploaded
jfb
parents:
diff changeset
88
67635b462045 Uploaded
jfb
parents:
diff changeset
89 /**
67635b462045 Uploaded
jfb
parents:
diff changeset
90 * Handles ActionEvent of fastaSearchButton being pressed. Opens a file
67635b462045 Uploaded
jfb
parents:
diff changeset
91 * browser for the selection of a FASTA database and stores the location of
67635b462045 Uploaded
jfb
parents:
diff changeset
92 * the file in the fastaPath Textfield.
67635b462045 Uploaded
jfb
parents:
diff changeset
93 *
67635b462045 Uploaded
jfb
parents:
diff changeset
94 * @param event
67635b462045 Uploaded
jfb
parents:
diff changeset
95 */
67635b462045 Uploaded
jfb
parents:
diff changeset
96 @FXML
67635b462045 Uploaded
jfb
parents:
diff changeset
97 public void fastaSearchClicked(ActionEvent event) {
67635b462045 Uploaded
jfb
parents:
diff changeset
98
67635b462045 Uploaded
jfb
parents:
diff changeset
99 /** Initialize new filechosoer. */
67635b462045 Uploaded
jfb
parents:
diff changeset
100 final FileChooser fileChooser = new FileChooser();
67635b462045 Uploaded
jfb
parents:
diff changeset
101
67635b462045 Uploaded
jfb
parents:
diff changeset
102 /** Create new extension filter */
67635b462045 Uploaded
jfb
parents:
diff changeset
103 ExtensionFilter filter
67635b462045 Uploaded
jfb
parents:
diff changeset
104 = new ExtensionFilter("Database", "*.fasta", "*.tabular");
67635b462045 Uploaded
jfb
parents:
diff changeset
105
67635b462045 Uploaded
jfb
parents:
diff changeset
106 /** Configure file chooser */
67635b462045 Uploaded
jfb
parents:
diff changeset
107 configFileChooser(fileChooser, lastDirectory, filter);
67635b462045 Uploaded
jfb
parents:
diff changeset
108
67635b462045 Uploaded
jfb
parents:
diff changeset
109 /** Open file select window. */
67635b462045 Uploaded
jfb
parents:
diff changeset
110 final File selectedFile
67635b462045 Uploaded
jfb
parents:
diff changeset
111 = fileChooser.showOpenDialog(KinaMine.stage);
67635b462045 Uploaded
jfb
parents:
diff changeset
112
67635b462045 Uploaded
jfb
parents:
diff changeset
113 /** Update fastapath and last directory, if not null */
67635b462045 Uploaded
jfb
parents:
diff changeset
114 if (selectedFile != null) {
67635b462045 Uploaded
jfb
parents:
diff changeset
115 lastDirectory = new File(selectedFile.getParent());
67635b462045 Uploaded
jfb
parents:
diff changeset
116 fastaPath.setText(selectedFile.getAbsolutePath());
67635b462045 Uploaded
jfb
parents:
diff changeset
117
67635b462045 Uploaded
jfb
parents:
diff changeset
118 }
67635b462045 Uploaded
jfb
parents:
diff changeset
119 }
67635b462045 Uploaded
jfb
parents:
diff changeset
120
67635b462045 Uploaded
jfb
parents:
diff changeset
121 /**
67635b462045 Uploaded
jfb
parents:
diff changeset
122 * Configures FileChooser.
67635b462045 Uploaded
jfb
parents:
diff changeset
123 *
67635b462045 Uploaded
jfb
parents:
diff changeset
124 * @param fileChooser
67635b462045 Uploaded
jfb
parents:
diff changeset
125 * @param lastDir
67635b462045 Uploaded
jfb
parents:
diff changeset
126 * @param filter
67635b462045 Uploaded
jfb
parents:
diff changeset
127 */
67635b462045 Uploaded
jfb
parents:
diff changeset
128 private static void configFileChooser(final FileChooser fileChooser,
67635b462045 Uploaded
jfb
parents:
diff changeset
129 File lastDir, ExtensionFilter filter) {
67635b462045 Uploaded
jfb
parents:
diff changeset
130
67635b462045 Uploaded
jfb
parents:
diff changeset
131 fileChooser.setTitle("Open File");
67635b462045 Uploaded
jfb
parents:
diff changeset
132
67635b462045 Uploaded
jfb
parents:
diff changeset
133 fileChooser.getExtensionFilters().add(filter);
67635b462045 Uploaded
jfb
parents:
diff changeset
134
67635b462045 Uploaded
jfb
parents:
diff changeset
135 /** If last directory exists, start file selection from there. */
67635b462045 Uploaded
jfb
parents:
diff changeset
136 if (lastDir == null) {
67635b462045 Uploaded
jfb
parents:
diff changeset
137 fileChooser.setInitialDirectory(
67635b462045 Uploaded
jfb
parents:
diff changeset
138 new File(System.getProperty("user.home")));
67635b462045 Uploaded
jfb
parents:
diff changeset
139 } else {
67635b462045 Uploaded
jfb
parents:
diff changeset
140 fileChooser.setInitialDirectory(lastDir);
67635b462045 Uploaded
jfb
parents:
diff changeset
141 }
67635b462045 Uploaded
jfb
parents:
diff changeset
142 }
67635b462045 Uploaded
jfb
parents:
diff changeset
143
67635b462045 Uploaded
jfb
parents:
diff changeset
144 /**
67635b462045 Uploaded
jfb
parents:
diff changeset
145 * Handles ActionEvent that browse output was clicked. Opens directory
67635b462045 Uploaded
jfb
parents:
diff changeset
146 * chooser and records path to directory chosen.
67635b462045 Uploaded
jfb
parents:
diff changeset
147 *
67635b462045 Uploaded
jfb
parents:
diff changeset
148 * @param event
67635b462045 Uploaded
jfb
parents:
diff changeset
149 */
67635b462045 Uploaded
jfb
parents:
diff changeset
150 public void browseFolderClicked(ActionEvent event) {
67635b462045 Uploaded
jfb
parents:
diff changeset
151
67635b462045 Uploaded
jfb
parents:
diff changeset
152 /** Initialize new DirectoryChooser */
67635b462045 Uploaded
jfb
parents:
diff changeset
153 final DirectoryChooser dirChooser = new DirectoryChooser();
67635b462045 Uploaded
jfb
parents:
diff changeset
154
67635b462045 Uploaded
jfb
parents:
diff changeset
155 dirChooser.setTitle("Choose Output Location");
67635b462045 Uploaded
jfb
parents:
diff changeset
156
67635b462045 Uploaded
jfb
parents:
diff changeset
157 /** Configure starting location for directory chooser. */
67635b462045 Uploaded
jfb
parents:
diff changeset
158 if (lastDirectory != null) {
67635b462045 Uploaded
jfb
parents:
diff changeset
159 dirChooser.setInitialDirectory(lastDirectory);
67635b462045 Uploaded
jfb
parents:
diff changeset
160 } else {
67635b462045 Uploaded
jfb
parents:
diff changeset
161 dirChooser.setInitialDirectory(new File(System.getProperty("user.home")));
67635b462045 Uploaded
jfb
parents:
diff changeset
162 }
67635b462045 Uploaded
jfb
parents:
diff changeset
163
67635b462045 Uploaded
jfb
parents:
diff changeset
164 /** Opens directory chooser window. */
67635b462045 Uploaded
jfb
parents:
diff changeset
165 final File output = dirChooser.showDialog(KinaMine.stage);
67635b462045 Uploaded
jfb
parents:
diff changeset
166
67635b462045 Uploaded
jfb
parents:
diff changeset
167 /** Set path if file not null */
67635b462045 Uploaded
jfb
parents:
diff changeset
168 if (output != null) {
67635b462045 Uploaded
jfb
parents:
diff changeset
169 outPath.setText(output.getAbsolutePath());
67635b462045 Uploaded
jfb
parents:
diff changeset
170 }
67635b462045 Uploaded
jfb
parents:
diff changeset
171
67635b462045 Uploaded
jfb
parents:
diff changeset
172 }
67635b462045 Uploaded
jfb
parents:
diff changeset
173
67635b462045 Uploaded
jfb
parents:
diff changeset
174 /**
67635b462045 Uploaded
jfb
parents:
diff changeset
175 * Handles event that submit button is clicked. Collects are required inputs
67635b462045 Uploaded
jfb
parents:
diff changeset
176 * for KineMineDriver.
67635b462045 Uploaded
jfb
parents:
diff changeset
177 *
67635b462045 Uploaded
jfb
parents:
diff changeset
178 * @param event
67635b462045 Uploaded
jfb
parents:
diff changeset
179 */
67635b462045 Uploaded
jfb
parents:
diff changeset
180 public void submitButtonClicked(ActionEvent event) {
67635b462045 Uploaded
jfb
parents:
diff changeset
181
67635b462045 Uploaded
jfb
parents:
diff changeset
182 /** Collect arguments */
67635b462045 Uploaded
jfb
parents:
diff changeset
183 String args[] = new String[5];
67635b462045 Uploaded
jfb
parents:
diff changeset
184 args[0] = pepPath.getText();
67635b462045 Uploaded
jfb
parents:
diff changeset
185 args[1] = fastaPath.getText();
67635b462045 Uploaded
jfb
parents:
diff changeset
186 args[2] = outPath.getText();
67635b462045 Uploaded
jfb
parents:
diff changeset
187 args[3] = fdrScore.getText();
67635b462045 Uploaded
jfb
parents:
diff changeset
188 args[4] = outGroup.getText();
67635b462045 Uploaded
jfb
parents:
diff changeset
189
67635b462045 Uploaded
jfb
parents:
diff changeset
190 ArrayList<String> error = checkForErrors(args);
67635b462045 Uploaded
jfb
parents:
diff changeset
191
67635b462045 Uploaded
jfb
parents:
diff changeset
192 /** Handle errors */
67635b462045 Uploaded
jfb
parents:
diff changeset
193 if (error.isEmpty()) {
67635b462045 Uploaded
jfb
parents:
diff changeset
194 boolean status = KinaMineDriver.run(args, debug = true);
67635b462045 Uploaded
jfb
parents:
diff changeset
195 completeWindow();
67635b462045 Uploaded
jfb
parents:
diff changeset
196 } else {
67635b462045 Uploaded
jfb
parents:
diff changeset
197 alertError(error);
67635b462045 Uploaded
jfb
parents:
diff changeset
198 }
67635b462045 Uploaded
jfb
parents:
diff changeset
199 }
67635b462045 Uploaded
jfb
parents:
diff changeset
200
67635b462045 Uploaded
jfb
parents:
diff changeset
201 public ArrayList<String> checkForErrors(String[] args) {
67635b462045 Uploaded
jfb
parents:
diff changeset
202
67635b462045 Uploaded
jfb
parents:
diff changeset
203 ArrayList<String> error = new ArrayList<>();
67635b462045 Uploaded
jfb
parents:
diff changeset
204
67635b462045 Uploaded
jfb
parents:
diff changeset
205 File pep = new File(args[0]);
67635b462045 Uploaded
jfb
parents:
diff changeset
206 File fasta = new File(args[1]);
67635b462045 Uploaded
jfb
parents:
diff changeset
207 File dir = new File(args[2]);
67635b462045 Uploaded
jfb
parents:
diff changeset
208 String score = args[3];
67635b462045 Uploaded
jfb
parents:
diff changeset
209
67635b462045 Uploaded
jfb
parents:
diff changeset
210 if (!pep.isFile()) {
67635b462045 Uploaded
jfb
parents:
diff changeset
211 error.add(args[0] + " is not a file.");
67635b462045 Uploaded
jfb
parents:
diff changeset
212 }
67635b462045 Uploaded
jfb
parents:
diff changeset
213 if (!pep.canRead()) {
67635b462045 Uploaded
jfb
parents:
diff changeset
214 error.add("Can't read peptide report: " + args[0]);
67635b462045 Uploaded
jfb
parents:
diff changeset
215 }
67635b462045 Uploaded
jfb
parents:
diff changeset
216 if (!fasta.isFile()) {
67635b462045 Uploaded
jfb
parents:
diff changeset
217 error.add(args[1] + " is not a file.");
67635b462045 Uploaded
jfb
parents:
diff changeset
218 }
67635b462045 Uploaded
jfb
parents:
diff changeset
219 if (!fasta.canRead()) {
67635b462045 Uploaded
jfb
parents:
diff changeset
220 error.add("Can't read database: " + args[0]);
67635b462045 Uploaded
jfb
parents:
diff changeset
221 }
67635b462045 Uploaded
jfb
parents:
diff changeset
222 if (!dir.isDirectory()){
67635b462045 Uploaded
jfb
parents:
diff changeset
223 error.add(dir + " is not a directory.");
67635b462045 Uploaded
jfb
parents:
diff changeset
224 }
67635b462045 Uploaded
jfb
parents:
diff changeset
225 if (!score.matches("[-+]?\\d*\\.?\\d+")) {
67635b462045 Uploaded
jfb
parents:
diff changeset
226 error.add("FDR Score: " + score + " is not a number.");
67635b462045 Uploaded
jfb
parents:
diff changeset
227 }
67635b462045 Uploaded
jfb
parents:
diff changeset
228
67635b462045 Uploaded
jfb
parents:
diff changeset
229 return error;
67635b462045 Uploaded
jfb
parents:
diff changeset
230 }
67635b462045 Uploaded
jfb
parents:
diff changeset
231
67635b462045 Uploaded
jfb
parents:
diff changeset
232 /**
67635b462045 Uploaded
jfb
parents:
diff changeset
233 * If error in arguments for KinaMineDriver, open error window and write
67635b462045 Uploaded
jfb
parents:
diff changeset
234 * error message to user.
67635b462045 Uploaded
jfb
parents:
diff changeset
235 *
67635b462045 Uploaded
jfb
parents:
diff changeset
236 * @param errors list of errors
67635b462045 Uploaded
jfb
parents:
diff changeset
237 */
67635b462045 Uploaded
jfb
parents:
diff changeset
238 public void alertError(ArrayList<String> errors) {
67635b462045 Uploaded
jfb
parents:
diff changeset
239
67635b462045 Uploaded
jfb
parents:
diff changeset
240 /** Format window. */
67635b462045 Uploaded
jfb
parents:
diff changeset
241 Stage window = new Stage();
67635b462045 Uploaded
jfb
parents:
diff changeset
242 window.initModality(Modality.APPLICATION_MODAL);
67635b462045 Uploaded
jfb
parents:
diff changeset
243 window.setTitle("Error");
67635b462045 Uploaded
jfb
parents:
diff changeset
244 window.setMinWidth(250);
67635b462045 Uploaded
jfb
parents:
diff changeset
245
67635b462045 Uploaded
jfb
parents:
diff changeset
246 /** Format message*/
67635b462045 Uploaded
jfb
parents:
diff changeset
247 String message = "";
67635b462045 Uploaded
jfb
parents:
diff changeset
248 for (String error : errors) {
67635b462045 Uploaded
jfb
parents:
diff changeset
249 message += error + "\n";
67635b462045 Uploaded
jfb
parents:
diff changeset
250 }
67635b462045 Uploaded
jfb
parents:
diff changeset
251 Label label = new Label(message);
67635b462045 Uploaded
jfb
parents:
diff changeset
252
67635b462045 Uploaded
jfb
parents:
diff changeset
253 /** Format Button */
67635b462045 Uploaded
jfb
parents:
diff changeset
254 Button closeButton = new Button("Close\n");
67635b462045 Uploaded
jfb
parents:
diff changeset
255 closeButton.setOnAction(e -> window.close());
67635b462045 Uploaded
jfb
parents:
diff changeset
256
67635b462045 Uploaded
jfb
parents:
diff changeset
257 /** Format layout */
67635b462045 Uploaded
jfb
parents:
diff changeset
258 VBox layout = new VBox(10);
67635b462045 Uploaded
jfb
parents:
diff changeset
259 layout.getChildren().addAll(label, closeButton);
67635b462045 Uploaded
jfb
parents:
diff changeset
260 layout.setAlignment(Pos.CENTER);
67635b462045 Uploaded
jfb
parents:
diff changeset
261
67635b462045 Uploaded
jfb
parents:
diff changeset
262 /** Set scene */
67635b462045 Uploaded
jfb
parents:
diff changeset
263 Scene scene = new Scene(layout);
67635b462045 Uploaded
jfb
parents:
diff changeset
264 window.setScene(scene);
67635b462045 Uploaded
jfb
parents:
diff changeset
265 window.showAndWait();
67635b462045 Uploaded
jfb
parents:
diff changeset
266
67635b462045 Uploaded
jfb
parents:
diff changeset
267 }
67635b462045 Uploaded
jfb
parents:
diff changeset
268
67635b462045 Uploaded
jfb
parents:
diff changeset
269 /**
67635b462045 Uploaded
jfb
parents:
diff changeset
270 * Opens window when Run is complete.
67635b462045 Uploaded
jfb
parents:
diff changeset
271 */
67635b462045 Uploaded
jfb
parents:
diff changeset
272 public void completeWindow() {
67635b462045 Uploaded
jfb
parents:
diff changeset
273
67635b462045 Uploaded
jfb
parents:
diff changeset
274 /** Format window. */
67635b462045 Uploaded
jfb
parents:
diff changeset
275 Stage window = new Stage();
67635b462045 Uploaded
jfb
parents:
diff changeset
276 window.initModality(Modality.APPLICATION_MODAL);
67635b462045 Uploaded
jfb
parents:
diff changeset
277 window.setMinWidth(250);
67635b462045 Uploaded
jfb
parents:
diff changeset
278
67635b462045 Uploaded
jfb
parents:
diff changeset
279 /** Format close button */
67635b462045 Uploaded
jfb
parents:
diff changeset
280 Label label = new Label("Run Complete");
67635b462045 Uploaded
jfb
parents:
diff changeset
281 Button closeButton = new Button("Done");
67635b462045 Uploaded
jfb
parents:
diff changeset
282 closeButton.setOnAction(e -> window.close());
67635b462045 Uploaded
jfb
parents:
diff changeset
283
67635b462045 Uploaded
jfb
parents:
diff changeset
284 /** Format layout */
67635b462045 Uploaded
jfb
parents:
diff changeset
285 VBox layout = new VBox(10);
67635b462045 Uploaded
jfb
parents:
diff changeset
286 layout.getChildren().addAll(label, closeButton);
67635b462045 Uploaded
jfb
parents:
diff changeset
287 layout.setAlignment(Pos.CENTER);
67635b462045 Uploaded
jfb
parents:
diff changeset
288
67635b462045 Uploaded
jfb
parents:
diff changeset
289 /** Set scene */
67635b462045 Uploaded
jfb
parents:
diff changeset
290 Scene scene = new Scene(layout);
67635b462045 Uploaded
jfb
parents:
diff changeset
291 window.setScene(scene);
67635b462045 Uploaded
jfb
parents:
diff changeset
292 window.showAndWait();
67635b462045 Uploaded
jfb
parents:
diff changeset
293
67635b462045 Uploaded
jfb
parents:
diff changeset
294 }
67635b462045 Uploaded
jfb
parents:
diff changeset
295
67635b462045 Uploaded
jfb
parents:
diff changeset
296 /**
67635b462045 Uploaded
jfb
parents:
diff changeset
297 * Initialize method for KinaMineGUI. Initializes all paths.
67635b462045 Uploaded
jfb
parents:
diff changeset
298 *
67635b462045 Uploaded
jfb
parents:
diff changeset
299 * @param url
67635b462045 Uploaded
jfb
parents:
diff changeset
300 * @param rb
67635b462045 Uploaded
jfb
parents:
diff changeset
301 */
67635b462045 Uploaded
jfb
parents:
diff changeset
302 @Override
67635b462045 Uploaded
jfb
parents:
diff changeset
303 public void initialize(URL url, ResourceBundle rb) {
67635b462045 Uploaded
jfb
parents:
diff changeset
304 System.out.println("Initializing...");
67635b462045 Uploaded
jfb
parents:
diff changeset
305 lastDirectory = null;
67635b462045 Uploaded
jfb
parents:
diff changeset
306 assert pepPath != null : "fx:id=\"pepPath\" was not injected: check your FXML file 'KinaMineGUI.fxml'.";
67635b462045 Uploaded
jfb
parents:
diff changeset
307 assert fastaPath != null : "fx:id=\"fastaPath\" was not injected: check your FXML file 'KinaMineGUI.fxml'.";
67635b462045 Uploaded
jfb
parents:
diff changeset
308 assert outPath != null : "fx:id=\"outPath\" was not injected: check your FXML file 'KinaMineGUI.fxml'.";
67635b462045 Uploaded
jfb
parents:
diff changeset
309
67635b462045 Uploaded
jfb
parents:
diff changeset
310 }
67635b462045 Uploaded
jfb
parents:
diff changeset
311
67635b462045 Uploaded
jfb
parents:
diff changeset
312 }