use of tryout.stub.CustomerAgentStub in project dwoss by gg-net.
the class CustomerSearchTryout method main.
public static void main(String[] args) {
// stub for the new Costumer modell with generator needed
Dl.remote().add(CustomerAgent.class, new CustomerAgentStub());
JButton close = new JButton("Schliessen");
close.addActionListener(e -> Ui.closeWindowOf(close));
JButton run = new JButton("OpenUi");
run.addActionListener(ev -> {
Ui.exec(() -> {
Ui.build().fxml().show(CustomerSearchController.class);
});
});
JPanel p = new JPanel();
p.add(run);
p.add(close);
UiCore.startSwing(() -> p);
}
use of tryout.stub.CustomerAgentStub in project dwoss by gg-net.
the class CustomerSimpleTryout method main.
public static void main(String[] args) {
// stub for the new Costumer modell with generator needed
Dl.remote().add(CustomerAgent.class, new CustomerAgentStub());
JButton close = new JButton("Schliessen");
close.addActionListener(e -> Ui.closeWindowOf(close));
JButton consumerCustomerButton = new JButton("Consumer Customer");
consumerCustomerButton.addActionListener(ev -> {
Customer consumerCustomer = makeValidCustomer();
System.out.println("IS simple: " + consumerCustomer.getSimpleViolationMessage());
System.out.println("Consumer Customer: " + consumerCustomer.isConsumer());
Ui.exec(() -> {
Optional<CustomerContinue> result = Ui.build().parent(consumerCustomerButton).fxml().eval(() -> consumerCustomer, CustomerSimpleController.class).opt();
if (!result.isPresent())
return;
Reply<Customer> reply = Dl.remote().lookup(CustomerAgent.class).store(result.get().simpleCustomer);
if (!Ui.failure().handle(reply))
return;
if (!result.get().continueEnhance)
return;
Ui.build().fxml().eval(() -> reply.getPayload(), CustomerEnhanceController.class).opt().ifPresent(c -> Ui.build().alert("Would store + " + c));
});
});
JButton bussinesCustomer = new JButton("Bussines Customer");
bussinesCustomer.addActionListener(ev -> {
Customer bussnisCustomer = makeValidCustomer();
Contact tempcon = bussnisCustomer.getContacts().get(0);
Company company = gen.makeCompany();
company.getContacts().clear();
company.getContacts().add(tempcon);
company.getCommunications().clear();
bussnisCustomer.getContacts().clear();
bussnisCustomer.getCompanies().add(company);
System.out.println("IS simple: " + bussnisCustomer.getSimpleViolationMessage());
System.out.println("Bussines Customer: " + bussnisCustomer.isBusiness());
Ui.exec(() -> {
Optional<CustomerContinue> result = Ui.build().parent(consumerCustomerButton).fxml().eval(() -> bussnisCustomer, CustomerSimpleController.class).opt();
if (!result.isPresent())
return;
Reply<Customer> reply = Dl.remote().lookup(CustomerAgent.class).store(result.get().simpleCustomer);
if (!Ui.failure().handle(reply))
return;
if (!result.get().continueEnhance)
return;
Ui.build().fxml().eval(() -> reply.getPayload(), CustomerEnhanceController.class).opt().ifPresent(c -> Ui.build().alert("Would store + " + c));
});
});
JButton nullCustomer = new JButton(" Create SimpleCustomer");
nullCustomer.addActionListener(ev -> {
Ui.exec(() -> {
Optional<CustomerContinue> result = Ui.build().parent(consumerCustomerButton).fxml().eval(CustomerSimpleController.class).opt();
if (!result.isPresent())
return;
Reply<Customer> reply = Dl.remote().lookup(CustomerAgent.class).store(result.get().simpleCustomer);
if (!Ui.failure().handle(reply))
return;
if (!result.get().continueEnhance)
return;
Ui.build().fxml().eval(() -> reply.getPayload(), CustomerEnhanceController.class).opt().ifPresent(c -> Ui.build().alert("Would store + " + c));
});
});
JPanel p = new JPanel();
p.add(consumerCustomerButton);
p.add(bussinesCustomer);
p.add(nullCustomer);
p.add(close);
UiCore.startSwing(() -> p);
}
Aggregations