List of usage examples for javafx.stage Modality WINDOW_MODAL
Modality WINDOW_MODAL
To view the source code for javafx.stage Modality WINDOW_MODAL.
Click Source Link
From source file:ca.wumbo.doommanager.client.controller.FileEditorController.java
/** * Creates a new DXML project and has the user set it up, then places it in * the tab./* ww w . j a va2s .co m*/ */ public void newDXMLProject() { // Create the wizard and wait for the result. DXMLProjectCreatorController controller = SpringContainer.getContext() .getBean(DXMLProjectCreatorController.class); Scene scene = new Scene(controller.getRootPane()); scene.getStylesheets().add(cssPath); Stage stage = new Stage(); stage.setTitle("DXML Project Setup Wizard"); stage.setResizable(false); stage.initModality(Modality.WINDOW_MODAL); stage.initOwner(coreController.getStage()); stage.setScene(scene); controller.setStage(stage); // Required for it to be able to close properly. controller.setParentStage(coreController.getStage()); // Required as well to block input if browsing for files. stage.showAndWait(); // If the user finished the work, get the DXML file. if (!controller.wasClosedByUser()) { DXML dxmlData = controller.getDxmlData(); // The file must also be valid. This should not ever be false unless there is a coding error. if (dxmlData.isValidDXMLFile()) { // Create it on the disk. DXMLCreationStatus status = dxmlData.createOnDisk(); // If the status shows success, add it to the view. switch (status) { case SUCCESS: // Since it succeeded, open up the project now. String path = dxmlData.getProjectInfo().getProjectLocationPath() + File.separator; path += dxmlData.getCompilation().getFilename() + File.separator; path += dxmlData.getCompilation().getFilename() + ".dxml"; // TODO - support any case extension. openDXMLProject(Paths.get(path)); break; case ALREADY_EXISTS: log.warn("DXML project already exists at the specified location. Aborting."); break; case FOLDER_CREATION_FAILURE: log.warn("Unable to create directory for the project. Are your permissions correct? Aborting."); break; case DXML_FILE_EXISTS: log.warn("DXML file already exists at location, aborting to prevent potential overwrite."); break; case DXML_FILE_CREATION_FAILURE: log.warn("Unable to create DXML file at location, are your permissions correct? Aborting."); break; case XML_MARSHALL_ERROR: log.warn("Unable to create the .dxml file. Are your file permissions correct? Aborting."); break; case FAILED: log.warn("Unable to create the necessary DXML file/folder resources at the provided location."); break; case INVALID_DXML_DATA: case BAD_PROJECT_PATH: log.warn("DXML project has corrupt data. Contact a developer, Aborting [Reason: {}].", status.name()); break; default: throw new DXMLException( "DXML status for disk creation returned an unexpected enumeration. Contact a developer."); } } else { throw new DXMLException( "DXML Wizard has not properly generated a proper file. Please contact a developer."); } } else { log.info("DXML project cancelled by user."); } }
From source file:ExcelFx.FXMLDocumentController.java
@FXML private void TablePatch(ActionEvent event) throws IOException { System.out.println("ExcelFx.FXMLDocumentController.TablePatch()"); try {/* www .j a v a2s .c o m*/ FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("FileOpenFXML.fxml")); Parent root1 = (Parent) fxmlLoader.load(); Stage stage = new Stage(); stage.initModality(Modality.WINDOW_MODAL); stage.initStyle(StageStyle.DECORATED); stage.setTitle(" "); stage.setScene(new Scene(root1)); stage.show(); } catch (Exception e) { System.err.println(e); } }
From source file:com.coolchick.translatortemplater.Main.java
private void showErrorDialog(Stage primaryStage, String text) { Alert dlg = new Alert(Alert.AlertType.ERROR); dlg.setTitle("NOPE.JPG"); dlg.initOwner(primaryStage);/*from w w w . ja v a2 s . com*/ dlg.initModality(Modality.WINDOW_MODAL); dlg.getDialogPane().setContentText(text); dlg.show(); }
From source file:net.sourceforge.pmd.util.fxdesigner.XPathPanelController.java
private void initGenerateXPathFromStackTrace() { ContextMenu menu = new ContextMenu(); MenuItem item = new MenuItem("Generate from stack trace..."); item.setOnAction(e -> {/*ww w . j av a2 s. co m*/ try { Stage popup = new Stage(); FXMLLoader loader = new FXMLLoader(DesignerUtil.getFxml("generate-xpath-from-stack-trace.fxml")); Parent root = loader.load(); Button button = (Button) loader.getNamespace().get("generateButton"); TextArea area = (TextArea) loader.getNamespace().get("stackTraceArea"); ValidationSupport validation = new ValidationSupport(); validation.registerValidator(area, Validator.createEmptyValidator("The stack trace may not be empty")); button.disableProperty().bind(validation.invalidProperty()); button.setOnAction(f -> { DesignerUtil.stackTraceToXPath(area.getText()).ifPresent(xpathExpressionArea::replaceText); popup.close(); }); popup.setScene(new Scene(root)); popup.initStyle(StageStyle.UTILITY); popup.initModality(Modality.WINDOW_MODAL); popup.initOwner(designerRoot.getMainStage()); popup.show(); } catch (IOException e1) { throw new RuntimeException(e1); } }); menu.getItems().add(item); xpathExpressionArea.addEventHandler(MouseEvent.MOUSE_CLICKED, t -> { if (t.getButton() == MouseButton.SECONDARY) { menu.show(xpathExpressionArea, t.getScreenX(), t.getScreenY()); } }); }
From source file:deincraftlauncher.InstallController.java
private void popupMessage(String text) { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setHeaderText("Benachrichtigung:"); alert.setContentText(text);//www . j a v a 2s.c o m alert.initModality(Modality.WINDOW_MODAL); alert.initStyle(StageStyle.UNDECORATED); alert.initOwner(deincraftlauncher.DeincraftLauncherUI.window); alert.show(); }
From source file:mesclasses.view.TimetableController.java
private Cours openEditDialog(Cours coursToEdit, Cours originalCours) { try {/*from ww w . ja v a 2 s . c om*/ // Load the fxml file and create a new stage for the popup dialog. FXMLLoader loader = new FXMLLoader(); loader.setLocation(MainApp.class.getResource(Constants.COURS_EDIT_DIALOG)); AnchorPane page = (AnchorPane) loader.load(); // Create the dialog Stage. Stage dialogStage = new Stage(); dialogStage.setTitle("Edition d'un cours"); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(primaryStage); Scene scene = new Scene(page); dialogStage.setScene(scene); // Set the person into the controller. CoursEditDialogController controller = loader.getController(); controller.setDialogStage(dialogStage); controller.setCours(coursToEdit, false); // Show the dialog and wait until the user closes it dialogStage.showAndWait(); int status = controller.getStatus(); if (status >= 0) { //update/cancel return controller.getCours(); } else { //delete getPane(coursToEdit).getChildren().remove(coursToEdit.getEvent()); int seances = model.delete(originalCours).size(); ModalUtil.info("Sances modifies", seances + " sances ont t modifies"); return null; } } catch (IOException e) { notif(e); return null; } }
From source file:net.sourceforge.pmd.util.fxdesigner.XPathPanelController.java
public void showExportXPathToRuleWizard() throws IOException { ExportXPathWizardController wizard = new ExportXPathWizardController(xpathExpressionProperty()); FXMLLoader loader = new FXMLLoader(getClass().getResource("fxml/xpath-export-wizard.fxml")); loader.setController(wizard);//from w ww . j a v a 2 s. c o m final Stage dialog = new Stage(); dialog.initOwner(designerRoot.getMainStage()); dialog.setOnCloseRequest(e -> wizard.shutdown()); dialog.initModality(Modality.WINDOW_MODAL); Parent root = loader.load(); Scene scene = new Scene(root); //stage.setTitle("PMD Rule Designer (v " + PMD.VERSION + ')'); dialog.setScene(scene); dialog.show(); }
From source file:mesclasses.view.JourneeController.java
private Cours openCoursDialog(Cours cours) { try {//from ww w . j a v a 2s . c om FXMLLoader loader = new FXMLLoader(); loader.setLocation(MainApp.class.getResource(Constants.COURS_EDIT_DIALOG)); AnchorPane page = (AnchorPane) loader.load(); // Create the dialog Stage. Stage dialogStage = new Stage(); dialogStage.setTitle("Cration d'un cours ponctuel"); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(primaryStage); Scene scene = new Scene(page); dialogStage.setScene(scene); // Set the person into the controller. CoursEditDialogController controller = loader.getController(); controller.setDialogStage(dialogStage); controller.setCours(cours, true); dialogStage.showAndWait(); int status = controller.getStatus(); if (status >= 0) { //update/cancel return controller.getCours(); } } catch (IOException e) { ModalUtil.alert("Erreur I/O", e.getMessage()); } return null; }
From source file:jp.ac.tohoku.ecei.sb.metabolome.lims.gui.MainWindowController.java
@Override public void initialize(URL location, ResourceBundle resources) { // Table Study initializeTable(tableStudy, StudyImpl.class); initializeTable(tablePlate, PlateImpl.class); initializeTable(tableSample, SampleImpl.class); initializeTable(tableInjection, InjectionImpl.class); initializeTable(tableCompound, CompoundImpl.class); initializeTable(tableHistory, OperationHistoryImpl.class); menuBar.setUseSystemMenuBar(true);//from ww w . j av a 2 s. c om commandManager = new CommandManager(); commandManager.setContext(commandManagerContext); final GUICommandPaneFactory commandPaneFactory = new GUICommandPaneFactory(commandManager); MetabolomeQC.addCorrectionCommands(commandManager); for (Map.Entry<String, Class> commend : commandManager.getCommands().entrySet()) { MenuItem menuItem = new MenuItem(commend.getKey()); menuItem.setText(commend.getKey()); menuItem.setOnAction(e -> { final Stage stage = new Stage(); stage.initModality(Modality.WINDOW_MODAL); Parent guiCommand = commandPaneFactory.getCommandPane(commend.getKey(), (commandEvent, managedCommand) -> { stage.close(); }); BorderPane margins = new BorderPane(guiCommand); BorderPane.setMargin(guiCommand, new Insets(10)); stage.setScene(new Scene(margins)); stage.initOwner(this.stage); stage.showAndWait(); onRefresh(null); }); correctionMenu.getItems().add(menuItem); } onRefresh(null); }
From source file:com.joliciel.talismane.terminology.viewer.TerminologyViewerController.java
private void showAlert(String text) { Stage dialogStage = new Stage(); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.setScene(new Scene(VBoxBuilder.create().children(new Text(text), new Button("Ok")) .alignment(Pos.CENTER).padding(new Insets(5)).build())); dialogStage.show();/* w ww .j a va 2s . c o m*/ }