This commit is contained in:
Sage The DM 2024-11-20 13:58:01 +01:00
commit bfa313d60d
23 changed files with 519 additions and 69 deletions

View file

@ -12,14 +12,37 @@ public class App {
public static final Lesson[][][] timeTable = new Lesson[ROOM_COUNT][DAY_COUNT][LESSON_COUNT]; public static final Lesson[][][] timeTable = new Lesson[ROOM_COUNT][DAY_COUNT][LESSON_COUNT];
private static final Teacher[] teachers = new Teacher[Teacher.nameMap.size()]; private static final Teacher[] teachers = new Teacher[Teacher.nameMap.size()];
// URLs for fetching CO2 data // Date constants
private static final String ROOM_39_URL = "https://api.thingspeak.com/channels/1521262/feeds.csv?results=8000"; private static final int START_YEAR = 2024;
private static final String ROOM_38_URL = "https://api.thingspeak.com/channels/1364580/feeds.csv?results=8000"; private static final int START_MONTH = 11; // November
private static final String ROOM_37_URL = "https://api.thingspeak.com/channels/1521263/feeds.csv?results=8000"; private static final int START_DAY = 4;
private static final String START_DATE = String.format("%d-%02d-%02d%%2000:00:00", START_YEAR, START_MONTH,
START_DAY);
private static final List<Co2Data> room39Data = Co2Data.getData(ROOM_39_URL, 39); private static final int END_YEAR = 2024;
private static final List<Co2Data> room38Data = Co2Data.getData(ROOM_38_URL, 38); private static final int END_MONTH = 11; // November
private static final List<Co2Data> room37Data = Co2Data.getData(ROOM_37_URL, 37); private static final int END_DAY = 8;
private static final String END_DATE = String.format("%d-%02d-%02d%%2000:00:00", END_YEAR, END_MONTH, END_DAY);
// Room channel numbers
private static final int ROOM_39_NUMBER = 1521262;
private static final int ROOM_38_NUMBER = 1364580;
private static final int ROOM_37_NUMBER = 1521263;
// Room URLs
private static final String ROOM_39_URL = createUrl(ROOM_39_NUMBER);
private static final String ROOM_38_URL = createUrl(ROOM_38_NUMBER);
private static final String ROOM_37_URL = createUrl(ROOM_37_NUMBER);
// Room data
private static final List<Co2Data> ROOM_39_DATA = Co2Data.getData(ROOM_39_URL, 39);
private static final List<Co2Data> ROOM_38_DATA = Co2Data.getData(ROOM_38_URL, 38);
private static final List<Co2Data> ROOM_37_DATA = Co2Data.getData(ROOM_37_URL, 37);
private static String createUrl(int channelNumber) {
return String.format("https://api.thingspeak.com/channels/%d/feeds.csv?start=%s&end=%s", channelNumber,
START_DATE, END_DATE);
}
// #region Initialization // #region Initialization
private static void initializeTeachers() { private static void initializeTeachers() {
@ -36,23 +59,22 @@ public class App {
} }
// #region Calculation // #region Calculation
private static void calculatePoints(List<Co2Data> data) { private static void calculatePoints(List<Co2Data> data, int roomNumber) {
for (Co2Data co2Data : data) { for (Co2Data co2Data : data) {
Date temp = co2Data.getDate(); Date temp = co2Data.getDate();
int intHour = temp.getHour(); int intHour = temp.getHour();
int intMinute = temp.getMinute(); int intMinute = temp.getMinute();
int intDay = temp.getDay();
if (FillTable.isBreak(intHour, intMinute)) { if (FillTable.isBreak(intHour, intMinute)) {
String whatBreak = FillTable.whatBreakIsIt(intHour, intMinute, intDay); String whatBreak = FillTable.whatBreakIsIt(intHour, intMinute);
int[] time = FillTable.whatTime(intHour, intMinute);
switch (whatBreak) { switch (whatBreak) {
case "short": case "short":
calculateFiveMinuteBreakPoints(co2Data); calculateFiveMinuteBreakPoints(data, time, roomNumber);
break; break;
case "long": case "long":
calculateLongerBreakPoints(co2Data); calculateLongerBreakPoints(data, time, roomNumber);
break; break;
default: default:
break; break;
} }
@ -60,15 +82,105 @@ public class App {
} }
} }
private static void calculateFiveMinuteBreakPoints(Co2Data data) { // #region 5min
calculateBonusPoints(data); private static int calculateFiveMinuteBreakPoints(List<Co2Data> data, int[] time, int roomNumber) {
// Calculate the time range for the break (e.g., a 5-minute break)
int startMinute = time[0];
int endMinute = time[1];
int points = 5; // Start with maximum points
// Loop over each minute in the break and check the CO2 level
for (int i = startMinute; i < endMinute; i++) {
// Get the CO2 data for the current minute (using the data list)
Co2Data minuteData = getCo2DataForMinute(data, i); // data is already a List<Co2Data>
if (minuteData != null) {
int currentCo2 = minuteData.getCo2Level();
Co2Data previousMinuteData = getCo2DataForMinute(data, i - 1); // data is a List<Co2Data>
if (previousMinuteData != null) {
int previousCo2 = previousMinuteData.getCo2Level();
// If CO2 level doesn't decrease, subtract points
if (currentCo2 >= previousCo2) {
points--;
}
}
}
} }
private static void calculateLongerBreakPoints(Co2Data data) { // After calculating the points, consider any bonus points for teacher switch or
calculateBonusPoints(data); // other criteria
points += calculateBonusPoints(data, time, roomNumber);
return Math.max(points, 0); // Ensure that points don't go below zero
} }
private static void calculateBonusPoints(Co2Data data) { // #region 5+ min
private static int calculateLongerBreakPoints(List<Co2Data> data, int[] time, int roomNumber) {
// Take the time for the entire break
int startMinute = time[0];
int endMinute = time[1];
int points = 10; // Start with maximum points for longer break
// Loop over each minute in the break and check the CO2 level
for (int i = startMinute; i < endMinute; i++) {
// Get the CO2 data for the current minute (using the data list)
Co2Data minuteData = getCo2DataForMinute(data, i); // data is already a List<Co2Data>
if (minuteData != null) {
int currentCo2 = minuteData.getCo2Level();
Co2Data previousMinuteData = getCo2DataForMinute(data, i - 1); // data is a List<Co2Data>
if (previousMinuteData != null) {
int previousCo2 = previousMinuteData.getCo2Level();
// If CO2 level doesn't decrease, subtract points
if (currentCo2 >= previousCo2) {
points--;
}
}
}
}
// After calculating the points, consider any bonus points for teacher switch or
// other criteria
points += calculateBonusPoints(data, time, roomNumber);
return Math.max(points, 0); // Ensure that points don't go below zero
}
// #region bonus
private static int calculateBonusPoints(List<Co2Data> data, int[] time, int roomNumber) {
// Check if the next lesson isn't lunch or the same teacher (if the next lesson
// is lunch, no bonus points possible)
boolean isTeacherChange = isTeacherChange(data, roomNumber, time); // Check if the teacher is changing
boolean isNextLessonLunch = FillTable.isNextLessonLunch();
if (!isNextLessonLunch && isTeacherChange) {
return 5; // Bonus points for teacher switch
} else {
return 0; // No bonus points
}
}
// #region checks
private static boolean isTeacherChange(List<Co2Data> data, int roomNumber, int[] time) {
// go through the lesson table of that day and time for the room
// check if the last teacher in the room equals itself or another teacher
return false; // Placeholder logic (to be implemented based on the timetable)
}
private static Co2Data getCo2DataForMinute(List<Co2Data> data, int minute) {
// Logic to get the CO2 data for a specific minute in the break
for (Co2Data co2Data : data) {
if (co2Data.getDate().getMinute() == minute) {
return co2Data;
}
}
return null; // Return null if no data matches
} }
// #region Sorting Printing // #region Sorting Printing
@ -106,10 +218,8 @@ public class App {
while (true) { while (true) {
if (scanner.hasNextInt()) { if (scanner.hasNextInt()) {
return scanner.nextInt(); return scanner.nextInt();
} else {
System.out.println("Invalid input. Please enter a number.");
scanner.next();
} }
scanner.next(); // Clear invalid input
} }
} }
@ -117,7 +227,8 @@ public class App {
System.out.println("Point calculation explanation:"); System.out.println("Point calculation explanation:");
System.out.println("1. Up to 5 points for keeping the window open during a small pause."); System.out.println("1. Up to 5 points for keeping the window open during a small pause.");
System.out.println("2. Up to 10 points for long pauses, depending on window usage."); System.out.println("2. Up to 10 points for long pauses, depending on window usage.");
System.out.println("3. 5 bonus points for teacher switches in the room."); System.out.println("3. 5 bonus points for teacher switches in classrooms.");
System.out.println("4. Deduct points if CO2 levels are too high.");
} }
private static void printShutDown() { private static void printShutDown() {
@ -127,17 +238,16 @@ public class App {
try { try {
Thread.sleep(1000); Thread.sleep(1000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
Thread.currentThread().interrupt(); e.printStackTrace();
} }
} }
System.out.println("Goodbye!");
} }
// @TODO: remove this before hand-in deadline // @TODO: remove this before hand-in deadline
public static void debbugingValueLists(List<Co2Data> data) { public static void debbugingValueLists(List<Co2Data> data) {
// Debugging co2Data // Debugging co2Data
int index = 0; int index = 0;
for (Co2Data a : room37Data) { for (Co2Data a : data) {
System.out.println(a.toString()); System.out.println(a.toString());
index++; index++;
} }
@ -150,16 +260,16 @@ public class App {
public static void main(String[] args) { public static void main(String[] args) {
boolean debbugingList = false; boolean debbugingList = false;
if (debbugingList) { if (debbugingList) {
debbugingValueLists(room37Data); debbugingValueLists(ROOM_37_DATA);
// debbugingValueLists(room38Data); // debbugingValueLists(room38Data);
// debbugingValueLists(room39Data); // debbugingValueLists(room39Data);
} else { } else {
System.out.println("Calculations in process please do not shut off..."); System.out.println("Calculations in process please do not shut off...");
fillInTimeTable(); fillInTimeTable();
initializeTeachers(); initializeTeachers();
calculatePoints(room37Data); calculatePoints(ROOM_37_DATA, 37);
calculatePoints(room38Data); calculatePoints(ROOM_38_DATA, 38);
calculatePoints(room39Data); calculatePoints(ROOM_39_DATA, 39);
sortTeachers(); sortTeachers();
printTeachers(); printTeachers();
while (true) { while (true) {

View file

@ -1,6 +1,3 @@
import java.util.Calendar;
import java.util.GregorianCalendar;
public class Date { public class Date {
// #region Fields // #region Fields
private int day; private int day;
@ -42,34 +39,9 @@ public class Date {
return minute; return minute;
} }
// #region Helper Method to Check Daylight Saving Time
private boolean isDaylightSavingTime() {
Calendar calendar = new GregorianCalendar();
calendar.set(year, month - 1, day); // Month is 0-based in Calendar
// Last Sunday in March (DST starts)
Calendar lastSundayInMarch = new GregorianCalendar(year, Calendar.MARCH, 31);
lastSundayInMarch.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
lastSundayInMarch.add(Calendar.DATE, -7); // Go back to last Sunday of March
// Last Sunday in October (DST ends)
Calendar lastSundayInOctober = new GregorianCalendar(year, Calendar.OCTOBER, 31);
lastSundayInOctober.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
lastSundayInOctober.add(Calendar.DATE, -7); // Go back to last Sunday of October
// Check if the current date is within the DST period
return calendar.after(lastSundayInMarch) && calendar.before(lastSundayInOctober);
}
// #region Adjust UTC to Switzerland Time // #region Adjust UTC to Switzerland Time
private void adjustForSwitzerlandTime() { private void adjustForSwitzerlandTime() {
if (isDaylightSavingTime()) {
// Switzerland is UTC +2 during DST (CEST)
hour += 2;
} else {
// Switzerland is UTC +1 during Standard Time (CET)
hour += 1; hour += 1;
}
// Adjust if the hour exceeds 24 or falls below 0 // Adjust if the hour exceeds 24 or falls below 0
if (hour >= 24) { if (hour >= 24) {

View file

@ -16,7 +16,8 @@ public class FillTable {
int dayIndex = getDayIndex(day); int dayIndex = getDayIndex(day);
for (int i = 0; i < teacherShortNames.length && i < startTime.length && i < endTime.length; i++) { for (int i = 0; i < teacherShortNames.length && i < startTime.length && i < endTime.length; i++) {
Teacher teacher = new Teacher(teacherShortNames[i]); // Initialize Teacher with shortform Teacher teacher = new Teacher(teacherShortNames[i]); // Initialize Teacher with shortform
App.timeTable[roomIndex][dayIndex][i] = new Lesson(roomIndex, teacher.getName(), startTime[i], endTime[i], App.timeTable[roomIndex][dayIndex][i] = new Lesson(roomIndex, teacher.getName(), startTime[i],
endTime[i],
day); day);
} }
} }
@ -83,12 +84,76 @@ public class FillTable {
"Friday", START_TIMES, END_TIMES, roomIndex); "Friday", START_TIMES, END_TIMES, roomIndex);
} }
static boolean isBreak(int intHour, int intMinute) { // #region Check Methods
// Check if the time is between 7 AM and 5 PM static int[] whatTime(int intHour, int intMinute) {
if (intHour >= 7 && intHour <= 17) { int[] result = new int[2]; // [most recent end time, next start time]
// Check if the time falls between any lesson start and end times result[0] = -1; // Initialize to -1 (no previous end time found)
result[1] = -1; // Initialize to -1 (no next start time found)
for (int i = 0; i < END_TIMES.length; i++) {
// Parse END_TIMES[i]
String[] endParts = END_TIMES[i].split(":");
int endHour = Integer.parseInt(endParts[0]);
int endMinute = Integer.parseInt(endParts[1]);
// Parse START_TIMES[i]
String[] startParts = START_TIMES[i].split(":");
int startHour = Integer.parseInt(startParts[0]);
int startMinute = Integer.parseInt(startParts[1]);
// Check for the most recent end time
if ((intHour > endHour) || (intHour == endHour && intMinute >= endMinute)) {
result[0] = i; // Track the most recent lesson's end time index
}
// Check for the next start time
if ((intHour < startHour) || (intHour == startHour && intMinute < startMinute)) {
result[1] = i; // Track the next lesson's start time index
break; // No need to continue since START_TIMES is sorted
}
}
return result;
}
static boolean isNextLessonLunch(int intHour, int intMinute, int roomIndex) {
int currentTimeInMinutes = intHour * 60 + intMinute;
int nextLessonIndex = getNextLessonIndex(currentTimeInMinutes, roomIndex);
if (nextLessonIndex == -1) {
return false;
}
String nextLessonStartTime = START_TIMES[nextLessonIndex];
String[] nextLessonStartParts = nextLessonStartTime.split(":");
int nextLessonStartInMinutes = Integer.parseInt(nextLessonStartParts[0]) * 60
+ Integer.parseInt(nextLessonStartParts[1]);
if (nextLessonStartInMinutes > currentTimeInMinutes) {
String teacherShortName = App.timeTable[roomIndex][getDayIndex("Monday")][nextLessonIndex]
.getTeacherInitials();
return teacherShortName.equals("Lunch");
}
return false;
}
private static int getNextLessonIndex(int currentTimeInMinutes, int roomIndex) {
for (int i = 0; i < START_TIMES.length; i++) {
String[] startParts = START_TIMES[i].split(":");
int startTimeInMinutes = Integer.parseInt(startParts[0]) * 60 + Integer.parseInt(startParts[1]);
if (startTimeInMinutes > currentTimeInMinutes) {
return i;
}
}
return -1;
}
static boolean isBreak(int intHour, int intMinute) {
if (intHour >= 7 && intHour <= 17) {
for (int i = 0; i < START_TIMES.length; i++) { for (int i = 0; i < START_TIMES.length; i++) {
// Split the start and end times into hours and minutes
String[] startTime = START_TIMES[i].split(":"); String[] startTime = START_TIMES[i].split(":");
String[] endTime = END_TIMES[i].split(":"); String[] endTime = END_TIMES[i].split(":");
@ -97,19 +162,32 @@ public class FillTable {
int endHour = Integer.parseInt(endTime[0]); int endHour = Integer.parseInt(endTime[0]);
int endMinute = Integer.parseInt(endTime[1]); int endMinute = Integer.parseInt(endTime[1]);
// Check if the given time is during the current lesson
if ((intHour > startHour || (intHour == startHour && intMinute >= startMinute)) && if ((intHour > startHour || (intHour == startHour && intMinute >= startMinute)) &&
(intHour < endHour || (intHour == endHour && intMinute < endMinute))) { (intHour < endHour || (intHour == endHour && intMinute < endMinute))) {
return false; // It's not a break, it's during a lesson return false;
} }
} }
return true; // If no lessons match, it must be a break return true;
}
return false;
} }
return false; // Time is outside of the school hours (7 AM to 6 PM roughly) static String whatBreakIsIt(int intHour, int intMinute) {
String whatBreak = "";
for (int i = 0; i < END_TIMES.length; i++) {
String[] tempEnd = END_TIMES[i].split(":");
String[] tempStart = START_TIMES[i].split(":");
if (intHour >= Integer.parseInt(tempStart[0]) && intHour <= Integer.parseInt(tempEnd[0])) {
if (intMinute >= Integer.parseInt(tempStart[1])
&& intMinute <= Integer.parseInt(tempEnd[1])) {
if (Integer.parseInt(tempEnd[1]) - Integer.parseInt(tempStart[1]) == 5) {
whatBreak = "short";
} else if (Integer.parseInt(tempEnd[1]) - Integer.parseInt(tempStart[1]) > 5) {
whatBreak = "long";
} }
}
static String whatBreakIsIt(int intHour, int intMinute, int intDay) { }
return "No Break"; // If no break is found, return "No Break" }
return whatBreak;
} }
} }

View file

@ -0,0 +1,51 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>_10_steuerrechner</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>13</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>13</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.6</version>
<executions>
<execution>
<!-- Default configuration for running -->
<!-- Usage: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<mainClass>com.example.App</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View file

@ -0,0 +1,38 @@
package com.example;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
/**
* JavaFX App
*/
public class App extends Application {
private static Scene scene;
@Override
public void start(Stage stage) throws IOException {
scene = new Scene(loadFXML("primary"), 640, 480);
stage.setScene(scene);
stage.show();
}
static void setRoot(String fxml) throws IOException {
scene.setRoot(loadFXML(fxml));
}
private static Parent loadFXML(String fxml) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml"));
return fxmlLoader.load();
}
public static void main(String[] args) {
launch();
}
}

View file

@ -0,0 +1,12 @@
package com.example;
import java.io.IOException;
import javafx.fxml.FXML;
public class PrimaryController {
@FXML
private void switchToSecondary() throws IOException {
App.setRoot("secondary");
}
}

View file

@ -0,0 +1,12 @@
package com.example;
import java.io.IOException;
import javafx.fxml.FXML;
public class SecondaryController {
@FXML
private void switchToPrimary() throws IOException {
App.setRoot("primary");
}
}

View file

@ -0,0 +1,7 @@
module com.example {
requires javafx.controls;
requires javafx.fxml;
opens com.example to javafx.fxml;
exports com.example;
}

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>
<GridPane alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/23.0.1" fx:controller="com.example.PrimaryController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<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>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Netto" wrappingWidth="90.13000106811523">
<GridPane.margin>
<Insets left="20.0" />
</GridPane.margin>
</Text>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Umsatzsteuer" GridPane.rowIndex="1">
<GridPane.margin>
<Insets left="20.0" />
</GridPane.margin>
</Text>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Brutto" GridPane.rowIndex="2">
<GridPane.margin>
<Insets left="20.0" />
</GridPane.margin>
</Text>
<TextField fx:id="inpNetto" promptText="Wert eingeben" GridPane.columnIndex="1">
<GridPane.margin>
<Insets right="20.0" />
</GridPane.margin>
</TextField>
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
<children>
<TextField fx:id="inpTax" promptText="Wert eingeben">
<HBox.margin>
<Insets right="20.0" />
</HBox.margin>
</TextField>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="\%" />
</children>
</HBox>
<VBox alignment="CENTER_LEFT" prefHeight="200.0" prefWidth="100.0" GridPane.columnIndex="1" GridPane.rowIndex="2">
<children>
<TextField fx:id="outBrutto">
<VBox.margin>
<Insets right="20.0" top="20.0" />
</VBox.margin>
</TextField>
<Button mnemonicParsing="false" text="Berechnen">
<VBox.margin>
<Insets top="20.0" />
</VBox.margin>
</Button>
</children>
</VBox>
</children>
</GridPane>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Button?>
<?import javafx.geometry.Insets?>
<VBox alignment="CENTER" spacing="20.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.SecondaryController">
<children>
<Label text="Secondary View" />
<Button fx:id="secondaryButton" text="Switch to Primary View" onAction="#switchToPrimary" />
</children>
<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
</padding>
</VBox>

View file

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>
<GridPane alignment="CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/23.0.1" fx:controller="com.example.PrimaryController">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<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>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Netto" wrappingWidth="90.13000106811523">
<GridPane.margin>
<Insets left="20.0" />
</GridPane.margin>
</Text>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Umsatzsteuer" GridPane.rowIndex="1">
<GridPane.margin>
<Insets left="20.0" />
</GridPane.margin>
</Text>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Brutto" GridPane.rowIndex="2">
<GridPane.margin>
<Insets left="20.0" />
</GridPane.margin>
</Text>
<TextField fx:id="inpNetto" promptText="Wert eingeben" GridPane.columnIndex="1">
<GridPane.margin>
<Insets right="20.0" />
</GridPane.margin>
</TextField>
<HBox alignment="CENTER_LEFT" prefHeight="100.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
<children>
<TextField fx:id="inpTax" promptText="Wert eingeben">
<HBox.margin>
<Insets right="20.0" />
</HBox.margin>
</TextField>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="\%" />
</children>
</HBox>
<VBox alignment="CENTER_LEFT" prefHeight="200.0" prefWidth="100.0" GridPane.columnIndex="1" GridPane.rowIndex="2">
<children>
<TextField fx:id="outBrutto">
<VBox.margin>
<Insets right="20.0" top="20.0" />
</VBox.margin>
</TextField>
<Button mnemonicParsing="false" text="Berechnen">
<VBox.margin>
<Insets top="20.0" />
</VBox.margin>
</Button>
</children>
</VBox>
</children>
</GridPane>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Button?>
<?import javafx.geometry.Insets?>
<VBox alignment="CENTER" spacing="20.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.example.SecondaryController">
<children>
<Label text="Secondary View" />
<Button fx:id="secondaryButton" text="Switch to Primary View" onAction="#switchToPrimary" />
</children>
<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
</padding>
</VBox>