use of eu.ggnet.saft.Ui in project dwoss by gg-net.
the class DocumentPrintAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
Ui.exec(() -> {
// TODO: This is a very special case, there the Ui needs the result on construction. So the consumer pattern cannot be used.
// This meeans, for now no progress display.
JasperPrint print = Dl.remote().lookup(DocumentSupporter.class).render(document, type);
CustomerMetaData customer = Dl.remote().lookup(CustomerService.class).asCustomerMetaData(customerId);
boolean mailAvailable = customer.getEmail() != null && !customer.getEmail().trim().isEmpty();
Ui.exec(() -> {
Ui.build().parent(controller.getView()).swing().eval(() -> new JRViewerCask(print, document, type, mailAvailable)).opt().filter(c -> c.isCorrectlyBriefed()).ifPresent(c -> Ui.progress().call(() -> {
CustomerDocument customerDocument = new CustomerDocument(customer.getFlags(), document, customer.getShippingCondition(), customer.getPaymentMethod());
for (StateTransition<CustomerDocument> stateTransition : Dl.remote().lookup(RedTapeWorker.class).getPossibleTransitions(customerDocument)) {
RedTapeStateTransition redTapeStateTransition = (RedTapeStateTransition) stateTransition;
for (RedTapeStateTransition.Hint hint : redTapeStateTransition.getHints()) {
if (hint == RedTapeStateTransition.Hint.SENDED_INFORMATION) {
this.document = Optional.of(Dl.remote().lookup(RedTapeWorker.class).stateChange(customerDocument, redTapeStateTransition, Lookup.getDefault().lookup(Guardian.class).getUsername())).filter(Ui.failure()::handle).map(Reply::getPayload).orElse(document);
}
}
}
controller.reloadSelectionOnStateChange(Dl.remote().lookup(DocumentSupporter.class).briefed(document, Dl.local().lookup(Guardian.class).getUsername()));
return null;
}));
});
});
}
use of eu.ggnet.saft.Ui 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);
});
});
});
}
Aggregations