|
@@ -43,11 +43,10 @@ public class FxApplication extends Application {
|
|
|
private final Optional<MacFunctions> macFunctions;
|
|
|
private final VaultService vaultService;
|
|
|
private final LicenseHolder licenseHolder;
|
|
|
- private final ObservableSet<Stage> visibleStages = FXCollections.observableSet();
|
|
|
- private final BooleanBinding hasVisibleStages = Bindings.isNotEmpty(visibleStages);
|
|
|
+ private final BooleanBinding hasVisibleStages;
|
|
|
|
|
|
@Inject
|
|
|
- FxApplication(Settings settings, Lazy<MainWindowComponent> mainWindow, Lazy<PreferencesComponent> preferencesWindow, UnlockComponent.Builder unlockWindowBuilder, QuitComponent.Builder quitWindowBuilder, Optional<MacFunctions> macFunctions, VaultService vaultService, LicenseHolder licenseHolder) {
|
|
|
+ FxApplication(Settings settings, Lazy<MainWindowComponent> mainWindow, Lazy<PreferencesComponent> preferencesWindow, UnlockComponent.Builder unlockWindowBuilder, QuitComponent.Builder quitWindowBuilder, Optional<MacFunctions> macFunctions, VaultService vaultService, LicenseHolder licenseHolder, ObservableSet<Stage> visibleStages) {
|
|
|
this.settings = settings;
|
|
|
this.mainWindow = mainWindow;
|
|
|
this.preferencesWindow = preferencesWindow;
|
|
@@ -56,6 +55,7 @@ public class FxApplication extends Application {
|
|
|
this.macFunctions = macFunctions;
|
|
|
this.vaultService = vaultService;
|
|
|
this.licenseHolder = licenseHolder;
|
|
|
+ this.hasVisibleStages = Bindings.isNotEmpty(visibleStages);
|
|
|
}
|
|
|
|
|
|
public void start() {
|
|
@@ -73,11 +73,6 @@ public class FxApplication extends Application {
|
|
|
throw new UnsupportedOperationException("Use start() instead.");
|
|
|
}
|
|
|
|
|
|
- private void addVisibleStage(Stage stage) {
|
|
|
- visibleStages.add(stage);
|
|
|
- stage.setOnHidden(evt -> visibleStages.remove(stage));
|
|
|
- }
|
|
|
-
|
|
|
private void hasVisibleStagesChanged(@SuppressWarnings("unused") ObservableValue<? extends Boolean> observableValue, @SuppressWarnings("unused") boolean oldValue, boolean newValue) {
|
|
|
if (newValue) {
|
|
|
macFunctions.map(MacFunctions::uiState).ifPresent(MacApplicationUiState::transformToForegroundApplication);
|
|
@@ -88,32 +83,28 @@ public class FxApplication extends Application {
|
|
|
|
|
|
public void showPreferencesWindow(SelectedPreferencesTab selectedTab) {
|
|
|
Platform.runLater(() -> {
|
|
|
- Stage stage = preferencesWindow.get().showPreferencesWindow(selectedTab);
|
|
|
- addVisibleStage(stage);
|
|
|
+ preferencesWindow.get().showPreferencesWindow(selectedTab);
|
|
|
LOG.debug("Showing Preferences");
|
|
|
});
|
|
|
}
|
|
|
|
|
|
public void showMainWindow() {
|
|
|
Platform.runLater(() -> {
|
|
|
- Stage stage = mainWindow.get().showMainWindow();
|
|
|
- addVisibleStage(stage);
|
|
|
+ mainWindow.get().showMainWindow();
|
|
|
LOG.debug("Showing MainWindow");
|
|
|
});
|
|
|
}
|
|
|
|
|
|
public void showUnlockWindow(Vault vault) {
|
|
|
Platform.runLater(() -> {
|
|
|
- Stage stage = unlockWindowBuilder.vault(vault).build().showUnlockWindow();
|
|
|
- addVisibleStage(stage);
|
|
|
+ unlockWindowBuilder.vault(vault).build().showUnlockWindow();
|
|
|
LOG.debug("Showing UnlockWindow for {}", vault.getDisplayableName());
|
|
|
});
|
|
|
}
|
|
|
|
|
|
public void showQuitWindow(QuitResponse response) {
|
|
|
Platform.runLater(() -> {
|
|
|
- Stage stage = quitWindowBuilder.quitResponse(response).build().showQuitWindow();
|
|
|
- addVisibleStage(stage);
|
|
|
+ quitWindowBuilder.quitResponse(response).build().showQuitWindow();
|
|
|
LOG.debug("Showing QuitWindow");
|
|
|
});
|
|
|
}
|