Search in sources :

Example 1 with Owner

use of com.haulmont.cuba.core.model.Owner in project jmix by jmix-framework.

the class ViewBuilderTest method testRefView.

@Test
public void testRefView() {
    FetchPlan view = ViewBuilder.of(Pet.class).add("owner", builder -> builder.add("name")).build();
    assertFalse(containsSystemProperties(view));
    assertNotNull(view.getProperty("owner"));
    FetchPlan ownerView = view.getProperty("owner").getFetchPlan();
    assertNotNull(ownerView);
    assertFalse(containsSystemProperties(ownerView));
    assertTrue(ownerView.containsProperty("name"));
}
Also used : Pet(com.haulmont.cuba.core.model.Pet) Test(org.junit.jupiter.api.Test) ViewBuilder(com.haulmont.cuba.core.global.ViewBuilder) List(java.util.List) FetchPlanProperty(io.jmix.core.FetchPlanProperty) FetchPlan(io.jmix.core.FetchPlan) Owner(com.haulmont.cuba.core.model.Owner) Assertions(org.junit.jupiter.api.Assertions) Autowired(org.springframework.beans.factory.annotation.Autowired) Metadata(io.jmix.core.Metadata) CoreTest(com.haulmont.cuba.core.testsupport.CoreTest) MetadataTools(io.jmix.core.MetadataTools) FetchPlan(io.jmix.core.FetchPlan) Test(org.junit.jupiter.api.Test) CoreTest(com.haulmont.cuba.core.testsupport.CoreTest)

Example 2 with Owner

use of com.haulmont.cuba.core.model.Owner in project jmix by jmix-framework.

the class DlcBaseScreen method ownersDlLoadDelegate.

@Install(to = "ownersDl", target = Target.DATA_LOADER)
private List<Owner> ownersDlLoadDelegate(LoadContext<Owner> loadContext) {
    events.add(new LoadEvent("ownersDl", loadContext));
    List<Owner> list = new ArrayList<>();
    Owner owner = metadata.create(Owner.class);
    owner.setName("Joe");
    list.add(owner);
    if (loadContext.getQuery().getParameters().isEmpty()) {
        owner = metadata.create(Owner.class);
        owner.setName("Jane");
        list.add(owner);
    }
    return list;
}
Also used : Owner(com.haulmont.cuba.core.model.Owner) ArrayList(java.util.ArrayList) Install(io.jmix.ui.screen.Install)

Aggregations

Owner (com.haulmont.cuba.core.model.Owner)2 ViewBuilder (com.haulmont.cuba.core.global.ViewBuilder)1 Pet (com.haulmont.cuba.core.model.Pet)1 CoreTest (com.haulmont.cuba.core.testsupport.CoreTest)1 FetchPlan (io.jmix.core.FetchPlan)1 FetchPlanProperty (io.jmix.core.FetchPlanProperty)1 Metadata (io.jmix.core.Metadata)1 MetadataTools (io.jmix.core.MetadataTools)1 Install (io.jmix.ui.screen.Install)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Assertions (org.junit.jupiter.api.Assertions)1 Test (org.junit.jupiter.api.Test)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1