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

@ -37,12 +37,12 @@ import java.util.Set;
import static java.lang.Math.max;
public class Controller_Frontend implements FrontendControllerInterface {
public class Controller_Frontend extends PICComponent implements FrontendControllerInterface {
private int [] prog;
private int [][] read;
private int [] ind;
private PICComponents picComponents;
private double executionTimeMultiplier = 1;
@ -83,30 +83,10 @@ public class Controller_Frontend implements FrontendControllerInterface {
private static volatile boolean isAutoRunActive = false;
private static volatile boolean isSleeping = false;
private final CommandInterface commands;
private final WatchdogTimerInterface watchdogTimer;
private final ProgramStackInterface programStack;
private final WindowManagement createWindow;
private final TableInterface table;
private final DataRegisterInterface dataRegister;
private final IOPortInterface ioPorts;
private final ToggleButtonInterface toggleButtonExt;
private final ParseFile fileParser;
public Controller_Frontend(CommandInterface commands, WatchdogTimerInterface watchdogTimer,
ProgramStackInterface programStack, WindowManagement createWindow, TableInterface table,
DataRegisterInterface dataRegister, IOPortInterface ioPorts, ToggleButtonInterface toggleButtons,
ParseFile fileParser) {
this.commands = commands;
this.watchdogTimer = watchdogTimer;
this.programStack = programStack;
this.createWindow = createWindow;
this.table = table;
this.dataRegister = dataRegister;
this.ioPorts = ioPorts;
this.toggleButtonExt = toggleButtons;
this.fileParser = fileParser;
public Controller_Frontend() {
super();
System.out.println(this);
}
@ -258,8 +238,8 @@ public class Controller_Frontend implements FrontendControllerInterface {
commands.decode(0);
}
watchdogTimer.testAndTrigger();
table.refresh();
createWindow.refreshTable();
Table.refresh();
CreateWindow.refreshTable();
ioPorts.refreshUI(getTRISbuttons(), getPORTbuttons());
updateStack();
updateWatchdog();
@ -303,6 +283,8 @@ public class Controller_Frontend implements FrontendControllerInterface {
stopAutoRun(null);
if(selectedFile != null){
String fileAddress = selectedFile.getAbsolutePath();
System.out.println(dataRegister);
if (null == dataRegister) dataRegister = (DataRegisterInterface) picComponents.getComponent(DataRegisterInterface.class);
dataRegister.initDataRegister();
dataRegister.resetPC();
toggleLEDs(null);
@ -322,7 +304,7 @@ public class Controller_Frontend implements FrontendControllerInterface {
commands.resetTotalExecutionTime();
watchdogTimer.reset();
wdtCheck.setSelected(false);
table.refresh();
Table.refresh();
read = ParseFile.parseDatei(fileAddress);
prog = read [0];
ind = read[1];
@ -491,8 +473,8 @@ public class Controller_Frontend implements FrontendControllerInterface {
allPORTButtons[i].getToggles().get(0).setSelected(true);
allTRISButtons[i].getToggles().get(1).setSelected(false);
allPORTButtons[i].getToggles().get(1).setSelected(false);
toggleButtonExt.get().addAlwaysOneSelectedSupport(allTRISButtons[i]);
toggleButtonExt.get().addAlwaysOneSelectedSupport(allPORTButtons[i]);
toggleButtonExt.addAlwaysOneSelectedSupport(allTRISButtons[i]);
toggleButtonExt.addAlwaysOneSelectedSupport(allPORTButtons[i]);
}
ledCheckA.setSelected(false);
@ -601,7 +583,9 @@ public class Controller_Frontend implements FrontendControllerInterface {
@Override
public void initialize(PICComponents picComponents) {
super.initialize(picComponents);
this.picComponents = picComponents;
System.out.println("Frontend");
}
}