Search in sources :

Example 11 with Customer

use of dataaccess.ex1.entity.Customer in project jmix-docs by jmix-framework.

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 12 with Customer

use of dataaccess.ex1.entity.Customer in project jmix-docs by jmix-framework.

the class UrlRoutesGeneratorScreen method onBtn3Click.

@Subscribe("btn3")
protected void onBtn3Click(Button.ClickEvent event) {
    // tag::get-editor-route[]
    Customer e = customerField.getValue();
    String route = urlRouting.getRouteGenerator().getEditorRoute(e);
    // end::get-editor-route[]
    notifications.create().withCaption(route).withType(Notifications.NotificationType.TRAY).show();
}
Also used : Customer(ui.ex1.entity.Customer) Subscribe(io.jmix.ui.screen.Subscribe)

Example 13 with Customer

use of dataaccess.ex1.entity.Customer in project jmix-docs by Haulmont.

the class OrderService method createOrderWithCustomer.

// end::load-sorted[]
// tag::save-multiple[]
Order createOrderWithCustomer() {
    Customer customer = dataManager.create(Customer.class);
    customer.setName("Alice");
    Order order = dataManager.create(Order.class);
    order.setCustomer(customer);
    // <1>
    EntitySet savedEntities = dataManager.save(order, customer);
    // <2>
    return savedEntities.get(order);
}
Also used : Order(dataaccess.ex1.entity.Order) Customer(dataaccess.ex1.entity.Customer)

Example 14 with Customer

use of dataaccess.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 15 with Customer

use of dataaccess.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)

Aggregations

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