Search in sources :

Example 16 with Customer

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();
    }
}
Also used : Customer(ui.ex1.entity.Customer)

Example 17 with Customer

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();
}
Also used : Customer(ui.ex1.entity.Customer)

Example 18 with Customer

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);
}
Also used : Customer(appsettings.ex1.entity.Customer) CustomerSettings(appsettings.ex1.entity.CustomerSettings) CustomerGrade(appsettings.ex1.entity.CustomerGrade)

Example 19 with Customer

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);
}
Also used : Customer(bpm.ex1.entity.Customer) HashMap(java.util.HashMap)

Example 20 with Customer

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);
    }
}
Also used : Customer(dataaccess.ex1.entity.Customer) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

Customer (ui.ex1.entity.Customer)34 Customer (dataaccess.ex1.entity.Customer)25 Autowired (org.springframework.beans.factory.annotation.Autowired)12 BaseAction (io.jmix.ui.action.BaseAction)10 io.jmix.ui.screen (io.jmix.ui.screen)10 Named (javax.inject.Named)10 BeforeEach (org.junit.jupiter.api.BeforeEach)10 CustomerEdit (ui.ex1.screen.entity.customer.CustomerEdit)10 Test (org.junit.jupiter.api.Test)9 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)9 Notifications (io.jmix.ui.Notifications)8 Action (io.jmix.ui.action.Action)8 io.jmix.ui.component (io.jmix.ui.component)8 Order (dataaccess.ex1.entity.Order)7 Metadata (io.jmix.core.Metadata)6 ParamsMap (io.jmix.core.common.util.ParamsMap)6 ScreenBuilders (io.jmix.ui.ScreenBuilders)6 DialogAction (io.jmix.ui.action.DialogAction)6 JmixIcon (io.jmix.ui.icon.JmixIcon)6 BigDecimal (java.math.BigDecimal)6