diff --git a/.vscode/launch.json b/.vscode/launch.json index 79763db..8fccd33 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,14 +8,14 @@ "type": "java", "name": "Launch Current File", "request": "launch", - "mainClass": "${file}" + "mainClass": "${file}", }, { "type": "java", "name": "Launch App", "request": "launch", "mainClass": "xyz.thastertyn.App", - "projectName": "jecnak-tui" + "projectName": "jecnak-tui", } ] } \ No newline at end of file diff --git a/src/main/java/xyz/thastertyn/Jecna/Znamky.java b/src/main/java/xyz/thastertyn/Jecna/Znamky.java index 6996cf1..59b0c4f 100644 --- a/src/main/java/xyz/thastertyn/Jecna/Znamky.java +++ b/src/main/java/xyz/thastertyn/Jecna/Znamky.java @@ -39,6 +39,11 @@ public class Znamky { int divisor = 0; for(Pair p : a) { + if(p.getValue0() == -1) + { + continue; + } + divident += p.getValue0() * p.getValue1(); divisor += p.getValue1(); } @@ -84,7 +89,14 @@ public class Znamky { break; } - int znamka = Integer.parseInt(znamkaElement.select("span.value").text()); + String zn = znamkaElement.select("span.value").text(); + int znamka; + if(zn.toLowerCase().equals("n") || zn.toLowerCase().equals("u")) + { + znamka = -1; + }else{ + znamka = Integer.parseInt(znamkaElement.select("span.value").text()); + } // Mala znamka se bude pocitat jako polovicni vaha if(znamkaElement.hasClass("scoreSmall")) diff --git a/src/main/java/xyz/thastertyn/Window/Content/Rozvrh.java b/src/main/java/xyz/thastertyn/Window/Content/Rozvrh.java index b8aeb0f..a023c73 100644 --- a/src/main/java/xyz/thastertyn/Window/Content/Rozvrh.java +++ b/src/main/java/xyz/thastertyn/Window/Content/Rozvrh.java @@ -15,8 +15,8 @@ public class Rozvrh extends JecnaContent { private xyz.thastertyn.Jecna.Rozvrh rozvrh = new xyz.thastertyn.Jecna.Rozvrh(); - //private String[] labels = {"Den", "7:30-8:15", "8:25-9:10", "9:20-10:05", "10:20-11:05", "11:15-12:00", "12:10-12:55", "13:05-13:50", "14:00-14:45", "14:55-15:40", "15:50-16:35"}; - private String[] labels = {"Den", "1.", "2.", "3.", "4.", "5.", "6.", "7.", "8.", "9.", "10."}; + private String[] labels = {"Den", "7:30-8:15", "8:25-9:10", "9:20-10:05", "10:20-11:05", "11:15-12:00", "12:10-12:55", "13:05-13:50", "14:00-14:45", "14:55-15:40", "15:50-16:35"}; + //private String[] labels = {"Den", "1.", "2.", "3.", "4.", "5.", "6.", "7.", "8.", "9.", "10."}; String[] days = {"PO", "UT", "ST", "CT", "PA"}; diff --git a/src/main/java/xyz/thastertyn/Window/Content/Znamky.java b/src/main/java/xyz/thastertyn/Window/Content/Znamky.java index acac87f..b12beec 100644 --- a/src/main/java/xyz/thastertyn/Window/Content/Znamky.java +++ b/src/main/java/xyz/thastertyn/Window/Content/Znamky.java @@ -48,6 +48,10 @@ public class Znamky extends JecnaContent { Label znamkaLabel = new Label(znamka.getValue0() + ""); switch(znamka.getValue0()) { + case -1: + znamkaLabel.setText("N"); + znamkaLabel.setTheme(new SimpleTheme(TextColor.ANSI.WHITE, TextColor.ANSI.BLACK)); + break; case 1: znamkaLabel.setTheme(new SimpleTheme(TextColor.ANSI.BLACK, TextColor.ANSI.GREEN)); break; diff --git a/src/main/java/xyz/thastertyn/Window/MainWindow.java b/src/main/java/xyz/thastertyn/Window/MainWindow.java index 33e2342..0762c38 100644 --- a/src/main/java/xyz/thastertyn/Window/MainWindow.java +++ b/src/main/java/xyz/thastertyn/Window/MainWindow.java @@ -4,6 +4,8 @@ import java.io.IOException; import java.util.Arrays; import com.googlecode.lanterna.TextColor; import com.googlecode.lanterna.gui2.BasicWindow; +import com.googlecode.lanterna.gui2.Border; +import com.googlecode.lanterna.gui2.Borders; import com.googlecode.lanterna.gui2.DefaultWindowManager; import com.googlecode.lanterna.gui2.Direction; import com.googlecode.lanterna.gui2.EmptySpace; @@ -51,14 +53,16 @@ public class MainWindow { window.setComponent(mainPanel); mainPanel.addComponent(new Separator(Direction.VERTICAL).setLayoutData(LinearLayout.createLayoutData(LinearLayout.Alignment.Fill))); + + String text = "Jecnak"; Panel content = new Panel(); - content.addTo(mainPanel); + mainPanel.addComponent(content.withBorder(Borders.singleLine(text))); Login login = new Login(); login.showDialog(textGUI); - window.addWindowListener(new WindowSwitchListener(content, login.getJessionId())); + window.addWindowListener(new WindowSwitchListener(content, login.getJessionId(), text)); textGUI.addWindowAndWait(window); diff --git a/src/main/java/xyz/thastertyn/Window/WindowSwitchListener.java b/src/main/java/xyz/thastertyn/Window/WindowSwitchListener.java index 4a70d2c..fe82502 100644 --- a/src/main/java/xyz/thastertyn/Window/WindowSwitchListener.java +++ b/src/main/java/xyz/thastertyn/Window/WindowSwitchListener.java @@ -4,7 +4,6 @@ import java.util.concurrent.atomic.AtomicBoolean; import com.googlecode.lanterna.TerminalPosition; import com.googlecode.lanterna.TerminalSize; -import com.googlecode.lanterna.gui2.Label; import com.googlecode.lanterna.gui2.Panel; import com.googlecode.lanterna.gui2.Window; import com.googlecode.lanterna.gui2.WindowBasedTextGUI; @@ -25,11 +24,11 @@ public class WindowSwitchListener implements WindowListener { private String JsessionId; Panel panel; - Label label; + String label; int current = 0; - public WindowSwitchListener(Panel holder, String JsessionId) + public WindowSwitchListener(Panel holder, String JsessionId, String label) { panel = holder; this.JsessionId = JsessionId; @@ -42,7 +41,7 @@ public class WindowSwitchListener implements WindowListener { contents[0].download(JsessionId); panel.removeAllComponents(); panel.addComponent(contents[0].getPanel()); - //label.setText(contents[0].getLabel()); + label = contents[0].getLabel(); } public void next() @@ -58,11 +57,11 @@ public class WindowSwitchListener implements WindowListener { { contents[current].download(JsessionId); } - + panel.removeAllComponents(); panel.addComponent(contents[current].getPanel()); - //label.setText(contents[current].getLabel()); + label = contents[current].getLabel(); } public void previous() @@ -81,7 +80,7 @@ public class WindowSwitchListener implements WindowListener { panel.removeAllComponents(); panel.addComponent(contents[current].getPanel()); - //label.setText(contents[current].getLabel()); + label = contents[current].getLabel(); } diff --git a/target/classes/xyz/thastertyn/Jecna/Znamky.class b/target/classes/xyz/thastertyn/Jecna/Znamky.class index 78c6ac4..0f1f0a0 100644 Binary files a/target/classes/xyz/thastertyn/Jecna/Znamky.class and b/target/classes/xyz/thastertyn/Jecna/Znamky.class differ diff --git a/target/classes/xyz/thastertyn/Window/Content/Rozvrh.class b/target/classes/xyz/thastertyn/Window/Content/Rozvrh.class index dec4b33..acffc40 100644 Binary files a/target/classes/xyz/thastertyn/Window/Content/Rozvrh.class and b/target/classes/xyz/thastertyn/Window/Content/Rozvrh.class differ diff --git a/target/classes/xyz/thastertyn/Window/Content/Znamky.class b/target/classes/xyz/thastertyn/Window/Content/Znamky.class index 360f92f..7b537cd 100644 Binary files a/target/classes/xyz/thastertyn/Window/Content/Znamky.class and b/target/classes/xyz/thastertyn/Window/Content/Znamky.class differ diff --git a/target/classes/xyz/thastertyn/Window/MainWindow.class b/target/classes/xyz/thastertyn/Window/MainWindow.class index c77f893..d0461ea 100644 Binary files a/target/classes/xyz/thastertyn/Window/MainWindow.class and b/target/classes/xyz/thastertyn/Window/MainWindow.class differ diff --git a/target/classes/xyz/thastertyn/Window/WindowSwitchListener.class b/target/classes/xyz/thastertyn/Window/WindowSwitchListener.class index a401765..2c554e9 100644 Binary files a/target/classes/xyz/thastertyn/Window/WindowSwitchListener.class and b/target/classes/xyz/thastertyn/Window/WindowSwitchListener.class differ