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);
}
});
}
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();
}
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);
}
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");
}
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")));
}
Aggregations