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