use of javafx.scene.control.TextInputDialog in project blue by kunstmusik.
the class PresetPane method addFolder.
/**
* @param currentPresetGroup
*/
protected void addFolder(PresetGroup presetGroup) {
TextInputDialog dlg = new TextInputDialog();
dlg.setTitle("Enter Folder Name");
dlg.setHeaderText("Enter Folder Name");
dlg.setGraphic(null);
BlueFX.style(dlg.getDialogPane());
Optional<String> str = dlg.showAndWait();
if (!str.isPresent() || str.get().length() == 0) {
return;
}
String folderName = str.get();
if (folderName.length() == 0) {
return;
}
PresetGroup newFolder = new PresetGroup();
newFolder.setPresetGroupName(folderName);
presetGroup.getSubGroups().add(newFolder);
Collections.sort(presetGroup.getSubGroups());
updatePresetMenu();
}
use of javafx.scene.control.TextInputDialog in project org.csstudio.display.builder by kasemir.
the class StringTable method getColumnName.
/**
* Prompt for column name
* @param name Suggested name
* @return Name entered by user or <code>null</code>
*/
private String getColumnName(final String name) {
final TextInputDialog dialog = new TextInputDialog(name);
// Position dialog near table
final Bounds absolute = localToScreen(getBoundsInLocal());
dialog.setX(absolute.getMinX() + 10);
dialog.setY(absolute.getMinY() + 10);
dialog.setTitle(Messages.RenameColumnTitle);
dialog.setHeaderText(Messages.RenameColumnInfo);
return dialog.showAndWait().orElse(null);
}
use of javafx.scene.control.TextInputDialog in project TeachingInSimulation by ScOrPiOzzy.
the class TypicalCase3D method showPopupMenu.
public void showPopupMenu(Wire wire) {
ContextMenu menu = null;
WireProxy proxy = wire.getProxy();
String key = String.format("%s%s-%s%s", proxy.getComp1Uuid(), proxy.getTernimal1Id(), proxy.getComp2Uuid(), proxy.getTernimal2Id());
if (menus.containsKey(key)) {
menu = menus.get(key);
} else {
MenuItem tag = new MenuItem(MsgUtil.getMessage("typical.case.wire.num"));
tag.setOnAction(e -> {
TextInputDialog steamIdDialog = new TextInputDialog(proxy.getNumber());
steamIdDialog.setTitle(MsgUtil.getMessage("typical.case.wire.num"));
steamIdDialog.setHeaderText(null);
steamIdDialog.getEditor().textProperty().addListener((b, o, n) -> {
Pattern pat = Pattern.compile(REGEX_CHINESE);
Matcher mat = pat.matcher(n);
if (mat.find()) {
steamIdDialog.getEditor().setText(o);
}
});
steamIdDialog.setContentText(MsgUtil.getMessage("typical.case.prompt.input.wire.num"));
steamIdDialog.showAndWait().ifPresent(number -> {
wire.getProxy().setNumber(number);
CircuitState state = jmeApp.getStateManager().getState(CircuitState.class);
if (state == null) {
return;
}
state.setTagNameChanged(true);
});
});
MenuItem del = new MenuItem(MsgUtil.getMessage("button.delete"));
del.setOnAction(e -> {
CircuitState state = jmeApp.getStateManager().getState(CircuitState.class);
if (state == null) {
return;
}
boolean enable = state.detachFromCircuit(wire);
if (enable) {
menus.remove(key);
} else {
AlertUtil.showAlert(AlertType.WARNING, MsgUtil.getMessage("alert.warning.wiring"));
}
});
menu = new ContextMenu(tag, del);
}
Point anchor = MouseInfo.getPointerInfo().getLocation();
menu.show(GUIState.getStage(), anchor.x, anchor.y);
}
use of javafx.scene.control.TextInputDialog in project TeachingInSimulation by ScOrPiOzzy.
the class TypicalCaseMenu method saveCase.
private void saveCase() {
SpringUtil.getBean(PageController.class).showLoading();
TypicalCase typicalCase = typicalCase3D.getTypicalCase();
if (typicalCase.getId() == null) {
TextInputDialog steamIdDialog = new TextInputDialog();
steamIdDialog.setTitle(MsgUtil.getMessage("menu.button.save"));
steamIdDialog.setHeaderText(null);
steamIdDialog.setContentText(MsgUtil.getMessage("typical.case.prompt.input.case"));
Optional<String> steamID = steamIdDialog.showAndWait();
if (steamID.isPresent()) {
typicalCase.setName(steamID.get());
}
}
typicalCase3D.save();
AlertUtil.showAlert(AlertType.INFORMATION, MsgUtil.getMessage("alert.information.data.save.success"));
}
use of javafx.scene.control.TextInputDialog in project financial by greatkendy123.
the class TGAddKaixiaoController method addPayItemAction.
/**
* 添加支出项目
*
* @time 2018年3月3日
* @param event
*/
public void addPayItemAction(ActionEvent event) {
TextInputDialog dialog = new TextInputDialog();
dialog.setTitle("添加");
dialog.setHeaderText(null);
dialog.setContentText("新增支出项目:");
Optional<String> result = dialog.showAndWait();
if (result.isPresent()) {
String newPayItem = result.get();
if (payItems.contains(newPayItem)) {
ShowUtil.show("已经存在支出项目:" + newPayItem);
} else {
// 修改界面和缓存
payItems.add(newPayItem);
payItemsChoice.setItems(FXCollections.observableArrayList(payItems));
// 更新到数据库
savePayItem();
// 刷新
initPayItemChoice();
// 自动选值
payItemsChoice.getSelectionModel().select(newPayItem);
}
}
}
Aggregations