本文整理汇总了Java中org.controlsfx.dialog.Dialogs类的典型用法代码示例。如果您正苦于以下问题:Java Dialogs类的具体用法?Java Dialogs怎么用?Java Dialogs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Dialogs类属于org.controlsfx.dialog包,在下文中一共展示了Dialogs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateFeeds
import org.controlsfx.dialog.Dialogs; //导入依赖的package包/类
public void updateFeeds() {
FeedService fs = new FeedService();
fs.setOnFailed(err -> {
Dialogs.create()
.message(getTranslation("message.updating.feed.failed"))
.showException(err.getSource().getException());
});
fs.setOnSucceeded(ev -> {
this.onUpdate.handle(dumbEvent);
});
Dialogs.create()
.message(getTranslation("message.updating.feed"))
.showWorkerProgress(fs);
fs.start();
}
示例2: deleteFeed
import org.controlsfx.dialog.Dialogs; //导入依赖的package包/类
public void deleteFeed() {
Dialogs.create()
.lightweight()
.title(getTranslation("menu.delete.feed"))
.message(getTranslation("message.select.feed.delete"))
.showChoices(
SubscriptionRepository.getSubscriptions()
.stream()
.map(sub -> sub.getTitle())
.collect(Collectors.toList())
).ifPresent(response -> {
l.debug("Delete {}", response);
SubscriptionRepository
.findByTitle(response)
.ifPresent(SubscriptionRepository::delete);
this.onAdd.handle(dumbEvent);
});
}
示例3: show
import org.controlsfx.dialog.Dialogs; //导入依赖的package包/类
public void show() {
CommandLink github = new CommandLink(
getTranslation("label.report.github"),
getTranslation("message.report.github")
);
CommandLink form = new CommandLink(
getTranslation("label.report.form"),
getTranslation("message.report.form")
);
Action response = Dialogs.create()
.title(getTranslation("menu.bug"))
.masthead(null)
.message(getTranslation("label.select.option"))
.showCommandLinks(form, github, form);
if(!response.equals(Dialog.Actions.CANCEL)){
if(response.equals(github)){
JavaFXUtils.openWebpage(GITHUB_URI);
}else{
JavaFXUtils.openWebpage(FORM_URI);
}
}
}
示例4: HeaderTableColumn
import org.controlsfx.dialog.Dialogs; //导入依赖的package包/类
public HeaderTableColumn(String text) {
super(text);
setContextMenu(new ContextMenu() {
{
MenuItem addPropertyColumnItem = new MenuItem("Add property column");
addPropertyColumnItem.setOnAction(event -> {
Optional<String> response = Dialogs.create()
.title("New property column")
.message("Property name:")
.showTextInput();
if (!response.isPresent()) {
return;
}
TableColumn propertyColumn = new PropertyTableColumn(response.get());
propertyColumn.setPrefWidth(125);
getTableView().getColumns().add(
getTableView().getColumns().indexOf(HeaderTableColumn.this),
propertyColumn
);
});
getItems().add(addPropertyColumnItem);
}
});
}
示例5: info
import org.controlsfx.dialog.Dialogs; //导入依赖的package包/类
public static void info(Window window, JSObject parameters) {
if (parameters == null)
return;
Dialogs dialogs = createDefaultDialogs(window);
applyParameter(dialogs, parameters);
String type = JSObjectUtils.getMember(parameters, "type", String.class).orElse("info");
switch (type) {
case "warning":
case "warn":
dialogs.showWarning();
break;
case "error":
dialogs.showError();
break;
default:
dialogs.showInformation();
break;
}
}
示例6: choice
import org.controlsfx.dialog.Dialogs; //导入依赖的package包/类
public static String choice(Window window, JSObject parameters) {
if (parameters == null)
return null;
Dialogs dialogs = createDefaultDialogs(window);
applyParameter(dialogs, parameters);
Collection<String> choices;
String defaultChoice = null;
if (JSObjectUtils.isArray(parameters))
choices = JSObjectUtils.getArray(parameters, String.class).collect(Collectors.toList());
else if (JSObjectUtils.isArray(parameters, "choices")) {
choices = JSObjectUtils.getArray(parameters, "choices", String.class).collect(Collectors.toList());
defaultChoice = JSObjectUtils.getMember(parameters, "defaultChoice", String.class).orElse(null);
} else
return null;
if (defaultChoice == null)
return dialogs.showChoices(choices).orElse(null);
else
return dialogs.showChoices(defaultChoice, choices).orElse(null);
}
示例7: convertToCommandLink
import org.controlsfx.dialog.Dialogs; //导入依赖的package包/类
private static Stream<Dialogs.CommandLink> convertToCommandLink(JSObject parameters) {
if (!JSObjectUtils.hasMember(parameters, "commands"))
return Stream.empty();
JSObject commands = JSObjectUtils.getMember(parameters, "commands", JSObject.class).get();
if (JSObjectUtils.isArray(commands)) {
// for String array
return JSObjectUtils.getArray(commands, String.class)
.map(t -> new Dialogs.CommandLink(t, null));
} else {
// for JSObject array
return JSObjectUtils.getMembersList(commands)
.map(m -> new Dialogs.CommandLink(m, JSObjectUtils.getMember(commands, m, String.class)
.orElse(null)));
}
}
示例8: process
import org.controlsfx.dialog.Dialogs; //导入依赖的package包/类
public void process(Stage stage, Artifact artifact) throws IOException {
final File updateFile = new File("update.zip");
final FileDownloadTask fileDownloadTask = new FileDownloadTask(artifact.getUrl(), updateFile);
progressBarDownload.progressProperty().bind(fileDownloadTask.progressProperty());
progressBarDownload.visibleProperty().bind(fileDownloadTask.runningProperty());
new Thread(fileDownloadTask).start();
fileDownloadTask.setOnSucceeded(event -> {
Dialogs.create()
.title("Restart required")
.message("To complete the installation please restart Biblio.")
.showInformation();
stage.close();
});
fileDownloadTask.setOnFailed(event -> {
Dialogs.create()
.title("Download failed")
.message("It was not possible to download the update. Please try again later.")
.showError();
stage.close();
});
}
示例9: accept
import org.controlsfx.dialog.Dialogs; //导入依赖的package包/类
public void accept() throws SQLException {
LOGGER.info("accept");
final String person = textFieldName.getText();
if (StringUtils.isBlank(person)) {
Action response = Dialogs.create()
.title("Error")
.message("Please introduce a name.")
.showError();
} else {
try {
Date ctime = DateUtils.parse(textFieldDate.getText(), DateUtils.DateTypeEnum.DATE);
final Book book = databaseManager.lendBook(bookId, person, ctime);
lendBookListener.lentBook(book);
stage.close();
} catch (Exception e) {
Dialogs.create()
.title("Wrong date format")
.message(String.format("Please introduce a valid date format \"%s\".", DateUtils.getDateFormat(DateUtils.DateTypeEnum.DATE)))
.showError();
}
}
}
示例10: accept
import org.controlsfx.dialog.Dialogs; //导入依赖的package包/类
public void accept() throws SQLException {
LOGGER.info("accept");
if (StringUtils.isBlank(textFieldDate.getText())) {
Action response = Dialogs.create()
.title("Error")
.message("Please introduce a date.")
.showError();
} else {
Date returnDate = null;
try {
returnDate = DateUtils.parse(textFieldDate.getText(), DateUtils.DateTypeEnum.DATE);
} catch (Exception e) {
Dialogs.create()
.title("Wrong date format")
.message(String.format("Please introduce a valid date format \"%s\".", DateUtils.getDateFormat(DateUtils.DateTypeEnum.DATE)))
.showError();
}
if (returnDate != null) {
final Book book = databaseManager.returnBook(bookId, returnDate);
returnBookListener.returnBook(book);
stage.close();
}
}
}
示例11: delete
import org.controlsfx.dialog.Dialogs; //导入依赖的package包/类
public void delete() throws SQLException, DropboxException {
LOGGER.info("delete");
Action response = Dialogs.create()
.title("Delete")
.message("Do you want to delete the book?")
.showConfirm();
if (response == org.controlsfx.dialog.Dialog.ACTION_YES) {
DatabaseContext.getDatabaseManager().deleteBook(bookId);
bookData.remove(bookFocusedIndex);
ImageUtils.deleteCover(textFieldIsbn.getText());
try {
dropboxManager.deleteCover(textFieldIsbn.getText());
} catch (NoAccountDropboxException e) {
LOGGER.debug("Cannot delete cover. {}.", e.getMessage());
}
resetBookView();
}
}
示例12: aboutAction
import org.controlsfx.dialog.Dialogs; //导入依赖的package包/类
@FXML
private void aboutAction(ActionEvent event) {
Dialogs.create()
.title("Informazioni")
.message("Questo software è stato ideato e prodotto da:\n"
+ "MARCO DALLA RIVA\n\n"
+ "Ringrazio per la collaborazione:\n"
+ "LUIGINO FIORE, FEDERICO PIRANA\n\n"
+ "----------------------------\n"
+ "Librerie Aggiuntive Usate:\n"
+ "ControlsFX\n"
+ "JFXtras\n"
+ "iText\n")
.lightweight()
.owner(null)
.masthead(null)
.showInformation();
}
示例13: launchLivestreamer
import org.controlsfx.dialog.Dialogs; //导入依赖的package包/类
private void launchLivestreamer(String url) {
livestreamerProgess.setPrefHeight(imageParent.getHeight());
livestreamerProgess.setPrefWidth(imageParent.getWidth());
try {
new ProcessBuilder("livestreamer", url, settings.getQuality(), "--no-version-check", "-Q", "--retry-open", "3").start();
livestreamerProgess.setVisible(true);
livestreamerProgess.setProgress(-1);
FxScheduler.scheduleOnce(Duration.seconds(6), () -> {
livestreamerProgess.setProgress(1);
livestreamerProgess.setVisible(false);
});
} catch (IOException e) {
Dialogs.create()
.owner(primaryStage)
.title("Livestreamer is not in path")
.message("Please install livestreamer: livestreamer.readthedocs.org")
.showError();
}
}
示例14: createDocumentEditor
import org.controlsfx.dialog.Dialogs; //导入依赖的package包/类
@ActionProxy(
id="newdoc",
text="New",
graphic="font>icomoon|FILE2",
longText = "Create New Document")
private DocumentEditor createDocumentEditor() {
final DocumentEditor editor = new DocumentEditor("");
Tab tab = new Tab( "New Document" );
tab.setContent(editor);
tab.setOnCloseRequest(new EventHandler<Event>() {
public void handle(Event e) {
Dialogs dlg = Dialogs.create().title("Confirmation").message("Close tab?");
if ( editor.isDirty() && dlg.showConfirm() != Dialog.Actions.YES ){
e.consume();
}
}
});
tabs.getTabs().add(tab);
tabs.getSelectionModel().select(tab);
return editor;
}
示例15: newList
import org.controlsfx.dialog.Dialogs; //导入依赖的package包/类
@FXML
public void newList(ActionEvent actionEvent) {
final Optional<String> listNameOption = Dialogs.
create().
title(resourceBundle.getString("dialog.title.new_list")).
message(resourceBundle.getString("dialog.label.listname")).
showTextInput();
if (hasValue(listNameOption)) {
final String listName = listNameOption.get().trim();
if (cacheService.doesCacheListNameExist(listName)) {
Dialogs.
create().
message(resourceBundle.getString("dialog.msg.list.does.exist")).
showError();
} else {
CacheList list = new CacheList();
list.setName(listName);
cacheService.storeCacheList(list);
setCacheListInContext();
}
}
}