@Override protected EmbeddedState getState(boolean markAsDirty) { return (EmbeddedState) super.getState(markAsDirty); } }
/** * Clears the error condition of the given field, if any. The default * implementation clears the * {@link AbstractComponent#setComponentError(ErrorMessage) component error} * of the field if it is a Component, otherwise does nothing. * * @param field * the field with an invalid value */ protected void clearError(HasValue<?> field) { if (field instanceof AbstractComponent) { ((AbstractComponent) field).setComponentError(null); } }
@Override public void setHeightUndefined() { setHeight(-1, Unit.PIXELS); }
@Override public void addStyleName(String style) { if (style == null || style.isEmpty()) { return; } if (getState().styles != null && getState().styles.contains(style)) { return; } if (style.contains(" ")) { // Split space separated style names and add them one by one. StringTokenizer tokenizer = new StringTokenizer(style, " "); while (tokenizer.hasMoreTokens()) { addStyleName(tokenizer.nextToken()); } return; } if (getState().styles == null) { getState().styles = new ArrayList<>(); } List<String> styles = getState().styles; styles.add(style); }
public static void configure(AbstractComponent layout, ResourceNode config) throws MException { if (config.getBoolean(LayoutBuilder.FULL_SIZE, false)) layout.setSizeFull(); else { String width = config.getString(LayoutBuilder.WIDTH, null); if (width != null) layout.setWidth(width); String height = config.getString(LayoutBuilder.HEIGHT, null); if (height != null) layout.setHeight(height); layout.setStyleName(config.getExtracted(LayoutBuilder.STYLE)); layout.setVisible(false);
/** * Sets the component's description. See {@link #getDescription()} for more * information on what the description is. * * @see #setDescription(String, ContentMode) * @param description * the new description string for the component. */ public void setDescription(String description) { setDescription(description, ContentMode.PREFORMATTED); }
/** * Applies annotation values to {@code component} * * @param component the component to be updated * @param annotationValues the annotation values to apply * @param annotationInfo used primarily to identify the Field, and therefore its name */ private void applyAnnotationValues(AbstractComponent component, AnnotationValues annotationValues, AnnotationInfo annotationInfo) { // set locale first Locale locale = annotationValues.locale.isPresent() ? annotationValues.locale.get() : currentLocale.getLocale(); component.setLocale(locale); // set caption, description & value if available if (annotationValues.captionKey.isPresent()) { component.setCaption(translate.from(annotationValues.captionKey.get(), locale)); } if (annotationValues.descriptionKey.isPresent()) { component.setDescription(translate.from(annotationValues.descriptionKey.get(), locale)); } if (annotationValues.valueKey.isPresent()) { if (component instanceof HasValue) { ((HasValue) component).setValue(translate.from(annotationValues.valueKey.get(), locale)); return; } else { log.warn("Field {} has a value annotation but does not implement HasValue. Annotation ignored", annotationInfo.getField() .getName()); } } }
Attributes attr = design.attributes(); for (String attribute : getDefaultAttributes()) { if (design.hasAttr(attribute)) { DesignAttributeHandler.assignValue(this, attribute, setLocale(getLocaleFromString(attr.get("locale"))); readSize(attr); com.vaadin.server.AbstractErrorMessage.ContentMode.HTML, ErrorLevel.ERROR); setComponentError(error); supported.addAll(getDefaultAttributes()); supported.addAll(getCustomAttributes()); for (Attribute a : attr) { if (!a.getKey().startsWith(":")
@Override public void setWidthUndefined() { setWidth(-1, Unit.PIXELS); }
@Override public void beforeClientResponse(boolean initial) { super.beforeClientResponse(initial); if (getCompositionRoot() == null) { throw new IllegalStateException( "A composite must always have a composition root"); } }
tile.addStyleName("cursorhand"); tile.addStyleName("thumbnail" + tileSize); tile.setWidth(( tileWidth * tileSize + (tileSize - 1) * tileHorizontalGap ) + "px"); tile.setHeight( tileHeight + "px"); overView.addComponent(tile);
/** * Performs messages localization * @param instance Building instance */ protected void localize(I instance) { if (caption != null) { instance.setCaption(LocalizationContext.translate(caption, true)); } if (description != null) { instance.setDescription(LocalizationContext.translate(description, true)); } }
@Override public void setVisible(boolean visible) { if (!visible) { setPopupVisible(false); } super.setVisible(visible); } }
public void setPermissions(MaduraPropertyWrapper property, AbstractComponent field) { PermissionManager permissionmanager = getPermissionManager(); if (!permissionmanager.hasPermission( property.getWritePermission())) { field.setReadOnly(true); } if (!permissionmanager.hasPermission( property.getReadPermission())) { field.setVisible(false); } }
@Override protected void initComponent() { super.initComponent(); if(!tableCreated) { createSimCardsTable(); tableCreated = true; } mainWindow = this.getWindow(); Panel basePanel = new Panel(""); basePanel.addComponent(inventoryFilterPanel); AbstractComponent separatorLine = Cf.horizontalLine(); //Of no signficance separatorLine.addStyleName("m2m-horizontal-line-list-separator"); separatorLine.setWidth("99%"); basePanel.addComponent(separatorLine); basePanel.addComponent(simCardTable); basePanel.setSizeFull(); basePanel.getContent().setSizeUndefined(); // <-- This is the important part addComponent(basePanel); setExpandRatio(basePanel, 1); }
@Override public void setStyleName(String style, boolean add) { getRootAbstractComponentOrThrow().setStyleName(style, add); }
@Override public void beforeClientResponse(boolean initial) { super.beforeClientResponse(initial); // Steal caption from target view if not explicitly defined String caption = getState().caption; AbstractComponent targetView = (AbstractComponent) getState() .getTargetView(); String targetViewCaption = getState().getTargetViewCaption(); if (caption == null) { caption = targetViewCaption; if (caption == null && targetView != null) { caption = targetView.getCaption(); } } getState().caption = caption; if (getState().getTargetViewCaption() == null) { if (targetView == null) { getState().setTargetViewCaption(caption); } } }
@Override public void setCaption(String caption) { super.setCaption(caption); getContent().setCaption(caption); }
public void doUpdate(DataConnector data) throws MException { if (data.getTaskName().equals(DataSource.CONNECTOR_TASK_TITLE)) { String arg = data.getString((String)label.getCaption()); if (equals(arg,label.getCaption())) return; label.setCaption(arg); return; } if (data.getTaskName().equals(DataSource.CONNECTOR_TASK_ERROR)) { String msg = data.getString(""); setErrorMessage(msg); return; } }