use of com.haulmont.cuba.desktop.gui.components.DesktopWindow in project cuba by cuba-platform.
the class DesktopWindowManager method moveFocus.
protected void moveFocus(java.awt.Component tab) {
Window window = tabs.get(tab).getCurrentWindow();
if (window != null) {
String focusComponentId = window.getFocusComponent();
boolean focused = false;
if (focusComponentId != null) {
com.haulmont.cuba.gui.components.Component focusComponent = window.getComponent(focusComponentId);
if (focusComponent != null) {
if (focusComponent.isEnabled() && focusComponent.isVisible()) {
focusComponent.requestFocus();
focused = true;
}
}
}
if (!focused && window instanceof Window.Wrapper) {
Window.Wrapper wrapper = (Window.Wrapper) window;
focused = ((DesktopWindow) wrapper.getWrappedWindow()).findAndFocusChildComponent();
if (!focused) {
tabsPane.requestFocus();
}
}
}
}
use of com.haulmont.cuba.desktop.gui.components.DesktopWindow in project cuba by cuba-platform.
the class DesktopWindowManager method isCloseWithCloseButtonPrevented.
protected boolean isCloseWithCloseButtonPrevented(Window currentWindow) {
DesktopWindow desktopWindow = (DesktopWindow) ComponentsHelper.getWindowImplementation(currentWindow);
if (desktopWindow != null) {
Window.BeforeCloseWithCloseButtonEvent event = new Window.BeforeCloseWithCloseButtonEvent(desktopWindow);
desktopWindow.fireBeforeCloseWithCloseButton(event);
return event.isClosePrevented();
}
return false;
}
use of com.haulmont.cuba.desktop.gui.components.DesktopWindow in project cuba by cuba-platform.
the class DesktopWindowManager method setWindowCaption.
@Override
public void setWindowCaption(Window window, String caption, String description) {
Window desktopWindow = window;
if (window instanceof Window.Wrapper) {
desktopWindow = ((Window.Wrapper) window).getWrappedWindow();
}
window.setCaption(caption);
String formattedCaption = formatTabDescription(caption, description);
WindowOpenInfo openInfo = windowOpenMode.get(desktopWindow);
if (openInfo != null) {
OpenMode openMode = openInfo.getOpenMode();
if (openMode != OpenMode.DIALOG) {
if (tabsPane != null) {
int selectedIndex = tabsPane.getSelectedIndex();
if (selectedIndex != -1) {
setActiveWindowCaption(caption, description, selectedIndex);
}
} else if (!isMainWindowManager) {
setTopLevelWindowCaption(formattedCaption);
}
} else {
JDialog jDialog = (JDialog) openInfo.getData();
if (jDialog != null) {
jDialog.setTitle(formattedCaption);
}
}
}
}
use of com.haulmont.cuba.desktop.gui.components.DesktopWindow in project cuba by cuba-platform.
the class DesktopWindowManager method isCloseWithShortcutPrevented.
protected boolean isCloseWithShortcutPrevented(Window currentWindow) {
DesktopWindow desktopWindow = (DesktopWindow) ComponentsHelper.getWindowImplementation(currentWindow);
if (desktopWindow != null) {
Window.BeforeCloseWithShortcutEvent event = new Window.BeforeCloseWithShortcutEvent(desktopWindow);
desktopWindow.fireBeforeCloseWithShortcut(event);
return event.isClosePrevented();
}
return false;
}
Aggregations