use of datamodel.ex1.entity.Customer in project jmix-docs by Haulmont.
the class CustomerService method createCustomer.
// end::transaction-template-inject[]
// tag::transaction-template-without-result[]
public void createCustomer() {
transactionTemplate.executeWithoutResult(status -> {
Customer customer = dataManager.create(Customer.class);
customer.setName("Alice");
dataManager.save(customer);
});
}
use of datamodel.ex1.entity.Customer in project jmix-docs by Haulmont.
the class ActionScreen method onInit.
// end::inject-sayHelloBtn[]
// tag::on-init-start[]
@Subscribe
public void onInit(InitEvent event) {
// end::on-init-start[]
// tag::create-action-set[]
createAction.setOpenMode(OpenMode.DIALOG);
createAction.setScreenClass(CustomerEdit.class);
// end::create-action-set[]
// tag::edit-action-set[]
editAction.setOpenMode(OpenMode.DIALOG);
editAction.setScreenClass(CustomerEdit.class);
// end::edit-action-set[]
// tag::bulk-action-set[]
custTableBulk.setOpenMode(OpenMode.THIS_TAB);
custTableBulk.setIncludeProperties(Arrays.asList("rewardPoints", "email"));
custTableBulk.setColumnsMode(ColumnsMode.ONE_COLUMN);
// end::bulk-action-set[]
// tag::remove-action-set[]
removeAction.setConfirmation(true);
removeAction.setConfirmationTitle("Removing customer...");
removeAction.setConfirmationMessage("Do you really want to remove the customer?");
// end::remove-action-set[]
// tag::view-action-set[]
viewAction.setOpenMode(OpenMode.DIALOG);
viewAction.setScreenClass(CustomerEdit.class);
// end::view-action-set[]
// tag::tagLookup-action-set[]
tagLookupAction.setOpenMode(OpenMode.DIALOG);
tagLookupAction.setScreenClass(CustomerBrowse.class);
// end::tagLookup-action-set[]
// tag::base-action-button[]
sayHelloBtn.setAction(new BaseAction("hello") {
@Override
public boolean isPrimary() {
return true;
}
@Override
public void actionPerform(Component component) {
notifications.create().withCaption("Hello!").withType(Notifications.NotificationType.TRAY).show();
}
});
sayGoodbyeBtn.setAction(new BaseAction("goodbye").withPrimary(true).withHandler(e -> notifications.create().withCaption("Goodbye!").withType(Notifications.NotificationType.TRAY).show()));
// end::base-action-button[]
// tag::on-init-end[]
}
use of datamodel.ex1.entity.Customer in project jmix-docs by Haulmont.
the class DataManagerResourceTest method setUp.
@BeforeEach
void setUp() {
Customer customer = dataManager.create(Customer.class);
customer.setName("test-customer-1");
customer.setConfidentialInfo("111");
authenticator.withSystem(() -> dataManager.save(customer));
customerId = customer.getId();
}
use of datamodel.ex1.entity.Customer in project jmix-docs by Haulmont.
the class TableScreen method onTableSelectEventSelection.
@Subscribe("tableSelectEvent")
public void onTableSelectEventSelection(Table.SelectionEvent<Customer> event) {
Customer customer = tableSelectEvent.getSingleSelected();
notifications.create().withCaption("You selected " + customer.getFirstName() + " " + customer.getLastName() + " customer").show();
}
use of datamodel.ex1.entity.Customer in project jmix-docs by Haulmont.
the class CustomerBrowseData method createCustomer.
// end::find-by-name[]
// tag::create-customer[]
private void createCustomer() {
Customer customer = metadata.create(Customer.class);
customer.setFirstName("John");
customer.setLastName("Doe");
customersDc.getMutableItems().add(customer);
}
Aggregations