clean up DetailViews
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Jannik 2020-05-22 17:12:07 +02:00
parent c04a7c0d4d
commit 834bffda93
Signed by: Seil0
GPG Key ID: E8459F3723C52C24
7 changed files with 56 additions and 76 deletions

View File

@ -39,6 +39,8 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.kellerkinder.Alerts.JFX2BtnCancelAlert; import org.kellerkinder.Alerts.JFX2BtnCancelAlert;
import org.kellerkinder.Alerts.JFXInfoAlert; import org.kellerkinder.Alerts.JFXInfoAlert;
import org.mosad.homeflix.application.view.FilmDetailView;
import org.mosad.homeflix.application.view.SeriesDetailView;
import org.mosad.homeflix.controller.DBController; import org.mosad.homeflix.controller.DBController;
import org.mosad.homeflix.controller.OMDbAPIController; import org.mosad.homeflix.controller.OMDbAPIController;
import org.mosad.homeflix.controller.UpdateController; import org.mosad.homeflix.controller.UpdateController;

View File

@ -30,6 +30,7 @@ import java.io.Writer;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.mosad.homeflix.application.view.FilmDetailView;
import org.mosad.homeflix.controller.DBController; import org.mosad.homeflix.controller.DBController;
import org.mosad.homeflix.controller.UpdateController; import org.mosad.homeflix.controller.UpdateController;
import org.mosad.homeflix.controller.XMLController; import org.mosad.homeflix.controller.XMLController;

View File

@ -0,0 +1,42 @@
package org.mosad.homeflix.application.view;
import org.mosad.homeflix.application.MainWindowController;
import javafx.animation.FadeTransition;
import javafx.fxml.FXML;
import javafx.scene.layout.AnchorPane;
import javafx.util.Duration;
public class DetailView {
@FXML protected AnchorPane rootPane;
public void updateGUILocal() {
throw new UnsupportedOperationException();
}
/**
* show the root pane
*/
public void showPane() {
rootPane.setVisible(true);
FadeTransition fadeIn = new FadeTransition(Duration.millis(300), rootPane);
fadeIn.setFromValue(0.3);
fadeIn.setToValue(1.0);
fadeIn.play();
}
/**
* hide the root pane and disable the blur in MainWindowController
*/
protected void hidePane() {
FadeTransition fadeOut = new FadeTransition(Duration.millis(200), rootPane);
fadeOut.setFromValue(1.0);
fadeOut.setToValue(0.3);
fadeOut.play();
rootPane.setVisible(false);
MainWindowController.getInstance().disableBlur(); // disable blur
}
}

View File

@ -20,7 +20,7 @@
* *
*/ */
package org.mosad.homeflix.application; package org.mosad.homeflix.application.view;
import java.awt.Desktop; import java.awt.Desktop;
import java.io.File; import java.io.File;
@ -35,18 +35,13 @@ import org.mosad.homeflix.player.Player;
import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXButton;
import javafx.animation.FadeTransition;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.text.Text; import javafx.scene.text.Text;
import javafx.util.Duration;
public class FilmDetailView { public class FilmDetailView extends DetailView {
@FXML private AnchorPane filmDVPane;
@FXML private Label lblTitle; @FXML private Label lblTitle;
@FXML private Label lblYear; @FXML private Label lblYear;
@ -88,7 +83,7 @@ public class FilmDetailView {
public void initialize() { public void initialize() {
dbController = DBController.getInstance(); dbController = DBController.getInstance();
filmDVPane.setStyle("-fx-background-color: rgba(89,89,89,0.9);"); rootPane.setStyle("-fx-background-color: rgba(89,89,89,0.9);");
} }
@FXML @FXML
@ -115,7 +110,7 @@ public class FilmDetailView {
@FXML @FXML
private void btnPlayAction() { private void btnPlayAction() {
playFilm(); new Player(currentStreamURL);
} }
@FXML @FXML
@ -178,6 +173,7 @@ public class FilmDetailView {
/** /**
* update the text of all static GUI elements of FilmDeatilView * update the text of all static GUI elements of FilmDeatilView
*/ */
@Override
public void updateGUILocal() { public void updateGUILocal() {
lblCrew.setText(XMLController.getLocalBundle().getString("crew")); lblCrew.setText(XMLController.getLocalBundle().getString("crew"));
lblDirectorsInfo.setText(XMLController.getLocalBundle().getString("directors")); lblDirectorsInfo.setText(XMLController.getLocalBundle().getString("directors"));
@ -190,38 +186,5 @@ public class FilmDetailView {
lblRevenueInfo.setText(XMLController.getLocalBundle().getString("boxOffice")); lblRevenueInfo.setText(XMLController.getLocalBundle().getString("boxOffice"));
lblRatingInfo.setText(XMLController.getLocalBundle().getString("rated")); lblRatingInfo.setText(XMLController.getLocalBundle().getString("rated"));
} }
/**
* show the FilmDVpane
*/
public void showPane() {
filmDVPane.setVisible(true);
FadeTransition fadeIn = new FadeTransition(Duration.millis(300), filmDVPane);
fadeIn.setFromValue(0.3);
fadeIn.setToValue(1.0);
fadeIn.play();
}
/**
* hide the FilmDVpane
*/
private void hidePane() {
FadeTransition fadeOut = new FadeTransition(Duration.millis(200), filmDVPane);
fadeOut.setFromValue(1.0);
fadeOut.setToValue(0.3);
fadeOut.play();
filmDVPane.setVisible(false);
MainWindowController.getInstance().disableBlur(); // disable blur
}
private void playFilm() {
if(new File(currentStreamURL).isDirectory()) {
return;
}
new Player(currentStreamURL);
}
} }

View File

@ -20,7 +20,7 @@
* *
*/ */
package org.mosad.homeflix.application; package org.mosad.homeflix.application.view;
import java.awt.Desktop; import java.awt.Desktop;
import java.io.File; import java.io.File;
@ -36,7 +36,6 @@ import org.mosad.homeflix.player.Player;
import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXButton;
import javafx.animation.FadeTransition;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
@ -46,14 +45,11 @@ import javafx.scene.control.ScrollPane;
import javafx.scene.control.ScrollPane.ScrollBarPolicy; import javafx.scene.control.ScrollPane.ScrollBarPolicy;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.HBox; import javafx.scene.layout.HBox;
import javafx.scene.text.Text; import javafx.scene.text.Text;
import javafx.util.Duration;
public class SeriesDetailView { public class SeriesDetailView extends DetailView {
@FXML private AnchorPane seriesDVPane;
@FXML private ScrollPane scrollPaneEpisodes; @FXML private ScrollPane scrollPaneEpisodes;
@FXML private HBox hBoxEpisodes; @FXML private HBox hBoxEpisodes;
@ -90,7 +86,7 @@ public class SeriesDetailView {
public void initialize() { public void initialize() {
dbController = DBController.getInstance(); dbController = DBController.getInstance();
seriesDVPane.setStyle("-fx-background-color: rgba(89,89,89,0.9);"); rootPane.setStyle("-fx-background-color: rgba(89,89,89,0.9);");
scrollPaneEpisodes.setStyle("-fx-background-color: transparent;"); scrollPaneEpisodes.setStyle("-fx-background-color: transparent;");
scrollPaneEpisodes.setHbarPolicy(ScrollBarPolicy.ALWAYS); scrollPaneEpisodes.setHbarPolicy(ScrollBarPolicy.ALWAYS);
@ -188,6 +184,7 @@ public class SeriesDetailView {
/** /**
* update the text of all static GUI elements of FilmDeatilView * update the text of all static GUI elements of FilmDeatilView
*/ */
@Override
public void updateGUILocal() { public void updateGUILocal() {
lblCrew.setText(XMLController.getLocalBundle().getString("crew")); lblCrew.setText(XMLController.getLocalBundle().getString("crew"));
lblDirectorsInfo.setText(XMLController.getLocalBundle().getString("directors")); lblDirectorsInfo.setText(XMLController.getLocalBundle().getString("directors"));
@ -195,31 +192,6 @@ public class SeriesDetailView {
lblActorsInfo.setText(XMLController.getLocalBundle().getString("actors")); lblActorsInfo.setText(XMLController.getLocalBundle().getString("actors"));
} }
/**
* show the FilmDVpane
*/
public void showPane() {
seriesDVPane.setVisible(true);
FadeTransition fadeIn = new FadeTransition(Duration.millis(300), seriesDVPane);
fadeIn.setFromValue(0.3);
fadeIn.setToValue(1.0);
fadeIn.play();
}
/**
* hide the FilmDVpane
*/
private void hidePane() {
FadeTransition fadeOut = new FadeTransition(Duration.millis(200), seriesDVPane);
fadeOut.setFromValue(1.0);
fadeOut.setToValue(0.3);
fadeOut.play();
seriesDVPane.setVisible(false);
MainWindowController.getInstance().disableBlur(); // disable blur
}
/** /**
* add all episodes of one season to the ScrollPane * add all episodes of one season to the ScrollPane
* @param season the season to add * @param season the season to add

View File

@ -12,7 +12,7 @@
<?import javafx.scene.text.Text?> <?import javafx.scene.text.Text?>
<?import javafx.scene.text.TextFlow?> <?import javafx.scene.text.TextFlow?>
<AnchorPane fx:id="filmDVPane" prefHeight="568.0" prefWidth="1130.0" style="-fx-background-color: #595959;" visible="false" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.mosad.homeflix.application.FilmDetailView"> <AnchorPane fx:id="rootPane" prefHeight="568.0" prefWidth="1130.0" style="-fx-background-color: #595959;" visible="false" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.mosad.homeflix.application.view.FilmDetailView">
<children> <children>
<HBox layoutX="22.0" layoutY="21.0" prefWidth="808.0" spacing="10.0" AnchorPane.leftAnchor="22.0" AnchorPane.rightAnchor="300.0" AnchorPane.topAnchor="22.0"> <HBox layoutX="22.0" layoutY="21.0" prefWidth="808.0" spacing="10.0" AnchorPane.leftAnchor="22.0" AnchorPane.rightAnchor="300.0" AnchorPane.topAnchor="22.0">
<children> <children>

View File

@ -14,7 +14,7 @@
<?import javafx.scene.text.Text?> <?import javafx.scene.text.Text?>
<?import javafx.scene.text.TextFlow?> <?import javafx.scene.text.TextFlow?>
<AnchorPane fx:id="seriesDVPane" prefHeight="568.0" prefWidth="1130.0" style="-fx-background-color: #595959;" visible="false" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.mosad.homeflix.application.SeriesDetailView"> <AnchorPane fx:id="rootPane" prefHeight="568.0" prefWidth="1130.0" style="-fx-background-color: #595959;" visible="false" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.mosad.homeflix.application.view.SeriesDetailView">
<children> <children>
<HBox layoutX="22.0" layoutY="21.0" prefWidth="808.0" spacing="10.0" AnchorPane.leftAnchor="22.0" AnchorPane.rightAnchor="310.0" AnchorPane.topAnchor="22.0"> <HBox layoutX="22.0" layoutY="21.0" prefWidth="808.0" spacing="10.0" AnchorPane.leftAnchor="22.0" AnchorPane.rightAnchor="310.0" AnchorPane.topAnchor="22.0">
<children> <children>