/** * Adds one or more style names to this component by using one or multiple * parameters. * * @param styles * the style name or style names to be added to the component * @see #addStyleName(String) * @see #setStyleName(String) * @see #removeStyleName(String) * @since 8.1 */ public default void addStyleNames(String... styles) { for (String style : styles) { addStyleName(style); } }
@Override public void addStyleName(String style) { getRootOrThrow().addStyleName(style); }
/** * Adds or removes a style name. Multiple styles can be specified as a * space-separated list of style names. * * If the {@code add} parameter is true, the style name is added to the * component. If the {@code add} parameter is false, the style name is * removed from the component. * <p> * Functionally this is equivalent to using {@link #addStyleName(String)} or * {@link #removeStyleName(String)} * * @since 8.5 * @param style * the style name to be added or removed * @param add * <code>true</code> to add the given style, <code>false</code> * to remove it * @see #addStyleName(String) * @see #removeStyleName(String) */ public default void setStyleName(String style, boolean add) { if (add) { addStyleName(style); } else { removeStyleName(style); } }
public void setContent(Component content) { layout.addComponent(content); content.addStyleName("dialog-content"); content.addStyleName("title"); }
/** * Sets the main component.<p> * * @param component the main component */ public void setMainContent(Component component) { component.addStyleName("borderless"); m_main.setContent(component); }
@Override protected Component createThumbnailComponent() { final Component previewComponent = createPreviewComponent(); previewComponent.addStyleName("file-preview"); return previewComponent; }
public void addSecondaryAction(Component actionControl) { actionControl.addStyleName("action-control primary-actions"); this.secondaryActionSlot.addComponentAsFirst(actionControl); }
public void addPrimaryAction(Component actionControl) { actionControl.addStyleName("action-control primary-actions"); this.primaryActionSlot.addComponentAsFirst(actionControl); }
/** * Add new section without a title into small app layout. */ public void addSection(Component section) { section.addStyleName("smallapp-section"); sectionsLayout.addComponent(section); }
@Override public void addComponent(Component c) { super.addComponent(c); components.add(c); c.addStyleName("v-form-field"); markAsDirty(); }
@Override public void addStyleName(String style) { super.addStyleName(style); // replicate to content getContent().ifPresent(c -> c.addStyleName(style)); }
@Override public void addStyleName(String style) { super.addStyleName(style); // add to internal field too getInternalField().addStyleName(style); }
protected void toggleMaximized(final Component panel, final boolean maximized) { if (maximized) { panel.setVisible(true); panel.addStyleName("max"); } else { panel.removeStyleName("max"); } }
@Override public F createFieldComponent() { F select = super.createFieldComponent(); if (getDefinition().getLayout() == Layout.horizontal) { select.addStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL); } return select; } }
protected void setIconStyle() { if (StringUtils.isNotEmpty(getIcon()) && StringUtils.isEmpty(getCaption())) { getComposition().addStyleName("popupview-icon-on-left"); } else { getComposition().removeStyleName("popupview-icon-on-left"); } } }
private void switchView(String viewId) { Optional.ofNullable(currentActiveContentView).ifPresent(UiFrameworkView::destroy); final ContentViewDefinition<T> contentViewDefinition = definition.getViews().get(viewId); //TODO: we don't always want tree here, there should be a more clever check! this.currentActiveContentView = getViewProvider().create(contentViewDefinition); this.contentViewToggleControls.get(viewId).addStyleName("active"); addComponent(currentActiveContentView.asVaadinComponent()); setExpandRatio(currentActiveContentView.asVaadinComponent(), 1f); }
protected void addProfileEntry(GridLayout layout, Component name, Component value) { name.addStyleName(ExplorerLayout.STYLE_PROFILE_FIELD); name.setSizeUndefined(); layout.addComponent(name); value.setSizeUndefined(); layout.addComponent(value); }
@Override public void setIcon(String icon) { this.icon = icon; if (StringUtils.isNotEmpty(icon)) { Resource iconResource = getIconResource(icon); getComposition().setIcon(iconResource); getComposition().addStyleName(ICON_STYLE); } else { getComposition().setIcon(null); getComposition().removeStyleName(ICON_STYLE); } }
@Override public void setTheme(String themeName) { String stylename = String.format("app-%s", themeName); final String themeUrl = String.format("../%s/styles.css", themeName); final Component vaadinComponent = asVaadinComponent(); vaadinComponent.addStyleName(stylename); final ThemeResource res = new ThemeResource(themeUrl); if (vaadinComponent.isAttached()) { Page.getCurrent().getStyles().add(res); } else { vaadinComponent.addAttachListener((AttachListener) event -> Page.getCurrent().getStyles().add(res)); } }
public void setSelectionStatusComponent(Component c) { if (getState().selectionStatusComponent != null) { ((Component)getState().selectionStatusComponent).removeStyleName(""); } getState().selectionStatusComponent = c; if (getSession() != null) { c.addStyleName("crop-status" + getConnectorId()); } }