Search in sources :

Example 6 with Customer

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

the class OrderService method saveAndReturnNothing.

// end::save-context[]
// tag::save-discard[]
void saveAndReturnNothing(List<Customer> entities) {
    SaveContext saveContext = new SaveContext().setDiscardSaved(true);
    for (Customer entity : entities) {
        saveContext.saving(entity);
    }
    dataManager.save(saveContext);
}
Also used : Customer(dataaccess.ex1.entity.Customer)

Example 7 with Customer

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

the class CustomerEventListener method onCustomerSaving.

@EventListener
void onCustomerSaving(EntitySavingEvent<Customer> event) {
    Customer customer = event.getEntity();
    String encrypted = encryptionService.encrypt(customer.getSensitiveData());
    customer.setEncryptedData(encrypted);
}
Also used : Customer(dataaccess.ex1.entity.Customer) TransactionalEventListener(org.springframework.transaction.event.TransactionalEventListener) EventListener(org.springframework.context.event.EventListener)

Example 8 with Customer

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

the class ActionScreen method onCustomersTableEdit.

// end::edit-action-performed-event[]
// tag::edit-action-performed-event-2[]
@Subscribe("customersTable.edit")
public void onCustomersTableEdit(Action.ActionPerformedEvent event) {
    screenBuilders.editor(customersTable).withOpenMode(OpenMode.DIALOG).withScreenClass(CustomerEdit.class).withAfterCloseListener(afterScreenCloseEvent -> {
        if (afterScreenCloseEvent.closedWith(StandardOutcome.COMMIT)) {
            Customer committedCustomer = (afterScreenCloseEvent.getSource()).getEditedEntity();
            System.out.println("Updated " + committedCustomer);
        }
    }).build().show();
}
Also used : Customer(ui.ex1.entity.Customer) CustomerEdit(ui.ex1.screen.entity.customer.CustomerEdit)

Example 9 with Customer

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

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

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