don't use mains primarystage, disabled column resizeing
This commit is contained in:
parent
d3d22db7a8
commit
3e80354d88
|
@ -59,7 +59,6 @@ public class Main extends Application {
|
||||||
LOGGER.info("User: " + XMLController.getUserName() + " " + XMLController.getUserHome());
|
LOGGER.info("User: " + XMLController.getUserName() + " " + XMLController.getUserHome());
|
||||||
|
|
||||||
this.primaryStage = primaryStage;
|
this.primaryStage = primaryStage;
|
||||||
mainWindowController = new MainWindowController(this);
|
|
||||||
|
|
||||||
mainWindow();
|
mainWindow();
|
||||||
}
|
}
|
||||||
|
@ -72,7 +71,6 @@ public class Main extends Application {
|
||||||
try {
|
try {
|
||||||
FXMLLoader loader = new FXMLLoader();
|
FXMLLoader loader = new FXMLLoader();
|
||||||
loader.setLocation(getClass().getResource("/fxml/MainWindow.fxml"));
|
loader.setLocation(getClass().getResource("/fxml/MainWindow.fxml"));
|
||||||
loader.setController(mainWindowController);
|
|
||||||
pane = (AnchorPane) loader.load();
|
pane = (AnchorPane) loader.load();
|
||||||
primaryStage.setMinHeight(600.00);
|
primaryStage.setMinHeight(600.00);
|
||||||
primaryStage.setMinWidth(1000.00);
|
primaryStage.setMinWidth(1000.00);
|
||||||
|
@ -100,6 +98,7 @@ public class Main extends Application {
|
||||||
XMLController.getPosterCache().mkdir();
|
XMLController.getPosterCache().mkdir();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mainWindowController = loader.getController(); //Link of FXMLController and controller class
|
||||||
mainWindowController.init();
|
mainWindowController.init();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.error(e);
|
LOGGER.error(e);
|
||||||
|
|
|
@ -82,6 +82,7 @@ import javafx.scene.text.Font;
|
||||||
import javafx.scene.text.TextFlow;
|
import javafx.scene.text.TextFlow;
|
||||||
import javafx.stage.DirectoryChooser;
|
import javafx.stage.DirectoryChooser;
|
||||||
import javafx.stage.FileChooser;
|
import javafx.stage.FileChooser;
|
||||||
|
import javafx.stage.Stage;
|
||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
import kellerkinder.HomeFlix.controller.DBController;
|
import kellerkinder.HomeFlix.controller.DBController;
|
||||||
import kellerkinder.HomeFlix.controller.OMDbAPIController;
|
import kellerkinder.HomeFlix.controller.OMDbAPIController;
|
||||||
|
@ -155,11 +156,11 @@ public class MainWindowController {
|
||||||
// poster-mode
|
// poster-mode
|
||||||
// @FXML private AnchorPane posterModeAnchorPane;
|
// @FXML private AnchorPane posterModeAnchorPane;
|
||||||
|
|
||||||
private Main main;
|
|
||||||
private MainWindowController mainWindowController;
|
private MainWindowController mainWindowController;
|
||||||
private UpdateController updateController;
|
private UpdateController updateController;
|
||||||
private DBController dbController;
|
private DBController dbController;
|
||||||
private XMLController xmlController;
|
private XMLController xmlController;
|
||||||
|
private Stage primaryStage;
|
||||||
private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
|
private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
|
||||||
|
|
||||||
private boolean menuTrue = false;
|
private boolean menuTrue = false;
|
||||||
|
@ -187,17 +188,16 @@ public class MainWindowController {
|
||||||
private MenuItem dislike = new MenuItem("dislike"); // TODO one option (like or dislike)
|
private MenuItem dislike = new MenuItem("dislike"); // TODO one option (like or dislike)
|
||||||
private ContextMenu menu = new ContextMenu(like, dislike);
|
private ContextMenu menu = new ContextMenu(like, dislike);
|
||||||
|
|
||||||
/**
|
public MainWindowController() {
|
||||||
* Initialize other objects: Updater, dbController and ApiQuery
|
// the constructor
|
||||||
* @param main the main object
|
|
||||||
*/
|
|
||||||
public MainWindowController(Main main) {
|
|
||||||
this.main = main;
|
|
||||||
mainWindowController = this;
|
|
||||||
xmlController = new XMLController(); // TODO pass it over from main?
|
|
||||||
dbController = new DBController(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void initialize() {
|
||||||
|
mainWindowController = this;
|
||||||
|
xmlController = new XMLController();
|
||||||
|
dbController = new DBController(this);
|
||||||
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
LOGGER.info("Initializing Project-HomeFlix build " + buildNumber);
|
LOGGER.info("Initializing Project-HomeFlix build " + buildNumber);
|
||||||
|
@ -206,6 +206,7 @@ public class MainWindowController {
|
||||||
checkAutoUpdate();
|
checkAutoUpdate();
|
||||||
|
|
||||||
// initialize the GUI and the DBController
|
// initialize the GUI and the DBController
|
||||||
|
primaryStage = (Stage) mainAnchorPane.getScene().getWindow(); // set primary stage for dialogs
|
||||||
initTabel();
|
initTabel();
|
||||||
initUI();
|
initUI();
|
||||||
initActions();
|
initActions();
|
||||||
|
@ -244,10 +245,21 @@ public class MainWindowController {
|
||||||
|
|
||||||
// film Table
|
// film Table
|
||||||
columnStreamUrl.setMaxWidth(0);
|
columnStreamUrl.setMaxWidth(0);
|
||||||
columnTitle.setMaxWidth(190);
|
columnTitle.setMaxWidth(182);
|
||||||
columnFavorite.setMaxWidth(80);
|
columnFavorite.setMaxWidth(80);
|
||||||
columnSeason.setMaxWidth(73);
|
columnSeason.setMaxWidth(70);
|
||||||
columnEpisode.setMaxWidth(77);
|
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;");
|
columnFavorite.setStyle("-fx-alignment: CENTER;");
|
||||||
|
|
||||||
filmsTreeTable.setRoot(filmRoot);
|
filmsTreeTable.setRoot(filmRoot);
|
||||||
|
@ -298,7 +310,6 @@ public class MainWindowController {
|
||||||
}
|
}
|
||||||
if (settingsTrue) {
|
if (settingsTrue) {
|
||||||
settingsScrollPane.setVisible(false);
|
settingsScrollPane.setVisible(false);
|
||||||
xmlController.saveSettings();
|
|
||||||
settingsTrue = false;
|
settingsTrue = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -476,7 +487,7 @@ public class MainWindowController {
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
if (output.contains("which: no vlc") || output == "") {
|
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();
|
vlcInfoAlert.showAndWait();
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
@ -525,7 +536,7 @@ public class MainWindowController {
|
||||||
private void aboutBtnAction() {
|
private void aboutBtnAction() {
|
||||||
String bodyText = "Project HomeFlix \nVersion: " + version + " (Build: " + buildNumber + ") \""
|
String bodyText = "Project HomeFlix \nVersion: " + version + " (Build: " + buildNumber + ") \""
|
||||||
+ versionName + "\" \n" + getBundle().getString("infoText");
|
+ 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();
|
infoAlert.showAndWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,7 +544,6 @@ public class MainWindowController {
|
||||||
private void settingsBtnclicked() {
|
private void settingsBtnclicked() {
|
||||||
if (settingsTrue) {
|
if (settingsTrue) {
|
||||||
settingsScrollPane.setVisible(false);
|
settingsScrollPane.setVisible(false);
|
||||||
xmlController.saveSettings();
|
|
||||||
settingsTrue = false;
|
settingsTrue = false;
|
||||||
} else {
|
} else {
|
||||||
settingsScrollPane.setVisible(true);
|
settingsScrollPane.setVisible(true);
|
||||||
|
@ -545,7 +555,7 @@ public class MainWindowController {
|
||||||
private void addDirectoryBtnAction(){
|
private void addDirectoryBtnAction(){
|
||||||
DirectoryChooser directoryChooser = new DirectoryChooser();
|
DirectoryChooser directoryChooser = new DirectoryChooser();
|
||||||
directoryChooser.setTitle(bundle.getString("addDirectory"));
|
directoryChooser.setTitle(bundle.getString("addDirectory"));
|
||||||
File selectedFolder = directoryChooser.showDialog(main.getPrimaryStage());
|
File selectedFolder = directoryChooser.showDialog(primaryStage);
|
||||||
if (selectedFolder != null && selectedFolder.exists()) {
|
if (selectedFolder != null && selectedFolder.exists()) {
|
||||||
addSource(selectedFolder.getPath(), "local");
|
addSource(selectedFolder.getPath(), "local");
|
||||||
} else {
|
} else {
|
||||||
|
@ -556,8 +566,8 @@ public class MainWindowController {
|
||||||
@FXML
|
@FXML
|
||||||
private void addStreamSourceBtnAction(){
|
private void addStreamSourceBtnAction(){
|
||||||
FileChooser fileChooser = new FileChooser();
|
FileChooser fileChooser = new FileChooser();
|
||||||
fileChooser.setTitle("addStreamSource");
|
fileChooser.setTitle(bundle.getString("addStreamSource"));
|
||||||
File selectedFile = fileChooser.showOpenDialog(main.getPrimaryStage());
|
File selectedFile = fileChooser.showOpenDialog(primaryStage);
|
||||||
if (selectedFile != null && selectedFile.exists()) {
|
if (selectedFile != null && selectedFile.exists()) {
|
||||||
addSource(selectedFile.getPath(), "stream");
|
addSource(selectedFile.getPath(), "stream");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
<?import javafx.scene.text.TextFlow?>
|
<?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>
|
<children>
|
||||||
<AnchorPane fx:id="tableModeAnchorPane" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="32.0">
|
<AnchorPane fx:id="tableModeAnchorPane" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="32.0">
|
||||||
<children>
|
<children>
|
||||||
|
|
Loading…
Reference in New Issue