use of com.haulmont.cuba.gui.components.Window.HasWorkArea in project cuba by cuba-platform.
the class WebScreens method getConfiguredWorkArea.
/**
* @return workarea instance of the root screen
* @throws IllegalStateException if there is no root screen or root screen does not have {@link AppWorkArea}
*/
@Nonnull
protected WebAppWorkArea getConfiguredWorkArea() {
RootWindow topLevelWindow = ui.getTopLevelWindow();
if (topLevelWindow == null) {
throw new IllegalStateException("There is no root screen opened");
}
Screen controller = topLevelWindow.getFrameOwner();
if (controller instanceof HasWorkArea) {
AppWorkArea workArea = ((HasWorkArea) controller).getWorkArea();
if (workArea != null) {
return (WebAppWorkArea) workArea;
}
}
throw new IllegalStateException("RootWindow does not have any configured work area");
}
use of com.haulmont.cuba.gui.components.Window.HasWorkArea in project cuba by cuba-platform.
the class WebScreens method getConfiguredWorkAreaOrNull.
@Nullable
protected WebAppWorkArea 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) {
AppWorkArea workArea = ((HasWorkArea) controller).getWorkArea();
if (workArea != null) {
return (WebAppWorkArea) workArea;
}
}
return null;
}
Aggregations