forked from IF-LK-2020/stundenplan
datensatz erweitert und filter nach Raum hinzugefügt
This commit is contained in:
parent
f889549a3b
commit
1ba4f9ce84
|
@ -26,3 +26,4 @@ hs_err_pid*
|
|||
/out/
|
||||
/.idea/
|
||||
/.~lock.Tage.csv#
|
||||
/alt/
|
||||
|
|
1202
Stunden.csv
1202
Stunden.csv
File diff suppressed because it is too large
Load Diff
|
@ -52,8 +52,18 @@ public class Stundenplan implements SelectionListener {
|
|||
for (int i = 0; i < r.getRowCount(); i++) {
|
||||
klassen[i] = r.getData()[i][0];
|
||||
}
|
||||
gui.addFilter("Lehrer", teachers);
|
||||
dbc.executeStatement("SELECT nummer FROM raeume");
|
||||
r = dbc.getCurrentQueryResult();
|
||||
String[] raeume = new String[r.getRowCount()];
|
||||
for (int i = 0; i < r.getRowCount(); i++) {
|
||||
raeume[i] = r.getData()[i][0];
|
||||
}
|
||||
|
||||
|
||||
gui.addFilter("Klasse", klassen);
|
||||
gui.addFilter("Lehrer", teachers);
|
||||
gui.addFilter("Raum", raeume);
|
||||
|
||||
// GUI anzeigen und Verhalten bei Interaktion festlegen
|
||||
gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
gui.addSelectionListener(this); // GUI ruft Methode selectionChanged auf, wenn sich eine Auswahlbox ändert.
|
||||
|
@ -74,10 +84,10 @@ public class Stundenplan implements SelectionListener {
|
|||
*/
|
||||
@Override
|
||||
public void selectionChanged(String pList, String pNewValue) {
|
||||
|
||||
gui.removeAllLessons();
|
||||
if (pList == "Lehrer") {
|
||||
// Zuerst alle bisherigen Stunden aus der GUI entfernen
|
||||
gui.removeAllLessons();
|
||||
|
||||
|
||||
// Neue Daten aus der Datenbank abfragen.
|
||||
// Hier gefakte Daten, die Struktur der Datenbank ist nicht vorgegeben.
|
||||
|
@ -104,8 +114,7 @@ public class Stundenplan implements SelectionListener {
|
|||
}
|
||||
|
||||
// GUI-Fenster neu zeichnen, um neue Elemente anzuzeigen.
|
||||
gui.revalidate();
|
||||
gui.repaint();
|
||||
|
||||
}
|
||||
}
|
||||
if (pList == "Klasse"){
|
||||
|
@ -131,10 +140,37 @@ public class Stundenplan implements SelectionListener {
|
|||
}
|
||||
|
||||
// GUI-Fenster neu zeichnen, um neue Elemente anzuzeigen.
|
||||
gui.revalidate();
|
||||
gui.repaint();
|
||||
|
||||
}
|
||||
}
|
||||
if (pList == "Raum"){
|
||||
dbc.executeStatement("SELECT blocknummer, raum, name, wochentag, kuerzel, Fach, stundenbeginn, stundendende FROM Stunden JOIN klassen ON Stunden.klassen_id = klassen.id JOIN unterrichtet ON unterrichtet.Stundenid = Stunden.id JOIN tagesblocks ON blocknr = blocknummer WHERE raum = \""+pNewValue+"\"");
|
||||
QueryResult r = dbc.getCurrentQueryResult();
|
||||
if (r != null) {
|
||||
String[][] data = r.getData();
|
||||
|
||||
// Neue Stunden in die GUI schreiben
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
int wochentag = getWochentag(r,i);
|
||||
gui.addLesson(
|
||||
|
||||
wochentag, // Spalte im Plan (0=Montag, ... ,4=Freitag)
|
||||
Integer.parseInt(data[i][0])-1, // Zeile im Plan (0=1. Stunde, ... ,9=10. Stunde)
|
||||
//Integer.parseInt(t.getData()[i][0])-1,
|
||||
data[i][5], // Titel
|
||||
"Raum " + data[i][1] + " | " + data[i][6] + " - " + data[i][7], // Untertitel
|
||||
data[i][4], // Beschreibungstext
|
||||
data[i][2], // Fußzeile
|
||||
new Color(colors(data,i)) // Farbe (Objekt der Klasse Color)
|
||||
);
|
||||
}
|
||||
|
||||
// GUI-Fenster neu zeichnen, um neue Elemente anzuzeigen.
|
||||
|
||||
}
|
||||
}
|
||||
gui.revalidate();
|
||||
gui.repaint();
|
||||
}
|
||||
|
||||
private int colors(String[][]data,int row){
|
||||
|
|
24
klassen.csv
24
klassen.csv
|
@ -1,7 +1,19 @@
|
|||
id,name,jahrgang
|
||||
1,a,5
|
||||
2,b,5
|
||||
3,c,5
|
||||
4,a,6
|
||||
5,b,6
|
||||
6,c,6
|
||||
1,5a,5
|
||||
2,5b,5
|
||||
3,5c,5
|
||||
4,6a,6
|
||||
5,6b,6
|
||||
6,6c,6
|
||||
7,7a,7
|
||||
8,7b,7
|
||||
9,7c,7
|
||||
10,8a,8
|
||||
11,8a,8
|
||||
12,8c,8
|
||||
13,9a,9
|
||||
14,9b,9
|
||||
15,9c,9
|
||||
16,10a,10
|
||||
17,10b,10
|
||||
18,10c,10
|
||||
|
|
|
BIN
stundenplan.db
BIN
stundenplan.db
Binary file not shown.
1200
unterrichtet.csv
1200
unterrichtet.csv
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue