Search in sources :

Example 6 with Screen

use of io.jmix.ui.screen.Screen in project jmix by jmix-framework.

the class HistoryNavigator method proceedHistoryBackward.

protected void proceedHistoryBackward(NavigationState requestedState) {
    Screen screen = urlChangeHandler.findActiveScreenByState(requestedState);
    urlChangeHandler.selectScreen(screen);
    urlTools.replaceState(requestedState.asRoute(), ui);
    history.backward();
}
Also used : Screen(io.jmix.ui.screen.Screen)

Example 7 with Screen

use of io.jmix.ui.screen.Screen in project jmix by jmix-framework.

the class HistoryNavigator method findPreviousState.

@Nullable
protected NavigationState findPreviousState(NavigationState requestedState) {
    if (urlChangeHandler.isRootState(requestedState)) {
        return requestedState;
    }
    if (Objects.equals(requestedState, history.getNow())) {
        requestedState = history.getPrevious();
    }
    NavigationState prevState;
    Screen prevStateScreen = urlChangeHandler.findScreenByState(requestedState);
    if (prevStateScreen == null && !urlChangeHandler.isRootState(requestedState)) {
        while (history.getPrevious() != null) {
            history.backward();
            NavigationState previousState = history.getPrevious();
            if (urlChangeHandler.findActiveScreenByState(previousState) != null || urlChangeHandler.isRootState(previousState)) {
                break;
            }
        }
        prevState = history.getPrevious();
    } else {
        prevState = requestedState;
    }
    return prevState;
}
Also used : Screen(io.jmix.ui.screen.Screen) Nullable(javax.annotation.Nullable)

Example 8 with Screen

use of io.jmix.ui.screen.Screen in project jmix by jmix-framework.

the class ScreensImpl method getConfiguredWorkAreaOrNull.

@Override
@Nullable
public AppWorkArea getConfiguredWorkAreaOrNull() {
    RootWindow topLevelWindow = ui.getTopLevelWindow();
    if (topLevelWindow == null) {
        throw new IllegalStateException("There is no root screen opened");
    }
    Screen controller = topLevelWindow.getFrameOwner();
    if (controller instanceof HasWorkArea) {
        return ((HasWorkArea) controller).getWorkArea();
    }
    return null;
}
Also used : HasWorkArea(io.jmix.ui.component.Window.HasWorkArea) Screen(io.jmix.ui.screen.Screen) Nullable(javax.annotation.Nullable)

Example 9 with Screen

use of io.jmix.ui.screen.Screen in project jmix by jmix-framework.

the class SearchFieldImpl method performSearch.

public void performSearch() {
    Screen frameOwner = ComponentsHelper.getWindowNN(this).getFrameOwner();
    String searchText = getValue();
    ScreenContext screenContext = getScreenContext(frameOwner);
    if (StringUtils.isBlank(searchText)) {
        Notifications notifications = screenContext.getNotifications();
        notifications.create(HUMANIZED).withCaption(messages.getMessage("io.jmix.searchui.noSearchText")).show();
    } else {
        String preparedSearchText = searchText.trim();
        SearchContext searchContext = new SearchContext(preparedSearchText).setSize(searchProperties.getSearchResultPageSize()).setEntities(getEntities());
        SearchResult searchResult = entitySearcher.search(searchContext, searchStrategy);
        if (searchCompletedHandler != null) {
            searchCompletedHandler.accept(new SearchCompletedEvent(this, searchResult));
        }
    }
}
Also used : ScreenContext(io.jmix.ui.screen.ScreenContext) UiControllerUtils.getScreenContext(io.jmix.ui.screen.UiControllerUtils.getScreenContext) SearchResultsScreen(io.jmix.searchui.screen.result.SearchResultsScreen) Screen(io.jmix.ui.screen.Screen) SearchContext(io.jmix.search.searching.SearchContext) SearchResult(io.jmix.search.searching.SearchResult) Notifications(io.jmix.ui.Notifications)

Example 10 with Screen

use of io.jmix.ui.screen.Screen in project jmix by jmix-framework.

the class DataLoadCoordinatorImpl method configureAutomatically.

private void configureAutomatically(DataLoader loader, FrameOwner frameOwner) {
    List<String> queryParameters = DataLoadersHelper.getQueryParameters(loader);
    List<String> allParameters = new ArrayList<>(queryParameters);
    allParameters.addAll(getConditionParameters(loader));
    // add triggers on container/component events
    for (String parameter : allParameters) {
        if (parameter.startsWith(containerPrefix)) {
            InstanceContainer container = UiControllerUtils.getScreenData(frameOwner).getContainer(parameter.substring(containerPrefix.length()));
            addOnContainerItemChangedLoadTrigger(loader, container, parameter);
        } else if (parameter.startsWith(componentPrefix)) {
            String componentId = parameter.substring(componentPrefix.length());
            Component component = frameOwner instanceof Screen ? ((Screen) frameOwner).getWindow().getComponentNN(componentId) : ((ScreenFragment) frameOwner).getFragment().getComponentNN(componentId);
            LikeClause likeClause = findLikeClause(loader, parameter);
            addOnComponentValueChangedLoadTrigger(loader, component, parameter, likeClause);
        }
    }
    // if the loader has no parameters in query, add trigger on BeforeShowEvent/AttachEvent
    if (queryParameters.isEmpty()) {
        Class eventClass = frameOwner instanceof Screen ? Screen.BeforeShowEvent.class : ScreenFragment.AttachEvent.class;
        addOnFrameOwnerEventLoadTrigger(loader, eventClass);
    }
}
Also used : ScreenFragment(io.jmix.ui.screen.ScreenFragment) Screen(io.jmix.ui.screen.Screen) ArrayList(java.util.ArrayList) InstanceContainer(io.jmix.ui.model.InstanceContainer) Component(io.jmix.ui.component.Component)

Aggregations

Screen (io.jmix.ui.screen.Screen)82 EditorScreen (io.jmix.ui.screen.EditorScreen)20 LookupScreen (io.jmix.ui.screen.LookupScreen)15 MapScreenOptions (io.jmix.ui.screen.MapScreenOptions)11 Nullable (javax.annotation.Nullable)9 Messages (io.jmix.core.Messages)6 WindowImpl (io.jmix.ui.component.impl.WindowImpl)6 Screens (io.jmix.ui.Screens)5 io.jmix.ui.component (io.jmix.ui.component)5 NavigationState (io.jmix.ui.navigation.NavigationState)5 FrameOwner (io.jmix.ui.screen.FrameOwner)5 UiControllerUtils (io.jmix.ui.screen.UiControllerUtils)5 java.util (java.util)5 Collectors (java.util.stream.Collectors)5 LoggerFactory (org.slf4j.LoggerFactory)5 Autowired (org.springframework.beans.factory.annotation.Autowired)5 LegacyFrame (com.haulmont.cuba.gui.screen.compatibility.LegacyFrame)4 ScreenEditorWrapper (com.haulmont.cuba.gui.screen.compatibility.ScreenEditorWrapper)4 MetaClass (io.jmix.core.metamodel.model.MetaClass)4 BaseAction (io.jmix.ui.action.BaseAction)4