@Override public void attach() { super.attach(); createColorHistoryIfNecessary(); }
/** * Constructs a new custom field. * * <p> * The component is implemented by wrapping the methods of the composition * root component given as parameter. The composition root must be set * before the component can be used. * </p> */ public CustomField() { // expand horizontally by default setWidth(100, Unit.PERCENTAGE); }
@Override public void setHeight(String height) { super.setHeight(height); getContent().setHeight(height); }
@Override public void setReadOnly(boolean readOnly) { super.setReadOnly(readOnly); if (field != null) { field.setReadOnly(readOnly); } }
@Override public void setComponentError(ErrorMessage componentError) { super.setComponentError(componentError); if (componentError != null) { addStyleName(DEFAULT_INVALID_FIELD_STYLE_CLASS); } else { removeStyleName(DEFAULT_INVALID_FIELD_STYLE_CLASS); } }
/** * Adds one or more style names to this component. * @param styleName Style name to add * @param reflectToInternalField <code>true</code> to add given <code>styleName</code> to internal field too */ protected void addStyleName(String styleName, boolean reflectToInternalField) { super.addStyleName(styleName); if (reflectToInternalField) { getInternalField().addStyleName(styleName); } }
@Override protected ColorPickerGrid getContent() { return (ColorPickerGrid) super.getContent(); }
@Override public void setReadOnly(boolean readOnly) { super.setReadOnly(readOnly); tokenField.setReadOnly(readOnly); }
@Override public void setComponentError(ErrorMessage componentError) { super.setComponentError(componentError); if (componentError != null) { addStyleName(DEFAULT_INVALID_FIELD_STYLE_CLASS); } else { removeStyleName(DEFAULT_INVALID_FIELD_STYLE_CLASS); } }
/** * Adds one or more style names to this component. * @param styleName Style name to add * @param reflectToInternalField <code>true</code> to add given <code>styleName</code> to internal field too */ protected void addStyleName(String styleName, boolean reflectToInternalField) { super.addStyleName(styleName); if (reflectToInternalField) { getInternalField().addStyleName(styleName); } }
/** * Constructs the content and notifies it that the {@link CustomField} is * attached to a window. * * @see com.vaadin.ui.Component#attach() */ @Override public void attach() { // First call super attach to notify all children (none if content has // not yet been created) super.attach(); // If the content has not yet been created, create and attach it at // this point by calling getContent() getContent(); }
@Override public void setReadOnly(boolean readOnly) { super.setReadOnly(readOnly); textField.setReadOnly(readOnly); }
@Override public void setWidth(float width, Unit unit) { super.setWidth(width, unit); updateComponentWidth(); }
@Override public void attach() { suppressTextChangeListener = true; super.attach(); suppressTextChangeListener = false; // update text representation manually if (field instanceof TextField) { updateTextRepresentation(); } }
@Override public void setHeight(float height, Unit unit) { super.setHeight(height, unit); updateComponentHeight(); }
@Override public void setComponentError(ErrorMessage componentError) { super.setComponentError(componentError); if (componentError == null) { textfield.removeStyleName("error"); } else { textfield.addStyleName("error"); } }
@Override public void addStyleName(String style) { super.addStyleName(style); // add to internal field too getInternalField().addStyleName(style); }
@Override protected Button getContent() { return (Button) super.getContent(); }
@Override public void setReadOnly(boolean readOnly) { super.setReadOnly(readOnly); textField.setReadOnly(readOnly); }
@Override public void setWidth(float width, Unit unit) { super.setWidth(width, unit); if (tf != null) { if (width != -1) { tf.setWidth("100%"); } else { tf.setWidth(null); } } }