Browse Source

don't use mains primarystage, disabled column resizeing

pull/12/head
Jannik 4 years ago
parent
commit
3e80354d88
  1. 3
      src/main/java/kellerkinder/HomeFlix/application/Main.java
  2. 48
      src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java
  3. 2
      src/main/resources/fxml/MainWindow.fxml

3
src/main/java/kellerkinder/HomeFlix/application/Main.java

@ -59,7 +59,6 @@ public class Main extends Application {
LOGGER.info("User: " + XMLController.getUserName() + " " + XMLController.getUserHome());
this.primaryStage = primaryStage;
mainWindowController = new MainWindowController(this);
mainWindow();
}
@ -72,7 +71,6 @@ public class Main extends Application {
try {
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource("/fxml/MainWindow.fxml"));
loader.setController(mainWindowController);
pane = (AnchorPane) loader.load();
primaryStage.setMinHeight(600.00);
primaryStage.setMinWidth(1000.00);
@ -100,6 +98,7 @@ public class Main extends Application {
XMLController.getPosterCache().mkdir();
}
mainWindowController = loader.getController(); //Link of FXMLController and controller class
mainWindowController.init();
} catch (IOException e) {
LOGGER.error(e);

48
src/main/java/kellerkinder/HomeFlix/application/MainWindowController.java

@ -82,6 +82,7 @@ import javafx.scene.text.Font;
import javafx.scene.text.TextFlow;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import javafx.stage.Stage;
import javafx.util.Duration;
import kellerkinder.HomeFlix.controller.DBController;
import kellerkinder.HomeFlix.controller.OMDbAPIController;
@ -155,11 +156,11 @@ public class MainWindowController {
// poster-mode
// @FXML private AnchorPane posterModeAnchorPane;
private Main main;
private MainWindowController mainWindowController;
private UpdateController updateController;
private DBController dbController;
private XMLController xmlController;
private Stage primaryStage;
private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
private boolean menuTrue = false;
@ -187,18 +188,17 @@ public class MainWindowController {
private MenuItem dislike = new MenuItem("dislike"); // TODO one option (like or dislike)
private ContextMenu menu = new ContextMenu(like, dislike);
/**
* Initialize other objects: Updater, dbController and ApiQuery
* @param main the main object
*/
public MainWindowController(Main main) {
this.main = main;
public MainWindowController() {
// the constructor
}
@FXML
public void initialize() {
mainWindowController = this;
xmlController = new XMLController(); // TODO pass it over from main?
xmlController = new XMLController();
dbController = new DBController(this);
}
public void init() {
LOGGER.info("Initializing Project-HomeFlix build " + buildNumber);
@ -206,6 +206,7 @@ public class MainWindowController {
checkAutoUpdate();
// initialize the GUI and the DBController
primaryStage = (Stage) mainAnchorPane.getScene().getWindow(); // set primary stage for dialogs
initTabel();
initUI();
initActions();
@ -244,10 +245,21 @@ public class MainWindowController {
// film Table
columnStreamUrl.setMaxWidth(0);
columnTitle.setMaxWidth(190);
columnTitle.setMaxWidth(182);
columnFavorite.setMaxWidth(80);
columnSeason.setMaxWidth(73);
columnEpisode.setMaxWidth(77);
columnSeason.setMaxWidth(70);
columnEpisode.setMaxWidth(70);
columnTitle.setMinWidth(182);
columnFavorite.setMinWidth(80);
columnSeason.setMinWidth(70);
columnEpisode.setMinWidth(70);
columnTitle.setResizable(false);
columnFavorite.setResizable(false);
columnSeason.setResizable(false);
columnEpisode.setResizable(false);
columnFavorite.setStyle("-fx-alignment: CENTER;");
filmsTreeTable.setRoot(filmRoot);
@ -298,7 +310,6 @@ public class MainWindowController {
}
if (settingsTrue) {
settingsScrollPane.setVisible(false);
xmlController.saveSettings();
settingsTrue = false;
}
});
@ -476,7 +487,7 @@ public class MainWindowController {
e1.printStackTrace();
}
if (output.contains("which: no vlc") || output == "") {
JFXInfoAlert vlcInfoAlert = new JFXInfoAlert("Info", getBundle().getString("vlcNotInstalled"), btnStyle, main.getPrimaryStage());
JFXInfoAlert vlcInfoAlert = new JFXInfoAlert("Info", getBundle().getString("vlcNotInstalled"), btnStyle, primaryStage);
vlcInfoAlert.showAndWait();
} else {
try {
@ -525,7 +536,7 @@ public class MainWindowController {
private void aboutBtnAction() {
String bodyText = "Project HomeFlix \nVersion: " + version + " (Build: " + buildNumber + ") \""
+ versionName + "\" \n" + getBundle().getString("infoText");
JFXInfoAlert infoAlert = new JFXInfoAlert("Project HomeFlix", bodyText, btnStyle, main.getPrimaryStage());
JFXInfoAlert infoAlert = new JFXInfoAlert("Project HomeFlix", bodyText, btnStyle, primaryStage);
infoAlert.showAndWait();
}
@ -533,7 +544,6 @@ public class MainWindowController {
private void settingsBtnclicked() {
if (settingsTrue) {
settingsScrollPane.setVisible(false);
xmlController.saveSettings();
settingsTrue = false;
} else {
settingsScrollPane.setVisible(true);
@ -545,7 +555,7 @@ public class MainWindowController {
private void addDirectoryBtnAction(){
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle(bundle.getString("addDirectory"));
File selectedFolder = directoryChooser.showDialog(main.getPrimaryStage());
File selectedFolder = directoryChooser.showDialog(primaryStage);
if (selectedFolder != null && selectedFolder.exists()) {
addSource(selectedFolder.getPath(), "local");
} else {
@ -556,8 +566,8 @@ public class MainWindowController {
@FXML
private void addStreamSourceBtnAction(){
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("addStreamSource");
File selectedFile = fileChooser.showOpenDialog(main.getPrimaryStage());
fileChooser.setTitle(bundle.getString("addStreamSource"));
File selectedFile = fileChooser.showOpenDialog(primaryStage);
if (selectedFile != null && selectedFile.exists()) {
addSource(selectedFile.getPath(), "stream");
} else {

2
src/main/resources/fxml/MainWindow.fxml

@ -22,7 +22,7 @@
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.TextFlow?>
<AnchorPane fx:id="mainAnchorPane" prefHeight="600.0" prefWidth="1000.0" xmlns="http://javafx.com/javafx/10.0.1" xmlns:fx="http://javafx.com/fxml/1">
<AnchorPane fx:id="mainAnchorPane" prefHeight="600.0" prefWidth="1000.0" xmlns="http://javafx.com/javafx/10.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="kellerkinder.HomeFlix.application.MainWindowController">
<children>
<AnchorPane fx:id="tableModeAnchorPane" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="32.0">
<children>

Loading…
Cancel
Save

Du besuchst diese Seite mit einem veralteten IPv4-Internetzugang. Möglicherweise treten in Zukunft Probleme mit der Erreichbarkeit und Performance auf. Bitte frage deinen Internetanbieter oder Netzwerkadministrator nach IPv6-Unterstützung.
You are visiting this site with an outdated IPv4 internet access. You may experience problems with accessibility and performance in the future. Please ask your ISP or network administrator for IPv6 support.
Weitere Infos | More Information
Klicke zum schließen | Click to close