本文整理汇总了Java中org.controlsfx.dialog.Dialog类的典型用法代码示例。如果您正苦于以下问题:Java Dialog类的具体用法?Java Dialog怎么用?Java Dialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Dialog类属于org.controlsfx.dialog包,在下文中一共展示了Dialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import org.controlsfx.dialog.Dialog; //导入依赖的package包/类
public void show() {
Dialog dlg = new Dialog(null, getTranslation("label.preferences"));
final GridPane content = new GridPane();
content.setHgap(10);
content.setVgap(10);
content.add(new Label(getTranslation("label.portals")), 0, 0);
content.add(portals, 1, 0);
GridPane.setHgrow(portals, Priority.ALWAYS);
content.add(autosave, 1, 1);
content.add(autoupdate, 1, 2);
dlg.setResizable(false);
dlg.setIconifiable(false);
dlg.setContent(content);
dlg.getActions().addAll(Dialog.Actions.CLOSE);
dlg.show();
}
示例2: show
import org.controlsfx.dialog.Dialog; //导入依赖的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);
}
}
}
示例3: newFile
import org.controlsfx.dialog.Dialog; //导入依赖的package包/类
@FXML
void newFile(ActionEvent e) {
if(ApplicationState.changesPending()) {
Action response = DialogFactory.pendingChanges();
if (response.equals(Dialog.Actions.YES)){
save(e);
}else if (response.equals(Dialog.Actions.CANCEL)){
return;
}
}
PreferencesController.setLastFilePath("");
ProfileRepository.clear();
SubscriptionRepository.clear();
refresh();
}
示例4: quit
import org.controlsfx.dialog.Dialog; //导入依赖的package包/类
@FXML
void quit(ActionEvent event) {
if(ApplicationState.changesPending()) {
Action response = DialogFactory.quit(this.parent);
// Cancel so no action is done
if(response.equals(Dialog.Actions.CANCEL)) return;
// Don't save changes, then quit
if(response.equals(Dialog.Actions.NO)){
Platform.exit();
return;
}
// Lets save and then quit
save(null);
Platform.exit();
}else{
Platform.exit();
}
}
示例5: MessageTypeDialog
import org.controlsfx.dialog.Dialog; //导入依赖的package包/类
public MessageTypeDialog() {
super(null, "Choose message type", false, DialogStyle.NATIVE);
setMasthead("Choose message type");
group = new ToggleGroup();
RadioButton textButton = new RadioButton("Text");
textButton.setUserData(new JmsTextMessage());
textButton.setToggleGroup(group);
textButton.setSelected(true);
RadioButton bytesButton = new RadioButton("Bytes");
bytesButton.setUserData(new JmsBytesMessage());
bytesButton.setToggleGroup(group);
HBox hbox = new HBox(5);
hbox.getChildren().add(textButton);
hbox.getChildren().add(bytesButton);
setContent(hbox);
Action action = new JmsMessageAction();
action.disabledProperty().bind(group.selectedToggleProperty().isNull());
ButtonBar.setType(action, ButtonBar.ButtonType.OK_DONE);
getActions().addAll(action, Dialog.Actions.CANCEL);
}
示例6: createDocumentEditor
import org.controlsfx.dialog.Dialog; //导入依赖的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;
}
示例7: editFeed
import org.controlsfx.dialog.Dialog; //导入依赖的package包/类
public void editFeed(Optional<Subscription> feed) {
SubscriptionForm dialog = SubscriptionForm.create(getBundle())
.setSubscription(feed.orElse(Subscription.create()));
Optional<Action> action = dialog.show();
if(action.isPresent() && action.get() != Dialog.Actions.CANCEL){
l.debug("Got response from dialog");
Subscription sub = dialog.getSubscription();
SubscriptionRepository.add(sub);
}
this.onAdd.handle(dumbEvent);
}
示例8: show
import org.controlsfx.dialog.Dialog; //导入依赖的package包/类
public Actions show(final File file) {
CommandLink overwrite = new CommandLink(
getTranslation("label.overwrite"),
getTranslation("message.overwrite")
);
CommandLink reload = new CommandLink(
getTranslation("label.reload"),
getTranslation("message.reload")
);
CommandLink save = new CommandLink(
getTranslation("label.save.as"),
getTranslation("message.save.as")
);
CommandLink cancel = new CommandLink(
getTranslation("label.cancel"),
getTranslation("message.cancel")
);
Action response = Dialogs.create()
.title(getTranslation("label.file.modified"))
.masthead(getTranslation("message.file.modified", file.toString()))
.message(getTranslation("label.select.option"))
.actions(Dialog.Actions.CANCEL)
.showCommandLinks(cancel, cancel, save, overwrite, reload);
if(response.equals(overwrite)) return Actions.OVERWRITE;
if(response.equals(reload)) return Actions.RELOAD;
if(response.equals(save)) return Actions.SAVE;
return Actions.CANCEL;
}
示例9: deleteMessages
import org.controlsfx.dialog.Dialog; //导入依赖的package包/类
private void deleteMessages() {
ObservableList<JmsMessageViewModel> messagesToDelete = getSelectionModel().getSelectedItems();
Action response = Dialogs.create().
title("Delete message").
message("Delete " + messagesToDelete.size() + " messages?").
showConfirm();
if (response != Dialog.Actions.YES) {
return;
}
new HashSet<>(messagesToDelete).forEach(message -> {
try {
if (jmsDestinationViewModel.isQueue()) {
jmsDestinationViewModel.deleteMessage(message);
getSelectionModel().select(null);
}
getItems().remove(message);
} catch (Exception ex) {
Dialogs.create()
.style(DialogStyle.NATIVE)
.owner(null)
.title("Delete message")
.masthead("Unable to delete message")
.message(ex.getMessage())
.showWarning();
}
});
}
示例10: JmsConnectionDialog
import org.controlsfx.dialog.Dialog; //导入依赖的package包/类
public JmsConnectionDialog() {
super(null, "Create connection", false, DialogStyle.NATIVE);
JmsConnection config = new JmsConnection();
JmsConnectionPanel connectionPanel = new JmsConnectionPanel(jmsProviderManager, config);
ScrollPane scrollPane = new ScrollPane(connectionPanel);
scrollPane.setMinHeight(300);
setContent(scrollPane);
CreateJmsConnectionAction createAction = new CreateJmsConnectionAction(config);
ButtonBar.setType(createAction, ButtonBar.ButtonType.OK_DONE);
getActions().addAll(createAction, Dialog.Actions.CANCEL);
createAction.disabledProperty().bind(connectionPanel.isValidPropertyProperty().not());
}
示例11: handle
import org.controlsfx.dialog.Dialog; //导入依赖的package包/类
public void handle(ActionEvent event) {
originalJmsConnectionConfig.setName(clonedJmsConnectionConfig.getName());
originalJmsConnectionConfig.setJmsProviderId(clonedJmsConnectionConfig.getJmsProviderId());
originalJmsConnectionConfig.setUserName(clonedJmsConnectionConfig.getUserName());
originalJmsConnectionConfig.setPassword(clonedJmsConnectionConfig.getPassword());
originalJmsConnectionConfig.getJmsConnectionProviderParams().clear();
originalJmsConnectionConfig.getJmsConnectionProviderParams().
addAll(clonedJmsConnectionConfig.getJmsConnectionProviderParams());
Dialog d = (Dialog) event.getSource();
d.hide();
}
示例12: handle
import org.controlsfx.dialog.Dialog; //导入依赖的package包/类
public void handle(ActionEvent event) {
originalJmsConnectionConfig.setName(clonedJmsConnectionConfig.getName());
originalJmsConnectionConfig.setRegexp(clonedJmsConnectionConfig.getRegexp());
Dialog d = (Dialog) event.getSource();
d.hide();
}
示例13: command
import org.controlsfx.dialog.Dialog; //导入依赖的package包/类
public static String command(Window window, JSObject parameters) {
if (parameters == null)
return null;
Dialogs dialogs = createDefaultDialogs(window);
applyParameter(dialogs, parameters);
Action action = dialogs.showCommandLinks(convertToCommandLink(parameters).collect(Collectors.toList()));
if (Dialog.Actions.CANCEL.equals(action))
return null;
else
return action.textProperty().get();
}
示例14: showAboutDialog
import org.controlsfx.dialog.Dialog; //导入依赖的package包/类
@FXML
public void showAboutDialog(ActionEvent actionEvent) {
Dialog dialog = new Dialog(null, resourceBundle.getString("dialog.title.about"));
dialog.setMasthead(MASTHEAD_TEXT);
dialog.setContent(ABOUT_TEXT);
dialog.setExpandableContent(new TextArea(LICENSE));
dialog.show();
}
示例15: show
import org.controlsfx.dialog.Dialog; //导入依赖的package包/类
public Optional<Action> show() {
Dialog dlg = new Dialog(null, getTranslation("message.add.subscription"));
final GridPane content = new GridPane();
content.setHgap(10);
content.setVgap(10);
ObservableList<String> portals = FXCollections.observableArrayList(
PreferencesController.getPortalsList()
);
portalField.setItems(portals);
portalField.setPrefWidth(400.0);
portalField.setEditable(true);
portalField.setValue(subscription.getPortal());
portalField.valueProperty().addListener((observable, old, neu) -> {
subscription.setPortal(neu);
save.disabledProperty().set(!isValid());
});
urlField.setText(subscription.getUri());
urlField.textProperty().addListener((observable, old, neu) -> {
subscription.setURI(neu);
save.disabledProperty().set(!isValid());
});
titleField.setText(subscription.getTitle());
titleField.textProperty().addListener((observable, old, neu) -> {
subscription.setTitle(neu);
save.disabledProperty().set(!isValid());
});
historyField.setText(subscription.getHistory().toString());
historyField.textProperty().addListener((observable, old, neu) -> {
subscription.setHistory(Integer.valueOf(neu));
save.disabledProperty().set(!isValid());
});
content.add(new Label(getTranslation("label.title")), 0, 0);
content.add(titleField, 1, 0);
GridPane.setHgrow(titleField, Priority.ALWAYS);
content.add(new Label(getTranslation("label.portal")), 0, 1);
content.add(portalField, 1, 1);
content.add(new Label(getTranslation("label.feed.url")), 0, 2);
content.add(urlField, 1, 2);
GridPane.setHgrow(urlField, Priority.ALWAYS);
content.add(new Label(getTranslation("label.history")), 0, 3);
content.add(historyField, 1, 3);
GridPane.setHgrow(historyField, Priority.ALWAYS);
dlg.setResizable(false);
dlg.setIconifiable(false);
dlg.setContent(content);
dlg.getActions().addAll(save, Dialog.Actions.CANCEL);
Platform.runLater(() -> titleField.requestFocus());
l.debug("Showing dialog");
return Optional.of(dlg.show());
}