introduce exam scheduling feature with CSP algorithm and calendar UI

This commit is contained in:
feyzagereme
2025-12-14 18:12:30 +03:00
parent 57b80a63b2
commit dbdb46e5de
4 changed files with 709 additions and 110 deletions

View File

@@ -4,64 +4,153 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<BorderPane xmlns="http://javafx.com/javafx"
<ScrollPane xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="org.example.se302.controller.ScheduleCalendarController"
styleClass="content-pane">
<top>
<VBox spacing="10">
<padding>
<Insets top="20" right="20" bottom="10" left="20"/>
</padding>
<Label text="Calendar View - Exam Schedule" styleClass="section-title"/>
<HBox spacing="10" alignment="CENTER_LEFT">
<Label text="Exam Period:"/>
<DatePicker fx:id="startDatePicker" promptText="Start Date"/>
<Label text="to"/>
<DatePicker fx:id="endDatePicker" promptText="End Date"/>
<Button text="Generate Schedule" onAction="#onGenerateSchedule" styleClass="primary-button"/>
</HBox>
</VBox>
</top>
<center>
<VBox spacing="10" alignment="CENTER">
<padding>
<Insets top="50" right="20" bottom="50" left="20"/>
</padding>
<Label text="📅" style="-fx-font-size: 48px;"/>
<Label text="Schedule Generation Coming Soon" styleClass="info-title"/>
<Label text="The calendar grid will display exam schedules across days and time slots."
wrapText="true" textAlignment="CENTER" maxWidth="500"/>
<Separator prefWidth="300"/>
<Label text="Preview: Grid Layout" styleClass="subsection-title"/>
<GridPane gridLinesVisible="true" styleClass="schedule-grid">
fitToWidth="true" fitToHeight="true"
hbarPolicy="AS_NEEDED" vbarPolicy="AS_NEEDED">
<BorderPane styleClass="content-pane">
<top>
<VBox spacing="15">
<padding>
<Insets top="10" right="10" bottom="10" left="10"/>
<Insets top="20" right="20" bottom="10" left="20"/>
</padding>
<!-- Header row -->
<Label text="" GridPane.columnIndex="0" GridPane.rowIndex="0" styleClass="grid-header"/>
<Label text="Day 1" GridPane.columnIndex="1" GridPane.rowIndex="0" styleClass="grid-header"/>
<Label text="Day 2" GridPane.columnIndex="2" GridPane.rowIndex="0" styleClass="grid-header"/>
<Label text="Day 3" GridPane.columnIndex="3" GridPane.rowIndex="0" styleClass="grid-header"/>
<!-- Time slots -->
<Label text="09:00" GridPane.columnIndex="0" GridPane.rowIndex="1" styleClass="grid-header"/>
<Label text="-" GridPane.columnIndex="1" GridPane.rowIndex="1" styleClass="grid-cell"/>
<Label text="-" GridPane.columnIndex="2" GridPane.rowIndex="1" styleClass="grid-cell"/>
<Label text="-" GridPane.columnIndex="3" GridPane.rowIndex="1" styleClass="grid-cell"/>
<Label text="11:00" GridPane.columnIndex="0" GridPane.rowIndex="2" styleClass="grid-header"/>
<Label text="-" GridPane.columnIndex="1" GridPane.rowIndex="2" styleClass="grid-cell"/>
<Label text="-" GridPane.columnIndex="2" GridPane.rowIndex="2" styleClass="grid-cell"/>
<Label text="-" GridPane.columnIndex="3" GridPane.rowIndex="2" styleClass="grid-cell"/>
<Label text="14:00" GridPane.columnIndex="0" GridPane.rowIndex="3" styleClass="grid-header"/>
<Label text="-" GridPane.columnIndex="1" GridPane.rowIndex="3" styleClass="grid-cell"/>
<Label text="-" GridPane.columnIndex="2" GridPane.rowIndex="3" styleClass="grid-cell"/>
<Label text="-" GridPane.columnIndex="3" GridPane.rowIndex="3" styleClass="grid-cell"/>
</GridPane>
</VBox>
</center>
</BorderPane>
<!-- Page Title -->
<Label text="📅 Calendar View - Exam Schedule Generator" styleClass="section-title"/>
<Label text="Configure and generate an optimized exam schedule using CSP algorithm."
wrapText="true" styleClass="description-label"/>
<Separator/>
<!-- Configuration Panel -->
<VBox spacing="15" styleClass="config-panel">
<Label text="Schedule Configuration" styleClass="subsection-title"/>
<!-- Row 1: Days and Slots -->
<HBox spacing="20" alignment="CENTER_LEFT">
<VBox spacing="5">
<Label text="Number of Days:"/>
<Spinner fx:id="numDaysSpinner" min="1" max="30" initialValue="5"
editable="true" prefWidth="100"/>
</VBox>
<VBox spacing="5">
<Label text="Slots per Day:"/>
<Spinner fx:id="slotsPerDaySpinner" min="1" max="10" initialValue="4"
editable="true" prefWidth="100"/>
</VBox>
<VBox spacing="5">
<Label text="Start Date:"/>
<DatePicker fx:id="startDatePicker" promptText="Select Start Date" prefWidth="150"/>
</VBox>
<VBox spacing="5">
<Label text="Slot Duration (min):"/>
<Spinner fx:id="slotDurationSpinner" min="30" max="240" initialValue="120"
editable="true" prefWidth="100"/>
</VBox>
</HBox>
<!-- Row 2: Strategy and Options -->
<HBox spacing="20" alignment="CENTER_LEFT">
<VBox spacing="5">
<Label text="Optimization Strategy:"/>
<ComboBox fx:id="strategyComboBox" prefWidth="200" promptText="Select Strategy"/>
</VBox>
<VBox spacing="5">
<Label text="Day Start Time:"/>
<ComboBox fx:id="startTimeComboBox" prefWidth="120" promptText="09:00"/>
</VBox>
<VBox spacing="5" alignment="CENTER_LEFT">
<padding>
<Insets top="18"/>
</padding>
<CheckBox fx:id="allowBackToBackCheckBox" text="Allow back-to-back exams" selected="true"/>
</VBox>
</HBox>
<!-- Row 3: Summary -->
<HBox spacing="10" alignment="CENTER_LEFT" styleClass="summary-row">
<Label text="Configuration Summary:"/>
<Label fx:id="summaryLabel" text="5 days × 4 slots = 20 total time slots"
styleClass="summary-value"/>
</HBox>
</VBox>
<Separator/>
<!-- Action Buttons -->
<HBox spacing="15" alignment="CENTER_LEFT">
<Button fx:id="generateButton" text="🚀 Generate Schedule"
onAction="#onGenerateSchedule" styleClass="primary-button" prefWidth="180"/>
<Button fx:id="cancelButton" text="Cancel" onAction="#onCancelGeneration"
disable="true" prefWidth="100"/>
<Region HBox.hgrow="ALWAYS"/>
<Label fx:id="statusLabel" text="Ready" styleClass="status-label"/>
</HBox>
<!-- Progress Bar -->
<VBox fx:id="progressContainer" spacing="5" visible="false" managed="false">
<ProgressBar fx:id="progressBar" prefWidth="400" progress="0"/>
<Label fx:id="progressLabel" text="Initializing..."/>
</VBox>
</VBox>
</top>
<center>
<VBox spacing="15">
<padding>
<Insets top="20" right="20" bottom="20" left="20"/>
</padding>
<!-- Schedule Grid Container -->
<Label text="Generated Schedule" styleClass="subsection-title"/>
<ScrollPane fx:id="scheduleScrollPane" fitToWidth="true" fitToHeight="false"
prefHeight="500" minHeight="300"
hbarPolicy="ALWAYS" vbarPolicy="ALWAYS"
VBox.vgrow="ALWAYS"
style="-fx-background-color: white; -fx-border-color: #bdc3c7; -fx-border-width: 1;">
<GridPane fx:id="scheduleGrid" gridLinesVisible="true" styleClass="schedule-grid"
minWidth="800" minHeight="400">
<padding>
<Insets top="10" right="10" bottom="10" left="10"/>
</padding>
<!-- Grid will be populated dynamically -->
<Label text="Click 'Generate Schedule' to create an exam schedule"
GridPane.columnIndex="0" GridPane.rowIndex="0"
styleClass="placeholder-text" wrapText="true"/>
</GridPane>
</ScrollPane>
<!-- Statistics Panel -->
<HBox spacing="30" alignment="CENTER_LEFT" styleClass="stats-panel">
<VBox spacing="3" alignment="CENTER">
<Label fx:id="totalCoursesLabel" text="0" styleClass="stat-value"/>
<Label text="Total Courses" styleClass="stat-label"/>
</VBox>
<Separator orientation="VERTICAL"/>
<VBox spacing="3" alignment="CENTER">
<Label fx:id="scheduledCoursesLabel" text="0" styleClass="stat-value"/>
<Label text="Scheduled" styleClass="stat-label"/>
</VBox>
<Separator orientation="VERTICAL"/>
<VBox spacing="3" alignment="CENTER">
<Label fx:id="classroomsUsedLabel" text="0" styleClass="stat-value"/>
<Label text="Classrooms Used" styleClass="stat-label"/>
</VBox>
<Separator orientation="VERTICAL"/>
<VBox spacing="3" alignment="CENTER">
<Label fx:id="generationTimeLabel" text="-" styleClass="stat-value"/>
<Label text="Generation Time" styleClass="stat-label"/>
</VBox>
</HBox>
</VBox>
</center>
</BorderPane>
</ScrollPane>