Search in sources :

Example 6 with OkCancelDialog

use of eu.ggnet.dwoss.util.OkCancelDialog in project dwoss by gg-net.

the class BasicViewTryout method main.

public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    BasicSpec basic = new BasicSpec();
    basic.setPartNo("ABX");
    basic.setColor(Color.RED);
    basic.setComment("Der große Kommentar");
    basic.setExtras(EnumSet.of(Extra.BLUETOOTH, Extra.CARD_READER));
    basic.setVideoPorts(EnumSet.of(VideoPort.HDMI, VideoPort.VGA));
    BasicView view = new BasicView();
    view.setSpec(basic);
    OkCancelDialog<BasicView> dialog = new OkCancelDialog<>("", view);
    dialog.setVisible(true);
    if (dialog.getCloseType() == CloseType.OK) {
        System.out.println(view.getSpec());
        System.out.println(view.getGtin());
    }
    Thread.sleep(1221);
    System.exit(0);
}
Also used : BasicSpec(eu.ggnet.dwoss.spec.ee.entity.BasicSpec) OkCancelDialog(eu.ggnet.dwoss.util.OkCancelDialog)

Example 7 with OkCancelDialog

use of eu.ggnet.dwoss.util.OkCancelDialog in project dwoss by gg-net.

the class DesktopBundleViewTryout method tryoutView.

@Test
public void tryoutView() throws InterruptedException {
    final ProductSpec spec = new SpecGenerator().makeSpec();
    DesktopBundleView view = new DesktopBundleView(new Mandators() {

        @Override
        public Mandator loadMandator() {
            return Mandator.builder().defaultMailSignature(null).smtpConfiguration(null).mailTemplateLocation(null).company(CompanyGen.makeCompany()).dossierPrefix("DW").documentIntermix(null).documentIdentifierGeneratorConfigurations(new EnumMap<>(DocumentType.class)).build();
        }

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

        @Override
        public ReceiptCustomers loadReceiptCustomers() {
            return ReceiptCustomers.builder().build();
        }

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

        @Override
        public Contractors loadContractors() {
            return new Contractors(EnumSet.of(TradeName.ALSO, TradeName.ACER), EnumSet.of(TradeName.ACER));
        }

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

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

        @Override
        public ProductSpec findProductSpecByPartNoEager(String partNo) {
            if (partNo == null)
                return null;
            if (partNo.startsWith("X"))
                return null;
            spec.setPartNo(partNo);
            return spec;
        }

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

        @Override
        public <T> List<T> findAll(Class<T> entityClass) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAll(Class<T> entityClass, int start, int amount) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAllEager(Class<T> entityClass) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> List<T> findAllEager(Class<T> entityClass, int start, int amount) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findById(Class<T> entityClass, Object id) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findById(Class<T> entityClass, Object id, LockModeType lockModeType) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findByIdEager(Class<T> entityClass, Object id) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }

        @Override
        public <T> T findByIdEager(Class<T> entityClass, Object id, LockModeType lockModeType) {
            // To change body of generated methods, choose Tools | Templates.
            throw new UnsupportedOperationException("Not supported yet.");
        }
    }, new ProductProcessorStub(), TradeName.ACER, TradeName.ACER, ProductGroup.DESKTOP, ProductGroup.MONITOR);
    view.setSpec(new DesktopBundle());
    OkCancelDialog<DesktopBundleView> dialog = new OkCancelDialog<>("BundleView", view);
    dialog.setVisible(true);
    dialog.dispose();
}
Also used : ProductProcessorStub(eu.ggnet.dwoss.receipt.stub.ProductProcessorStub) SpecAgent(eu.ggnet.dwoss.spec.ee.SpecAgent) SpecGenerator(eu.ggnet.dwoss.spec.ee.assist.gen.SpecGenerator) OkCancelDialog(eu.ggnet.dwoss.util.OkCancelDialog) ProductSpec(eu.ggnet.dwoss.spec.ee.entity.ProductSpec) DesktopBundle(eu.ggnet.dwoss.spec.ee.entity.DesktopBundle) DesktopBundleView(eu.ggnet.dwoss.receipt.product.DesktopBundleView) Mandators(eu.ggnet.dwoss.mandator.Mandators) LockModeType(javax.persistence.LockModeType) Test(org.junit.Test)

Example 8 with OkCancelDialog

use of eu.ggnet.dwoss.util.OkCancelDialog in project dwoss by gg-net.

the class AnnulationInvoiceAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    Calendar release = Calendar.getInstance();
    release.setTime(doc.getHistory().getRelease());
    Calendar beforeOneYear = Calendar.getInstance();
    beforeOneYear.set(Calendar.YEAR, Calendar.getInstance().get(Calendar.YEAR) - 1);
    if (beforeOneYear.after(release) && JOptionPane.CANCEL_OPTION == JOptionPane.showConfirmDialog(parent, "Der Vorgang ist über ein Jahr alt und die Garantie ist abgelaufen!\nMöchten sie fortfahren?", "Garantie Warnung", JOptionPane.OK_CANCEL_OPTION)) {
        return;
    }
    List<AfterInvoicePosition> creditPositions = new ArrayList<>();
    for (Position position : doc.getPositions().values()) {
        if (position.getType() != PositionType.COMMENT)
            creditPositions.add(new AfterInvoicePosition(position));
    }
    CreditMemoView view = new CreditMemoView(creditPositions);
    OkCancelDialog<CreditMemoView> dialog = new OkCancelDialog<>(getValue(Action.NAME).toString(), view);
    dialog.setLocationRelativeTo(parent);
    dialog.setVisible(true);
    if (dialog.getCloseType() == CloseType.OK) {
        doc.removeAllPositions();
        for (Position position : view.getPositions()) {
            position.setPrice(position.getPrice() * (-1));
            doc.append(position);
        }
        doc.setType(DocumentType.ANNULATION_INVOICE);
        doc.setDirective(Directive.BALANCE_REPAYMENT);
        Document d = Dl.remote().lookup(RedTapeWorker.class).update(doc, view.getStockLocation(), Dl.local().lookup(Guardian.class).getUsername());
        controller.reloadSelectionOnStateChange(d.getDossier());
    }
}
Also used : AfterInvoicePosition(eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition) Position(eu.ggnet.dwoss.redtape.ee.entity.Position) AfterInvoicePosition(eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition) OkCancelDialog(eu.ggnet.dwoss.util.OkCancelDialog) RedTapeWorker(eu.ggnet.dwoss.redtapext.ee.RedTapeWorker) Document(eu.ggnet.dwoss.redtape.ee.entity.Document) CreditMemoView(eu.ggnet.dwoss.redtapext.ui.cao.document.annulation.CreditMemoView)

Example 9 with OkCancelDialog

use of eu.ggnet.dwoss.util.OkCancelDialog in project dwoss by gg-net.

the class ComplaintAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    Calendar release = Calendar.getInstance();
    release.setTime(doc.getHistory().getRelease());
    Calendar beforeOneYear = Calendar.getInstance();
    beforeOneYear.set(Calendar.YEAR, Calendar.getInstance().get(Calendar.YEAR) - 1);
    if (beforeOneYear.after(release) && JOptionPane.CANCEL_OPTION == JOptionPane.showConfirmDialog(parent, "Der Vorgang ist über ein Jahr alt und die Garantie ist abgelaufen!\nMöchten sie fortfahren?", "Garantie Warnung", JOptionPane.OK_CANCEL_OPTION)) {
        return;
    }
    List<AfterInvoicePosition> creditPositions = new ArrayList<>();
    for (Position position : doc.getPositions().values()) {
        if (position.getType() != PositionType.COMMENT) {
            AfterInvoicePosition aiPosition = new AfterInvoicePosition(position);
            if (doc.getDossier().isDispatch() && position.getType() == PositionType.SHIPPING_COST)
                aiPosition.setParticipate(true);
            creditPositions.add(aiPosition);
        }
    }
    ComplaintView view = new ComplaintView(creditPositions);
    OkCancelDialog<ComplaintView> dialog = new OkCancelDialog<>("Reklamation anmelden", view);
    dialog.setLocationRelativeTo(parent);
    dialog.setVisible(true);
    if (dialog.getCloseType() == CloseType.OK) {
        doc.removeAllPositions();
        for (Position position : view.getPositions()) {
            doc.append(position);
        }
        doc.setType(DocumentType.COMPLAINT);
        doc.setDirective(Directive.WAIT_FOR_COMPLAINT_COMPLETION);
        Document d = Dl.remote().lookup(RedTapeWorker.class).update(doc, null, Dl.local().lookup(Guardian.class).getUsername());
        controller.reloadSelectionOnStateChange(d.getDossier());
    }
}
Also used : AfterInvoicePosition(eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition) ComplaintView(eu.ggnet.dwoss.redtapext.ui.cao.document.annulation.ComplaintView) Position(eu.ggnet.dwoss.redtape.ee.entity.Position) AfterInvoicePosition(eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition) OkCancelDialog(eu.ggnet.dwoss.util.OkCancelDialog) RedTapeWorker(eu.ggnet.dwoss.redtapext.ee.RedTapeWorker) Document(eu.ggnet.dwoss.redtape.ee.entity.Document)

Example 10 with OkCancelDialog

use of eu.ggnet.dwoss.util.OkCancelDialog in project dwoss by gg-net.

the class MonitorView method main.

// End of variables declaration//GEN-END:variables
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    ProductProcessorStub stub = new ProductProcessorStub();
    MonitorView view = new MonitorView();
    view.setSpec(stub.monitor);
    OkCancelDialog<MonitorView> create = new OkCancelDialog("Display Details", view);
    create.setVisible(true);
    System.out.println(create.getSubContainer().getSpec());
    System.exit(0);
}
Also used : OkCancelDialog(eu.ggnet.dwoss.util.OkCancelDialog) ProductProcessorStub(eu.ggnet.dwoss.receipt.stub.ProductProcessorStub)

Aggregations

OkCancelDialog (eu.ggnet.dwoss.util.OkCancelDialog)20 ProductProcessorStub (eu.ggnet.dwoss.receipt.stub.ProductProcessorStub)6 Position (eu.ggnet.dwoss.redtape.ee.entity.Position)5 Document (eu.ggnet.dwoss.redtape.ee.entity.Document)4 AfterInvoicePosition (eu.ggnet.dwoss.redtapext.ui.cao.document.AfterInvoicePosition)4 RedTapeWorker (eu.ggnet.dwoss.redtapext.ee.RedTapeWorker)3 CreditMemoView (eu.ggnet.dwoss.redtapext.ui.cao.document.annulation.CreditMemoView)3 OldCustomer (eu.ggnet.dwoss.customer.ee.priv.OldCustomer)2 OldCustomerAgent (eu.ggnet.dwoss.customer.ee.priv.OldCustomerAgent)2 Mandators (eu.ggnet.dwoss.mandator.Mandators)2 SalesProduct (eu.ggnet.dwoss.redtape.ee.entity.SalesProduct)2 SpecAgent (eu.ggnet.dwoss.spec.ee.SpecAgent)2 ProductSpec (eu.ggnet.dwoss.spec.ee.entity.ProductSpec)2 ArrayList (java.util.ArrayList)2 AbstractGuardian (eu.ggnet.dwoss.common.AbstractGuardian)1 AddressService (eu.ggnet.dwoss.customer.opi.AddressService)1 CustomerMetaData (eu.ggnet.dwoss.customer.opi.CustomerMetaData)1 CustomerService (eu.ggnet.dwoss.customer.opi.CustomerService)1 UiCustomer (eu.ggnet.dwoss.customer.opi.UiCustomer)1 CustomerCreateWithSearchController (eu.ggnet.dwoss.customer.ui.old.CustomerCreateWithSearchController)1