Search in sources :

Example 21 with TextInputDialog

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();
}
Also used : PresetGroup(blue.orchestra.blueSynthBuilder.PresetGroup) TextInputDialog(javafx.scene.control.TextInputDialog)

Example 22 with TextInputDialog

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);
}
Also used : Bounds(javafx.geometry.Bounds) TextInputDialog(javafx.scene.control.TextInputDialog)

Example 23 with TextInputDialog

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);
}
Also used : WireProxy(com.cas.circuit.vo.archive.WireProxy) CircuitState(com.cas.sim.tis.app.state.CircuitState) Pattern(java.util.regex.Pattern) Matcher(java.util.regex.Matcher) ContextMenu(javafx.scene.control.ContextMenu) MenuItem(javafx.scene.control.MenuItem) Point(java.awt.Point) TextInputDialog(javafx.scene.control.TextInputDialog)

Example 24 with TextInputDialog

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"));
}
Also used : PageController(com.cas.sim.tis.view.controller.PageController) TypicalCase(com.cas.sim.tis.entity.TypicalCase) TextInputDialog(javafx.scene.control.TextInputDialog)

Example 25 with TextInputDialog

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);
        }
    }
}
Also used : TextInputDialog(javafx.scene.control.TextInputDialog)

Aggregations

TextInputDialog (javafx.scene.control.TextInputDialog)38 Alert (javafx.scene.control.Alert)12 FXML (javafx.fxml.FXML)9 ActionEvent (javafx.event.ActionEvent)8 EventHandler (javafx.event.EventHandler)8 KeyFrame (javafx.animation.KeyFrame)7 Timeline (javafx.animation.Timeline)7 Stage (javafx.stage.Stage)7 ReplyUtil (eu.ggnet.dwoss.common.ReplyUtil)6 AccessableAction (eu.ggnet.saft.core.auth.AccessableAction)6 ActionEvent (java.awt.event.ActionEvent)6 Dl (eu.ggnet.saft.Dl)5 Ui (eu.ggnet.saft.Ui)5 Reply (eu.ggnet.saft.api.Reply)5 IOException (java.io.IOException)4 Guardian (eu.ggnet.saft.core.auth.Guardian)3 Point (java.awt.Point)3 Optional (java.util.Optional)3 StringUtils (org.apache.commons.lang3.StringUtils)3 CircuitState (com.cas.sim.tis.app.state.CircuitState)2