use of io.jmix.ui.component.Window in project jmix by jmix-framework.
the class ScreenToolsImpl method openDefaultScreen.
@Override
public void openDefaultScreen(Screens screens) {
String defaultScreenId = uiProperties.getDefaultScreenId();
if (StringUtils.isEmpty(defaultScreenId)) {
return;
}
if (!windowConfig.hasWindow(defaultScreenId)) {
log.info("Can't find default screen: {}", defaultScreenId);
return;
}
Screen screen = screens.create(defaultScreenId, OpenMode.NEW_TAB);
if (screen instanceof EditorScreen) {
((EditorScreen) screen).setEntityToEdit(getEntityToEdit(defaultScreenId));
}
screen.show();
Window window = screen.getWindow();
setDefaultScreenWindow(window);
if (!uiProperties.isDefaultScreenCanBeClosed()) {
window.setCloseable(false);
}
}
use of io.jmix.ui.component.Window in project jmix by jmix-framework.
the class WindowBreadCrumbs method update.
public void update() {
boolean isTestMode = ui.isTestMode();
linksLayout.removeAllComponents();
for (Iterator<Window> it = windows.iterator(); it.hasNext(); ) {
Window window = it.next();
Button button = new NavigationButton(window);
button.setCaption(StringUtils.trimToEmpty(window.getCaption()));
button.addClickListener(this::navigationButtonClicked);
button.setSizeUndefined();
button.setStyleName(ValoTheme.BUTTON_LINK);
button.setTabIndex(-1);
if (isTestMode) {
button.setJTestId("breadCrubms_Button_" + window.getId());
}
if (ui.isPerformanceTestMode()) {
button.setId(ui.getTestIdManager().getTestId("breadCrubms_Button_" + window.getId()));
}
if (it.hasNext()) {
linksLayout.addComponent(button);
Label separatorLab = new Label(" > ");
separatorLab.setStyleName("jmix-breadcrumbs-separator");
separatorLab.setSizeUndefined();
separatorLab.setContentMode(ContentMode.HTML);
linksLayout.addComponent(separatorLab);
} else {
Label captionLabel = new Label(window.getCaption());
captionLabel.setStyleName("jmix-breadcrumbs-win-caption");
captionLabel.setSizeUndefined();
linksLayout.addComponent(captionLabel);
}
}
}
use of io.jmix.ui.component.Window in project jmix by jmix-framework.
the class WindowBreadCrumbs method isCloseWithCloseButtonPrevented.
protected boolean isCloseWithCloseButtonPrevented(@Nullable Window currentWindow) {
WindowImpl windowImpl = (WindowImpl) currentWindow;
if (windowImpl != null) {
Window.BeforeCloseEvent event = new Window.BeforeCloseEvent(windowImpl, CloseOriginType.CLOSE_BUTTON);
windowImpl.fireBeforeClose(event);
return event.isClosePrevented();
}
return false;
}
use of io.jmix.ui.component.Window in project jmix by jmix-framework.
the class UiControllerPropertyInjector method findComponent.
@Nullable
protected Component findComponent(String componentId) {
Component component = null;
Window window = null;
if (sourceScreen != null) {
window = sourceScreen.getWindow();
} else if (frameOwner instanceof ScreenFragment) {
FrameOwner host = ((ScreenFragment) frameOwner).getHostController();
if (host instanceof Screen) {
window = ((Screen) host).getWindow();
}
} else if (frameOwner instanceof Screen) {
window = ((Screen) frameOwner).getWindow();
}
if (window != null) {
component = window.getComponent(componentId);
}
return component;
}
Aggregations