Connected views to models. Added photos.

This commit is contained in:
samuele-brusegan
2026-05-14 21:21:39 +02:00
parent 0490f081ed
commit 53b171016d
19 changed files with 60 additions and 5 deletions

View File

@@ -12,6 +12,8 @@ import org.example.views.MainUI;
*/
public class App extends Application {
public static final double MULTIPLIER = 1.5;
@Override
public void start(Stage stage) {
MainUI.start(stage);

View File

@@ -1,4 +1,12 @@
package org.example.controller;
import org.example.models.MainLogic;
import org.example.models.Path;
public class Controller {
public static Path logic(int k, double multiplier) {
return MainLogic.logic(k, multiplier);
}
}

View File

@@ -9,12 +9,20 @@ import java.util.Set;
public class MainLogic {
private static final HashMap<Set<Node>, List<Path>> cache = new HashMap<>();
public static final double MULTIPLIER = 1.5;
public static final int K = 4;
public static double MULTIPLIER = 1.5;
public static int K = 4;
public static double LENGHT;
public static void main(String[] args) {
System.out.println(logic(K, MULTIPLIER));
}
public static Path logic(int k, double multiplier) {
// Parsing args
K = k; MULTIPLIER = multiplier;
// Login
ArrayList<Node> nl = importData();
Node moncalieri = nl.getLast();
nl.remove(moncalieri);
@@ -34,7 +42,7 @@ public class MainLogic {
bestPath = p;
}
}
System.out.println(bestPath);
return bestPath;
}
public static ArrayList<Node> importData() {

View File

@@ -1,17 +1,54 @@
package org.example.views;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.control.TextFormatter;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import org.example.App;
import org.example.controller.Controller;
import org.example.models.Path;
import java.util.function.UnaryOperator;
public class MainUI {
public static void start(Stage stage) {
//Controller.logic()
VBox root = new VBox();
TextField numericField = new TextField();
// Filter to allow only integer numbers
UnaryOperator<TextFormatter.Change> filter = change -> {
String text = change.getControlNewText();
// Regex: allows empty field (for deletion) or digits only
if (text.matches("\\d*")) {
return change;
}
return null; // Reject the change
};
Button submit = new Button("Submit");
HBox hBox = new HBox(numericField,submit);
root.getChildren().add(hBox);
var scene = new Scene(root, 640, 480);
submit.setOnAction(event -> {
int k = Integer.parseInt(numericField.getText());
double multiplier = App.MULTIPLIER;
Path bestPath = Controller.logic(k, multiplier);
slideShowStart();
});
var label = new Label("Hello, JavaFX " + "javafxVersion" + ", running on Java " + "javaVersion" + ".");
var scene = new Scene(new StackPane(label), 640, 480);
stage.setScene(scene);
stage.show();
}
private static void slideShowStart() {
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 826 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 MiB