Search in sources :

Example 1 with OK

use of javafx.scene.control.ButtonType.OK 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 2 with OK

use of javafx.scene.control.ButtonType.OK 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 3 with OK

use of javafx.scene.control.ButtonType.OK 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)

Aggregations

Dl (eu.ggnet.saft.Dl)3 Ui (eu.ggnet.saft.Ui)3 AccessableAction (eu.ggnet.saft.core.auth.AccessableAction)3 ActionEvent (java.awt.event.ActionEvent)3 OK (javafx.scene.control.ButtonType.OK)3 ReplyUtil (eu.ggnet.dwoss.common.ReplyUtil)2 Reply (eu.ggnet.saft.api.Reply)2 Bindings (javafx.beans.binding.Bindings)2 Alert (javafx.scene.control.Alert)2 CONFIRMATION (javafx.scene.control.Alert.AlertType.CONFIRMATION)2 TextInputDialog (javafx.scene.control.TextInputDialog)2 ImageIdHandler (eu.ggnet.dwoss.misc.ee.ImageIdHandler)1 UnitDestroyer (eu.ggnet.dwoss.receipt.ee.UnitDestroyer)1 DocumentSupporter (eu.ggnet.dwoss.redtapext.ee.DocumentSupporter)1 EXPORT_DOSSIER_TO_XLS (eu.ggnet.dwoss.rights.api.AtomicRight.EXPORT_DOSSIER_TO_XLS)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 Guardian (eu.ggnet.saft.core.auth.Guardian)1