Search in sources :

Example 1 with TabSheet

use of io.jmix.ui.component.TabSheet in project jmix by jmix-framework.

the class EntityCombinedScreen method initEditComponents.

/**
 * Initializes edit controls, depending on if they should be enabled or disabled.
 * @param enabled if true - enables edit controls and disables controls on the left side of the splitter
 *                if false - vice versa
 */
protected void initEditComponents(boolean enabled) {
    TabSheet tabSheet = getTabSheet();
    if (tabSheet != null) {
        ComponentsHelper.walkComponents(tabSheet, (component, name) -> {
            if (component instanceof FieldGroup) {
                ((FieldGroup) component).setEditable(enabled);
            } else if (component instanceof Table) {
                ((Table) component).getActions().forEach(action -> action.setEnabled(enabled));
            } else if (!(component instanceof HasComponents)) {
                component.setEnabled(enabled);
            }
        });
    }
    getFieldGroup().setEditable(enabled);
    getActionsPane().setVisible(enabled);
    getLookupBox().setEnabled(!enabled);
}
Also used : MetaClass(io.jmix.core.metamodel.model.MetaClass) Datasource(com.haulmont.cuba.gui.data.Datasource) LockService(com.haulmont.cuba.core.app.LockService) LockNotSupported(io.jmix.core.pessimisticlocking.LockNotSupported) TabSheet(io.jmix.ui.component.TabSheet) EditAction(com.haulmont.cuba.gui.components.actions.EditAction) RemoveAction(com.haulmont.cuba.gui.components.actions.RemoveAction) EntityValues(io.jmix.core.entity.EntityValues) Metadata(com.haulmont.cuba.core.global.Metadata) CreateAction(com.haulmont.cuba.gui.components.actions.CreateAction) EntityOp(io.jmix.core.security.EntityOp) ArrayList(java.util.ArrayList) AbstractDatasource(com.haulmont.cuba.gui.data.impl.AbstractDatasource) Component(io.jmix.ui.component.Component) List(java.util.List) LockInfo(io.jmix.core.pessimisticlocking.LockInfo) ExtendedEntities(io.jmix.core.ExtendedEntities) Map(java.util.Map) Entity(io.jmix.core.Entity) DatatypeFormatter(io.jmix.core.metamodel.datatype.DatatypeFormatter) Collections(java.util.Collections) CollectionDatasource(com.haulmont.cuba.gui.data.CollectionDatasource) Nullable(javax.annotation.Nullable) io.jmix.ui.component(io.jmix.ui.component) TabSheet(io.jmix.ui.component.TabSheet)

Example 2 with TabSheet

use of io.jmix.ui.component.TabSheet 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)

Aggregations

TabSheet (io.jmix.ui.component.TabSheet)2 LockService (com.haulmont.cuba.core.app.LockService)1 Metadata (com.haulmont.cuba.core.global.Metadata)1 CreateAction (com.haulmont.cuba.gui.components.actions.CreateAction)1 EditAction (com.haulmont.cuba.gui.components.actions.EditAction)1 RemoveAction (com.haulmont.cuba.gui.components.actions.RemoveAction)1 CollectionDatasource (com.haulmont.cuba.gui.data.CollectionDatasource)1 Datasource (com.haulmont.cuba.gui.data.Datasource)1 AbstractDatasource (com.haulmont.cuba.gui.data.impl.AbstractDatasource)1 SneferuUiTest (de.diedavids.sneferu.SneferuUiTest)1 TabsheetComponentDescriptor (de.diedavids.sneferu.components.descriptor.TabsheetComponentDescriptor)1 Entity (io.jmix.core.Entity)1 ExtendedEntities (io.jmix.core.ExtendedEntities)1 EntityValues (io.jmix.core.entity.EntityValues)1 DatatypeFormatter (io.jmix.core.metamodel.datatype.DatatypeFormatter)1 MetaClass (io.jmix.core.metamodel.model.MetaClass)1 LockInfo (io.jmix.core.pessimisticlocking.LockInfo)1 LockNotSupported (io.jmix.core.pessimisticlocking.LockNotSupported)1 EntityOp (io.jmix.core.security.EntityOp)1 Visit (io.jmix.petclinic.entity.visit.Visit)1