use of datamodel.ex1.entity.Customer in project jmix-docs by jmix-framework.
the class OrderService method saveAndReturnNothing.
// end::save-context[]
// tag::save-discard[]
void saveAndReturnNothing(List<Customer> entities) {
SaveContext saveContext = new SaveContext().setDiscardSaved(true);
for (Customer entity : entities) {
saveContext.saving(entity);
}
dataManager.save(saveContext);
}
use of datamodel.ex1.entity.Customer in project jmix-docs by jmix-framework.
the class CustomerEventListener method onCustomerSaving.
@EventListener
void onCustomerSaving(EntitySavingEvent<Customer> event) {
Customer customer = event.getEntity();
String encrypted = encryptionService.encrypt(customer.getSensitiveData());
customer.setEncryptedData(encrypted);
}
use of datamodel.ex1.entity.Customer in project jmix-docs by jmix-framework.
the class ActionScreen method onCustomersTableEdit.
// end::edit-action-performed-event[]
// tag::edit-action-performed-event-2[]
@Subscribe("customersTable.edit")
public void onCustomersTableEdit(Action.ActionPerformedEvent event) {
screenBuilders.editor(customersTable).withOpenMode(OpenMode.DIALOG).withScreenClass(CustomerEdit.class).withAfterCloseListener(afterScreenCloseEvent -> {
if (afterScreenCloseEvent.closedWith(StandardOutcome.COMMIT)) {
Customer committedCustomer = (afterScreenCloseEvent.getSource()).getEditedEntity();
System.out.println("Updated " + committedCustomer);
}
}).build().show();
}
use of datamodel.ex1.entity.Customer in project jmix-docs by jmix-framework.
the class ActionScreen method onCustTableView.
// end::view-after-close-handler[]
// tag::view-action-performed-event[]
@Subscribe("custTable.view")
public void onCustTableView(Action.ActionPerformedEvent event) {
CustomerEdit customerEdit = screenBuilders.editor(custTable).withOpenMode(OpenMode.DIALOG).withScreenClass(CustomerEdit.class).withAfterCloseListener(afterScreenCloseEvent -> {
if (afterScreenCloseEvent.closedWith(StandardOutcome.COMMIT)) {
Customer committedCustomer = (afterScreenCloseEvent.getSource()).getEditedEntity();
System.out.println("Updated " + committedCustomer);
}
}).build();
customerEdit.setReadOnly(true);
customerEdit.show();
}
use of datamodel.ex1.entity.Customer in project jmix-docs by jmix-framework.
the class ShowScreens method lookupCustomerWithParameter.
// end::lookup-select[]
// tag::lookup-with-parameter[]
private void lookupCustomerWithParameter() {
screenBuilders.lookup(Customer.class, this).withScreenId("uiex1_Customer.browse").withOpenMode(OpenMode.DIALOG).withSelectHandler(users -> {
Customer customer = users.iterator().next();
userField.setValue(customer.getFirstName() + " " + customer.getLastName());
}).build().show();
}
Aggregations