use of io.jmix.ui.component.impl.WindowImpl in project jmix by jmix-framework.
the class ScreensImpl method afterScreenRemove.
protected void afterScreenRemove(Screen screen) {
if (screen.getWindow() instanceof RootWindow) {
return;
}
Screen currentScreen = getAnyCurrentScreen();
if (currentScreen != null) {
NavigationState resolvedState = ((WindowImpl) currentScreen.getWindow()).getResolvedState();
if (resolvedState != null) {
String currentScreenRoute = resolvedState.asRoute();
urlTools.replaceState(currentScreenRoute, ui);
}
}
}
use of io.jmix.ui.component.impl.WindowImpl in project jmix by jmix-framework.
the class ScreensImpl method showThisTabWindow.
protected void showThisTabWindow(Screen screen) {
AppWorkAreaImpl workArea = getConfiguredWorkArea();
workArea.switchTo(State.WINDOW_CONTAINER);
TabWindowContainer windowContainer;
if (workArea.getMode() == Mode.TABBED) {
TabSheetBehaviour tabSheet = workArea.getTabbedWindowContainer().getTabSheetBehaviour();
windowContainer = (TabWindowContainer) tabSheet.getSelectedTab();
} else {
windowContainer = (TabWindowContainer) workArea.getSingleWindowContainer().getWindowContainer();
}
if (windowContainer == null || windowContainer.getBreadCrumbs() == null) {
throw new IllegalStateException("BreadCrumbs not found");
}
WindowBreadCrumbs breadCrumbs = windowContainer.getBreadCrumbs();
Window currentWindow = breadCrumbs.getCurrentWindow();
windowContainer.removeComponent(currentWindow.unwrapComposition(Layout.class));
Window newWindow = screen.getWindow();
com.vaadin.ui.Component newWindowComposition = newWindow.unwrapComposition(com.vaadin.ui.Component.class);
windowContainer.addComponent(newWindowComposition);
breadCrumbs.addWindow(newWindow);
WindowImpl windowImpl = (WindowImpl) screen.getWindow();
windowImpl.setResolvedState(createOrUpdateState(windowImpl.getResolvedState(), getConfiguredWorkArea().generateUrlStateMark()));
if (workArea.getMode() == Mode.TABBED) {
TabSheetBehaviour tabSheet = workArea.getTabbedWindowContainer().getTabSheetBehaviour();
String tabId = tabSheet.getTab(windowContainer);
TabWindow tabWindow = (TabWindow) newWindow;
String formattedCaption = tabWindow.formatTabCaption();
String formattedDescription = tabWindow.formatTabDescription();
tabSheet.setTabCaption(tabId, formattedCaption);
if (!Objects.equals(formattedCaption, formattedDescription)) {
tabSheet.setTabDescription(tabId, formattedDescription);
} else {
tabSheet.setTabDescription(tabId, null);
}
tabSheet.setTabIcon(tabId, iconResolver.getIconResource(newWindow.getIcon()));
tabSheet.setTabClosable(tabId, newWindow.isCloseable());
ContentSwitchMode contentSwitchMode = ContentSwitchMode.valueOf(tabWindow.getContentSwitchMode().name());
tabSheet.setContentSwitchMode(tabId, contentSwitchMode);
} else {
windowContainer.markAsDirtyRecursive();
}
}
use of io.jmix.ui.component.impl.WindowImpl in project jmix by jmix-framework.
the class ScreensImpl method showDialogWindow.
protected void showDialogWindow(Screen screen) {
DialogWindow window = (DialogWindow) screen.getWindow();
AppWorkArea workArea = getConfiguredWorkAreaOrNull();
if (workArea != null) {
WindowImpl windowImpl = (WindowImpl) screen.getWindow();
windowImpl.setResolvedState(createOrUpdateState(windowImpl.getResolvedState(), getConfiguredWorkArea().generateUrlStateMark()));
}
window.withUnwrappedComposition(JmixWindow.class, vWindow -> {
vWindow.setErrorHandler(ui);
String jmixId = "dialog_" + window.getId();
if (ui.isTestMode()) {
vWindow.setJTestId(jmixId);
}
if (ui.isPerformanceTestMode()) {
vWindow.setId(ui.getTestIdManager().getTestId(jmixId));
}
if (hasModalWindow()) {
// force modal
window.setModal(true);
}
ui.addWindow(vWindow);
});
}
use of io.jmix.ui.component.impl.WindowImpl in project jmix by jmix-framework.
the class ScreensImpl method changeUrl.
protected void changeUrl(Screen screen) {
WindowImpl windowImpl = (WindowImpl) screen.getWindow();
Map<String, String> params = windowImpl.getResolvedState() != null ? windowImpl.getResolvedState().getParams() : Collections.emptyMap();
ui.getUrlRouting().pushState(screen, params);
}
Aggregations