Skip to content

Commit

Permalink
fixes #297 by disabling closing of modal windows via operating system…
Browse files Browse the repository at this point in the history
… shortcut (closing the modal window is correctly handled by the appropriate buttons)
  • Loading branch information
chalkos committed Jun 21, 2017
1 parent 6d21e45 commit 30226a6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/main/java/org/roda/rodain/ui/ModalStage.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package org.roda.rodain.ui;

import javafx.application.Platform;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.stage.WindowEvent;
import org.roda.rodain.core.Constants;
import org.roda.rodain.ui.utils.UnsafeDouble;

Expand Down Expand Up @@ -34,6 +38,7 @@ public ModalStage(Stage primaryStage) {
colorAdjust = new ColorAdjust();
colorAdjust.setBrightness(-0.275);

setOnCloseRequest(Event::consume);
setResizable(false);

Scene scene = new Scene(new HBox(), 800, 580);
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/roda/rodain/ui/RodaInApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import java.util.Optional;
import java.util.Set;

import javafx.event.EventHandler;
import javafx.scene.control.DialogEvent;
import org.apache.commons.configuration.ConfigurationException;
import org.roda.rodain.core.ConfigurationManager;
import org.roda.rodain.core.Constants;
Expand Down Expand Up @@ -459,7 +461,7 @@ private void createMenu() {

menuView.getItems().addAll(showFiles, showIgnored, showMapped);

// Help
// Check version
final MenuItem checkVersion = new MenuItem(I18n.t(Constants.I18N_MAIN_CHECK_VERSION));
checkVersion.setAccelerator(KeyCombination.keyCombination("Ctrl+U"));
checkVersion.setOnAction(event -> {
Expand All @@ -481,6 +483,7 @@ private void createMenu() {
}
});

// Help
String startingValue = ConfigurationManager.getAppConfig(Constants.CONF_K_APP_HELP_ENABLED);
String showHelpText;
if (Boolean.parseBoolean(startingValue)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.List;
import java.util.Map;

import javafx.event.Event;
import org.roda.rodain.core.Constants;
import org.roda.rodain.core.creation.CreateSips;
import org.roda.rodain.core.schema.Sip;
Expand Down Expand Up @@ -47,6 +48,7 @@ public CreationModalStage(Stage primaryStage) {
colorAdjust = new ColorAdjust();
colorAdjust.setBrightness(-0.275);

setOnCloseRequest(Event::consume);
setResizable(true);

Scene scene = new Scene(new HBox());
Expand Down Expand Up @@ -133,4 +135,4 @@ public void handle(MouseEvent mouseEvent) {

show();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.roda.rodain.ui.creation;

import javafx.event.Event;
import org.roda.rodain.core.Constants;
import org.roda.rodain.ui.utils.UnsafeDouble;

Expand Down Expand Up @@ -33,6 +34,7 @@ public RenameModalStage(Stage primaryStage) {
colorAdjust = new ColorAdjust();
colorAdjust.setBrightness(-0.275);

setOnCloseRequest(Event::consume);
setResizable(true);

Scene scene = new Scene(new HBox(), 400, PREPARATION_HEIGHT);
Expand Down Expand Up @@ -85,4 +87,4 @@ public void handle(MouseEvent mouseEvent) {

show();
}
}
}

0 comments on commit 30226a6

Please sign in to comment.