diff --git a/bin/.gitignore b/bin/.gitignore index 94b23b3..b42b859 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -1,3 +1 @@ /application/ -/datatypes/ -/resources/ diff --git a/bin/application/MainWindowController$2.class b/bin/application/MainWindowController$2.class index 9883ba2..2a2682f 100644 Binary files a/bin/application/MainWindowController$2.class and b/bin/application/MainWindowController$2.class differ diff --git a/bin/application/MainWindowController$7.class b/bin/application/MainWindowController$7.class index d05b49b..0413802 100644 Binary files a/bin/application/MainWindowController$7.class and b/bin/application/MainWindowController$7.class differ diff --git a/bin/application/MainWindowController.class b/bin/application/MainWindowController.class index 91cd370..a0ce15b 100644 Binary files a/bin/application/MainWindowController.class and b/bin/application/MainWindowController.class differ diff --git a/bin/application/uiDataType.class b/bin/application/uiDataType.class deleted file mode 100644 index 02c14ce..0000000 Binary files a/bin/application/uiDataType.class and /dev/null differ diff --git a/bin/datatypes/CourseTableDataType.class b/bin/datatypes/CourseTableDataType.class new file mode 100644 index 0000000..6d42e58 Binary files /dev/null and b/bin/datatypes/CourseTableDataType.class differ diff --git a/bin/datatypes/SmmdbApiDataType.class b/bin/datatypes/SmmdbApiDataType.class new file mode 100644 index 0000000..f59b43d Binary files /dev/null and b/bin/datatypes/SmmdbApiDataType.class differ diff --git a/bin/datatypes/UIROMDataType.class b/bin/datatypes/UIROMDataType.class new file mode 100644 index 0000000..f09c43b Binary files /dev/null and b/bin/datatypes/UIROMDataType.class differ diff --git a/src/application/MainWindowController.java b/src/application/MainWindowController.java index 1bf8b90..f0f1691 100644 --- a/src/application/MainWindowController.java +++ b/src/application/MainWindowController.java @@ -25,7 +25,6 @@ import java.math.BigInteger; import java.sql.SQLException; import java.time.LocalDate; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; import java.util.Optional; import java.util.Properties; @@ -43,7 +42,8 @@ import com.jfoenix.controls.JFXTreeTableView; import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition; import datatypes.SmmdbApiDataType; -import datatypes.courseTableDataType; +import datatypes.UIROMDataType; +import datatypes.CourseTableDataType; import javafx.animation.FadeTransition; import javafx.animation.ParallelTransition; import javafx.animation.TranslateTransition; @@ -148,22 +148,22 @@ public class MainWindowController { @FXML - private JFXTreeTableView courseTreeTable = new JFXTreeTableView(); + private JFXTreeTableView courseTreeTable = new JFXTreeTableView(); @FXML - TreeItem root = new TreeItem<>(new courseTableDataType("",0,0,0)); + TreeItem root = new TreeItem<>(new CourseTableDataType("",0,0,0)); @FXML - private JFXTreeTableColumn titleColumn = new JFXTreeTableColumn<>("title"); + private JFXTreeTableColumn titleColumn = new JFXTreeTableColumn<>("title"); @FXML - private JFXTreeTableColumn starsColumn = new JFXTreeTableColumn<>("stars"); + private JFXTreeTableColumn starsColumn = new JFXTreeTableColumn<>("stars"); @FXML - private JFXTreeTableColumn downloadsColumn = new JFXTreeTableColumn<>("downloads"); + private JFXTreeTableColumn downloadsColumn = new JFXTreeTableColumn<>("downloads"); @FXML - private JFXTreeTableColumn idColumn = new JFXTreeTableColumn<>("id"); + private JFXTreeTableColumn idColumn = new JFXTreeTableColumn<>("id"); Main main; dbController dbController; @@ -198,7 +198,7 @@ public class MainWindowController { private File fileLinux = new File(dirLinux + "/config.xml"); File pictureCacheWin = new File(dirWin+"/picture_cache"); File pictureCacheLinux = new File(dirLinux+"/picture_cache"); - private ObservableList games = FXCollections.observableArrayList(); + private ObservableList games = FXCollections.observableArrayList(); ObservableList courses = FXCollections.observableArrayList(); Properties props = new Properties(); Properties gameProps = new Properties(); @@ -494,7 +494,14 @@ public class MainWindowController { selected = courseTreeTable.getSelectionModel().getSelectedIndex(); //get selected item id = idColumn.getCellData(selected); //get name of selected item - //TODO show additional information and download option + for (int i = 0; i < courses.size(); i++) { + if (courses.get(i).getId() == id) { + + //TODO show additional information and download option + System.out.println(i); + } + + } System.out.println(id + "; " + selected); } @@ -556,10 +563,10 @@ public class MainWindowController { //add query response to courseTreeTable for(int i = 0; i < courses.size(); i++){ - courseTableDataType helpCourse = new courseTableDataType(courses.get(i).getTitle(), courses.get(i).getDownloads(), + CourseTableDataType helpCourse = new CourseTableDataType(courses.get(i).getTitle(), courses.get(i).getDownloads(), courses.get(i).getStars(), courses.get(i).getId()); - root.getChildren().add(new TreeItem(helpCourse)); //add data to root-node + root.getChildren().add(new TreeItem(helpCourse)); //add data to root-node } } @@ -825,6 +832,7 @@ public class MainWindowController { selectedGameTitleID = titleID; selectedGameTitle = title; + //underling selected Label lastGameLabel.setStyle("-fx-underline: false;"); games.get(selectedUIDataIndex).getLabel().setStyle("-fx-underline: true;"); lastGameLabel = games.get(selectedUIDataIndex).getLabel(); @@ -865,7 +873,7 @@ public class MainWindowController { } }); - games.add(new uiDataType(VBox, gameTitleLabel, gameBtn, titleID, romPath)); + games.add(new UIROMDataType(VBox, gameTitleLabel, gameBtn, titleID, romPath)); } //add all games to the UI (only called on startup) diff --git a/src/application/dbController.java b/src/application/dbController.java index 6f4bb2e..d3e3677 100644 --- a/src/application/dbController.java +++ b/src/application/dbController.java @@ -96,7 +96,7 @@ public class dbController { System.out.println("games database loaded successfull"); } - //creating database, if db has 0 entries search for all .rpx files in the roms directory and add them + //creating database, if database has 0 entries search for all .rpx files in the roms directory and add them void createRomDatabase() { try { Statement stmt = connection.createStatement(); diff --git a/src/datatypes/courseTableDataType.java b/src/datatypes/CourseTableDataType.java similarity index 80% rename from src/datatypes/courseTableDataType.java rename to src/datatypes/CourseTableDataType.java index f5c8fc3..29ebc10 100644 --- a/src/datatypes/courseTableDataType.java +++ b/src/datatypes/CourseTableDataType.java @@ -1,3 +1,6 @@ +/** + * Datatype used in the TreeTableview for + */ package datatypes; import com.jfoenix.controls.datamodels.treetable.RecursiveTreeObject; @@ -7,14 +10,14 @@ import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; -public class courseTableDataType extends RecursiveTreeObject { +public class CourseTableDataType extends RecursiveTreeObject { public final StringProperty title; public final IntegerProperty downloads; public final IntegerProperty stars; public final IntegerProperty id; - public courseTableDataType(String title, int downloads, int stars, int id) { + public CourseTableDataType(String title, int downloads, int stars, int id) { this.title = new SimpleStringProperty(title); this.downloads = new SimpleIntegerProperty(downloads); this.stars = new SimpleIntegerProperty(stars); diff --git a/src/datatypes/SmmdbApiDataType.java b/src/datatypes/SmmdbApiDataType.java index 2c5d589..6bfb53d 100644 --- a/src/datatypes/SmmdbApiDataType.java +++ b/src/datatypes/SmmdbApiDataType.java @@ -1,3 +1,6 @@ +/** + * Datatype used for the smmdbapi query + */ package datatypes; import javafx.beans.property.IntegerProperty; diff --git a/src/application/uiDataType.java b/src/datatypes/UIROMDataType.java similarity index 89% rename from src/application/uiDataType.java rename to src/datatypes/UIROMDataType.java index a8dd24c..0a4ba8d 100644 --- a/src/application/uiDataType.java +++ b/src/datatypes/UIROMDataType.java @@ -1,4 +1,7 @@ -package application; +/** + * Datatype used for UI ROM elements + */ +package datatypes; import com.jfoenix.controls.JFXButton; @@ -8,15 +11,15 @@ import javafx.beans.property.StringProperty; import javafx.scene.control.Label; import javafx.scene.layout.VBox; -public class uiDataType { - +public class UIROMDataType { + private final SimpleObjectProperty vBox = new SimpleObjectProperty<>(); private final SimpleObjectProperty