/** * 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 setReadOnly(boolean readOnly) { selectField.setReadOnly(readOnly); super.setReadOnly(readOnly); }
@Override public void setValue(T newFieldValue) throws com.vaadin.v7.data.Property.ReadOnlyException, ConversionException { ensureContainerSet(); super.setValue(newFieldValue); }
@Override public void setHeight(float height, Unit unit) { super.setHeight(height, unit); if (textArea != null) { if (height < 0) { textArea.setHeightUndefined(); } else { textArea.setHeight("100%"); } } }
@Override public void attach() { ensureContainerSet(); super.attach(); }
@Override protected CubaResizableTextAreaWrapperState getState() { return (CubaResizableTextAreaWrapperState) super.getState(); }
@Override public ErrorMessage getErrorMessage() { final ErrorMessage errorMessage = super.getErrorMessage(); getSelect().setStyleName("error", errorMessage != null); return errorMessage; }
@Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); tf.setEnabled(enabled); }
@Override public void beforeClientResponse(boolean initial) { super.beforeClientResponse(initial); //To change body of generated methods, choose Tools | Templates. }
@Override protected CroppableImage getContent() { return (CroppableImage)super.getContent(); }
@Override public void setHeight(float height, Unit unit) { super.setHeight(height, unit); getContent().setHeight(height, unit); }
@Override public void attach() { super.attach(); setFilterDecorator(decorator); }
@Override protected CubaResizableTextAreaWrapperState getState(boolean markAsDirty) { return (CubaResizableTextAreaWrapperState) super.getState(markAsDirty); }
@Override public ErrorMessage getErrorMessage() { final ErrorMessage errorMessage = super.getErrorMessage(); if (errorMessage == null) { textfield.removeStyleName("error"); } else { textfield.addStyleName("error"); } return errorMessage; }
@Override public void setEnabled(boolean enabled) { super.setEnabled(enabled); jcrop.setEnabled(enabled); }
@Override public void beforeClientResponse(boolean initial) { super.beforeClientResponse(initial); if (getState(false).resizableDirection.equals(ResizeDirection.BOTH) && isPercentageSize()) { LoggerFactory.getLogger(CubaResizableTextAreaWrapper.class).warn( "TextArea with percentage size can not be resizable"); getState().resizableDirection = ResizeDirection.NONE; } else if (getState(false).resizableDirection.equals(ResizeDirection.VERTICAL) && Unit.PERCENTAGE.equals(getHeightUnits())) { LoggerFactory.getLogger(CubaResizableTextAreaWrapper.class).warn( "TextArea height with percentage size can not be resizable to vertical direction"); getState().resizableDirection = ResizeDirection.NONE; } else if (getState(false).resizableDirection.equals(ResizeDirection.HORIZONTAL) && (Unit.PERCENTAGE.equals(getWidthUnits()))) { LoggerFactory.getLogger(CubaResizableTextAreaWrapper.class).warn( "TextArea width with percentage size can not be resizable to horizontal direction"); getState().resizableDirection = ResizeDirection.NONE; } }
/** * 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); tf.setReadOnly(readOnly); }
/** * {@inheritDoc} * * Sets the width of the wrapped select component. * * @param width the new width for this select * @param unit the unit of the new width */ @Override public void setWidth(float width, Unit unit) { if (select != null) { select.setWidth(width, unit); } super.setWidth(width, unit); }
@Override public void setValue(SelectionArea newFieldValue) throws ReadOnlyException, ConversionException { if ((newFieldValue == null && getValue() != null) || (newFieldValue != null && !newFieldValue.equals(getValue()))) { super.setValue(newFieldValue); } }