use of ui.ex1.entity.Customer in project jmix-docs by Haulmont.
the class CustomerBrowse method onGetLinkButtonClick.
// end::related-action-performed-event[]
// tag::get-editor-route[]
@Subscribe("getLinkButton")
protected void onGetLinkButtonClick(Button.ClickEvent event) {
Customer selectedCustomer = customersTable.getSingleSelected();
if (selectedCustomer != null) {
String routeToSelectedRole = urlRouting.getRouteGenerator().getEditorRoute(selectedCustomer);
dialogs.createMessageDialog().withCaption("Generated route").withMessage(routeToSelectedRole).withWidth("710").show();
}
}
use of ui.ex1.entity.Customer in project jmix-docs by Haulmont.
the class ShowScreens method lookupCustomer.
// end::create-with-parameter[]
// tag::lookup[]
private void lookupCustomer() {
screenBuilders.lookup(Customer.class, this).withSelectHandler(customers -> {
Customer customer = customers.iterator().next();
userField.setValue(customer.getFirstName() + " " + customer.getLastName());
}).build().show();
}
use of ui.ex1.entity.Customer in project jmix-docs by Haulmont.
the class CustomerEdit method onInitEntity.
@Subscribe
public void onInitEntity(InitEntityEvent<Customer> event) {
CustomerSettings customerSettings = appSettings.load(CustomerSettings.class);
CustomerGrade defaultGrade = customerSettings.getDefaultGrade();
Customer customer = event.getEntity();
customer.setGrade(defaultGrade);
}
use of ui.ex1.entity.Customer in project jmix-docs by Haulmont.
the class CustomerEdit method onCommitAndCloseBtnClick.
// tag::commit[]
@Subscribe("commitAndCloseBtn")
public void onCommitAndCloseBtnClick(Button.ClickEvent event) {
Customer customer = getEditedEntity();
String name = customer.getName();
Map<String, Object> params = new HashMap<>();
// <1>
params.put("customer", customer);
// <2>
params.put("name", name);
// <3>
runtimeService.startProcessInstanceByKey(// <4>
"new-customer", // <5>
params);
}
use of ui.ex1.entity.Customer in project jmix-docs by Haulmont.
the class CustomerServiceTest method setUp.
@BeforeEach
void setUp() {
customer1 = dataManager.create(Customer.class);
customer1.setName("Alice");
customer1.setEmail("alice@company.com");
customer1.setGrade(CustomerGrade.PLATINUM);
customer2 = dataManager.create(Customer.class);
customer2.setName("Bob");
customer2.setEmail("bob@company.com");
customer2.setGrade(CustomerGrade.GOLD);
dataManager.save(customer1, customer2);
for (int i = 1; i <= 50; i++) {
Customer customer = dataManager.create(Customer.class);
customer.setName("cust-" + Strings.padStart(String.valueOf(i), 2, '0'));
customer.setEmail("cust-" + i + "@mail.com");
customer.setGrade(i > 40 ? CustomerGrade.PLATINUM : (i > 30 ? CustomerGrade.GOLD : CustomerGrade.BRONZE));
dataManager.save(customer);
}
}
Aggregations