Search in sources :

Example 16 with Visit

use of io.jmix.petclinic.entity.visit.Visit in project jmix-sneferu by mariodavid.

the class MyVisits method onInit.

@Subscribe
protected void onInit(InitEvent event) {
    tableEdit.withHandler(actionPerformedEvent -> {
        Visit item = table.getSingleSelected();
        if (item != null) {
            refreshOptionsForLookupFields();
            disableEditControls();
            getActionsPane().setVisible(true);
        }
    });
}
Also used : Visit(io.jmix.petclinic.entity.visit.Visit) Subscribe(io.jmix.ui.screen.Subscribe)

Example 17 with Visit

use of io.jmix.petclinic.entity.visit.Visit in project jmix-sneferu by mariodavid.

the class VisitBrowse method updateVisit.

private void updateVisit(Object entity, LocalDateTime newStart, LocalDateTime newEnd) {
    Visit visit = (Visit) entity;
    visit.setVisitStart(newStart);
    visit.setVisitEnd(newEnd);
    dataContext.commit();
    notifications.create(Notifications.NotificationType.TRAY).withCaption(messageBundle.formatMessage("visitUpdated", messages.getMessage(visit.getType()), visit.getPetName())).show();
}
Also used : Visit(io.jmix.petclinic.entity.visit.Visit)

Example 18 with Visit

use of io.jmix.petclinic.entity.visit.Visit in project jmix-sneferu by mariodavid.

the class GetValueInteractionTest method when_interactionIsPerformed_then_valueIsReturnedFromTheComponent.

@Test
void when_interactionIsPerformed_then_valueIsReturnedFromTheComponent(UiTestAPI uiTestAPI) {
    // given:
    StandardEditorTestAPI<Visit, VisitEdit> visitEdit = uiTestAPI.openStandardEditor(Visit.class, VisitEdit.class);
    // and:
    visitEdit.interact(enter(VISIT_START_FIELD, VISIT_START_VALUE));
    // when:
    final LocalDateTime actualVisitStart = (LocalDateTime) visitEdit.andThenGet(getValue(VISIT_START_FIELD));
    // then:
    assertThat(actualVisitStart).isEqualTo(VISIT_START_VALUE);
}
Also used : VisitEdit(io.jmix.petclinic.screen.visit.VisitEdit) LocalDateTime(java.time.LocalDateTime) Visit(io.jmix.petclinic.entity.visit.Visit) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) SneferuUiTest(de.diedavids.sneferu.SneferuUiTest)

Example 19 with Visit

use of io.jmix.petclinic.entity.visit.Visit in project jmix-sneferu by mariodavid.

the class OpenTabInteractionTest method when_interactionIsPerformed_then_tabIsSelected.

@Test
void when_interactionIsPerformed_then_tabIsSelected(UiTestAPI uiTestAPI) {
    // given:
    final StandardLookupTestAPI<Visit, VisitBrowse> openedScreen = uiTestAPI.openStandardLookup(Visit.class, VisitBrowse.class);
    final TabsheetComponentDescriptor tabSheet = tabSheet("contentTabSheet");
    assertThat(openedScreen.rawComponent(tabSheet)).isNotNull();
    assertThat(openedScreen.rawComponent(tabSheet).getTab("tableTab")).isNotNull();
    // when:
    openedScreen.interact(openTab(tabSheet, "tableTab"));
    // then:
    final TabSheet.Tab selectedTab = openedScreen.rawComponent(tabSheet).getSelectedTab();
    // and:
    assertThat(selectedTab.getName()).isEqualTo("tableTab");
}
Also used : Visit(io.jmix.petclinic.entity.visit.Visit) TabsheetComponentDescriptor(de.diedavids.sneferu.components.descriptor.TabsheetComponentDescriptor) TabSheet(io.jmix.ui.component.TabSheet) VisitBrowse(io.jmix.petclinic.screen.visit.VisitBrowse) SneferuUiTest(de.diedavids.sneferu.SneferuUiTest) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 20 with Visit

use of io.jmix.petclinic.entity.visit.Visit in project jmix-sneferu by mariodavid.

the class OpenTabInteractionTest method when_interactionIsPerformedWithInvalidTab_then_exceptionIsThrown.

@Test
void when_interactionIsPerformedWithInvalidTab_then_exceptionIsThrown(UiTestAPI uiTestAPI) {
    // given:
    final StandardLookupTestAPI<Visit, VisitBrowse> openedScreen = uiTestAPI.openStandardLookup(Visit.class, VisitBrowse.class);
    final TabsheetComponentDescriptor tabSheet = tabSheet("contentTabSheet");
    assertThat(openedScreen.rawComponent(tabSheet)).isNotNull();
    // expect:
    assertThrows(IllegalStateException.class, () -> openedScreen.interact(openTab(tabSheet, "notExistingTab")));
}
Also used : Visit(io.jmix.petclinic.entity.visit.Visit) TabsheetComponentDescriptor(de.diedavids.sneferu.components.descriptor.TabsheetComponentDescriptor) VisitBrowse(io.jmix.petclinic.screen.visit.VisitBrowse) SneferuUiTest(de.diedavids.sneferu.SneferuUiTest) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

Visit (io.jmix.petclinic.entity.visit.Visit)31 SneferuUiTest (de.diedavids.sneferu.SneferuUiTest)25 Test (org.junit.jupiter.api.Test)25 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)25 VisitEdit (io.jmix.petclinic.screen.visit.VisitEdit)17 VisitBrowse (io.jmix.petclinic.screen.visit.VisitBrowse)9 LocalDateTime (java.time.LocalDateTime)5 VisitType (io.jmix.petclinic.entity.visit.VisitType)4 Subscribe (io.jmix.ui.screen.Subscribe)4 OperationResult (io.jmix.ui.util.OperationResult)3 ScreenNotOpenException (de.diedavids.sneferu.ScreenNotOpenException)2 TabsheetComponentDescriptor (de.diedavids.sneferu.components.descriptor.TabsheetComponentDescriptor)2 Interactions.screenOpenMode (de.diedavids.sneferu.Interactions.screenOpenMode)1 ButtonTestAPI (de.diedavids.sneferu.components.testapi.ButtonTestAPI)1 Pet (io.jmix.petclinic.entity.pet.Pet)1 Button (io.jmix.ui.component.Button)1 TabSheet (io.jmix.ui.component.TabSheet)1 OpenMode (io.jmix.ui.screen.OpenMode)1 Screen (io.jmix.ui.screen.Screen)1