/** * Add a listener that will be notified when this screen is closed with actionId {@link #COMMIT_ACTION_ID}. * * @param listener listener instance * @deprecated Use {@link Screen#addAfterCloseListener(Consumer)} instead. */ @Deprecated default void addCloseWithCommitListener(CloseWithCommitListener listener) { addCloseListener(new CloseListenerAdapter(listener)); }
/** * Returns the field group. Override if the field group id differs from "fieldGroup". */ protected Form getForm() { return (Form) getWindow().getComponentNN("form"); }
/** * This method is called by the framework after opening the screen to apply user settings to all components. */ @Deprecated default void applySettings(Settings settings) { UiControllerUtils.applySettings(getFrameOwner(), settings); }
/** * @deprecated Please use {@link Window#setCaption(String)} ()} and {@link Window#setDescription(String)} ()} methods. */ @Deprecated default void setWindowCaption(Window window, String caption, String description) { window.setCaption(caption); window.setDescription(description); }
protected void onCloseWindowButtonClick(@SuppressWarnings("unused") MouseEventDetails meDetails) { Window window = getCurrentWindow(); if (!window.isCloseable()) { return; } if (!isCloseWithCloseButtonPrevented(window)) { window.getFrameOwner() .close(FrameOwner.WINDOW_CLOSE_ACTION); } }
protected void updateWindowCaption() { Window window = getWindow(); String filterTitle; if (filterMode == FilterMode.GENERIC_MODE && filterEntity != null && filterEntity != adHocFilter) { filterTitle = getFilterCaption(filterEntity); } else { filterTitle = null; } window.setDescription(filterTitle); if (initialWindowCaption == null) { initialWindowCaption = window.getCaption(); } windowManager.setWindowCaption(window, initialWindowCaption, filterTitle); String newCaption = Strings.isNullOrEmpty(filterTitle) ? caption : caption + ": " + filterTitle; captionChangedListener.accept(newCaption); }
@Override public void onApplicationEvent(AppLoggedInEvent event) { App app = event.getApp(); Connection connection = app.getConnection(); if (connection.isAuthenticated() && !isLoggedInWithExternalAuth(connection.getSessionNN())) { User user = connection.getSessionNN().getUser(); // Change password on logon if (Boolean.TRUE.equals(user.getChangePasswordAtNextLogon())) { WindowManager wm = app.getWindowManager(); for (Window window : wm.getOpenWindows()) { window.setEnabled(false); } WindowInfo changePasswordDialog = windowConfig.getWindowInfo("sec$User.changePassword"); Window changePasswordWindow = wm.openWindow(changePasswordDialog, WindowManager.OpenType.DIALOG.closeable(false), ParamsMap.of("cancelEnabled", Boolean.FALSE)); changePasswordWindow.addCloseListener(actionId -> { for (Window window : wm.getOpenWindows()) { window.setEnabled(true); } }); } } } }
@Nullable @Override public Component getComponent(String id) { return frame.getComponent(id); }
String filterComponentId = StringUtils.join(Arrays.copyOfRange(strings, 1, strings.length), '.'); filterComponent = (Filter) window.getComponentNN(filterComponentId); if (window.getFrameOwner() instanceof LegacyFrame) { DsContext dsContext = ((LegacyFrame) window.getFrameOwner()).getDsContext(); if (dsContext != null) { ((DsContextImplementation) dsContext).resumeSuspended();
@Override public WindowContext getContext() { return frame.getContext(); }
@Subscribe protected void onInit(InitEvent event) { Window window = getWindow(); Label<String> msgLabel = uiComponents.create(Label.TYPE_STRING); msgLabel.setAlignment(Component.Alignment.TOP_CENTER); msgLabel.addStyleName(HaloTheme.LABEL_H1); msgLabel.setValue(messages.formatMessage(NotFoundScreen.class, "notAssociatedRoute", requestedRoute)); window.add(msgLabel); window.setCaption(messages.formatMessage(NotFoundScreen.class, "tabCaption", requestedRoute)); } }
/** * Set the screen caption. If called in {@link #init(java.util.Map)}, overrides the value from XML. * @param caption caption */ @Override public void setCaption(String caption) { frame.setCaption(caption); }
@Override public DialogOptions getDialogOptions() { return frame.getDialogOptions(); }
button.setCaption(StringUtils.trimToEmpty(window.getCaption())); button.addClickListener(this::navigationButtonClicked); button.setSizeUndefined(); button.setCubaId("breadCrubms_Button_" + window.getId()); button.setId(ui.getTestIdManager().getTestId("breadCrubms_Button_" + window.getId())); linksLayout.addComponent(separatorLab); } else { Label captionLabel = new Label(window.getCaption()); captionLabel.setStyleName("c-breadcrumbs-win-caption"); captionLabel.setSizeUndefined();
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(); } } } }
public void saveScreenHistory(Screen frameOwner) { WindowContext windowContext = frameOwner.getWindow().getContext(); if (security.isEntityOpPermitted(ScreenHistoryEntity.class, EntityOp.CREATE) && (frameOwner instanceof EditorScreen) && windowContext.getLaunchMode() != OpenMode.DIALOG && (screenIds.contains(frameOwner.getId()))) { String caption = frameOwner.getWindow().getCaption(); UUID entityId = null; Entity entity = ((EditorScreen) frameOwner).getEditedEntity(); if (entity != null) { if (PersistenceHelper.isNew(entity)) { return; } if (StringUtils.isBlank(caption)) { caption = messages.getTools().getEntityCaption(entity.getMetaClass()) + " " + metadata.getTools().getInstanceName(entity); } entityId = (UUID) entity.getId(); } ScreenHistoryEntity screenHistoryEntity = metadata.create(ScreenHistoryEntity.class); screenHistoryEntity.setCaption(StringUtils.abbreviate(caption, 255)); screenHistoryEntity.setUrl(makeLink(frameOwner)); screenHistoryEntity.setEntityId(entityId); addAdditionalFields(screenHistoryEntity, entity); CommitContext cc = new CommitContext(Collections.singleton(screenHistoryEntity)); dataManager.commit(cc); } }
@Override public void addTimer(Timer timer) { frame.addTimer(timer); }
if (!WindowParams.DISABLE_AUTO_REFRESH.getBool(window.getContext())) { if (getResultingManualApplyRequired()) { if (BooleanUtils.isTrue(defaultFilter.getApplyDefault())) { window.setDescription(getFilterCaption(filterEntity)); } else window.setDescription(null);
@Override public void add(Component component) { frame.add(component); }
/** * @return screen caption which is set in XML or via {@link #setCaption(String)} */ @Override public String getCaption() { return frame.getCaption(); }