javafx.scene.control.Alert.AlertType Java Examples

The following examples show how to use javafx.scene.control.Alert.AlertType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DisplayWindow.java    From marathonv5 with Apache License 2.0 7 votes vote down vote up
private boolean closeEditor(IEditor e) {
    if (e == null) {
        return true;
    }
    if (e.isDirty()) {
        Optional<ButtonType> result = FXUIUtils.showConfirmDialog(DisplayWindow.this,
                "File \"" + e.getName() + "\" Modified. Do you want to save the changes ",
                "File \"" + e.getName() + "\" Modified", AlertType.CONFIRMATION, ButtonType.YES, ButtonType.NO,
                ButtonType.CANCEL);
        ButtonType shouldSaveFile = result.get();
        if (shouldSaveFile == ButtonType.CANCEL) {
            return false;
        }
        if (shouldSaveFile == ButtonType.YES) {
            File file = save(e);
            if (file == null) {
                return false;
            }
            EditorDockable dockable = (EditorDockable) e.getData("dockable");
            dockable.updateKey();
        }
    }
    return true;
}
 
Example #2
Source File: FileResource.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override
public Optional<ButtonType> delete(Optional<ButtonType> option) {
    if (!option.isPresent() || option.get() != FXUIUtils.YES_ALL) {
        option = FXUIUtils.showConfirmDialog(null, "Do you want to delete `" + path + "`?", "Confirm", AlertType.CONFIRMATION,
                ButtonType.YES, ButtonType.NO, FXUIUtils.YES_ALL, ButtonType.CANCEL);
    }
    if (option.isPresent() && (option.get() == ButtonType.YES || option.get() == FXUIUtils.YES_ALL)) {
        if (Files.exists(path)) {
            try {
                Files.delete(path);
                Event.fireEvent(this, new ResourceModificationEvent(ResourceModificationEvent.DELETE, this));
                getParent().getChildren().remove(this);
            } catch (IOException e) {
                String message = String.format("Unable to delete: %s: %s%n", path, e);
                FXUIUtils.showMessageDialog(null, message, "Unable to delete", AlertType.ERROR);
            }
        }
    }
    return option;
}
 
Example #3
Source File: DisplayWindow.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public boolean canAppend(File file) {
    EditorDockable dockable = findEditorDockable(file);
    if (dockable == null) {
        return true;
    }
    if (!dockable.getEditor().isDirty()) {
        return true;
    }
    Optional<ButtonType> result = FXUIUtils.showConfirmDialog(DisplayWindow.this,
            "File " + file.getName() + " being edited. Do you want to save the file?", "Save Module", AlertType.CONFIRMATION,
            ButtonType.YES, ButtonType.NO);
    ButtonType option = result.get();
    if (option == ButtonType.YES) {
        save(dockable.getEditor());
        return true;
    }
    return false;
}
 
Example #4
Source File: SimplePopups.java    From pmd-designer with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public static void showAboutPopup(DesignerRoot root) {
    Alert licenseAlert = new Alert(AlertType.INFORMATION);
    licenseAlert.setWidth(500);
    licenseAlert.setHeaderText("About");

    ScrollPane scroll = new ScrollPane();
    TextArea textArea = new TextArea();

    String sb =
        "PMD core version:\t\t\t" + PMDVersion.VERSION + "\n"
            + "Designer version:\t\t\t" + Designer.getCurrentVersion()
            + " (supports PMD core " + Designer.getPmdCoreMinVersion() + ")\n"
            + "Designer settings dir:\t\t"
            + root.getService(DesignerRoot.DISK_MANAGER).getSettingsDirectory() + "\n"
            + "Available languages:\t\t"
            + AuxLanguageRegistry.getSupportedLanguages().map(Language::getTerseName).collect(Collectors.toList())
            + "\n";

    textArea.setText(sb);
    scroll.setContent(textArea);

    licenseAlert.getDialogPane().setContent(scroll);
    licenseAlert.showAndWait();
}
 
Example #5
Source File: FXMLTimingController.java    From pikatimer with GNU General Public License v3.0 6 votes vote down vote up
public void removeTimingLocation(ActionEvent fxevent){
    final TimingLocation tl = timingLocListView.getSelectionModel().getSelectedItem();
    
    // If the location is referenced by a split, 
    // toss up a warning and leave it alone
    final StringProperty splitsUsing = new SimpleStringProperty();
    raceDAO.listRaces().forEach(r -> {
        r.getSplits().forEach(s -> {
            if (s.getTimingLocation().equals(tl)) splitsUsing.set(splitsUsing.getValueSafe() + r.getRaceName() + " " + s.getSplitName() + "\n");
        });
    });
    
    if (splitsUsing.isEmpty().get()) {
        timingDAO.removeTimingLocation(tl);;
        timingLocAddButton.requestFocus();
        //timingLocAddButton.setDefaultButton(true);
    } else {
        Alert alert = new Alert(AlertType.INFORMATION);
        alert.setTitle("Unable to Remove Timing Location");
        alert.setHeaderText("Unable to remove the " + tl.getLocationName() + " timing location.");
        alert.setContentText("The timing location is in use by the following splits:\n" + splitsUsing.getValueSafe());
        alert.showAndWait();
    }
}
 
Example #6
Source File: FileDeleteHandler.java    From PeerWasp with MIT License 6 votes vote down vote up
private void showError(final String message) {
	Runnable dialog = new Runnable() {
		@Override
		public void run() {
			Alert dlg = DialogUtils.createAlert(AlertType.ERROR);
			dlg.setTitle("Error - Delete.");
			dlg.setHeaderText("Could not delete file(s).");
			dlg.setContentText(message);
			dlg.showAndWait();
		}
	};

	if (Platform.isFxApplicationThread()) {
		dialog.run();
	} else {
		Platform.runLater(dialog);
	}
}
 
Example #7
Source File: Group.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public static Group createGroup(GroupType type, Path path, String name) {
    List<Group> groups = getGroups(type);
    for (Group g : groups) {
        if (g.getName().equals(name)) {
            Optional<ButtonType> option = FXUIUtils.showConfirmDialog(null,
                    type.fileType() + " `" + g.getName() + "` name is already used.", "Duplicate " + type.fileType() + " Name",
                    AlertType.CONFIRMATION);
            if (!option.isPresent() || option.get() == ButtonType.CANCEL) {
                return null;
            }
        }
    }
    Group group = new Group(name);
    try {
        Files.write(path, (type.fileCommentHeader() + group.toJSONString()).getBytes());
        return new Group(path.toFile());
    } catch (IOException e) {
        return null;
    }
}
 
Example #8
Source File: CaptureController.java    From logbook-kai with MIT License 6 votes vote down vote up
@FXML
void movie(ActionEvent event) {
    // キャプチャ中であれば止める
    this.stopTimeLine();
    // 連写モード解除
    this.cyclic.setSelected(false);

    if ((AppConfig.get().getFfmpegPath() == null || AppConfig.get().getFfmpegPath().isEmpty())
            || (AppConfig.get().getFfmpegArgs() == null || AppConfig.get().getFfmpegArgs().isEmpty())
            || (AppConfig.get().getFfmpegExt() == null || AppConfig.get().getFfmpegExt().isEmpty())) {
        Tools.Conrtols.alert(AlertType.INFORMATION, "設定が必要です", "[設定]メニューの[キャプチャ]タブから"
                + "FFmpegパスおよび引数を設定してください。", this.getWindow());
        this.movie.setSelected(false);
    }
    if (this.movie.isSelected()) {
        // キャプチャボタンテキストの変更
        this.setCatureButtonState(ButtonState.START);
        // 直接保存に設定
        this.direct.setSelected(true);
    } else {
        // キャプチャボタンテキストの変更
        this.setCatureButtonState(ButtonState.CAPTURE);
    }
}
 
Example #9
Source File: MenuController.java    From zest-writer with GNU General Public License v3.0 6 votes vote down vote up
@FXML private void handleDownloadArticleButtonAction(ActionEvent event){
    if(! MainApp.getZdsutils().isAuthenticated()){
        Service<Void> loginTask = handleLoginButtonAction(event);
        loginTask.setOnSucceeded(t -> downloadContents("ARTICLE"));
        loginTask.setOnCancelled(t -> {
            hBottomBox.getChildren().clear();
            Alert alert = new CustomAlert(AlertType.ERROR);
            alert.setTitle(Configuration.getBundle().getString("ui.dialog.auth.failed.title"));
            alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.auth.failed.header"));
            alert.setContentText(Configuration.getBundle().getString("ui.dialog.auth.failed.text"));

            alert.showAndWait();
        });

        loginTask.start();
    }else{
        downloadContents("ARTICLE");
    }
}
 
Example #10
Source File: ImageInputDialog.java    From zest-writer with GNU General Public License v3.0 6 votes vote down vote up
@FXML private void handleSelectFileAction(){
    if(! zdsUtils.isAuthenticated()){
        Service<Void> loginTask = menuManager.handleLoginButtonAction(null);
        loginTask.setOnSucceeded(t -> selectAndUploadImage());
        loginTask.setOnCancelled(t -> {
            menuManager.getHBottomBox().getChildren().clear();
            Alert alert = new CustomAlert(AlertType.ERROR);
            alert.setTitle(Configuration.getBundle().getString("ui.dialog.auth.failed.title"));
            alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.auth.failed.header"));
            alert.setContentText(Configuration.getBundle().getString("ui.dialog.auth.failed.text"));

            alert.showAndWait();
        });
        loginTask.start();
    }else{
        selectAndUploadImage();
    }
}
 
Example #11
Source File: DisplayWindow.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override
public void handleInput(GroupInputInfo info) {
    try {
        File file = info.getFile();
        if (file == null) {
            return;
        }
        Group group = Group.createGroup(type, file.toPath(), info.getName());
        if (group == null) {
            return;
        }
        fileUpdated(file);
        navigatorPanel.updated(DisplayWindow.this, new FileResource(file.getParentFile()));
        suitesPanel.updated(DisplayWindow.this, new FileResource(file));
        featuresPanel.updated(DisplayWindow.this, new FileResource(file));
        storiesPanel.updated(DisplayWindow.this, new FileResource(file));
        issuesPanel.updated(DisplayWindow.this, new FileResource(file));
        Platform.runLater(() -> openFile(file));
    } catch (Exception e) {
        e.printStackTrace();
        FXUIUtils.showConfirmDialog(DisplayWindow.this,
                "Could not complete creation of " + type.fileType().toLowerCase() + " file.",
                "Error in creating a " + type.fileType().toLowerCase() + " file", AlertType.ERROR);
    }
}
 
Example #12
Source File: ShareFolderUILoader.java    From PeerWasp with MIT License 6 votes vote down vote up
private static void showError(final String message) {
	Runnable dialog = new Runnable() {
		@Override
		public void run() {
			Alert dlg = DialogUtils.createAlert(AlertType.ERROR);
			dlg.setTitle("Error Share Folder.");
			dlg.setHeaderText("Could not share folder.");
			dlg.setContentText(message);
			dlg.showAndWait();
		}
	};

	if (Platform.isFxApplicationThread()) {
		dialog.run();
	} else {
		Platform.runLater(dialog);
	}
}
 
Example #13
Source File: MZmineGUI.java    From old-mzmine3 with GNU General Public License v2.0 6 votes vote down vote up
public static void closeProject() {
  Alert alert = new Alert(AlertType.CONFIRMATION);
  Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
  stage.getIcons().add(mzMineIcon);
  alert.setTitle("Confirmation");
  alert.setHeaderText("Close project");
  String s = "Are you sure you want to close the current project?";
  alert.setContentText(s);
  Optional<ButtonType> result = alert.showAndWait();

  if ((result.isPresent()) && (result.get() == ButtonType.OK)) {
    MZmineGUIProject newProject = new MZmineGUIProject();
    activateProject(newProject);
    setStatusBarMessage("");
  }
}
 
Example #14
Source File: SelectRootPathUtils.java    From PeerWasp with MIT License 6 votes vote down vote up
public static boolean confirmMoveDirectoryDialog(File newPath) {
	boolean yes = false;

	Alert dlg = DialogUtils.createAlert(AlertType.CONFIRMATION);
	dlg.setTitle("Move Directory");
	dlg.setHeaderText("Move the directory?");
	dlg.setContentText(String.format("This will move the directory to a new location: %s.",
							newPath.toString()));

	dlg.getButtonTypes().clear();
	dlg.getButtonTypes().addAll(ButtonType.YES, ButtonType.NO);

	dlg.showAndWait();
	yes = dlg.getResult() == ButtonType.YES;

	return yes;
}
 
Example #15
Source File: DisplayWindow.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override
public void handle(FixtureStageInfo fixtureInfo) {
    newFile(getFixtureHeader(fixtureInfo.getProperties(), fixtureInfo.getSelectedLauncher()),
            new File(System.getProperty(Constants.PROP_FIXTURE_DIR)));
    currentEditor.setDirty(true);
    File fixtureFile = new File(System.getProperty(Constants.PROP_FIXTURE_DIR),
            fixtureInfo.getFixtureName() + scriptModel.getSuffix());
    try {
        currentEditor.setData("filename", fixtureFile.getName());
        saveTo(fixtureFile);
        currentEditor.setDirty(false);
        updateView();
    } catch (IOException e) {
        FXUIUtils.showMessageDialog(DisplayWindow.this, "Unable to save the fixture: " + e.getMessage(), "Invalid File",
                AlertType.ERROR);
        return;
    }
    setDefaultFixture(fixtureInfo.getFixtureName());
}
 
Example #16
Source File: MenuController.java    From zest-writer with GNU General Public License v3.0 6 votes vote down vote up
@FXML private void handleDownloadButtonAction(ActionEvent event){
    if(! MainApp.getZdsutils().isAuthenticated()){
        Service<Void> loginTask = handleLoginButtonAction(event);
        loginTask.setOnSucceeded(t -> downloadContents(null));
        loginTask.setOnCancelled(t -> {
            hBottomBox.getChildren().clear();
            Alert alert = new CustomAlert(AlertType.ERROR);
            alert.setTitle(Configuration.getBundle().getString("ui.dialog.auth.failed.title"));
            alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.auth.failed.header"));
            alert.setContentText(Configuration.getBundle().getString("ui.dialog.auth.failed.text"));

            alert.showAndWait();
        });

        loginTask.start();
    }else{
        downloadContents(null);
    }
}
 
Example #17
Source File: IdentifyGraphicsSample.java    From arcgis-runtime-samples-java with Apache License 2.0 6 votes vote down vote up
/**
 * Indicates when a graphic is clicked by showing an Alert.
 */
private void createGraphicDialog() {

  try {
    // get the list of graphics returned by identify
    IdentifyGraphicsOverlayResult result = identifyGraphics.get();
    List<Graphic> graphics = result.getGraphics();

    if (!graphics.isEmpty()) {
      // show a alert dialog box if a graphic was returned
      Alert dialog = new Alert(AlertType.INFORMATION);
      dialog.initOwner(mapView.getScene().getWindow());
      dialog.setHeaderText(null);
      dialog.setTitle("Information Dialog Sample");
      dialog.setContentText("Clicked on " + graphics.size() + " graphic");
      dialog.showAndWait();
    }
  } catch (Exception e) {
    // on any error, display the stack trace
    e.printStackTrace();
  }
}
 
Example #18
Source File: ResourceView.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
private void newFolder(Resource resource) {
    Path filePath = resource.getFilePath();
    if (filePath == null) {
        return;
    }
    File file;
    if (resource instanceof FolderResource) {
        file = resource.getFilePath().toFile();
    } else {
        file = resource.getFilePath().getParent().toFile();
    }
    File newFile = FXUIUtils.showMarathonSaveFileChooser(new MarathonFileChooserInfo("Create new folder", file, true),
            "Create a folder with the given name", FXUIUtils.getIcon("fldr_obj"));
    if (newFile == null) {
        return;
    }
    if (newFile.exists()) {
        FXUIUtils.showMessageDialog(this.getScene().getWindow(), "Folder with name '" + newFile.getName() + "' already exists.",
                "Folder exists", AlertType.INFORMATION);
    } else {
        newFile.mkdir();
    }
    refreshView();
}
 
Example #19
Source File: GroupResource.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
@Override
public Optional<ButtonType> delete(Optional<ButtonType> option) {
    if (!option.isPresent() || option.get() != FXUIUtils.YES_ALL) {
        option = FXUIUtils.showConfirmDialog(null, "Do you want to delete `" + group.getName() + "`?", "Confirm",
                AlertType.CONFIRMATION, ButtonType.YES, ButtonType.NO, FXUIUtils.YES_ALL, ButtonType.CANCEL);
    }
    if (option.isPresent() && (option.get() == ButtonType.YES || option.get() == FXUIUtils.YES_ALL)) {
        try {
            Group.delete(type, group);
            Event.fireEvent(this, new ResourceModificationEvent(ResourceModificationEvent.DELETE, this));
            getParent().getChildren().remove(this);
        } catch (Exception e) {
            e.printStackTrace();
            String message = String.format("Unable to delete: %s: %s%n", group.getName(), e);
            FXUIUtils.showMessageDialog(null, message, "Unable to delete", AlertType.ERROR);
        }
    }
    return option;
}
 
Example #20
Source File: AppUtils.java    From OEE-Designer with MIT License 6 votes vote down vote up
public static ButtonType showAlert(AlertType type, String title, String header, String errorMessage) {
	// Show the error message.
	Alert alert = new Alert(type);
	alert.setTitle(title);
	alert.setHeaderText(header);
	alert.setContentText(errorMessage);
	alert.setResizable(true);

	// modal
	Optional<ButtonType> result = alert.showAndWait();

	ButtonType buttonType = null;
	try {
		buttonType = result.get();
	} catch (NoSuchElementException e) {
	}
	return buttonType;
}
 
Example #21
Source File: EditorFrame.java    From JetUML with GNU General Public License v3.0 6 votes vote down vote up
private void close() 
{
	DiagramTab diagramTab = getSelectedDiagramTab();
	// we only want to check attempts to close a frame
	if( diagramTab.hasUnsavedChanges() ) 
	{
		// ask user if it is ok to close
		Alert alert = new Alert(AlertType.CONFIRMATION, RESOURCES.getString("dialog.close.ok"), ButtonType.YES, ButtonType.NO);
		alert.initOwner(aMainStage);
		alert.setTitle(RESOURCES.getString("dialog.close.title"));
		alert.setHeaderText(RESOURCES.getString("dialog.close.title"));
		alert.showAndWait();

		if (alert.getResult() == ButtonType.YES) 
		{
			removeGraphFrameFromTabbedPane(diagramTab);
		}
		return;
	} 
	else 
	{
		removeGraphFrameFromTabbedPane(diagramTab);
	}
}
 
Example #22
Source File: NeuralnetInterfaceController.java    From FakeImageDetection with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void neuralnetProcessCompleted(HashMap<String, Double> result) {
    if (result == null) {
        Platform.runLater(new Runnable() {
            @Override
            public void run() {
                Calert.showAlert("Forced Rollback", "Image Detection Failed:\nCorrupted File", AlertType.ERROR);
                rollBack(null);
                return;
            }
        });
    }
    bulgingTransition.stop();
    updateIndicatorText("Done");
    System.out.println("Neural net result:-\n" + result);
    loadResult(result);
}
 
Example #23
Source File: AddAnnotationDialog.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
private boolean checkInput()
{
	if (traces.isEmpty())
	{
		new Alert(AlertType.INFORMATION, Messages.AddAnnotation_NoTraces).showAndWait();
		return false;
	}
	final MultipleSelectionModel<Trace<XTYPE>> seletion = trace_list.getSelectionModel();
	final Trace<XTYPE> item = seletion.isEmpty() ? traces.get(0) : seletion.getSelectedItem();
	final String content = text.getText().trim();
	if (content.isEmpty())
	{
		new Alert(AlertType.WARNING, Messages.AddAnnotation_NoContent).showAndWait();
		return false;
	}
	plot.addAnnotation(item, content);
    return true;
}
 
Example #24
Source File: Tools.java    From logbook-kai with MIT License 6 votes vote down vote up
/**
 * ノードの内容をPNGファイルとして出力します
 *
 * @param node ノード
 * @param title タイトル及びファイル名
 * @param own 親ウインドウ
 */
public static void storeSnapshot(Node node, String title, Window own) {
    try {
        FileChooser chooser = new FileChooser();
        chooser.setTitle(title + "の保存");
        chooser.setInitialFileName(title + ".png");
        chooser.getExtensionFilters().addAll(
                new ExtensionFilter("PNG Files", "*.png"));
        File f = chooser.showSaveDialog(own);
        if (f != null) {
            SnapshotParameters sp = new SnapshotParameters();
            sp.setFill(Color.WHITESMOKE);
            WritableImage image = node.snapshot(sp, null);
            try (OutputStream out = Files.newOutputStream(f.toPath())) {
                ImageIO.write(SwingFXUtils.fromFXImage(image, null), "png", out);
            }
        }
    } catch (Exception e) {
        alert(AlertType.WARNING, "画像ファイルに保存出来ませんでした", "指定された場所へ画像ファイルを書き込みできませんでした", e, own);
    }
}
 
Example #25
Source File: FXMLTimingController.java    From pikatimer with GNU General Public License v3.0 6 votes vote down vote up
public void clearAllOverrides(ActionEvent fxevent){
    //TODO: Prompt and then remove all times associated with that timing location 
    // _or_ all timing locations
    Alert alert = new Alert(AlertType.CONFIRMATION);
    alert.setTitle("Clear Overrides...");
    alert.setHeaderText("Delete Overrides:");
    alert.setContentText("Do you want to delete all overrides?");

    //ButtonType allButtonType = new ButtonType("All");
    
    ButtonType deleteButtonType = new ButtonType("Delete",ButtonData.YES);
    ButtonType cancelButtonType = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE);

    alert.getButtonTypes().setAll(cancelButtonType, deleteButtonType );

    Optional<ButtonType> result = alert.showAndWait();
    if (result.get() == deleteButtonType) {
        // delete all
        timingDAO.clearAllOverrides(); 
    }
 
}
 
Example #26
Source File: UpdateApplication.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
private void restart(final Node node)
{
    final String message =
            "The application will now exit,\n" +
            "so you can then start the updated version\n";
    final Alert prompt = new Alert(AlertType.INFORMATION,
                                   message,
                                   ButtonType.OK);
    prompt.setTitle(NAME);
    prompt.setHeaderText("Update completed");
    DialogHelper.positionDialog(prompt, node, -400, -250);
    prompt.showAndWait();
    System.exit(0);
}
 
Example #27
Source File: AlertMaker.java    From Library-Assistant with Apache License 2.0 5 votes vote down vote up
public static void showErrorMessage(Exception ex) {
    Alert alert = new Alert(AlertType.ERROR);
    alert.setTitle("Error occured");
    alert.setHeaderText("Error Occured");
    alert.setContentText(ex.getLocalizedMessage());

    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    ex.printStackTrace(pw);
    String exceptionText = sw.toString();

    Label label = new Label("The exception stacktrace was:");

    TextArea textArea = new TextArea(exceptionText);
    textArea.setEditable(false);
    textArea.setWrapText(true);

    textArea.setMaxWidth(Double.MAX_VALUE);
    textArea.setMaxHeight(Double.MAX_VALUE);
    GridPane.setVgrow(textArea, Priority.ALWAYS);
    GridPane.setHgrow(textArea, Priority.ALWAYS);

    GridPane expContent = new GridPane();
    expContent.setMaxWidth(Double.MAX_VALUE);
    expContent.add(label, 0, 0);
    expContent.add(textArea, 0, 1);

    alert.getDialogPane().setExpandableContent(expContent);

    styleAlert(alert);
    alert.showAndWait();
}
 
Example #28
Source File: UserGuiInteractor.java    From kafka-message-tool with MIT License 5 votes vote down vote up
@Override
public boolean getYesNoDecision(String title,
                                String header,
                                String content) {
    Alert alert = new Alert(AlertType.CONFIRMATION);
    alert.initOwner(owner);
    alert.setTitle(title);
    alert.setHeaderText(header);
    alert.getDialogPane().setContent(getTextNodeContent(content));

    decorateWithCss(alert);

    Optional<ButtonType> result = alert.showAndWait();
    return result.get() == ButtonType.OK;
}
 
Example #29
Source File: LogbookAvailabilityChecker.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
private static void showAlert(String logBookProviderId){
    Platform.runLater(() -> {
        Alert alert = new Alert(AlertType.ERROR);
        alert.setTitle(Messages.LogbookServiceUnavailableTitle);
        alert.setHeaderText(
                MessageFormat.format(Messages.LogbookServiceHasNoLogbooks, logBookProviderId));
        alert.showAndWait();
    });
}
 
Example #30
Source File: EditorFrame.java    From JetUML with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Exits the program if no graphs have been modified or if the user agrees to
 * abandon modified graphs.
 */
public void exit() 
{
	final int modcount = getNumberOfUsavedDiagrams();
	if (modcount > 0) 
	{
		Alert alert = new Alert(AlertType.CONFIRMATION, 
				MessageFormat.format(RESOURCES.getString("dialog.exit.ok"), new Object[] { Integer.valueOf(modcount) }),
				ButtonType.YES, 
				ButtonType.NO);
		alert.initOwner(aMainStage);
		alert.setTitle(RESOURCES.getString("dialog.exit.title"));
		alert.setHeaderText(RESOURCES.getString("dialog.exit.title"));
		alert.showAndWait();

		if (alert.getResult() == ButtonType.YES) 
		{
			Preferences.userNodeForPackage(UMLEditor.class).put("recent", aRecentFiles.serialize());
			System.exit(0);
		}
	}
	else 
	{
		Preferences.userNodeForPackage(UMLEditor.class).put("recent", aRecentFiles.serialize());
		System.exit(0);
	}
}