use of com.haulmont.cuba.web.sys.TabWindowContainer in project cuba by cuba-platform.
the class WebAppWorkArea method getCurrentWindowContainer.
@Nullable
protected TabWindowContainer getCurrentWindowContainer() {
TabWindowContainer layout;
if (getMode() == Mode.TABBED) {
TabSheetBehaviour tabSheetBehaviour = getTabbedWindowContainer().getTabSheetBehaviour();
layout = (TabWindowContainer) tabSheetBehaviour.getSelectedTab();
} else {
CubaSingleModeContainer singleWindowContainer = getSingleWindowContainer();
layout = (TabWindowContainer) singleWindowContainer.getWindowContainer();
}
return layout;
}
use of com.haulmont.cuba.web.sys.TabWindowContainer in project cuba by cuba-platform.
the class WebAppWorkArea method moveFocus.
protected void moveFocus(TabSheetBehaviour tabSheet, String tabId) {
TabWindowContainer windowContainer = (TabWindowContainer) tabSheet.getTabComponent(tabId);
Window window = windowContainer.getBreadCrumbs().getCurrentWindow();
if (window != null) {
boolean focused = false;
String focusComponentId = window.getFocusComponent();
if (focusComponentId != null) {
com.haulmont.cuba.gui.components.Component focusComponent = window.getComponent(focusComponentId);
if (focusComponent instanceof com.haulmont.cuba.gui.components.Component.Focusable && focusComponent.isEnabledRecursive() && focusComponent.isVisibleRecursive()) {
((com.haulmont.cuba.gui.components.Component.Focusable) focusComponent).focus();
focused = true;
}
}
if (!focused && window instanceof Window.Wrapper) {
Window.Wrapper wrapper = (Window.Wrapper) window;
focused = ((WebWindow) wrapper.getWrappedWindow()).findAndFocusChildComponent();
}
if (!focused) {
tabSheet.focus();
}
}
}
use of com.haulmont.cuba.web.sys.TabWindowContainer in project cuba by cuba-platform.
the class WebAppWorkArea method getActiveWorkAreaScreensStream.
public Stream<Screen> getActiveWorkAreaScreensStream() {
if (getMode() == Mode.TABBED) {
TabSheetBehaviour tabSheetBehaviour = getTabbedWindowContainer().getTabSheetBehaviour();
return tabSheetBehaviour.getTabComponentsStream().map(c -> {
TabWindowContainer windowContainer = (TabWindowContainer) c;
Window currentWindow = windowContainer.getBreadCrumbs().getCurrentWindow();
return currentWindow.getFrameOwner();
});
} else {
CubaSingleModeContainer singleWindowContainer = getSingleWindowContainer();
TabWindowContainer windowContainer = (TabWindowContainer) singleWindowContainer.getWindowContainer();
if (windowContainer != null) {
Window currentWindow = windowContainer.getBreadCrumbs().getCurrentWindow();
return Stream.of(currentWindow.getFrameOwner());
}
}
return Stream.empty();
}
use of com.haulmont.cuba.web.sys.TabWindowContainer in project cuba by cuba-platform.
the class WebAppWorkArea method getCurrentBreadcrumbs.
public Collection<Screen> getCurrentBreadcrumbs() {
TabWindowContainer layout = getCurrentWindowContainer();
if (layout != null) {
WindowBreadCrumbs breadCrumbs = layout.getBreadCrumbs();
List<Screen> screens = new ArrayList<>(breadCrumbs.getWindows().size());
Iterator<Window> windowIterator = breadCrumbs.getWindows().descendingIterator();
while (windowIterator.hasNext()) {
Screen frameOwner = windowIterator.next().getFrameOwner();
screens.add(frameOwner);
}
return screens;
}
return Collections.emptyList();
}
Aggregations