Skip to content

Commit

Permalink
#27 added field to choose architecture model
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanPirnbaum committed Jul 26, 2019
1 parent b20600d commit f0988f7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
import javafx.scene.control.CheckBox;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.TextField;
import javafx.stage.FileChooser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Controller;

import java.io.File;

/**
* @author Stephan Pirnbaum
*/
Expand Down Expand Up @@ -49,6 +52,12 @@ public class ConfigurationDialogController extends AbstractController {
@FXML
private TextField populationSize;

@FXML
private TextField architecturePath;

@FXML
private Button chooseArchitecture;

@Autowired
@Lazy
ClassificationRunner classificationRunner;
Expand All @@ -69,9 +78,9 @@ public void initialize() {
generations.setText(newValue.replaceAll("[^\\d]", ""));
}
}));
this.chooseArchitecture.setOnAction(e -> this.selectArchitecture());
}


private void execute() {
this.execute.setDisable(true);
try {
Expand All @@ -94,4 +103,14 @@ private void execute() {
this.execute.setDisable(false);
}

private void selectArchitecture() {
FileChooser chooser = new FileChooser();
chooser.setTitle("Select Architecture Model");
File f;
chooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter("xml", "xml"));
if ((f = chooser.showOpenDialog(this.chooseArchitecture.getScene().getWindow())) != null) {
this.architecturePath.setText(f.toURI().toString());
}
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane fx:id="configPane" maxWidth="426.0" minWidth="426.0" prefHeight="183.0" prefWidth="426.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.buschmais.sarf.app.ui.ConfigurationDialogController">
Expand All @@ -19,6 +19,7 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
Expand All @@ -40,12 +41,19 @@
<GridPane.margin>
<Insets left="10.0" />
</GridPane.margin></CheckBox>
<ProgressBar fx:id="progress" prefHeight="18.0" prefWidth="237.0" progress="0.0" GridPane.columnIndex="1" GridPane.rowIndex="5" />
<Button fx:id="execute" mnemonicParsing="false" prefHeight="39.0" prefWidth="256.0" text="Execute" GridPane.columnIndex="1" GridPane.rowIndex="5" />
<ProgressBar fx:id="progress" prefHeight="18.0" prefWidth="237.0" progress="0.0" GridPane.columnIndex="1" GridPane.rowIndex="6" />
<Button fx:id="execute" mnemonicParsing="false" prefHeight="39.0" prefWidth="256.0" text="Execute" GridPane.columnIndex="1" GridPane.rowIndex="6" />
<Label text="Generations" GridPane.rowIndex="3" />
<Label text="Population Size" GridPane.rowIndex="4" />
<TextField fx:id="generations" text="300" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<TextField fx:id="populationSize" text="100" GridPane.columnIndex="1" GridPane.rowIndex="4" />
<Label text="Architecture Model" GridPane.rowIndex="5" />
<TextField fx:id="architecturePath" prefHeight="25.0" prefWidth="380.0" GridPane.columnIndex="1" GridPane.rowIndex="5" />
<Button fx:id="chooseArchitecture" mnemonicParsing="false" text="Choose" GridPane.columnIndex="2" GridPane.rowIndex="5">
<GridPane.margin>
<Insets left="10.0" />
</GridPane.margin>
</Button>
</children>
</GridPane>
</children>
Expand Down

0 comments on commit f0988f7

Please sign in to comment.