diff --git a/src/main/java/xyz/thastertyn/App.java b/src/main/java/xyz/thastertyn/App.java index 0eca844..a7ec750 100644 --- a/src/main/java/xyz/thastertyn/App.java +++ b/src/main/java/xyz/thastertyn/App.java @@ -1,6 +1,6 @@ package xyz.thastertyn; -import xyz.thastertyn.ContentDisplay.MainWindow; +import xyz.thastertyn.Display.MainWindow; /** * Hello world! diff --git a/src/main/java/xyz/thastertyn/ContentDisplay/Content/Jidelna.java b/src/main/java/xyz/thastertyn/ContentDisplay/Content/Jidelna.java deleted file mode 100644 index 7368bb9..0000000 --- a/src/main/java/xyz/thastertyn/ContentDisplay/Content/Jidelna.java +++ /dev/null @@ -1,5 +0,0 @@ -package xyz.thastertyn.ContentDisplay.Content; - -public class Jidelna { - -} diff --git a/src/main/java/xyz/thastertyn/ContentDisplay/Content/JecnaContent.java b/src/main/java/xyz/thastertyn/Display/Content/JecnaContent.java similarity index 70% rename from src/main/java/xyz/thastertyn/ContentDisplay/Content/JecnaContent.java rename to src/main/java/xyz/thastertyn/Display/Content/JecnaContent.java index a416d6b..ab6b109 100644 --- a/src/main/java/xyz/thastertyn/ContentDisplay/Content/JecnaContent.java +++ b/src/main/java/xyz/thastertyn/Display/Content/JecnaContent.java @@ -1,6 +1,7 @@ -package xyz.thastertyn.ContentDisplay.Content; +package xyz.thastertyn.Display.Content; import com.googlecode.lanterna.gui2.WindowBasedTextGUI; +import com.googlecode.lanterna.gui2.dialogs.MessageDialog; import com.googlecode.lanterna.gui2.Panel; import com.googlecode.lanterna.gui2.Label; @@ -13,6 +14,5 @@ public abstract class JecnaContent { public abstract void download(); public abstract boolean hasStarted(); public abstract Label getLabel(); - public abstract void specify(final int y, final int hy); - public abstract void getOptions(final WindowBasedTextGUI textGUI); + public abstract void showOptions(final WindowBasedTextGUI textGUI); } diff --git a/src/main/java/xyz/thastertyn/Display/Content/Jidelna.java b/src/main/java/xyz/thastertyn/Display/Content/Jidelna.java new file mode 100644 index 0000000..7b4156b --- /dev/null +++ b/src/main/java/xyz/thastertyn/Display/Content/Jidelna.java @@ -0,0 +1,5 @@ +package xyz.thastertyn.Display.Content; + +public class Jidelna { + +} diff --git a/src/main/java/xyz/thastertyn/ContentDisplay/Content/OmluvnyList.java b/src/main/java/xyz/thastertyn/Display/Content/OmluvnyList.java similarity index 77% rename from src/main/java/xyz/thastertyn/ContentDisplay/Content/OmluvnyList.java rename to src/main/java/xyz/thastertyn/Display/Content/OmluvnyList.java index 5f9e323..52f9de3 100644 --- a/src/main/java/xyz/thastertyn/ContentDisplay/Content/OmluvnyList.java +++ b/src/main/java/xyz/thastertyn/Display/Content/OmluvnyList.java @@ -1,4 +1,4 @@ -package xyz.thastertyn.ContentDisplay.Content; +package xyz.thastertyn.Display.Content; import java.io.IOException; import java.net.UnknownHostException; @@ -14,7 +14,7 @@ public class OmluvnyList extends JecnaContent{ private Panel omluvnyPanel = new Panel(); private Label borderLabel = new Label("Omluvny L."); - private xyz.thastertyn.JecnaParse.OmluvnyList omluvnyList = new xyz.thastertyn.JecnaParse.OmluvnyList(); + private xyz.thastertyn.Scrape.OmluvnyList omluvnyList = new xyz.thastertyn.Scrape.OmluvnyList(); private boolean hasStarted = false; @@ -55,13 +55,7 @@ public class OmluvnyList extends JecnaContent{ } @Override - public void specify(int y, int hy) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'specify'"); - } - - @Override - public void getOptions(WindowBasedTextGUI textGUI) { + public void showOptions(WindowBasedTextGUI textGUI) { // TODO Auto-generated method stub throw new UnsupportedOperationException("Unimplemented method 'getOptions'"); } diff --git a/src/main/java/xyz/thastertyn/ContentDisplay/Content/Rozvrh.java b/src/main/java/xyz/thastertyn/Display/Content/Rozvrh.java similarity index 83% rename from src/main/java/xyz/thastertyn/ContentDisplay/Content/Rozvrh.java rename to src/main/java/xyz/thastertyn/Display/Content/Rozvrh.java index 14170e5..91c1406 100644 --- a/src/main/java/xyz/thastertyn/ContentDisplay/Content/Rozvrh.java +++ b/src/main/java/xyz/thastertyn/Display/Content/Rozvrh.java @@ -1,4 +1,4 @@ -package xyz.thastertyn.ContentDisplay.Content; +package xyz.thastertyn.Display.Content; import java.io.IOException; import java.net.UnknownHostException; @@ -6,13 +6,14 @@ import java.net.UnknownHostException; import com.googlecode.lanterna.gui2.Label; import com.googlecode.lanterna.gui2.Panel; import com.googlecode.lanterna.gui2.WindowBasedTextGUI; +import com.googlecode.lanterna.gui2.dialogs.MessageDialog; import com.googlecode.lanterna.gui2.table.Table; public class Rozvrh extends JecnaContent { private Panel rozvrhPanel = new Panel(); private Label borderLabel = new Label("Rozvrh"); - private xyz.thastertyn.JecnaParse.Rozvrh rozvrh = new xyz.thastertyn.JecnaParse.Rozvrh(); + private xyz.thastertyn.Scrape.Rozvrh rozvrh = new xyz.thastertyn.Scrape.Rozvrh(); private boolean hasStarted = false; @@ -73,13 +74,7 @@ public class Rozvrh extends JecnaContent { } @Override - public void specify(int y, int hy) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'specify'"); - } - - @Override - public void getOptions(WindowBasedTextGUI textGUI) { + public void showOptions(WindowBasedTextGUI textGUI) { // TODO Auto-generated method stub throw new UnsupportedOperationException("Unimplemented method 'getOptions'"); } diff --git a/src/main/java/xyz/thastertyn/ContentDisplay/Content/Sdeleni.java b/src/main/java/xyz/thastertyn/Display/Content/Sdeleni.java similarity index 77% rename from src/main/java/xyz/thastertyn/ContentDisplay/Content/Sdeleni.java rename to src/main/java/xyz/thastertyn/Display/Content/Sdeleni.java index 2df15a5..039a57e 100644 --- a/src/main/java/xyz/thastertyn/ContentDisplay/Content/Sdeleni.java +++ b/src/main/java/xyz/thastertyn/Display/Content/Sdeleni.java @@ -1,4 +1,4 @@ -package xyz.thastertyn.ContentDisplay.Content; +package xyz.thastertyn.Display.Content; import java.io.IOException; @@ -9,13 +9,14 @@ import com.googlecode.lanterna.gui2.GridLayout; import com.googlecode.lanterna.gui2.Label; import com.googlecode.lanterna.gui2.Panel; import com.googlecode.lanterna.gui2.WindowBasedTextGUI; +import com.googlecode.lanterna.gui2.dialogs.MessageDialog; public class Sdeleni extends JecnaContent { private Panel sdeleniPanel = new Panel(); private Label borderLabel = new Label("Sdeleni R."); - private xyz.thastertyn.JecnaParse.Sdeleni sdeleni = new xyz.thastertyn.JecnaParse.Sdeleni(); + private xyz.thastertyn.Scrape.Sdeleni sdeleni = new xyz.thastertyn.Scrape.Sdeleni(); private boolean hasStarted = false; @@ -65,13 +66,7 @@ public class Sdeleni extends JecnaContent { } @Override - public void specify(int y, int hy) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'specify'"); - } - - @Override - public void getOptions(WindowBasedTextGUI textGUI) { + public void showOptions(WindowBasedTextGUI textGUI) { // TODO Auto-generated method stub throw new UnsupportedOperationException("Unimplemented method 'getOptions'"); } diff --git a/src/main/java/xyz/thastertyn/ContentDisplay/Content/Znamky.java b/src/main/java/xyz/thastertyn/Display/Content/Znamky.java similarity index 90% rename from src/main/java/xyz/thastertyn/ContentDisplay/Content/Znamky.java rename to src/main/java/xyz/thastertyn/Display/Content/Znamky.java index f8a6e3e..98faf63 100644 --- a/src/main/java/xyz/thastertyn/ContentDisplay/Content/Znamky.java +++ b/src/main/java/xyz/thastertyn/Display/Content/Znamky.java @@ -1,4 +1,4 @@ -package xyz.thastertyn.ContentDisplay.Content; +package xyz.thastertyn.Display.Content; import java.io.IOException; import java.util.ArrayList; @@ -11,7 +11,9 @@ import com.googlecode.lanterna.gui2.Label; import com.googlecode.lanterna.gui2.LinearLayout; import com.googlecode.lanterna.gui2.Panel; import com.googlecode.lanterna.gui2.WindowBasedTextGUI; +import com.googlecode.lanterna.gui2.dialogs.MessageDialog; +import xyz.thastertyn.Display.Dialogs.OptionsDialog; import xyz.thastertyn.Tuples.Pair; public class Znamky extends JecnaContent { @@ -20,7 +22,7 @@ public class Znamky extends JecnaContent { .setLayoutManager(new GridLayout(3)); private Label borderLabel = new Label("Znamky"); - private xyz.thastertyn.JecnaParse.Znamky znamky = new xyz.thastertyn.JecnaParse.Znamky(); + private xyz.thastertyn.Scrape.Znamky znamky = new xyz.thastertyn.Scrape.Znamky(); private boolean hasStarted = false; @@ -159,14 +161,9 @@ public class Znamky extends JecnaContent { } @Override - public void specify(int y, int hy) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'specify'"); - } + public void showOptions(WindowBasedTextGUI textGUI) { + OptionsDialog d = new OptionsDialog(znamky.getOptions()); - @Override - public void getOptions(WindowBasedTextGUI textGUI) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'getOptions'"); + d.showDialog(textGUI); } } diff --git a/src/main/java/xyz/thastertyn/ContentDisplay/CredentialsInput.java b/src/main/java/xyz/thastertyn/Display/Dialogs/CredentialsInput.java similarity index 98% rename from src/main/java/xyz/thastertyn/ContentDisplay/CredentialsInput.java rename to src/main/java/xyz/thastertyn/Display/Dialogs/CredentialsInput.java index 5d2e75d..d7837fc 100644 --- a/src/main/java/xyz/thastertyn/ContentDisplay/CredentialsInput.java +++ b/src/main/java/xyz/thastertyn/Display/Dialogs/CredentialsInput.java @@ -1,4 +1,4 @@ -package xyz.thastertyn.ContentDisplay; +package xyz.thastertyn.Display.Dialogs; import java.util.Arrays; @@ -29,7 +29,7 @@ public class CredentialsInput extends DialogWindow { private CheckBox remember; - CredentialsInput() + public CredentialsInput() { super("Login"); this.user = null; diff --git a/src/main/java/xyz/thastertyn/Display/Dialogs/OptionsDialog.java b/src/main/java/xyz/thastertyn/Display/Dialogs/OptionsDialog.java new file mode 100644 index 0000000..e7db0ad --- /dev/null +++ b/src/main/java/xyz/thastertyn/Display/Dialogs/OptionsDialog.java @@ -0,0 +1,74 @@ +package xyz.thastertyn.Display.Dialogs; + +import java.util.ArrayList; +import java.util.Arrays; + +import com.googlecode.lanterna.gui2.Button; +import com.googlecode.lanterna.gui2.ComboBox; +import com.googlecode.lanterna.gui2.EmptySpace; +import com.googlecode.lanterna.gui2.GridLayout; +import com.googlecode.lanterna.gui2.LocalizedString; +import com.googlecode.lanterna.gui2.Panel; +import com.googlecode.lanterna.gui2.Window; +import com.googlecode.lanterna.gui2.WindowBasedTextGUI; +import com.googlecode.lanterna.gui2.dialogs.DialogWindow; + +import xyz.thastertyn.Tuples.Pair; + +public class OptionsDialog extends DialogWindow { + + + private int option0 = 0; + private int option1 = 0; + + + public OptionsDialog(Pair, ArrayList> options) + { + super("Choose from below"); + + Panel mainPanel = new Panel() + .setLayoutManager(new GridLayout(1) + .setLeftMarginSize(1) + .setRightMarginSize(1)); + + new Panel().setLayoutManager(new GridLayout(3)) + .addComponent(new ComboBox<>(options.getValue0(), options.getValue0().size() - 1)) + .addComponent(new EmptySpace()) + .addComponent(new ComboBox<>(options.getValue1(), options.getValue1().size() - 1)) + .addTo(mainPanel); + + new Panel() + .setLayoutManager( + new GridLayout(2).setHorizontalSpacing(1)) + .addComponent( + new Button(LocalizedString.OK.toString(), this::onOK) + .setLayoutData(GridLayout.createLayoutData( + GridLayout.Alignment.CENTER, + GridLayout.Alignment.CENTER, + true, + false))) + .addComponent( + new Button(LocalizedString.Cancel.toString(), this::onCancel)) + .addTo(mainPanel); + + + setHints(Arrays.asList(Window.Hint.CENTERED)); + setComponent(mainPanel); + } + + public void onOK() + { + close(); + } + + public void onCancel() + { + close(); + } + + @Override + public String showDialog(WindowBasedTextGUI textGUI) { + super.showDialog(textGUI); + return ""; + } +} diff --git a/src/main/java/xyz/thastertyn/ContentDisplay/LoginController.java b/src/main/java/xyz/thastertyn/Display/LoginController.java similarity index 94% rename from src/main/java/xyz/thastertyn/ContentDisplay/LoginController.java rename to src/main/java/xyz/thastertyn/Display/LoginController.java index 10c445f..ab16ee2 100644 --- a/src/main/java/xyz/thastertyn/ContentDisplay/LoginController.java +++ b/src/main/java/xyz/thastertyn/Display/LoginController.java @@ -1,4 +1,4 @@ -package xyz.thastertyn.ContentDisplay; +package xyz.thastertyn.Display; import java.io.BufferedReader; import java.io.BufferedWriter; @@ -14,13 +14,14 @@ import com.googlecode.lanterna.gui2.WindowBasedTextGUI; import com.googlecode.lanterna.gui2.dialogs.MessageDialog; import com.googlecode.lanterna.gui2.dialogs.MessageDialogButton; +import xyz.thastertyn.Display.Dialogs.CredentialsInput; import xyz.thastertyn.Tuples.Triplet; public class LoginController { private WindowBasedTextGUI textGUI; - private xyz.thastertyn.ContentDisplay.CredentialsInput dialog; - private xyz.thastertyn.JecnaParse.Login login = new xyz.thastertyn.JecnaParse.Login(); + private xyz.thastertyn.Display.Dialogs.CredentialsInput dialog; + private xyz.thastertyn.Scrape.Login login = new xyz.thastertyn.Scrape.Login(); public LoginController(WindowBasedTextGUI textGUI) { diff --git a/src/main/java/xyz/thastertyn/ContentDisplay/MainWindow.java b/src/main/java/xyz/thastertyn/Display/MainWindow.java similarity index 98% rename from src/main/java/xyz/thastertyn/ContentDisplay/MainWindow.java rename to src/main/java/xyz/thastertyn/Display/MainWindow.java index a68649b..371cc3e 100644 --- a/src/main/java/xyz/thastertyn/ContentDisplay/MainWindow.java +++ b/src/main/java/xyz/thastertyn/Display/MainWindow.java @@ -1,4 +1,4 @@ -package xyz.thastertyn.ContentDisplay; +package xyz.thastertyn.Display; import java.io.IOException; import java.util.Arrays; diff --git a/src/main/java/xyz/thastertyn/ContentDisplay/WindowSwitchListener.java b/src/main/java/xyz/thastertyn/Display/WindowSwitchListener.java similarity index 89% rename from src/main/java/xyz/thastertyn/ContentDisplay/WindowSwitchListener.java rename to src/main/java/xyz/thastertyn/Display/WindowSwitchListener.java index f42fcfb..9a33eee 100644 --- a/src/main/java/xyz/thastertyn/ContentDisplay/WindowSwitchListener.java +++ b/src/main/java/xyz/thastertyn/Display/WindowSwitchListener.java @@ -1,4 +1,4 @@ -package xyz.thastertyn.ContentDisplay; +package xyz.thastertyn.Display; import java.util.concurrent.atomic.AtomicBoolean; @@ -17,11 +17,11 @@ import com.googlecode.lanterna.gui2.dialogs.MessageDialogButton; import com.googlecode.lanterna.input.KeyStroke; import com.googlecode.lanterna.input.KeyType; -import xyz.thastertyn.ContentDisplay.Content.JecnaContent; -import xyz.thastertyn.ContentDisplay.Content.OmluvnyList; -import xyz.thastertyn.ContentDisplay.Content.Rozvrh; -import xyz.thastertyn.ContentDisplay.Content.Sdeleni; -import xyz.thastertyn.ContentDisplay.Content.Znamky; +import xyz.thastertyn.Display.Content.JecnaContent; +import xyz.thastertyn.Display.Content.OmluvnyList; +import xyz.thastertyn.Display.Content.Rozvrh; +import xyz.thastertyn.Display.Content.Sdeleni; +import xyz.thastertyn.Display.Content.Znamky; public class WindowSwitchListener implements WindowListener { @@ -115,7 +115,7 @@ public class WindowSwitchListener implements WindowListener { case Character: if(keyStroke.getCharacter() == ' ') { - MessageDialog.showMessageDialog(textGUI, "Space pressed", "Good job", MessageDialogButton.OK); + contents[current].showOptions(textGUI); } break; case Escape: diff --git a/src/main/java/xyz/thastertyn/JecnaParse/JecnaParser.java b/src/main/java/xyz/thastertyn/JecnaParse/JecnaParser.java deleted file mode 100644 index 85f9bf2..0000000 --- a/src/main/java/xyz/thastertyn/JecnaParse/JecnaParser.java +++ /dev/null @@ -1,5 +0,0 @@ -package xyz.thastertyn.JecnaParse; - -public class JecnaParser { - -} diff --git a/src/main/java/xyz/thastertyn/JecnaParse/Jidelna.java b/src/main/java/xyz/thastertyn/JecnaParse/Jidelna.java deleted file mode 100644 index 2600d8d..0000000 --- a/src/main/java/xyz/thastertyn/JecnaParse/Jidelna.java +++ /dev/null @@ -1,5 +0,0 @@ -package xyz.thastertyn.JecnaParse; - -public class Jidelna { - -} diff --git a/src/main/java/xyz/thastertyn/Scrape/BaseJecnaParser.java b/src/main/java/xyz/thastertyn/Scrape/BaseJecnaParser.java new file mode 100644 index 0000000..8c89ef4 --- /dev/null +++ b/src/main/java/xyz/thastertyn/Scrape/BaseJecnaParser.java @@ -0,0 +1,9 @@ +package xyz.thastertyn.Scrape; + +import xyz.thastertyn.Types.BaseType; + +public abstract class BaseJecnaParser { + + public abstract void download(); + public abstract BaseType getData(); +} diff --git a/src/main/java/xyz/thastertyn/JecnaParse/Downloader.java b/src/main/java/xyz/thastertyn/Scrape/Downloader.java similarity index 91% rename from src/main/java/xyz/thastertyn/JecnaParse/Downloader.java rename to src/main/java/xyz/thastertyn/Scrape/Downloader.java index 5839e06..449ac84 100644 --- a/src/main/java/xyz/thastertyn/JecnaParse/Downloader.java +++ b/src/main/java/xyz/thastertyn/Scrape/Downloader.java @@ -1,4 +1,4 @@ -package xyz.thastertyn.JecnaParse; +package xyz.thastertyn.Scrape; import org.jsoup.Connection; import org.jsoup.Jsoup; diff --git a/src/main/java/xyz/thastertyn/Scrape/Jidelna.java b/src/main/java/xyz/thastertyn/Scrape/Jidelna.java new file mode 100644 index 0000000..7ca2285 --- /dev/null +++ b/src/main/java/xyz/thastertyn/Scrape/Jidelna.java @@ -0,0 +1,5 @@ +package xyz.thastertyn.Scrape; + +public class Jidelna { + +} diff --git a/src/main/java/xyz/thastertyn/JecnaParse/Login.java b/src/main/java/xyz/thastertyn/Scrape/Login.java similarity index 99% rename from src/main/java/xyz/thastertyn/JecnaParse/Login.java rename to src/main/java/xyz/thastertyn/Scrape/Login.java index ff0a2ff..e5e7a54 100644 --- a/src/main/java/xyz/thastertyn/JecnaParse/Login.java +++ b/src/main/java/xyz/thastertyn/Scrape/Login.java @@ -1,4 +1,4 @@ -package xyz.thastertyn.JecnaParse; +package xyz.thastertyn.Scrape; import java.io.IOException; import java.net.UnknownHostException; diff --git a/src/main/java/xyz/thastertyn/JecnaParse/OmluvnyList.java b/src/main/java/xyz/thastertyn/Scrape/OmluvnyList.java similarity index 96% rename from src/main/java/xyz/thastertyn/JecnaParse/OmluvnyList.java rename to src/main/java/xyz/thastertyn/Scrape/OmluvnyList.java index 04a5d91..04ae7b9 100644 --- a/src/main/java/xyz/thastertyn/JecnaParse/OmluvnyList.java +++ b/src/main/java/xyz/thastertyn/Scrape/OmluvnyList.java @@ -1,4 +1,4 @@ -package xyz.thastertyn.JecnaParse; +package xyz.thastertyn.Scrape; import java.io.IOException; import java.net.UnknownHostException; diff --git a/src/main/java/xyz/thastertyn/JecnaParse/Rozvrh.java b/src/main/java/xyz/thastertyn/Scrape/Rozvrh.java similarity index 98% rename from src/main/java/xyz/thastertyn/JecnaParse/Rozvrh.java rename to src/main/java/xyz/thastertyn/Scrape/Rozvrh.java index 20cd777..7f3d63f 100644 --- a/src/main/java/xyz/thastertyn/JecnaParse/Rozvrh.java +++ b/src/main/java/xyz/thastertyn/Scrape/Rozvrh.java @@ -1,4 +1,4 @@ -package xyz.thastertyn.JecnaParse; +package xyz.thastertyn.Scrape; import java.io.IOException; import java.net.UnknownHostException; diff --git a/src/main/java/xyz/thastertyn/JecnaParse/Sdeleni.java b/src/main/java/xyz/thastertyn/Scrape/Sdeleni.java similarity index 96% rename from src/main/java/xyz/thastertyn/JecnaParse/Sdeleni.java rename to src/main/java/xyz/thastertyn/Scrape/Sdeleni.java index 67a00e0..fa3a4bf 100644 --- a/src/main/java/xyz/thastertyn/JecnaParse/Sdeleni.java +++ b/src/main/java/xyz/thastertyn/Scrape/Sdeleni.java @@ -1,4 +1,4 @@ -package xyz.thastertyn.JecnaParse; +package xyz.thastertyn.Scrape; import java.io.IOException; import java.net.UnknownHostException; diff --git a/src/main/java/xyz/thastertyn/JecnaParse/Znamky.java b/src/main/java/xyz/thastertyn/Scrape/Znamky.java similarity index 85% rename from src/main/java/xyz/thastertyn/JecnaParse/Znamky.java rename to src/main/java/xyz/thastertyn/Scrape/Znamky.java index 6ad9fe0..6c454e7 100644 --- a/src/main/java/xyz/thastertyn/JecnaParse/Znamky.java +++ b/src/main/java/xyz/thastertyn/Scrape/Znamky.java @@ -1,4 +1,4 @@ -package xyz.thastertyn.JecnaParse; +package xyz.thastertyn.Scrape; import java.io.IOException; import java.net.UnknownHostException; @@ -11,15 +11,18 @@ import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import xyz.thastertyn.Tuples.Pair; +import xyz.thastertyn.Tuples.Triplet; public class Znamky { private boolean wasDownloaded; + // schoolYear, schoolYearId + private ArrayList>, Double>> test = new ArrayList<>(); private ArrayList>,Double>>> grades = new ArrayList<>(); // Integer znaci id roku, boolean jestli je jen prvni nebo i druhe pololeti - private Pair, ArrayList> options = new Pair<>(); + private Pair>, ArrayList>> options = new Pair<>(new ArrayList>(), new ArrayList>()); public void downloadZnamky(/*, int schoolYearId, int schoolYearHalfId*/) throws UnknownHostException, IOException { @@ -80,26 +83,17 @@ public class Znamky { Elements schoolYear = optionsPanel.select("select[id=schoolYearId]").select("option"); Elements schoolYearId = optionsPanel.select("select[id=schoolYearHalfId]").select("option"); - /* - Elements roky = znamkyDoc.select("select[name=schoolYearId]"); - Elements pololetiSelect = znamkyDoc.select("select[name=schoolYearHalfId]"); + for(Element e : schoolYear) + { + options.getValue0().add(e.attr("value")); + } - for(Element e : roky) - { - boolean jeCelyRok = false; - - if(pololetiSelect.size() == 2) - { - jeCelyRok = true; - } - - int rok = Integer.parseInt(e.attr("value")); - - options.add(new Pair(rok, jeCelyRok)); - }*/ + for(Element e : schoolYearId) + { + options.getValue1().add(new Pair<>(e.attr("value", e.text())); + } wasDownloaded = true; - } private void addGrade(int index, String subject, int grade, double weight) @@ -147,6 +141,11 @@ public class Znamky { return grades; } + public Pair, ArrayList> getOptions() + { + return options; + } + @Override public String toString() { diff --git a/src/main/java/xyz/thastertyn/Types/BaseType.java b/src/main/java/xyz/thastertyn/Types/BaseType.java new file mode 100644 index 0000000..26a87fe --- /dev/null +++ b/src/main/java/xyz/thastertyn/Types/BaseType.java @@ -0,0 +1,5 @@ +package xyz.thastertyn.Types; + +public abstract class BaseType { + +} diff --git a/src/main/java/xyz/thastertyn/Types/OmluvnyList.java b/src/main/java/xyz/thastertyn/Types/OmluvnyList.java new file mode 100644 index 0000000..373671b --- /dev/null +++ b/src/main/java/xyz/thastertyn/Types/OmluvnyList.java @@ -0,0 +1,13 @@ +package xyz.thastertyn.Types; + +public class OmluvnyList { + + private String datum; + private String popis; + + public OmluvnyList(String datum, String popis) + { + this.datum = datum; + this.popis = popis; + } +} diff --git a/src/main/java/xyz/thastertyn/Types/Znamka.java b/src/main/java/xyz/thastertyn/Types/Znamka.java new file mode 100644 index 0000000..a92955f --- /dev/null +++ b/src/main/java/xyz/thastertyn/Types/Znamka.java @@ -0,0 +1,19 @@ +package xyz.thastertyn.Types; + +public class Znamka { + + private int znamka; + private boolean malaZnamka; + private String text; + private String datum; + + + public Znamka(int znamka, boolean malaZnamka, String text, String datum) + { + this.znamka = znamka; + this.malaZnamka = malaZnamka; + this.datum = datum; + this.text = text; + } + +}