Search in sources :

Example 1 with CONFIRMATION

use of javafx.scene.control.Alert.AlertType.CONFIRMATION in project dwoss by gg-net.

the class ImportImageIdsAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    Ui.exec(() -> {
        Optional<File> inFile = Ui.fileChooser().open().opt();
        if (!inFile.isPresent())
            return;
        Ui.build().dialog().eval(() -> new Alert(CONFIRMATION, "ImageIds aus der Datei:" + inFile.get().getPath() + " importieren ?")).opt().filter(b -> b == OK).map(b -> TikaUtil.isExcel(inFile.get())).filter(Ui.failure()::handle).map(Reply::getPayload).map(f -> Ui.progress().call(() -> Dl.remote().lookup(ImageIdHandler.class).importMissing(new FileJacket("in", ".xls", f)))).filter(Ui.failure()::handle).isPresent();
    });
}
Also used : Alert(javafx.scene.control.Alert) FileJacket(eu.ggnet.dwoss.util.FileJacket) AccessableAction(eu.ggnet.saft.core.auth.AccessableAction) Ui(eu.ggnet.saft.Ui) ActionEvent(java.awt.event.ActionEvent) File(java.io.File) Dl(eu.ggnet.saft.Dl) CONFIRMATION(javafx.scene.control.Alert.AlertType.CONFIRMATION) TikaUtil(eu.ggnet.dwoss.util.TikaUtil) Reply(eu.ggnet.saft.api.Reply) IMPORT_IMAGE_IDS(eu.ggnet.dwoss.rights.api.AtomicRight.IMPORT_IMAGE_IDS) ImageIdHandler(eu.ggnet.dwoss.misc.ee.ImageIdHandler) Optional(java.util.Optional) OK(javafx.scene.control.ButtonType.OK) ImageIdHandler(eu.ggnet.dwoss.misc.ee.ImageIdHandler) Alert(javafx.scene.control.Alert) FileJacket(eu.ggnet.dwoss.util.FileJacket) File(java.io.File)

Example 2 with CONFIRMATION

use of javafx.scene.control.Alert.AlertType.CONFIRMATION in project dwoss by gg-net.

the class ScrapUnitAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    Ui.exec(() -> {
        Ui.build().title("SopoNr die verschrottet werden soll").dialog().eval(() -> {
            TextInputDialog dialog = new TextInputDialog();
            dialog.setContentText("SopoNr die verschrottet werden soll:");
            return dialog;
        }).opt().filter(s -> !StringUtils.isBlank(s)).ifPresent(r -> {
            Ui.build().dialog().eval(() -> new Alert(CONFIRMATION, "SopoNr " + r + " wirklich verschrotten ?")).opt().filter(b -> b == OK).map(u -> ReplyUtil.wrap(() -> Dl.remote().lookup(UnitDestroyer.class).verifyScarpOrDeleteAble(r))).filter(Ui.failure()::handle).map(Reply::getPayload).ifPresent(u -> {
                Ui.build().title("Bitte Grund angeben").dialog().eval(() -> {
                    TextInputDialog dialog = new TextInputDialog();
                    dialog.setContentText("Bitte Grund angeben");
                    dialog.getDialogPane().lookupButton(OK).disableProperty().bind(Bindings.createBooleanBinding(() -> dialog.getEditor().getText().trim().isEmpty(), dialog.getEditor().textProperty()));
                    return dialog;
                }).opt().filter(s -> !StringUtils.isBlank(s)).ifPresent(c -> {
                    Dl.remote().lookup(UnitDestroyer.class).scrap(u, c, Dl.local().lookup(Guardian.class).getUsername());
                    Ui.build().alert().message("SopoNr " + r + " ist verschrottet.").show(AlertType.INFO);
                });
            });
        });
    });
}
Also used : Alert(javafx.scene.control.Alert) UPDATE_UNIQUE_UNIT_TO_SCRAP_UNIT(eu.ggnet.dwoss.rights.api.AtomicRight.UPDATE_UNIQUE_UNIT_TO_SCRAP_UNIT) AccessableAction(eu.ggnet.saft.core.auth.AccessableAction) Ui(eu.ggnet.saft.Ui) ActionEvent(java.awt.event.ActionEvent) Bindings(javafx.beans.binding.Bindings) StringUtils(org.apache.commons.lang3.StringUtils) Dl(eu.ggnet.saft.Dl) CONFIRMATION(javafx.scene.control.Alert.AlertType.CONFIRMATION) Guardian(eu.ggnet.saft.core.auth.Guardian) AlertType(eu.ggnet.saft.core.ui.AlertType) ReplyUtil(eu.ggnet.dwoss.common.ReplyUtil) TextInputDialog(javafx.scene.control.TextInputDialog) Reply(eu.ggnet.saft.api.Reply) UnitDestroyer(eu.ggnet.dwoss.receipt.ee.UnitDestroyer) OK(javafx.scene.control.ButtonType.OK) Alert(javafx.scene.control.Alert) UnitDestroyer(eu.ggnet.dwoss.receipt.ee.UnitDestroyer) TextInputDialog(javafx.scene.control.TextInputDialog)

Example 3 with CONFIRMATION

use of javafx.scene.control.Alert.AlertType.CONFIRMATION in project dwoss by gg-net.

the class DeleteUnitAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    Ui.exec(() -> {
        Ui.build().title("SopoNr die gelöscht werden soll").dialog().eval(() -> {
            TextInputDialog dialog = new TextInputDialog();
            dialog.setContentText("SopoNr die gelöscht werden soll:");
            return dialog;
        }).opt().filter(s -> !StringUtils.isBlank(s)).ifPresent(r -> {
            Ui.build().dialog().eval(() -> new Alert(CONFIRMATION, "SopoNr " + r + " wirklich gelöschen ?")).opt().map(s -> ReplyUtil.wrap(() -> Dl.remote().lookup(UnitDestroyer.class).verifyScarpOrDeleteAble(r))).filter(Ui.failure()::handle).map(Reply::getPayload).ifPresent(u -> {
                Dl.remote().lookup(UnitDestroyer.class).delete(u, "Löschung aus UI", Dl.local().lookup(Guardian.class).getUsername());
                Ui.build().alert().message("SopoNr " + r + " ist gelöscht.").show(AlertType.INFO);
            });
        });
    });
}
Also used : Alert(javafx.scene.control.Alert) AccessableAction(eu.ggnet.saft.core.auth.AccessableAction) Ui(eu.ggnet.saft.Ui) DELETE_UNIQUE_UNIT(eu.ggnet.dwoss.rights.api.AtomicRight.DELETE_UNIQUE_UNIT) ActionEvent(java.awt.event.ActionEvent) StringUtils(org.apache.commons.lang3.StringUtils) Dl(eu.ggnet.saft.Dl) CONFIRMATION(javafx.scene.control.Alert.AlertType.CONFIRMATION) Guardian(eu.ggnet.saft.core.auth.Guardian) AlertType(eu.ggnet.saft.core.ui.AlertType) ReplyUtil(eu.ggnet.dwoss.common.ReplyUtil) TextInputDialog(javafx.scene.control.TextInputDialog) Reply(eu.ggnet.saft.api.Reply) UnitDestroyer(eu.ggnet.dwoss.receipt.ee.UnitDestroyer) Alert(javafx.scene.control.Alert) UnitDestroyer(eu.ggnet.dwoss.receipt.ee.UnitDestroyer) TextInputDialog(javafx.scene.control.TextInputDialog)

Aggregations

Dl (eu.ggnet.saft.Dl)3 Ui (eu.ggnet.saft.Ui)3 Reply (eu.ggnet.saft.api.Reply)3 AccessableAction (eu.ggnet.saft.core.auth.AccessableAction)3 ActionEvent (java.awt.event.ActionEvent)3 Alert (javafx.scene.control.Alert)3 CONFIRMATION (javafx.scene.control.Alert.AlertType.CONFIRMATION)3 ReplyUtil (eu.ggnet.dwoss.common.ReplyUtil)2 UnitDestroyer (eu.ggnet.dwoss.receipt.ee.UnitDestroyer)2 Guardian (eu.ggnet.saft.core.auth.Guardian)2 AlertType (eu.ggnet.saft.core.ui.AlertType)2 OK (javafx.scene.control.ButtonType.OK)2 TextInputDialog (javafx.scene.control.TextInputDialog)2 StringUtils (org.apache.commons.lang3.StringUtils)2 ImageIdHandler (eu.ggnet.dwoss.misc.ee.ImageIdHandler)1 DELETE_UNIQUE_UNIT (eu.ggnet.dwoss.rights.api.AtomicRight.DELETE_UNIQUE_UNIT)1 IMPORT_IMAGE_IDS (eu.ggnet.dwoss.rights.api.AtomicRight.IMPORT_IMAGE_IDS)1 UPDATE_UNIQUE_UNIT_TO_SCRAP_UNIT (eu.ggnet.dwoss.rights.api.AtomicRight.UPDATE_UNIQUE_UNIT_TO_SCRAP_UNIT)1 FileJacket (eu.ggnet.dwoss.util.FileJacket)1 TikaUtil (eu.ggnet.dwoss.util.TikaUtil)1