Search in sources :

Example 11 with TextInputDialog

use of javafx.scene.control.TextInputDialog in project financial by greatkendy123.

the class MyController method delTeamAction.

/**
 * 删除团队ID
 * 备注:此方法的界面按钮已经删除,但后台代码仍保留着(以备后期要重新开发)
 *
 * @time 2017年11月14日
 * @param event
 */
public void delTeamAction(ActionEvent event) {
    // 注册界面
    TextInputDialog dialog = new TextInputDialog("");
    dialog.setTitle("注册");
    dialog.setHeaderText(null);
    dialog.setContentText("删除团队ID:");
    // dialog.getDialogPane().getButtonTypes().removeAll(ButtonType.CANCEL);
    Optional<String> result = dialog.showAndWait();
    result.ifPresent(_teamId -> {
        try {
            String teamId = _teamId.trim().toUpperCase();
            // 判断是否有此团队
            Huishui hs = DataConstans.huishuiMap.get(teamId);
            if (hs == null) {
                ShowUtil.show("哥,不存在此团队ID,请检查!");
                return;
            }
            // 清空数据库与缓存中回水表中的团队记录
            DBUtil.delHuishui(teamId);
            DataConstans.huishuiMap.remove(teamId);
            // 清空数据库与缓存中属于该团队的人员记录
            DBUtil.delMembers_after_delTeam(teamId);
            synchronized (DataConstans.membersMap) {
                Iterator<Map.Entry<String, Player>> ite = DataConstans.membersMap.entrySet().iterator();
                while (ite.hasNext()) {
                    Map.Entry<String, Player> entry = ite.next();
                    Player player = entry.getValue();
                    if (player.getTeamName().trim().toUpperCase().equals(teamId)) {
                        // 删除
                        ite.remove();
                    }
                }
            }
            // 以下清除代码
            // A 清空代理查询中的团队下拉框
            String selected_team = teamIDCombox.getSelectionModel().getSelectedItem();
            teamIDCombox.getItems().remove(teamId);
            if (teamId.equals(selected_team) && teamIDCombox.getItems().size() > 0) {
                teamIDCombox.getSelectionModel().select(0);
            }
            // B 积分查询中的团队下拉框
            String selected_jifen = jfTeamIDCombox.getSelectionModel().getSelectedItem();
            jfTeamIDCombox.getItems().remove(teamId);
            if (teamId.equals(selected_jifen) && jfTeamIDCombox.getItems().size() > 0) {
                jfTeamIDCombox.getSelectionModel().select(0);
            }
            // C 实时上码中的团队下拉框
            ShangmaService.initShangmaButton();
            ((Button) shangmaVBox.getChildren().get(0)).fire();
            ShowUtil.show("删除成功!", 2);
        } catch (Exception e) {
            log.error("删除团队ID失败", e);
        }
    });
}
Also used : Huishui(com.kendy.entity.Huishui) Player(com.kendy.entity.Player) RadioButton(javafx.scene.control.RadioButton) MouseButton(javafx.scene.input.MouseButton) Button(javafx.scene.control.Button) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) IOException(java.io.IOException) TextInputDialog(javafx.scene.control.TextInputDialog)

Example 12 with TextInputDialog

use of javafx.scene.control.TextInputDialog in project dwoss by gg-net.

the class ExportDossierToXlsAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    Ui.exec(() -> {
        Ui.build().title("Bitte DossierId eingeben").dialog().eval(() -> {
            TextInputDialog dialog = new TextInputDialog();
            dialog.setContentText("Bitte DossierId eingeben:");
            dialog.getDialogPane().lookupButton(OK).disableProperty().bind(Bindings.createBooleanBinding(() -> dialog.getEditor().getText().trim().isEmpty(), dialog.getEditor().textProperty()));
            return dialog;
        }).opt().filter(s -> !StringUtils.isBlank(s)).map(r -> ReplyUtil.wrap(() -> Ui.osOpen(Dl.remote().lookup(DocumentSupporter.class).toXls(r).toTemporaryFile()))).filter(Ui.failure()::handle);
    });
}
Also used : Dl(eu.ggnet.saft.Dl) StringUtils(org.apache.commons.lang.StringUtils) ReplyUtil(eu.ggnet.dwoss.common.ReplyUtil) EXPORT_DOSSIER_TO_XLS(eu.ggnet.dwoss.rights.api.AtomicRight.EXPORT_DOSSIER_TO_XLS) TextInputDialog(javafx.scene.control.TextInputDialog) DocumentSupporter(eu.ggnet.dwoss.redtapext.ee.DocumentSupporter) AccessableAction(eu.ggnet.saft.core.auth.AccessableAction) Ui(eu.ggnet.saft.Ui) OK(javafx.scene.control.ButtonType.OK) ActionEvent(java.awt.event.ActionEvent) Bindings(javafx.beans.binding.Bindings) TextInputDialog(javafx.scene.control.TextInputDialog)

Example 13 with TextInputDialog

use of javafx.scene.control.TextInputDialog in project jabref by JabRef.

the class FXDialogService method showInputDialogAndWait.

@Override
public Optional<String> showInputDialogAndWait(String title, String content) {
    TextInputDialog inputDialog = new TextInputDialog();
    inputDialog.setHeaderText(title);
    inputDialog.setContentText(content);
    return inputDialog.showAndWait();
}
Also used : TextInputDialog(javafx.scene.control.TextInputDialog)

Example 14 with TextInputDialog

use of javafx.scene.control.TextInputDialog in project Smartcity-Smarthouse by TechnionYP5777.

the class RoomViewController method addSensor.

private void addSensor(final double x, final double y) {
    final TextInputDialog dialog = new TextInputDialog("sensor name");
    dialog.setGraphic(new ImageView(new Image(getClass().getResourceAsStream("Homeicon.png"))));
    dialog.setTitle("Create Sensor");
    dialog.setHeaderText("Config your simulator");
    dialog.setContentText("Please enter sensor name:");
    final Optional<String> result = dialog.showAndWait();
    if (!result.isPresent())
        return;
    final String name = result.get();
    final SensorLabel label = new SensorLabel(x, y, name);
    final SensorData sensor = new SensorData(name, label, location);
    mainController.addSensor(sensor);
    RoomViewController.this.labels.add(label);
    pane.getChildren().add(label);
}
Also used : SensorData(il.ac.technion.cs.smarthouse.simulator.model.SensorData) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image) TextInputDialog(javafx.scene.control.TextInputDialog)

Example 15 with TextInputDialog

use of javafx.scene.control.TextInputDialog in project Money-Manager by krHasan.

the class MakeATransactionController method gmCreateSourceBtn.

@FXML
private void gmCreateSourceBtn(ActionEvent event) {
    TextInputDialog dialog = new TextInputDialog();
    dialog.setTitle("Create Income Source");
    dialog.setHeaderText("Create Income Source, Where from you get Tk.");
    dialog.setContentText("Please type a source name :");
    Stage MakeATransactionStage = (Stage) gmbtnCreateSource.getScene().getWindow();
    dialog.setX(MakeATransactionStage.getX() + 200);
    dialog.setY(MakeATransactionStage.getY() + 170);
    Optional<String> result = dialog.showAndWait();
    if (result.isPresent()) {
        String typedName = result.get();
        if (typedName.length() == 0) {
            Alert alert = new Alert(AlertType.WARNING);
            alert.setTitle("Operation Falied");
            alert.setHeaderText(null);
            alert.setContentText("Write a Source Name Please");
            alert.setX(MakeATransactionStage.getX() + 200);
            alert.setY(MakeATransactionStage.getY() + 170);
            Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {

                @Override
                public void handle(ActionEvent event) {
                    alert.hide();
                }
            }));
            idlestage.setCycleCount(1);
            idlestage.play();
            alert.showAndWait();
        } else if (countWords(typedName) == 0) {
            Alert alert = new Alert(AlertType.WARNING);
            alert.setTitle("Operation Falied");
            alert.setHeaderText(null);
            alert.setContentText("Write a Source Name Please");
            alert.setX(MakeATransactionStage.getX() + 200);
            alert.setY(MakeATransactionStage.getY() + 170);
            Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {

                @Override
                public void handle(ActionEvent event) {
                    alert.hide();
                }
            }));
            idlestage.setCycleCount(1);
            idlestage.play();
            alert.showAndWait();
        } else {
            new Source().createSource(typedName);
            Alert confirmationMsg = new Alert(AlertType.INFORMATION);
            confirmationMsg.setTitle("Message");
            confirmationMsg.setHeaderText(null);
            confirmationMsg.setContentText("Source " + typedName + " created successfully");
            Stage SettingsStage = (Stage) MakeATransactionStage.getScene().getWindow();
            confirmationMsg.setX(SettingsStage.getX() + 200);
            confirmationMsg.setY(SettingsStage.getY() + 170);
            Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(2), new EventHandler<ActionEvent>() {

                @Override
                public void handle(ActionEvent event) {
                    confirmationMsg.hide();
                }
            }));
            idlestage.setCycleCount(1);
            idlestage.play();
            confirmationMsg.showAndWait();
            gmLoadSource();
            gmcmboSource.getSelectionModel().selectLast();
        }
    }
}
Also used : Timeline(javafx.animation.Timeline) ActionEvent(javafx.event.ActionEvent) Stage(javafx.stage.Stage) KeyFrame(javafx.animation.KeyFrame) EventHandler(javafx.event.EventHandler) Alert(javafx.scene.control.Alert) Source(tab.Source) TextInputDialog(javafx.scene.control.TextInputDialog) FXML(javafx.fxml.FXML)

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