worked on dbcontroller part 6 / favIcons
This commit is contained in:
@ -24,6 +24,9 @@ import com.eclipsesource.json.JsonArray;
|
||||
import com.eclipsesource.json.JsonObject;
|
||||
import com.eclipsesource.json.JsonValue;
|
||||
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
|
||||
public class DBController {
|
||||
|
||||
public DBController(MainWindowController m) {
|
||||
@ -32,6 +35,8 @@ public class DBController {
|
||||
|
||||
private MainWindowController mainWindowController;
|
||||
private String DB_PATH = System.getProperty("user.home") + "\\Documents\\HomeFlix" + "\\" + "Homeflix.db"; // der Pfad der Datenbank-Datei
|
||||
private ImageView favorite_black = new ImageView(new Image("recources/icons/ic_favorite_black_18dp_1x.png"));
|
||||
private ImageView favorite_border_black = new ImageView(new Image("recources/icons/ic_favorite_border_black_18dp_1x.png"));
|
||||
private List<String> filmsdbAll = new ArrayList<String>();
|
||||
private List<String> filmsdbLocal = new ArrayList<String>();
|
||||
private List<String> filmsdbStream = new ArrayList<String>();
|
||||
@ -68,15 +73,15 @@ public class DBController {
|
||||
}
|
||||
|
||||
void createDatabase() {
|
||||
System.out.println("<=====starting loading sql=====>");
|
||||
System.out.println("<==========starting loading sql==========>");
|
||||
|
||||
PreparedStatement ps;
|
||||
PreparedStatement psS;
|
||||
|
||||
try {
|
||||
Statement stmt = connection.createStatement();
|
||||
stmt.executeUpdate("create table if not exists film_local (rating, titel, streamUrl)");
|
||||
stmt.executeUpdate("create table if not exists film_streaming (year, season, episode, rating, resolution, titel, streamUrl)");
|
||||
stmt.executeUpdate("create table if not exists film_local (rating, titel, streamUrl, favIcon)");
|
||||
stmt.executeUpdate("create table if not exists film_streaming (year, season, episode, rating, resolution, titel, streamUrl, favIcon)");
|
||||
stmt.close();
|
||||
} catch (SQLException e1) {
|
||||
e1.printStackTrace();
|
||||
@ -134,14 +139,15 @@ public class DBController {
|
||||
System.out.println("creating entries ...");
|
||||
|
||||
try{
|
||||
ps = connection.prepareStatement("insert into film_local values (?, ?, ?)");
|
||||
psS = connection.prepareStatement("insert into film_streaming values (?, ?, ?, ?, ?, ?, ?)");
|
||||
ps = connection.prepareStatement("insert into film_local values (?, ?, ?, ?)");
|
||||
psS = connection.prepareStatement("insert into film_streaming values (?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
|
||||
for(int j=0;j!=entries.length;j++) // Geht alle Dateien im Verzeichniss durch
|
||||
{
|
||||
ps.setInt(1, 0); // definiert Bewertung als Integer in der dritten Spalte
|
||||
ps.setString(2, cutOffEnd(entries[j])); // definiert Name als String in der ersten Spalte
|
||||
ps.setString(3,entries[j]); // definiert Pfad als String in der zweiten Spalte
|
||||
ps.setString(4, "favorite_border_black");
|
||||
ps.addBatch(); // f<>gt den Eintrag hinzu
|
||||
}
|
||||
|
||||
@ -161,6 +167,7 @@ public class DBController {
|
||||
psS.setString(5, item.asObject().getString("resolution", ""));
|
||||
psS.setString(6, item.asObject().getString("titel",""));
|
||||
psS.setString(7, item.asObject().getString("streamUrl", ""));
|
||||
psS.setString(8, "favorite_border_black");
|
||||
psS.addBatch(); // f<>gt den Eintrag hinzu
|
||||
}
|
||||
} catch (IOException e) {
|
||||
@ -201,7 +208,7 @@ public class DBController {
|
||||
Statement stmt = connection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery("SELECT * FROM film_local");
|
||||
while (rs.next()) {
|
||||
mainWindowController.newDaten.add(new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3)));
|
||||
mainWindowController.newDaten.add(new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), favorite_border_black));
|
||||
}
|
||||
stmt.close();
|
||||
rs.close();
|
||||
@ -209,7 +216,7 @@ public class DBController {
|
||||
//load streaming Data TODO check if there are streaming data before loading -> maybe there is an issue now
|
||||
rs = stmt.executeQuery("SELECT * FROM film_streaming;");
|
||||
while (rs.next()) {
|
||||
mainWindowController.streamData.add(new streamUiData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7)));
|
||||
mainWindowController.streamData.add(new streamUiData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), favorite_border_black));
|
||||
}
|
||||
stmt.close();
|
||||
rs.close();
|
||||
@ -217,7 +224,7 @@ public class DBController {
|
||||
System.err.println("Ups! an error occured!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("<=====finished loading sql=====>");
|
||||
System.out.println("<==========finished loading sql==========>");
|
||||
}
|
||||
|
||||
//refreshs the data in mainWindowController.newDaten and mainWindowController.streamData
|
||||
@ -229,14 +236,22 @@ public class DBController {
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery("SELECT * FROM film_local WHERE titel = '"+name+"';" );
|
||||
mainWindowController.newDaten.set(i, new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3)));
|
||||
if(rs.getString(4).equals("favorite_black")){
|
||||
mainWindowController.newDaten.set(i, new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), favorite_black));
|
||||
}else{
|
||||
mainWindowController.newDaten.set(i, new streamUiData(1, 1, 1, rs.getDouble(1), "1", rs.getString(2), rs.getString(3), favorite_border_black));
|
||||
}
|
||||
stmt.close();
|
||||
rs.close();
|
||||
} catch (SQLException e) {
|
||||
try {
|
||||
stmt = connection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery("SELECT * FROM film_streaming WHERE titel = '"+name+"';" );
|
||||
mainWindowController.streamData.set(i,new streamUiData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7)));
|
||||
if(rs.getString(8).equals("favorite_black")){
|
||||
mainWindowController.streamData.set(i,new streamUiData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), favorite_black));
|
||||
}else{
|
||||
mainWindowController.streamData.set(i,new streamUiData(rs.getInt(1), rs.getInt(2), rs.getInt(3), rs.getDouble(4), rs.getString(5), rs.getString(6), rs.getString(7), favorite_border_black));
|
||||
}
|
||||
stmt.close();
|
||||
rs.close();
|
||||
} catch (SQLException e1) {
|
||||
@ -276,13 +291,13 @@ public class DBController {
|
||||
System.out.println("checking for entrys to add to DB ...");
|
||||
String[] entries = new File(mainWindowController.getPath()).list();
|
||||
Statement stmt = connection.createStatement();
|
||||
PreparedStatement ps = connection.prepareStatement("insert into film_streaming values (?, ?, ?, ?, ?, ?, ?)");;
|
||||
PreparedStatement ps = connection.prepareStatement("insert into film_streaming values (?, ?, ?, ?, ?, ?, ?, ?)");;
|
||||
int i=0;
|
||||
|
||||
for(int a=0; a<filmsDir.size(); a++){
|
||||
if(filmsdbLocal.contains(filmsDir.get(a))){
|
||||
}else{
|
||||
stmt.executeUpdate("insert into film_local values (0, '"+cutOffEnd(entries[a])+"', '"+entries[a]+"')");
|
||||
stmt.executeUpdate("insert into film_local values (0, '"+cutOffEnd(entries[a])+"', '"+entries[a]+"','favorite_border_black')");
|
||||
connection.commit();
|
||||
stmt.close();
|
||||
System.out.println("added \""+filmsDir.get(a)+"\" to databsae");
|
||||
@ -308,6 +323,7 @@ public class DBController {
|
||||
ps.setString(5, items.get(i).asObject().getString("resolution", ""));
|
||||
ps.setString(6, items.get(i).asObject().getString("titel",""));
|
||||
ps.setString(7, items.get(i).asObject().getString("streamUrl", ""));
|
||||
ps.setString(8, "favorite_border_black");
|
||||
ps.addBatch(); // adds the entry
|
||||
|
||||
// stmt.executeUpdate("insert into film_streaming values ("+items.get(i).asObject().getInt("year", 0)+", "+items.get(i).asObject().getInt("season", 0)+", "+items.get(i).asObject().getInt("episode", 0)+", 0, '"+items.get(i).asObject().getString("resolution", ""+"', '"+items.get(i).asObject().getString("titel","")+"', '"+items.get(i).asObject().getString("streamUrl", "")+"')"));
|
||||
@ -328,7 +344,8 @@ public class DBController {
|
||||
while (rs.next()) {
|
||||
System.out.println(rs.getString(1));
|
||||
System.out.println(rs.getString(2));
|
||||
System.out.println(rs.getString(3)+"\n");
|
||||
System.out.println(rs.getString(3));
|
||||
System.out.println(rs.getString(4)+"\n");
|
||||
}
|
||||
stmt.close();
|
||||
rs.close();
|
||||
@ -343,7 +360,8 @@ public class DBController {
|
||||
System.out.println(rs.getString(4));
|
||||
System.out.println(rs.getString(5));
|
||||
System.out.println(rs.getString(6));
|
||||
System.out.println(rs.getString(7)+"\n");
|
||||
System.out.println(rs.getString(7));
|
||||
System.out.println(rs.getString(8)+"\n");
|
||||
}
|
||||
stmt.close();
|
||||
rs.close();
|
||||
@ -358,15 +376,15 @@ public class DBController {
|
||||
void getFavStatus(String name){
|
||||
try{
|
||||
Statement stmt = connection.createStatement();
|
||||
ResultSet rs = stmt.executeQuery("SELECT titel, rating FROM film_local WHERE titel = '"+name+"';" ); //SQL Befehl
|
||||
System.out.println("local:"+rs.getString("rating")+", "+rs.getString("titel"));
|
||||
ResultSet rs = stmt.executeQuery("SELECT titel, rating, favIcon FROM film_local WHERE titel = '"+name+"';" ); //SQL Befehl
|
||||
System.out.println("local:"+rs.getString("rating")+", "+rs.getString("titel")+", "+rs.getString("favIcon"));
|
||||
stmt.close();
|
||||
rs.close();
|
||||
}catch(SQLException e){
|
||||
try {
|
||||
Statement stmtS = connection.createStatement();
|
||||
ResultSet rsS = stmtS.executeQuery("SELECT titel, rating FROM film_streaming WHERE titel = '"+name+"';" );
|
||||
System.out.println("streaming:"+rsS.getString("rating")+", "+rsS.getString("titel"));
|
||||
ResultSet rsS = stmtS.executeQuery("SELECT titel, rating, favIcon FROM film_streaming WHERE titel = '"+name+"';" );
|
||||
System.out.println("streaming:"+rsS.getString("rating")+", "+rsS.getString("titel")+", "+rsS.getString("favIcon"));
|
||||
stmtS.close();
|
||||
rsS.close();
|
||||
} catch (SQLException e1) {
|
||||
@ -381,7 +399,7 @@ public class DBController {
|
||||
System.out.println("defavorisieren ...");
|
||||
try{
|
||||
Statement stmt = connection.createStatement();
|
||||
stmt.executeUpdate("UPDATE film_local SET rating=0 WHERE titel='"+name+"';");
|
||||
stmt.executeUpdate("UPDATE film_local SET rating=0,favIcon='favorite_border_black' WHERE titel='"+name+"';");
|
||||
connection.commit();
|
||||
stmt.close();
|
||||
}catch(SQLException e){
|
||||
@ -390,7 +408,7 @@ public class DBController {
|
||||
}
|
||||
try {
|
||||
Statement stmt = connection.createStatement();
|
||||
stmt.executeUpdate("UPDATE film_streaming SET rating=0 WHERE streamUrl='"+streamUrl+"';");
|
||||
stmt.executeUpdate("UPDATE film_streaming SET rating=0,favIcon='favorite_border_black' WHERE streamUrl='"+streamUrl+"';");
|
||||
connection.commit();
|
||||
stmt.close();
|
||||
} catch (SQLException e1) {
|
||||
@ -403,7 +421,7 @@ public class DBController {
|
||||
System.out.println("favorisieren ...");
|
||||
try{
|
||||
Statement stmt = connection.createStatement();
|
||||
stmt.executeUpdate("UPDATE film_local SET rating=1 WHERE titel='"+name+"';");
|
||||
stmt.executeUpdate("UPDATE film_local SET rating=1,favIcon='favorite_black' WHERE titel='"+name+"';");
|
||||
connection.commit();
|
||||
stmt.close();
|
||||
}catch(SQLException e){
|
||||
@ -412,7 +430,7 @@ public class DBController {
|
||||
}
|
||||
try {
|
||||
Statement stmt = connection.createStatement();
|
||||
stmt.executeUpdate("UPDATE film_streaming SET rating=1 WHERE streamUrl='"+streamUrl+"';");
|
||||
stmt.executeUpdate("UPDATE film_streaming SET rating=1,favIcon='favorite_black' WHERE streamUrl='"+streamUrl+"';");
|
||||
connection.commit();
|
||||
stmt.close();
|
||||
} catch (SQLException e1) {
|
||||
|
@ -53,8 +53,6 @@ import com.jfoenix.controls.JFXToggleButton;
|
||||
import javafx.animation.FadeTransition;
|
||||
import javafx.animation.ParallelTransition;
|
||||
import javafx.animation.TranslateTransition;
|
||||
import javafx.beans.property.ReadOnlyObjectWrapper;
|
||||
import javafx.beans.property.ReadOnlyStringWrapper;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
@ -73,7 +71,6 @@ import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.control.TreeItem;
|
||||
import javafx.scene.control.TreeTableColumn;
|
||||
import javafx.scene.control.TreeTableColumn.CellDataFeatures;
|
||||
import javafx.scene.control.TreeTableView;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
@ -154,27 +151,28 @@ public class MainWindowController {
|
||||
private Label aulbl;
|
||||
@FXML
|
||||
ImageView image1;
|
||||
private ImageView imv1;
|
||||
|
||||
|
||||
@FXML
|
||||
TreeItem<streamUiData> root = new TreeItem<>(new streamUiData(1, 1, 1, 5.0,"1", "filme","1"));
|
||||
TreeItem<streamUiData> root = new TreeItem<>(new streamUiData(1, 1, 1, 5.0,"1", "filme","1", imv1));
|
||||
@FXML
|
||||
TreeTableColumn<streamUiData, Double> columnRating = new TreeTableColumn<>("Bewertung");
|
||||
TreeTableColumn<streamUiData, ImageView> columnRating = new TreeTableColumn<>("Rating");
|
||||
@FXML
|
||||
TreeTableColumn<streamUiData, String> columnTitel = new TreeTableColumn<>("Name");
|
||||
TreeTableColumn<streamUiData, String> columnTitel = new TreeTableColumn<>("Titel");
|
||||
@FXML
|
||||
TreeTableColumn<streamUiData, String> columnStreamUrl = new TreeTableColumn<>("Datei Name");
|
||||
TreeTableColumn<streamUiData, String> columnStreamUrl = new TreeTableColumn<>("File Name");
|
||||
@FXML
|
||||
TreeTableColumn<streamUiData, String> columnResolution = new TreeTableColumn<>("Auflösung");
|
||||
TreeTableColumn<streamUiData, String> columnResolution = new TreeTableColumn<>("Resolution");
|
||||
@FXML
|
||||
TreeTableColumn<streamUiData, Integer> columnYear = new TreeTableColumn<>("Jahr");
|
||||
TreeTableColumn<streamUiData, Integer> columnYear = new TreeTableColumn<>("Year");
|
||||
@FXML
|
||||
TreeTableColumn<streamUiData, Integer> columnSeason = new TreeTableColumn<>("Staffel");
|
||||
TreeTableColumn<streamUiData, Integer> columnSeason = new TreeTableColumn<>("Season");
|
||||
@FXML
|
||||
TreeTableColumn<streamUiData, Integer> columnEpisode = new TreeTableColumn<>("Episode");
|
||||
|
||||
@FXML
|
||||
private TreeItem<streamUiData> streamingRoot =new TreeItem<>(new streamUiData(1 ,1 ,1 ,1.0 ,"1" ,"filme" ,"1"));
|
||||
private TreeItem<streamUiData> streamingRoot =new TreeItem<>(new streamUiData(1 ,1 ,1 ,1.0 ,"1" ,"filme" ,"1", imv1));
|
||||
@FXML
|
||||
private TableColumn<streamUiData, String> dataNameColumn = new TableColumn<>("Datei Name");
|
||||
@FXML
|
||||
@ -252,9 +250,7 @@ public class MainWindowController {
|
||||
private ImageView skip_next_black = new ImageView(new Image("recources/icons/ic_skip_next_black_18dp_1x.png"));
|
||||
private ImageView play_arrow_white = new ImageView(new Image("recources/icons/ic_play_arrow_white_18dp_1x.png"));
|
||||
private ImageView play_arrow_black = new ImageView(new Image("recources/icons/ic_play_arrow_black_18dp_1x.png"));
|
||||
@SuppressWarnings("unused")
|
||||
private ImageView favorite_black = new ImageView(new Image("recources/icons/ic_favorite_black_18dp_1x.png"));
|
||||
@SuppressWarnings("unused")
|
||||
private ImageView favorite_border_black = new ImageView(new Image("recources/icons/ic_favorite_border_black_18dp_1x.png"));
|
||||
private DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||
private ContextMenu menu = new ContextMenu();
|
||||
@ -436,6 +432,7 @@ public class MainWindowController {
|
||||
|
||||
@FXML
|
||||
private void debugBtnclicked(){
|
||||
newDaten.get(selected).setImage(favorite_black);
|
||||
//for testing
|
||||
}
|
||||
|
||||
@ -529,8 +526,8 @@ public class MainWindowController {
|
||||
// columnRating.setSortType(TreeTableColumn.SortType.ASCENDING);
|
||||
// }
|
||||
|
||||
debugBtn.setDisable(true); //debugging btn for tests
|
||||
debugBtn.setVisible(false);
|
||||
debugBtn.setDisable(false); //debugging btn for tests
|
||||
debugBtn.setVisible(true);
|
||||
|
||||
tfPath.setText(getPath());
|
||||
|
||||
@ -554,41 +551,52 @@ public class MainWindowController {
|
||||
}
|
||||
|
||||
//initialisierung der Tabellen für filme(beide Modi) und Streaming-Settings
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({ "unchecked"})
|
||||
private void initTabel(){
|
||||
|
||||
//filmtabelle
|
||||
columnRating.setMaxWidth(120);
|
||||
columnTitel.setMaxWidth(240);
|
||||
columnRating.setMaxWidth(80);
|
||||
columnTitel.setMaxWidth(260);
|
||||
columnStreamUrl.setMaxWidth(0);
|
||||
dataNameColumn.setPrefWidth(130);
|
||||
dataNameColumn.setPrefWidth(150);
|
||||
dataNameEndColumn.setPrefWidth(170);
|
||||
columnRating.setStyle("-fx-alignment: CENTER;");
|
||||
|
||||
treeTableViewfilm.setRoot(root);
|
||||
treeTableViewfilm.setColumnResizePolicy( TreeTableView.CONSTRAINED_RESIZE_POLICY );
|
||||
treeTableViewfilm.setShowRoot(false);
|
||||
|
||||
//inhalt in Zelle schreiben
|
||||
columnTitel.setCellValueFactory((CellDataFeatures<streamUiData, String> p) ->
|
||||
new ReadOnlyStringWrapper(p.getValue().getValue().getTitel()));
|
||||
|
||||
columnRating.setCellValueFactory((CellDataFeatures<streamUiData, Double> p) ->
|
||||
new ReadOnlyObjectWrapper<Double>(p.getValue().getValue().getRating()));
|
||||
// columnTitel.setCellValueFactory((CellDataFeatures<streamUiData, String> p) ->
|
||||
// new ReadOnlyStringWrapper(p.getValue().getValue().getTitel()));
|
||||
//
|
||||
// columnRating.setCellValueFactory((CellDataFeatures<streamUiData, Double> p) ->
|
||||
// new ReadOnlyObjectWrapper<Double>(p.getValue().getValue().getRating()));
|
||||
//
|
||||
// columnStreamUrl.setCellValueFactory((CellDataFeatures<streamUiData, String> p) ->
|
||||
// new ReadOnlyStringWrapper(p.getValue().getValue().getStreamUrl()));
|
||||
//
|
||||
// columnResolution.setCellValueFactory((CellDataFeatures<streamUiData, String> p) ->
|
||||
// new ReadOnlyStringWrapper(p.getValue().getValue().getResolution()));
|
||||
//
|
||||
// columnYear.setCellValueFactory((CellDataFeatures<streamUiData, Integer> p) ->
|
||||
// new ReadOnlyObjectWrapper(p.getValue().getValue().getYear()));
|
||||
//
|
||||
// columnSeason.setCellValueFactory((CellDataFeatures<streamUiData, Integer> p) ->
|
||||
// new ReadOnlyObjectWrapper(p.getValue().getValue().getSeason()));
|
||||
//
|
||||
// columnEpisode.setCellValueFactory((CellDataFeatures<streamUiData, Integer> p) ->
|
||||
// new ReadOnlyObjectWrapper(p.getValue().getValue().getEpisode()));
|
||||
|
||||
columnStreamUrl.setCellValueFactory((CellDataFeatures<streamUiData, String> p) ->
|
||||
new ReadOnlyStringWrapper(p.getValue().getValue().getStreamUrl()));
|
||||
|
||||
columnResolution.setCellValueFactory((CellDataFeatures<streamUiData, String> p) ->
|
||||
new ReadOnlyStringWrapper(p.getValue().getValue().getResolution()));
|
||||
|
||||
columnYear.setCellValueFactory((CellDataFeatures<streamUiData, Integer> p) ->
|
||||
new ReadOnlyObjectWrapper(p.getValue().getValue().getYear()));
|
||||
|
||||
columnSeason.setCellValueFactory((CellDataFeatures<streamUiData, Integer> p) ->
|
||||
new ReadOnlyObjectWrapper(p.getValue().getValue().getSeason()));
|
||||
|
||||
columnEpisode.setCellValueFactory((CellDataFeatures<streamUiData, Integer> p) ->
|
||||
new ReadOnlyObjectWrapper(p.getValue().getValue().getEpisode()));
|
||||
//write content into cell (new)
|
||||
columnTitel.setCellValueFactory(cellData -> cellData.getValue().getValue().titelProperty());
|
||||
columnRating.setCellValueFactory(cellData -> cellData.getValue().getValue().imageProperty());
|
||||
columnStreamUrl.setCellValueFactory(cellData -> cellData.getValue().getValue().streamUrlProperty());
|
||||
columnResolution.setCellValueFactory(cellData -> cellData.getValue().getValue().resolutionProperty());
|
||||
columnYear.setCellValueFactory(cellData -> cellData.getValue().getValue().yearProperty().asObject());
|
||||
columnSeason.setCellValueFactory(cellData -> cellData.getValue().getValue().seasonProperty().asObject());
|
||||
columnEpisode.setCellValueFactory(cellData -> cellData.getValue().getValue().episodeProperty().asObject());
|
||||
|
||||
treeTableViewfilm.getColumns().addAll(columnTitel, columnRating, columnStreamUrl, columnResolution, columnYear, columnSeason, columnEpisode);
|
||||
treeTableViewfilm.getColumns().get(2).setVisible(false); //blendet die Column mit den Dateinamen aus (wichtig um sie abzuspielen)
|
||||
@ -724,8 +732,8 @@ public class MainWindowController {
|
||||
for(int i = 0; i < newDaten.size(); i++){
|
||||
root.getChildren().add(new TreeItem<streamUiData>(newDaten.get(i))); //fügt daten zur Rootnode hinzu
|
||||
}
|
||||
columnRating.setMaxWidth(120);
|
||||
columnTitel.setMaxWidth(240);
|
||||
columnRating.setMaxWidth(80);
|
||||
columnTitel.setMaxWidth(280);
|
||||
treeTableViewfilm.getColumns().get(3).setVisible(false);
|
||||
treeTableViewfilm.getColumns().get(4).setVisible(false);
|
||||
treeTableViewfilm.getColumns().get(5).setVisible(false);
|
||||
@ -756,7 +764,7 @@ public class MainWindowController {
|
||||
if(entries[i].endsWith(".json")){
|
||||
String titel = ohneEndung(entries[i]);
|
||||
String data = entries[i];
|
||||
streamingData.add(new streamUiData(1,1,1,5.0,"1",titel ,data));
|
||||
streamingData.add(new streamUiData(1,1,1,5.0,"1",titel ,data, imv1));
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < streamingData.size(); i++){
|
||||
|
@ -4,21 +4,24 @@ import javafx.beans.property.DoubleProperty;
|
||||
import javafx.beans.property.IntegerProperty;
|
||||
import javafx.beans.property.SimpleDoubleProperty;
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.scene.image.ImageView;
|
||||
|
||||
public class streamUiData {
|
||||
|
||||
private IntegerProperty year = new SimpleIntegerProperty();
|
||||
private IntegerProperty season = new SimpleIntegerProperty();
|
||||
private IntegerProperty episode = new SimpleIntegerProperty();
|
||||
private DoubleProperty rating = new SimpleDoubleProperty();
|
||||
private StringProperty resolution = new SimpleStringProperty();
|
||||
private StringProperty titel = new SimpleStringProperty();
|
||||
private StringProperty streamUrl = new SimpleStringProperty();
|
||||
private final IntegerProperty year = new SimpleIntegerProperty();
|
||||
private final IntegerProperty season = new SimpleIntegerProperty();
|
||||
private final IntegerProperty episode = new SimpleIntegerProperty();
|
||||
private final DoubleProperty rating = new SimpleDoubleProperty();
|
||||
private final StringProperty resolution = new SimpleStringProperty();
|
||||
private final StringProperty titel = new SimpleStringProperty();
|
||||
private final StringProperty streamUrl = new SimpleStringProperty();
|
||||
private final SimpleObjectProperty<ImageView> image = new SimpleObjectProperty<>();
|
||||
|
||||
//uiData ist der Typ der Daten in der TreeTabelView
|
||||
public streamUiData (final int year, final int season, final int episode, final double rating, final String resolution, final String titel, final String streamUrl) {
|
||||
public streamUiData (final int year, final int season, final int episode, final double rating, final String resolution, final String titel, final String streamUrl, final ImageView image) {
|
||||
this.year.set(year);
|
||||
this.season.set(season);
|
||||
this.episode.set(episode);
|
||||
@ -26,63 +29,7 @@ public class streamUiData {
|
||||
this.resolution.set(resolution);
|
||||
this.titel.set(titel);
|
||||
this.streamUrl.set(streamUrl);
|
||||
}
|
||||
|
||||
public int getYear() {
|
||||
return year.get();
|
||||
}
|
||||
|
||||
public int getSeason() {
|
||||
return season.get();
|
||||
}
|
||||
|
||||
public int getEpisode() {
|
||||
return episode.get();
|
||||
}
|
||||
|
||||
public double getRating() {
|
||||
return rating.get();
|
||||
}
|
||||
|
||||
public String getResolution() {
|
||||
return resolution.get();
|
||||
}
|
||||
|
||||
public String getTitel() {
|
||||
return titel.get();
|
||||
}
|
||||
|
||||
public String getStreamUrl() {
|
||||
return streamUrl.get();
|
||||
}
|
||||
|
||||
|
||||
public void setYear(int year) {
|
||||
this.year.set(year);
|
||||
}
|
||||
|
||||
public void setSeason(int season) {
|
||||
this.season.set(season);
|
||||
}
|
||||
|
||||
public void setEpisode(int season) {
|
||||
this.episode.set(season);
|
||||
}
|
||||
|
||||
public void setRating(int rating) {
|
||||
this.rating.set(rating);
|
||||
}
|
||||
|
||||
public void setResolution(String resolution) {
|
||||
this.resolution.set(resolution);
|
||||
}
|
||||
|
||||
public void setTitel(String titel) {
|
||||
this.titel.set(titel);
|
||||
}
|
||||
|
||||
public void setStreamUrl(StringProperty streamUrl) {
|
||||
this.streamUrl = streamUrl;
|
||||
this.image.set(image);
|
||||
}
|
||||
|
||||
public IntegerProperty yearProperty(){
|
||||
@ -112,4 +59,74 @@ public class streamUiData {
|
||||
public StringProperty streamUrlProperty(){
|
||||
return streamUrl;
|
||||
}
|
||||
|
||||
public SimpleObjectProperty<ImageView> imageProperty(){
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
public final int getYear() {
|
||||
return yearProperty().get();
|
||||
}
|
||||
|
||||
public final int getSeason() {
|
||||
return seasonProperty().get();
|
||||
}
|
||||
|
||||
public final int getEpisode() {
|
||||
return episodeProperty().get();
|
||||
}
|
||||
|
||||
public final double getRating() {
|
||||
return ratingProperty().get();
|
||||
}
|
||||
|
||||
public final String getResolution() {
|
||||
return resolutionProperty().get();
|
||||
}
|
||||
|
||||
public final String getTitel() {
|
||||
return titelProperty().get();
|
||||
}
|
||||
|
||||
public final String getStreamUrl() {
|
||||
return streamUrlProperty().get();
|
||||
}
|
||||
|
||||
public final ImageView getImage() {
|
||||
return imageProperty().get();
|
||||
}
|
||||
|
||||
|
||||
public final void setYear(int year) {
|
||||
yearProperty().set(year);
|
||||
}
|
||||
|
||||
public final void setSeason(int season) {
|
||||
seasonProperty().set(season);
|
||||
}
|
||||
|
||||
public final void setEpisode(int season) {
|
||||
episodeProperty().set(season);
|
||||
}
|
||||
|
||||
public final void setRating(int rating) {
|
||||
ratingProperty().set(rating);
|
||||
}
|
||||
|
||||
public final void setResolution(String resolution) {
|
||||
resolutionProperty().set(resolution);
|
||||
}
|
||||
|
||||
public final void setTitel(String titel) {
|
||||
titelProperty().set(titel);
|
||||
}
|
||||
|
||||
public final void setStreamUrl(String streamUrl) {
|
||||
streamUrlProperty().set(streamUrl);
|
||||
}
|
||||
|
||||
public final void setImage(ImageView image) {
|
||||
imageProperty().set(image);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user