Search in sources :

Example 11 with Customer

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

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();
}
Also used : CollectionLoader(io.jmix.ui.model.CollectionLoader) java.util(java.util) Customer(ui.ex1.entity.Customer) BulkEditors(io.jmix.ui.bulk.BulkEditors) Dialogs(io.jmix.ui.Dialogs) io.jmix.ui.action.list(io.jmix.ui.action.list) TagLookupAction(io.jmix.ui.action.tagpicker.TagLookupAction) Autowired(org.springframework.beans.factory.annotation.Autowired) Metadata(io.jmix.core.Metadata) ParamsMap(io.jmix.core.common.util.ParamsMap) CustomerEdit(ui.ex1.screen.entity.customer.CustomerEdit) ColumnsMode(io.jmix.ui.app.bulk.ColumnsMode) Notifications(io.jmix.ui.Notifications) io.jmix.ui.screen(io.jmix.ui.screen) ScreenBuilders(io.jmix.ui.ScreenBuilders) CustomerBrowse(ui.ex1.screen.entity.customer.CustomerBrowse) RemoveOperation(io.jmix.ui.RemoveOperation) Action(io.jmix.ui.action.Action) BaseAction(io.jmix.ui.action.BaseAction) Named(javax.inject.Named) MetaProperty(io.jmix.core.metamodel.model.MetaProperty) DialogAction(io.jmix.ui.action.DialogAction) io.jmix.ui.component(io.jmix.ui.component) Customer(ui.ex1.entity.Customer) CustomerEdit(ui.ex1.screen.entity.customer.CustomerEdit)

Example 12 with Customer

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

the class ShowScreens method lookupCustomerWithParameter.

// end::lookup-select[]
// tag::lookup-with-parameter[]
private void lookupCustomerWithParameter() {
    screenBuilders.lookup(Customer.class, this).withScreenId("uiex1_Customer.browse").withOpenMode(OpenMode.DIALOG).withSelectHandler(users -> {
        Customer customer = users.iterator().next();
        userField.setValue(customer.getFirstName() + " " + customer.getLastName());
    }).build().show();
}
Also used : Customer(ui.ex1.entity.Customer)

Example 13 with Customer

use of ui.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 14 with Customer

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

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

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