Search in sources :

Example 1 with CustomerGenerator

use of eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator in project dwoss by gg-net.

the class CustomerHtmlTryout method start.

@Override
public void start(Stage primaryStage) throws Exception {
    CustomerGenerator gen = new CustomerGenerator();
    Customer c1 = gen.makeOldCustomer();
    Customer c2 = gen.makeCustomer();
    DefaultCustomerSalesdata defaults = DefaultCustomerSalesdata.builder().allowedSalesChannels(EnumSet.of(SalesChannel.CUSTOMER)).paymentCondition(PaymentCondition.CUSTOMER).shippingCondition(ShippingCondition.DEALER_ONE).paymentMethod(PaymentMethod.DIRECT_DEBIT).build();
    String MATCHCODE = c1.getMandatorMetadata().stream().map(MandatorMetadata::getMandatorMatchcode).findFirst().orElse("NONE");
    OldCustomer c0 = ConverterUtil.convert(c1, MATCHCODE, defaults);
    WebView view = new WebView();
    view.getEngine().loadContent(Css.toHtml5WithStyle("<h1>OldCustomer.toHtml()</h1>" + c0.toHtmlHighDetailed() + "<hr /><h1>makeOldCustmer : Customer.toHtml(MATCHCODE,defaults)</h1>" + c1.toHtml(MATCHCODE, defaults) + "<hr /><h1>makeOldCustmer : Customer.toHtml()</h1>" + c1.toHtml() + "<hr /><h1>makeCustmer : Customer.toHtml()</h1>" + c2.toHtml()));
    primaryStage.setScene(new Scene(new BorderPane(view)));
    primaryStage.sizeToScene();
    primaryStage.show();
}
Also used : BorderPane(javafx.scene.layout.BorderPane) OldCustomer(eu.ggnet.dwoss.customer.ee.priv.OldCustomer) Customer(eu.ggnet.dwoss.customer.ee.entity.Customer) OldCustomer(eu.ggnet.dwoss.customer.ee.priv.OldCustomer) MandatorMetadata(eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata) DefaultCustomerSalesdata(eu.ggnet.dwoss.mandator.api.value.DefaultCustomerSalesdata) CustomerGenerator(eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator) WebView(javafx.scene.web.WebView) Scene(javafx.scene.Scene)

Example 2 with CustomerGenerator

use of eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator in project dwoss by gg-net.

the class CompanyUpdateTryOut method main.

// CustomerComapnyController
public static void main(String[] args) {
    CustomerGenerator gen = new CustomerGenerator();
    Company company = gen.makeCompany();
    company.setTaxId("Steuernummer");
    gen.makeAddresses(5).forEach(a -> company.getAddresses().add(a));
    gen.makeContacts(6).forEach(c -> company.getContacts().add(c));
    company.getCommunications().add(gen.makeCommunication());
    company.getCommunications().add(gen.makeCommunication());
    company.getCommunications().add(gen.makeCommunication());
    company.getCommunications().add(gen.makeCommunication());
    company.getCommunications().get(new Random().nextInt(company.getCommunications().size() - 1)).setPrefered(true);
    JButton close = new JButton("Schliessen");
    close.addActionListener(e -> Ui.closeWindowOf(close));
    JButton editButton = new JButton("edit");
    editButton.addActionListener(ev -> {
        Ui.exec(() -> {
            Ui.build().fxml().eval(() -> company, CompanyUpdateController.class).opt().ifPresent(System.out::println);
        });
    });
    JButton addButton = new JButton("add");
    addButton.addActionListener(ev -> {
        Ui.exec(() -> {
            Ui.build().fxml().eval(() -> new Company(), CompanyUpdateController.class).opt().ifPresent(System.out::println);
        });
    });
    JPanel p = new JPanel();
    p.add(editButton);
    p.add(addButton);
    p.add(close);
    UiCore.startSwing(() -> p);
}
Also used : JPanel(javax.swing.JPanel) Company(eu.ggnet.dwoss.customer.ee.entity.Company) Random(java.util.Random) JButton(javax.swing.JButton) CustomerGenerator(eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator)

Example 3 with CustomerGenerator

use of eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator in project dwoss by gg-net.

the class ContactUpdateTryout method main.

public static void main(String[] args) {
    CustomerGenerator gen = new CustomerGenerator();
    Contact contact = gen.makeContact();
    contact.setTitle("Dr.");
    contact.getAddresses().add(gen.makeAddress());
    contact.getAddresses().add(gen.makeAddress());
    contact.getAddresses().add(gen.makeAddress());
    contact.getCommunications().add(gen.makeCommunication());
    contact.getCommunications().add(gen.makeCommunication());
    contact.getCommunications().add(gen.makeCommunication());
    JButton close = new JButton("Schliessen");
    close.addActionListener(e -> Ui.closeWindowOf(close));
    JButton editButton = new JButton("edit");
    editButton.addActionListener(ev -> {
        Ui.exec(() -> {
            Ui.build().fxml().eval(() -> contact, ContactUpdateController.class).opt().ifPresent(System.out::println);
        });
    });
    JButton addButton = new JButton("add");
    addButton.addActionListener(ev -> {
        Ui.exec(() -> {
            Ui.build().fxml().eval(() -> new Contact(), ContactUpdateController.class).opt().ifPresent(System.out::println);
        });
    });
    JPanel p = new JPanel();
    p.add(editButton);
    p.add(addButton);
    p.add(close);
    UiCore.startSwing(() -> p);
}
Also used : JPanel(javax.swing.JPanel) JButton(javax.swing.JButton) CustomerGenerator(eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator) Contact(eu.ggnet.dwoss.customer.ee.entity.Contact)

Example 4 with CustomerGenerator

use of eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator in project dwoss by gg-net.

the class PreferedAddressLabelsTryOut method main.

public static void main(String[] args) {
    CustomerGenerator gen = new CustomerGenerator();
    JButton close = new JButton("Schliessen");
    close.addActionListener(e -> Ui.closeWindowOf(close));
    JButton firmenKundenButton = new JButton("Lade FirmenKunde");
    firmenKundenButton.addActionListener(ev -> {
        Customer customer = gen.makeCustomer();
        customer.getContacts().clear();
        customer.getCompanies().add(gen.makeCompany());
        customer.getCompanies().add(gen.makeCompany());
        if (!customer.isValid()) {
            Ui.exec(() -> {
                Ui.build().alert("customer is invalid" + customer.getViolationMessage());
            });
            return;
        }
        Ui.exec(() -> {
            Ui.build().fxml().eval(() -> customer, PreferedAddressLabelsController.class);
        });
    });
    JButton endKundenButton = new JButton("Lade Endkunde");
    endKundenButton.addActionListener(ev -> {
        Customer customer = gen.makeCustomer();
        customer.getCompanies().clear();
        customer.getContacts().add(gen.makeContact());
        customer.getContacts().add(gen.makeContact());
        if (!customer.isValid()) {
            Ui.exec(() -> {
                Ui.build().alert("customer is invalid" + customer.getViolationMessage());
            });
            return;
        }
        Ui.exec(() -> {
            Ui.build().fxml().eval(() -> customer, PreferedAddressLabelsController.class);
        });
    });
    JPanel p = new JPanel();
    p.add(firmenKundenButton);
    p.add(endKundenButton);
    p.add(close);
    UiCore.startSwing(() -> p);
}
Also used : JPanel(javax.swing.JPanel) Customer(eu.ggnet.dwoss.customer.ee.entity.Customer) JButton(javax.swing.JButton) CustomerGenerator(eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator)

Example 5 with CustomerGenerator

use of eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator in project dwoss by gg-net.

the class MandatorMetaDataController method initialize.

@Override
public void initialize(URL location, ResourceBundle resources) {
    CustomerGenerator gen = new CustomerGenerator();
    MandatorMetadata m = gen.makeMandatorMetadata();
    defaultCustomerSalesdata = new DefaultCustomerSalesdata(m.getShippingCondition(), m.getPaymentCondition(), m.getPaymentMethod(), m.getAllowedSalesChannels(), new ArrayList(m.getAllowedSalesChannels()));
    this.setDefaultValues(defaultCustomerSalesdata);
    saveButton.setDisable(true);
    shippingConditionComboBox.getItems().setAll(ShippingCondition.values());
    paymentConditionComboBox.getItems().setAll(PaymentCondition.values());
    paymentMethodComboBox.getItems().setAll(PaymentMethod.values());
    shippingConditionComboBox.setConverter(new StringConverter<ShippingCondition>() {

        @Override
        public ShippingCondition fromString(String string) {
            throw new UnsupportedOperationException("fromString is not supported");
        }

        @Override
        public String toString(ShippingCondition myClassinstance) {
            return myClassinstance.toString();
        }
    });
    paymentConditionComboBox.setConverter(new StringConverter<PaymentCondition>() {

        @Override
        public PaymentCondition fromString(String string) {
            throw new UnsupportedOperationException("fromString is not supported");
        }

        @Override
        public String toString(PaymentCondition myClassinstance) {
            return myClassinstance.getNote();
        }
    });
    paymentMethodComboBox.setConverter(new StringConverter<PaymentMethod>() {

        @Override
        public PaymentMethod fromString(String string) {
            throw new UnsupportedOperationException("fromString is not supported");
        }

        @Override
        public String toString(PaymentMethod myClassinstance) {
            return myClassinstance.getNote();
        }
    });
    paymentConditionComboBox.setCellFactory(new Callback<ListView<PaymentCondition>, ListCell<PaymentCondition>>() {

        @Override
        public ListCell<PaymentCondition> call(ListView<PaymentCondition> l) {
            return new ListCell<PaymentCondition>() {

                @Override
                public String toString() {
                    return this.toString();
                }

                @Override
                protected void updateItem(PaymentCondition item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item == null || empty) {
                        setGraphic(null);
                    } else {
                        setText(item.getNote());
                    }
                }
            };
        }
    });
    paymentMethodComboBox.setCellFactory((ListView<PaymentMethod> l) -> new ListCell<PaymentMethod>() {

        @Override
        protected void updateItem(PaymentMethod item, boolean empty) {
            super.updateItem(item, empty);
            if (item == null || empty) {
                setGraphic(null);
            } else {
                setText(item.getNote());
            }
        }
    });
    InvalidationListener saveButtonDisablingListener = new InvalidationListener() {

        @Override
        public void invalidated(javafx.beans.Observable observable) {
            if (shippingConditionComboBox.getSelectionModel().isEmpty() && paymentConditionComboBox.getSelectionModel().isEmpty() && paymentMethodComboBox.getSelectionModel().isEmpty() && allowedSalesChannelCheckBoxList.stream().noneMatch(CheckBox::isSelected))
                saveButton.setDisable(true);
            else
                saveButton.setDisable(false);
        }
    };
    shippingConditionComboBox.getSelectionModel().selectedItemProperty().addListener(saveButtonDisablingListener);
    paymentConditionComboBox.getSelectionModel().selectedItemProperty().addListener(saveButtonDisablingListener);
    paymentMethodComboBox.getSelectionModel().selectedItemProperty().addListener(saveButtonDisablingListener);
    allowedSalesChannelCheckBoxList.forEach(e -> e.selectedProperty().addListener(saveButtonDisablingListener));
}
Also used : MandatorMetadata(eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata) DefaultCustomerSalesdata(eu.ggnet.dwoss.mandator.api.value.DefaultCustomerSalesdata) CustomerGenerator(eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator) InvalidationListener(javafx.beans.InvalidationListener)

Aggregations

CustomerGenerator (eu.ggnet.dwoss.customer.ee.assist.gen.CustomerGenerator)9 JButton (javax.swing.JButton)5 JPanel (javax.swing.JPanel)5 Customer (eu.ggnet.dwoss.customer.ee.entity.Customer)3 MandatorMetadata (eu.ggnet.dwoss.customer.ee.entity.MandatorMetadata)3 DefaultCustomerSalesdata (eu.ggnet.dwoss.mandator.api.value.DefaultCustomerSalesdata)2 Address (eu.ggnet.dwoss.customer.ee.entity.Address)1 Company (eu.ggnet.dwoss.customer.ee.entity.Company)1 Contact (eu.ggnet.dwoss.customer.ee.entity.Contact)1 AddressLabel (eu.ggnet.dwoss.customer.ee.entity.projection.AddressLabel)1 OldCustomer (eu.ggnet.dwoss.customer.ee.priv.OldCustomer)1 FileJacket (eu.ggnet.dwoss.util.FileJacket)1 Random (java.util.Random)1 InvalidationListener (javafx.beans.InvalidationListener)1 Scene (javafx.scene.Scene)1 BorderPane (javafx.scene.layout.BorderPane)1 WebView (javafx.scene.web.WebView)1