Skip to content
Snippets Groups Projects
Commit 0b542c64 authored by Dean Jonas Finkes's avatar Dean Jonas Finkes
Browse files

renaming controller

parent 987f12a8
No related branches found
No related tags found
1 merge request!1Initial gui, closes #5
......@@ -51,6 +51,8 @@ public class MainApp extends Application {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(MainApp.class.getResource("MainScreen.fxml"));
AnchorPane screen = (AnchorPane) loader.load();
MainScreenController controller = (MainScreenController) loader.getController();
controller.setPathToJavaApp(primaryStage.getScene().getWindow());
rootLayout.setCenter(screen);
} catch (IOException e) {
e.printStackTrace();
......@@ -66,7 +68,7 @@ public class MainApp extends Application {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(MainApp.class.getResource("SelectScreen.fxml"));
AnchorPane screen = (AnchorPane) loader.load();
SelectScene controller = (SelectScene) loader.getController();
SelectScreenController controller = (SelectScreenController) loader.getController();
controller.setApp(this);
rootLayout.setCenter(screen);
} catch (IOException e) {
......
......@@ -7,31 +7,33 @@
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ui.MainScene">
<AnchorPane prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ui.MainScreenController">
<children>
<SplitPane dividerPositions="0.5" layoutX="268.0" layoutY="150.0" orientation="VERTICAL" prefHeight="600.0" prefWidth="800.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<SplitPane dividerPositions="0.2809364548494983" orientation="VERTICAL" prefHeight="683.0" prefWidth="800.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<items>
<AnchorPane maxHeight="100.0" maxWidth="798.0" minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="798.0" SplitPane.resizableWithParent="false">
<AnchorPane maxHeight="165.0" maxWidth="798.0" minHeight="0.0" minWidth="0.0" prefHeight="165.0" prefWidth="798.0" SplitPane.resizableWithParent="false">
<children>
<ProgressBar fx:id="progressBar" layoutX="133.0" layoutY="24.0" mouseTransparent="true" prefHeight="48.0" prefWidth="559.0" progress="0.0" />
<Button layoutX="25.0" layoutY="24.0" mnemonicParsing="false" onAction="#handleAbortAction" prefHeight="48.0" prefWidth="94.0" text="Abbrechen" />
<Button layoutX="702.0" layoutY="24.0" mnemonicParsing="false" onAction="#handleStartAction" prefHeight="48.0" prefWidth="76.0" text="Start" />
<TextField fx:id="loadJavaAppTextField" layoutX="250.0" layoutY="94.0" />
<Button layoutX="413.0" layoutY="94.0" mnemonicParsing="false" onAction="#handleLoadJavaAppButtonAction" text="Load Java App" />
</children>
</AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0">
<children>
<SplitPane dividerPositions="0.5" layoutX="0.0" prefHeight="491.0" prefWidth="800.0">
<SplitPane dividerPositions="0.5" layoutX="0.0" prefHeight="427.0" prefWidth="800.0">
<items>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<Button layoutX="125.0" layoutY="20.0" mnemonicParsing="false" onAction="#handleUseCurrentCodeAction" text="Use current code" />
<TextArea fx:id="currentCodeField" editable="false" layoutX="25.0" layoutY="65.0" prefHeight="402.0" prefWidth="342.0" />
<TextArea fx:id="currentCodeField" editable="false" layoutX="25.0" layoutY="65.0" prefHeight="320.0" prefWidth="340.0" />
</children>
</AnchorPane>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
<children>
<Button layoutX="125.0" layoutY="20.0" mnemonicParsing="false" onAction="#handleUseParallelCodeAction" prefWidth="150.0" text="Use optimized code" />
<TextArea fx:id="parallelCodeField" editable="false" layoutX="25.0" layoutY="65.0" prefHeight="402.0" prefWidth="342.0" />
<TextArea fx:id="parallelCodeField" editable="false" layoutX="25.0" layoutY="65.0" prefHeight="320.0" prefWidth="340.0" />
</children>
</AnchorPane>
</items>
......
package ui;
import java.io.File;
import java2sdg.Sdg;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Control;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.stage.DirectoryChooser;
import javafx.stage.Window;
import matcher.Matcher;
public class MainScene extends Control {
public class MainScreenController extends Control {
@FXML
ProgressBar progressBar;
......@@ -17,6 +24,9 @@ public class MainScene extends Control {
@FXML
TextArea parallelCodeField;
@FXML
TextField loadJavaAppTextField;
private void setDemoText() {
String current = "\n"
+ "public List<Output> processInputs(List<Input> inputs) throws InterruptedException, ExecutionException {\n"
......@@ -42,6 +52,14 @@ public class MainScene extends Control {
parallelCodeField.setText(parallel);
}
public void setPathToJavaApp(Window window) {
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle("Open Java Application Folder");
File selectedDirectory = directoryChooser.showDialog(window);
if (selectedDirectory != null)
loadJavaAppTextField.setText(selectedDirectory.getAbsolutePath());
}
@FXML
private void handleUseCurrentCodeAction(ActionEvent event) {
setDemoText();
......@@ -54,10 +72,49 @@ public class MainScene extends Control {
progressBar.setProgress(progressBar.getProgress() + 0.1);
}
@FXML
private void handleLoadJavaAppButtonAction(ActionEvent event) {
setPathToJavaApp(progressBar.getScene().getWindow());
}
@FXML
private void handleStartAction(ActionEvent event) {
setDemoText();
progressBar.setProgress(0.9);
// start soot analysis
String[] args = new String[13];
String pathToAnalyze = loadJavaAppTextField.getText();
String mainClassToAnalyze = "helloWorld.HelloWorld";
args[0] = "-cp";
// logging libs not needed at the moment
// args[1] =
// "lib\\logging\\slf4j-api-1.7.13.jar;lib\\logging\\logback-classic-1.1.3.jar;lib\\logging\\logback-core-1.1.3.jar;"
// + pathToAnalyze;
args[1] = pathToAnalyze;
args[2] = "-pp";
args[3] = "-app";
args[4] = "-w";
args[5] = "-no-bodies-for-excluded";
args[6] = "-keep-line-number";
args[7] = "-p";
args[8] = "jb";
args[9] = "use-original-names:true";
args[10] = "-main-class";
args[11] = mainClassToAnalyze;
args[12] = mainClassToAnalyze;
Sdg.main(args);
// start matching candidate and parallelization pattern
File candidatePatterns = new File("/NeoSuit/src/main/resources/CandidatePatterns.xml");
File parallelizationPatterns = new File("/NeoSuit/src/main/resources/ParallelizationPatterns.xml");
Matcher matcher = new Matcher();
matcher.setPathToDB("pathToDB");
matcher.setCandidatePatterns(candidatePatterns);
matcher.setParallelizationPatterns(parallelizationPatterns);
matcher.match();
}
@FXML
......
......@@ -7,7 +7,7 @@
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.AnchorPane?>
<AnchorPane prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ui.SelectScene">
<AnchorPane prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ui.SelectScreenController">
<children>
<Text fx:id="dragText" layoutX="310.0" layoutY="221.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Drag Folder" wrappingWidth="177.015625">
<font>
......
......@@ -4,9 +4,8 @@ import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Control;
import javafx.scene.text.Text;
import javafx.stage.DirectoryChooser;
public class SelectScene extends Control {
public class SelectScreenController extends Control {
private MainApp app;
......@@ -16,10 +15,6 @@ public class SelectScene extends Control {
@FXML
private void handleSelectButtonAction(ActionEvent event) {
// TODO: open dialog, etc
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle("Open Java Application Folder");
directoryChooser.showDialog(dragText.getScene().getWindow());
app.showMainScreen();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment