Working Component Management

This commit is contained in:
2025-04-14 15:12:02 +02:00
committed by LucaaMueller
parent 133ee646d1
commit 4310011f0e
20 changed files with 138 additions and 170 deletions

View File

@ -1,12 +1,10 @@
package fabrik.simulator.pic16f84;
import fabrik.simulator.pic16f84.interfaces.CommandInterface;
import fabrik.simulator.pic16f84.interfaces.WindowManagement;
import fabrik.simulator.pic16f84.interfaces.DataRegisterInterface;
import fabrik.simulator.pic16f84.interfaces.IOPortInterface;
import fabrik.simulator.pic16f84.interfaces.*;
import javafx.beans.property.SimpleStringProperty;
import javafx.geometry.Insets;
import javafx.scene.chart.PieChart;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TableColumn;
@ -21,28 +19,16 @@ import static javafx.application.Application.launch;
public class Table {
//Hier wird die Tabelle aktualisiert
//Tabelle aktualisieren
private final WindowManagement createWindow;
private final DataRegisterInterface dataRegister;
private final CommandInterface command;
private final PreScaler preScaler;
private final IOPortInterface ioPorts;
public Table (DataRegisterInterface dataRegister, WindowManagement createWindow, CommandInterface command, PreScaler preScaler, IOPortInterface ioPorts){
this.dataRegister = dataRegister;
this.createWindow = createWindow;
this.command = command;
this.preScaler = preScaler;
this.ioPorts = ioPorts;
}
//Hier wird die Tabelle aktualisiert
//Tabelle aktualisieren
private static DataRegisterInterface dataRegister;
private static CommandInterface commands;
private static final int NUM_COLUMNS = 8; // Anzahl der Spalten
private static final double TABLE_WIDTH = 425; // Breite der TableView
private static final double TABLE_HEIGHT = 600; // Höhe der TableView
private static IOPortInterface ioPorts;
private static PreScalerInterface preScaler;
private static String formatHex(String s) {
return (s.length() == 1) ? "0" + s : s;
@ -60,9 +46,17 @@ public class Table {
return s;
}
public static VBox init(PICComponents picComponents){
dataRegister = (DataRegisterInterface) picComponents.getComponent(DataRegisterInterface.class);
commands = (CommandInterface) picComponents.getComponent(CommandInterface.class);
ioPorts = (IOPortInterface) picComponents.getComponent(IOPortInterface.class);
preScaler = (PreScalerInterface) picComponents.getComponent(PreScalerInterface.class);
return refresh();
}
public VBox refresh(){
// Erstelle eine Instanz der DataRegister-Klasse
public static VBox refresh() {
// Erstelle eine Instanz der dataRegister-Klasse
// Erstelle eine TableView für die Datenanzeige
@ -108,7 +102,7 @@ public class Table {
Label spacing = new Label(" ");
Label spacing2 = new Label(" ");
Label wRegisterLabel = new Label("W-Register: 0x" + formatHex(Integer.toHexString(command.get_wRegister()).toUpperCase()));
Label wRegisterLabel = new Label("W-Register: 0x" + formatHex(Integer.toHexString(commands.get_wRegister()).toUpperCase()));
Label cLabel = new Label("Carry-Flag: " + dataRegister.getCarryFlag());
Label dcLabel = new Label("DigitCarry-Flag: " + dataRegister.getDigitCarryFlag());
Label zLabel = new Label("Zero-Flag: " + dataRegister.getZeroFlag());
@ -147,7 +141,7 @@ public class Table {
}
private void triggerReset() {
private static void triggerReset() {
dataRegister.initDataRegister();
ioPorts.refreshUI(Controller_Frontend.getTRISbuttons(), Controller_Frontend.getPORTbuttons());
CreateWindow.refreshTable();
@ -158,7 +152,7 @@ public class Table {
}
// Hilfsklasse für die Datenanzeige in der TableView
public class DataEntry {
public static class DataEntry {
private final String address;
private final String value;