Skip to content

Commit 1235a7c

Browse files
committed
- cleanup
1 parent f2da5b1 commit 1235a7c

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

src/main/java/mediathek/javafx/bookmark/BookmarkWindowController.java

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ public BookmarkWindowController() {
120120
Font.loadFont(BookmarkWindowController.class.getResourceAsStream("/mediathek/res/programm/fxml/fontawesome-webfont.ttf"), 16);
121121
}
122122

123-
private static void setStageSize(Stage window) {
123+
private void setStageSize() {
124124
Configuration config = ApplicationConfiguration.getConfiguration();
125125
try {
126126
config.lock(LockMode.READ);
127-
window.setWidth(config.getInt(ApplicationConfiguration.APPLICATION_UI_BOOKMARKLIST + ".width", 640));
128-
window.setHeight(config.getInt(ApplicationConfiguration.APPLICATION_UI_BOOKMARKLIST + ".heigth", 480));
129-
window.setX(config.getInt(ApplicationConfiguration.APPLICATION_UI_BOOKMARKLIST + ".location.x", 0));
130-
window.setY(config.getInt(ApplicationConfiguration.APPLICATION_UI_BOOKMARKLIST + ".location.y", 0));
127+
stage.setWidth(config.getInt(ApplicationConfiguration.APPLICATION_UI_BOOKMARKLIST + ".width", 640));
128+
stage.setHeight(config.getInt(ApplicationConfiguration.APPLICATION_UI_BOOKMARKLIST + ".heigth", 480));
129+
stage.setX(config.getInt(ApplicationConfiguration.APPLICATION_UI_BOOKMARKLIST + ".location.x", 0));
130+
stage.setY(config.getInt(ApplicationConfiguration.APPLICATION_UI_BOOKMARKLIST + ".location.y", 0));
131131
}
132132
finally {
133133
config.unlock(LockMode.READ);
@@ -566,18 +566,28 @@ private void tbviewMouseClick(MouseEvent e) {
566566
}
567567
}
568568

569+
private Stage createStage() {
570+
Stage stage = new Stage();
571+
stage.setTitle("Merkliste verwalten");
572+
stage.getIcons().add(new Image("/mediathek/res/MediathekView.png"));
573+
stage.setOnHiding(_ -> {
574+
cancelBookmarkSave();
575+
saveBookMarkList();
576+
});
577+
578+
return stage;
579+
}
580+
569581
/**
570582
* Display Window on screen
571583
* During first call a new window is created, for successive calls the existing window is reused
572584
*/
573585
public void show() {
574586
Platform.runLater(() -> {
575587
if (stage == null) {
576-
stage = new Stage();
577-
setStageSize(stage); // restore size
578-
setStageEvents();
579-
stage.setTitle("Merkliste verwalten");
580-
stage.getIcons().add(new Image("/mediathek/res/MediathekView.png"));
588+
stage = createStage();
589+
setStageSize(); // restore size
590+
581591
try {
582592
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/mediathek/res/programm/fxml/bookmarkWindow.fxml"));
583593
fxmlLoader.setController(this);
@@ -738,13 +748,6 @@ public void saveSettings() {
738748
}
739749
}
740750

741-
private void setStageEvents() {
742-
stage.setOnHiding(_ -> {
743-
cancelBookmarkSave();
744-
saveBookMarkList();
745-
});
746-
}
747-
748751
/**
749752
* Returns true if the current table selection contains unseen items
750753
* @return boolean

0 commit comments

Comments
 (0)