reworked the DBController

* some tasks are now done at the SourcesController
* use PrepareStatement
* generall clean up
This commit is contained in:
2018-12-04 22:31:11 +01:00
parent 6585908717
commit c3a148b267
5 changed files with 412 additions and 286 deletions

View File

@ -166,7 +166,7 @@ public class MainWindowController {
private boolean autoplay = false;
private final String version = "0.7.0";
private final String buildNumber = "163";
private final String buildNumber = "165";
private final String versionName = "toothless dragon";
private String btnStyle;
private String color;
@ -214,7 +214,7 @@ public class MainWindowController {
initActions();
dbController.init();
posterModeStartup(); // TODO testing
// posterModeStartup(); // TODO testing
}
// Initialize general UI elements
@ -550,7 +550,7 @@ public class MainWindowController {
directoryChooser.setTitle(bundle.getString("addDirectory"));
File selectedFolder = directoryChooser.showDialog(main.getPrimaryStage());
if (selectedFolder != null && selectedFolder.exists()) {
mainWindowController.addSource(selectedFolder.getPath(), "local");
addSource(selectedFolder.getPath(), "local");
} else {
LOGGER.error("The selected folder dosen't exist!");
}
@ -563,7 +563,6 @@ public class MainWindowController {
File selectedFile = fileChooser.showOpenDialog(main.getPrimaryStage());
if (selectedFile != null && selectedFile.exists()) {
addSource(selectedFile.getPath(), "stream");
dbController.refreshDataBase();
} else {
LOGGER.error("The selected file dosen't exist!");
}
@ -605,6 +604,8 @@ public class MainWindowController {
* add data from films-list to films-table
*/
public void addFilmsToTable(ObservableList<FilmTabelDataType> elementsList) {
System.out.println(elementsList.size());
for (FilmTabelDataType element : elementsList) {
@ -667,6 +668,12 @@ public class MainWindowController {
} catch (IOException e) {
LOGGER.error(e);
}
// clear old sources list/table
getSourcesList().clear();
getSourceRoot().getChildren().clear();
// update the database and all films from the database
dbController.refreshDataBase();
}
/**