Search in sources :

Example 1 with DocumentUpdateController

use of eu.ggnet.dwoss.redtapext.ui.cao.document.DocumentUpdateController in project dwoss by gg-net.

the class DossierCreateAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    Ui.exec(() -> {
        Dossier dos = Dl.remote().lookup(RedTapeWorker.class).create(customer.getId(), dispatch, Dl.local().lookup(Guardian.class).getUsername());
        // This is safe, as a create will return exactly one document.
        Document doc = dos.getDocuments().iterator().next();
        Addresses addresses = Dl.remote().lookup(RedTapeWorker.class).requestAdressesByCustomer(customer.getId());
        doc.setInvoiceAddress(addresses.getInvoice());
        doc.setShippingAddress(addresses.getShipping());
        Ui.exec(() -> {
            Ui.build().parent(controller.getView()).swing().eval(() -> {
                DocumentUpdateView docView = new DocumentUpdateView(doc);
                docView.setController(new DocumentUpdateController(docView, doc));
                docView.setCustomerValues(customer.getId());
                return OkCancelWrap.vetoResult(docView);
            }).opt().filter(r -> handleFailure(r, doc)).map(Reply::getPayload).ifPresent(this::handleSuccesses);
        });
    });
}
Also used : Addresses(eu.ggnet.dwoss.redtapext.ee.RedTapeWorker.Addresses) DocumentUpdateController(eu.ggnet.dwoss.redtapext.ui.cao.document.DocumentUpdateController) DocumentUpdateView(eu.ggnet.dwoss.redtapext.ui.cao.document.DocumentUpdateView) Dossier(eu.ggnet.dwoss.redtape.ee.entity.Dossier) RedTapeWorker(eu.ggnet.dwoss.redtapext.ee.RedTapeWorker) Document(eu.ggnet.dwoss.redtape.ee.entity.Document)

Example 2 with DocumentUpdateController

use of eu.ggnet.dwoss.redtapext.ui.cao.document.DocumentUpdateController in project dwoss by gg-net.

the class DocumentUpdateViewTryout method main.

public static void main(String[] args) {
    // Test different settings of booking accounts in ledgers and in positions
    // Test comment
    Dl.remote().add(CustomerService.class, new CustomerServiceStub());
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | UnsupportedLookAndFeelException e) {
    // If Nimbus is not available, you can set the GUI to another look and feel.
    }
    UiCore.startSwing(() -> {
        JLabel l = new JLabel("Main Application");
        l.setFont(new Font("DejaVu Sans", 0, 48));
        return l;
    });
    Dossier dos = new Dossier();
    dos.setPaymentMethod(PaymentMethod.DIRECT_DEBIT);
    final Document doc = new Document(DocumentType.ORDER, SEND_ORDER, new DocumentHistory("UnitTest", "Ein Kommentar"));
    dos.add(doc);
    Address address = new Address("Max Mustermann\nMusterstrass 11\n22222 Musterstadt");
    doc.setInvoiceAddress(address);
    doc.setShippingAddress(address);
    doc.setTaxType(GENERAL_SALES_TAX_DE_SINCE_2007);
    doc.append(Position.builder().type(UNIT).amount(1).description("Intel Core I7 i7-4500U (1.8 Ghz), Memory (in MB): 8192, Intel Graphics Series HD on Board, Festplatte(n): 750GB HDD," + " Display: 15.6\" (39,62 cm), Crystal Bright, HD (1366x768), 16:9, , Farbe: silber, Ausstattung: Touchscreen, USB 3, Bluetooth," + " Kartenleser, WLAN b + g + n, Webcam, Videokonnektor(en) : HDMI, VGA, Windows 8.1 64").name("Acer Aspire E1-572P-74508G75Dnii (NX.MFSED.003) SopoNr:123456 SN:NXMFSED00312312122EF001S").bookingAccount(L_1000_STD_UNIT).uniqueUnitId(1).uniqueUnitProductId(1).price(100).tax(doc.getSingleTax()).build());
    doc.append(Position.builder().type(UNIT).amount(1).description("Intel Core I7 i7-4500U (1.8 Ghz), Memory (in MB): 8192, Intel Graphics Series HD on Board, Festplatte(n): 750GB HDD," + " Display: 15.6\" (39,62 cm), Crystal Bright, HD (1366x768), 16:9, , Farbe: silber, Ausstattung: Touchscreen, USB 3, Bluetooth," + " Kartenleser, WLAN b + g + n, Webcam, Videokonnektor(en) : HDMI, VGA, Windows 8.1 64").name("Acer Aspire E1-572P-74508G75Dnii (NX.MFSED.003) SopoNr:12345 SN:NXMFSED00312312122EF001S").bookingAccount(L_1000_STD_UNIT).uniqueUnitId(2).uniqueUnitProductId(2).price(100).tax(doc.getSingleTax()).build());
    doc.append(Position.builder().type(UNIT).amount(1).description("Intel Core I7 i7-4500U (1.8 Ghz), Memory (in MB): 8192, Intel Graphics Series HD on Board, Festplatte(n): 750GB HDD," + " Display: 15.6\" (39,62 cm), Crystal Bright, HD (1366x768), 16:9, , Farbe: silber, Ausstattung: Touchscreen, USB 3, Bluetooth," + " Kartenleser, WLAN b + g + n, Webcam, Videokonnektor(en) : HDMI, VGA, Windows 8.1 64").name("Acer Aspire E1-572P-74508G75Dnii (NX.MFSED.003) SopoNr:1234 SN:NXMFSED00312312122EF001S").bookingAccount(L_1000_STD_UNIT).price(100).uniqueUnitId(3).uniqueUnitProductId(3).tax(0.07).build());
    doc.append(Position.builder().type(SERVICE).amount(1).description("Intel Core I7 i7-4500U (1.8 Ghz), Memory (in MB): 8192, Intel Graphics Series HD on Board, Festplatte(n): 750GB HDD," + " Display: 15.6\" (39,62 cm), Crystal Bright, HD (1366x768), 16:9, , Farbe: silber, Ausstattung: Touchscreen, USB 3, Bluetooth," + " Kartenleser, WLAN b + g + n, Webcam, Videokonnektor(en) : HDMI, VGA, Windows 8.1 64").name("Service Acer Aspire E1-572P-74508G75Dnii").price(100).bookingAccount(L_1001_HW_SW_STORE).tax(0).build());
    doc.append(Position.builder().type(SHIPPING_COST).amount(1).description("Versandkosten").name("Versandkosten").price(10).bookingAccount(L_1002_VERSANDKOSTEN).tax(doc.getSingleTax()).build());
    Dl.remote().add(Mandators.class, new Mandators() {

        @Override
        public PostLedger loadPostLedger() {
            return new PostLedger(PostLedger.add().positionTypes(UNIT).taxTypes(GENERAL_SALES_TAX_DE_SINCE_2007).primaryLedger(L_1000_STD_UNIT), PostLedger.add().positionTypes(UNIT).taxTypes(UNTAXED).primaryLedger(2001, "Geräte ohne Ust."), PostLedger.add().positionTypes(UNIT, SERVICE, PRODUCT_BATCH, SHIPPING_COST, UNIT_ANNEX).taxTypes(REVERSE_CHARGE).primaryLedger(3000, "Reverse Charge"), PostLedger.add().positionTypes(SERVICE).taxTypes(GENERAL_SALES_TAX_DE_SINCE_2007).primaryLedger(2002, "Dienstleistung Store").alternativeLedger(L_1000_STD_UNIT).alternativeLedger(L_1002_VERSANDKOSTEN).alternativeLedger(L_1001_HW_SW_STORE), PostLedger.add().positionTypes(PRODUCT_BATCH).taxTypes(GENERAL_SALES_TAX_DE_SINCE_2007).primaryLedger(L_1001_HW_SW_STORE), PostLedger.add().positionTypes(SHIPPING_COST).taxTypes(GENERAL_SALES_TAX_DE_SINCE_2007).primaryLedger(L_1002_VERSANDKOSTEN));
        }

        @Override
        public DefaultCustomerSalesdata loadSalesdata() {
            return new DefaultCustomerSalesdata(ShippingCondition.DEFAULT, PaymentCondition.CUSTOMER, PaymentMethod.DIRECT_DEBIT, null, null);
        }

        // <editor-fold defaultstate="collapsed" desc="Unused Methods">
        @Override
        public ShippingTerms loadShippingTerms() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Mandator loadMandator() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public ReceiptCustomers loadReceiptCustomers() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public SpecialSystemCustomers loadSystemCustomers() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public Contractors loadContractors() {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }
    });
    Dl.remote().add(RedTapeWorker.class, new RedTapeWorkerStub());
    Dl.remote().add(RedTapeAgent.class, null);
    Dl.remote().add(UnitOverseer.class, null);
    Dl.local().add(Guardian.class, new AbstractGuardian() {

        {
            setRights(new Operator("All Rights", 1, Arrays.asList(AtomicRight.values())));
        }

        @Override
        public void login(String user, char[] pass) throws AuthenticationException {
        }
    });
    DocumentUpdateView view = new DocumentUpdateView(doc);
    DocumentUpdateController controller = new DocumentUpdateController(view, doc);
    view.setController(controller);
    view.setCustomerValues(1);
    Ui.exec(() -> {
        Ui.build().title("Dokument bearbeiten").swing().eval(() -> OkCancelWrap.vetoResult(view)).opt().ifPresent(System.out::println);
    });
}
Also used : Operator(eu.ggnet.dwoss.rights.api.Operator) AuthenticationException(eu.ggnet.saft.core.auth.AuthenticationException) Font(java.awt.Font) LookAndFeelInfo(javax.swing.UIManager.LookAndFeelInfo) CustomerServiceStub(tryout.stub.CustomerServiceStub) RedTapeWorkerStub(tryout.stub.RedTapeWorkerStub) AbstractGuardian(eu.ggnet.dwoss.common.AbstractGuardian) DocumentUpdateController(eu.ggnet.dwoss.redtapext.ui.cao.document.DocumentUpdateController) DocumentUpdateView(eu.ggnet.dwoss.redtapext.ui.cao.document.DocumentUpdateView) Mandators(eu.ggnet.dwoss.mandator.Mandators)

Example 3 with DocumentUpdateController

use of eu.ggnet.dwoss.redtapext.ui.cao.document.DocumentUpdateController in project dwoss by gg-net.

the class DossierUpdateAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    if (doc.getDossier().getId() == 0) {
        Ui.build(parent).title("Fehler").alert().message("Sopo Aufträge können nicht bearbeitet werden.").show(ERROR);
        return;
    }
    Ui.exec(() -> {
        Ui.build().parent(parent).swing().eval(() -> {
            DocumentUpdateView view = new DocumentUpdateView(doc);
            DocumentUpdateController controller = new DocumentUpdateController(view, doc);
            view.setController(controller);
            view.setCustomerValues(id);
            return OkCancelWrap.vetoResult(view);
        }).opt().filter(this::handleFailure).map(Reply::getPayload).ifPresent(this::handleSuccess);
    });
}
Also used : DocumentUpdateController(eu.ggnet.dwoss.redtapext.ui.cao.document.DocumentUpdateController) DocumentUpdateView(eu.ggnet.dwoss.redtapext.ui.cao.document.DocumentUpdateView)

Aggregations

DocumentUpdateController (eu.ggnet.dwoss.redtapext.ui.cao.document.DocumentUpdateController)3 DocumentUpdateView (eu.ggnet.dwoss.redtapext.ui.cao.document.DocumentUpdateView)3 AbstractGuardian (eu.ggnet.dwoss.common.AbstractGuardian)1 Mandators (eu.ggnet.dwoss.mandator.Mandators)1 Document (eu.ggnet.dwoss.redtape.ee.entity.Document)1 Dossier (eu.ggnet.dwoss.redtape.ee.entity.Dossier)1 RedTapeWorker (eu.ggnet.dwoss.redtapext.ee.RedTapeWorker)1 Addresses (eu.ggnet.dwoss.redtapext.ee.RedTapeWorker.Addresses)1 Operator (eu.ggnet.dwoss.rights.api.Operator)1 AuthenticationException (eu.ggnet.saft.core.auth.AuthenticationException)1 Font (java.awt.Font)1 LookAndFeelInfo (javax.swing.UIManager.LookAndFeelInfo)1 CustomerServiceStub (tryout.stub.CustomerServiceStub)1 RedTapeWorkerStub (tryout.stub.RedTapeWorkerStub)1