use of ui.ex1.entity.Customer in project jmix-docs by Haulmont.
the class KeyValueTest method test.
@Test
void test() {
// tag::load[]
List<KeyValueEntity> entities = dataManager.loadValues("select e.customer, sum(e.amount) from sample_Order e group by e.customer").properties("customer", "total").list();
// end::load[]
assertEquals(2, entities.size());
// tag::get-value[]
for (KeyValueEntity entity : entities) {
Customer customer = entity.getValue("customer");
BigDecimal totalAmount = entity.getValue("total");
// ...
}
// end::get-value[]
}
use of ui.ex1.entity.Customer in project jmix-docs by Haulmont.
the class ActionScreen method custTableCreateNewEntitySupplier.
// end::screen-configurer[]
// tag::new-entity-supplier[]
@Install(to = "custTable.create", subject = "newEntitySupplier")
private Customer custTableCreateNewEntitySupplier() {
Customer customer = metadata.create(Customer.class);
customer.setFirstName("Sean");
customer.setLastName("White");
return customer;
}
use of ui.ex1.entity.Customer in project jmix-docs by Haulmont.
the class ActionScreen method onCustomersTableCreate.
// end::action-performed-event[]
// tag::action-performed-event-2[]
@Subscribe("customersTable.create")
public void onCustomersTableCreate(Action.ActionPerformedEvent event) {
screenBuilders.editor(customersTable).newEntity().withOpenMode(OpenMode.DIALOG).withScreenClass(CustomerEdit.class).withAfterCloseListener(afterScreenCloseEvent -> {
if (afterScreenCloseEvent.closedWith(StandardOutcome.COMMIT)) {
Customer committedCustomer = (afterScreenCloseEvent.getSource()).getEditedEntity();
System.out.println("Created " + committedCustomer);
}
}).build().show();
}
use of ui.ex1.entity.Customer in project jmix-docs by Haulmont.
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 ui.ex1.entity.Customer in project jmix-docs by Haulmont.
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();
}
Aggregations