/** * Scrolls any component between the component and UI to a suitable position * so the component is visible to the user. The given component must belong * to this UI. * * @param component * the component to be scrolled into view * @throws IllegalArgumentException * if {@code component} does not belong to this UI */ public void scrollIntoView(Component component) throws IllegalArgumentException { if (component.getUI() != this) { throw new IllegalArgumentException( "The component where to scroll must belong to this UI."); } scrollIntoView = component; markAsDirty(); }
throws IllegalArgumentException { UI parentUI = content.getUI(); if (parentUI != null) { VaadinSession parentSession = parentUI.getSession();
/** * Gets the UI the component is attached to. * * @return the UI this component is attached to */ public UI getUI() { return getSource().getUI().get(); }
@Override public synchronized Broadcaster broadcast(@Nonnull final String group, @Nonnull final String message, @Nonnull Component sender) { checkNotNull(sender); ScopedUI scopedUI = (ScopedUI) sender.getUI(); return broadcast(group, message, scopedUI.getInstanceKey()); }
@Override public synchronized Broadcaster broadcast(final String group, final String message, Component sender) { checkNotNull(sender); ScopedUI scopedUI = (ScopedUI) sender.getUI(); return broadcast(group, message, scopedUI.getInstanceKey()); }
@Override public void handleAction(Object sender, Object target) { Component menuImpl = menuItem.getMenu().unwrap(Component.class); CubaUI ui = (CubaUI) menuImpl.getUI(); if (ui.isAccessibleForUser(menuImpl)) { menuItem.getCommand().accept(menuItem); } else { LoggerFactory.getLogger(MenuShortcutAction.class) .debug("Ignoring shortcut action because menu is inaccessible for user"); } } }
@Override public void handleAction(Object sender, Object target) { com.vaadin.ui.Component menuImpl = menuItem.getMenu().unwrap(com.vaadin.ui.Component.class); CubaUI ui = (CubaUI) menuImpl.getUI(); if (ui.isAccessibleForUser(menuImpl)) { Consumer<SideMenu.MenuItem> command = menuItem.getCommand(); if (command != null) { command.accept(menuItem); } } else { LoggerFactory.getLogger(SideMenuShortcutListener.class) .debug("Ignoring shortcut action because menu is inaccessible for user"); } } }
protected void onCloseButtonClick(CubaWindow.PreCloseEvent preCloseEvent) { preCloseEvent.setPreventClose(true); com.vaadin.ui.Component component = getComponent(); CubaUI ui = (CubaUI) component.getUI(); if (!ui.isAccessibleForUser(component)) { LoggerFactory.getLogger(WebWindow.class) .debug("Ignore close button click because Window is inaccessible for user"); return; } BeforeCloseEvent event = new BeforeCloseEvent(this, CloseOriginType.CLOSE_BUTTON); fireBeforeClose(event); if (!event.isClosePrevented()) { // user has clicked on X getFrameOwner().close(new StandardCloseAction(Window.CLOSE_ACTION_ID)); } }
protected void onCloseShortcutTriggered(Object sender, Object target) { if (this.isCloseable()) { com.vaadin.ui.Component component = getComponent(); CubaUI ui = (CubaUI) component.getUI(); if (!ui.isAccessibleForUser(component)) { LoggerFactory.getLogger(WebWindow.class) .debug("Ignore shortcut action because Window is inaccessible for user"); return; } BeforeCloseEvent event = new BeforeCloseEvent(this, CloseOriginType.SHORTCUT); fireBeforeClose(event); if (!event.isClosePrevented()) { getFrameOwner().close(new StandardCloseAction(Window.CLOSE_ACTION_ID)); } } }
/** * This method will add the Popover to the top level window so that it is * aligned below or on top of the given component, <em>unless</em> this is a * small screen device, e.g a smart phone. By default, an arrow pointing to * the given related component will be shown. * <p> * On a small screen device, a 100% wide overlay will slide in from the * bottom or top depending on the given related components position (in an * attempt to leave the related component visible, though this is not * guaranteed). * * @param relatedComponent * the component next to which the popover is shown. */ public void showRelativeTo(Component relatedComponent) { getState().setRelatedComponent(relatedComponent); if (relatedComponent != null && getParent() == null) { relatedComponent.getUI().addWindow(this); } markAsDirty(); }
/** * creates a new button in case of pressed switches to the given * {@code view}. * * @param view * the view to switch to in case the button is pressed */ public ValoMenuItemButton(final DashboardMenuItem view) { this.view = view; setPrimaryStyleName("valo-menu-item"); setIcon(view.getDashboardIcon()); setCaption(view.getDashboardCaption()); setDescription(view.getDashboardCaptionLong()); setId(view.getDashboardCaption().toLowerCase()); /* Avoid double click */ setDisableOnClick(true); addClickListener(event -> event.getComponent().getUI().getNavigator().navigateTo(view.getViewName())); }
/** * creates a new button in case of pressed switches to the given * {@code view}. * * @param view * the view to switch to in case the button is pressed */ public ValoMenuItemButton(final DashboardMenuItem view) { this.view = view; setPrimaryStyleName("valo-menu-item"); setIcon(view.getDashboardIcon()); setCaption(view.getDashboardCaption()); setDescription(view.getDashboardCaptionLong()); setId(view.getDashboardCaption().toLowerCase()); /* Avoid double click */ setDisableOnClick(true); addClickListener(event -> event.getComponent().getUI().getNavigator().navigateTo(view.getViewName())); }
window.setHeight("90%"); m_component.getUI().addWindow(window);
window.setHeight("90%"); m_component.getUI().addWindow(window);
window.setHeight("90%"); m_component.getUI().addWindow(window);
window.setHeight("80%"); m_component.getUI().addWindow(window);