use of eu.ggnet.saft.core.ui.UiParent in project dwoss by gg-net.
the class OldCustomerUpi method updateCustomer.
@Override
public boolean updateCustomer(UiParent parent, long customerId) {
OldCustomer customer = Dl.remote().lookup(OldCustomerAgent.class).findById(customerId);
CustomerEditView ec = new CustomerEditView();
ec.setCustomer(customer);
// HINT: This was RedTapeView as parrent. If users complain about the location of create customer, add it to Workspace or else.
OkCancelDialog<CustomerEditView> dialog = new OkCancelDialog<>(SwingCore.windowAncestor(Optional.ofNullable(parent).map(UiParent::swingOrMain).orElse(null)).orElse(SwingCore.mainFrame()), Dialog.ModalityType.DOCUMENT_MODAL, "Kunden editieren", ec);
dialog.setVisible(true);
boolean changed = false;
if (dialog.getCloseType() == CloseType.OK) {
Dl.remote().lookup(OldCustomerAgent.class).store(ec.getCustomer());
for (AddressChange addressChange : ec.getChangedAdresses()) {
if (JOptionPane.showOptionDialog(dialog, "Adresse wurde geändert, soll diese Änderung an allen Dokumenten des Kunden übernommen werden?", "Adressänderung", JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, null, null, null) == JOptionPane.YES_OPTION) {
Dl.remote().lookup(AddressService.class).notifyAddressChange(addressChange);
}
changed = true;
}
}
return changed;
}
Aggregations