/** * Sets the number of text lines that are visible. * * @param lines the number of visible lines */ public void setVisibleLines(int lines) { getTextAreaElement().setRows(lines); }
/** * This constructor may be used by subclasses to explicitly use an existing * element. This element must be a <textarea> element. * * @param element the element to be used */ protected TextArea(Element element) { super(element.<Element>cast()); TextAreaElement.as(element); }
/** * Gets the number of text lines that are visible. * * @return the number of visible lines */ public int getVisibleLines() { return getTextAreaElement().getRows(); }
@Override protected void copyAttributes(Element src, Element dest) { TextAreaElement source = src.cast(); TextAreaElement destination = dest.cast(); destination.setAccessKey(source.getAccessKey()); destination.setCols(source.getCols()); destination.setDefaultValue(source.getDefaultValue()); destination.setDisabled(source.isDisabled()); destination.setName(source.getName()); destination.setReadOnly(source.isReadOnly()); destination.setRows(source.getRows()); destination.setValue(source.getValue()); }
/** * Sets the requested width of the text box (this is not an exact value, as * not all characters are created equal). * * @param width the requested width, in characters */ public void setCharacterWidth(int width) { getTextAreaElement().setCols(width); }
/** * Gets the requested width of the text box (this is not an exact value, as * not all characters are created equal). * * @return the requested width, in characters */ public int getCharacterWidth() { return getTextAreaElement().getCols(); }
@Override public TextAreaBuilder value(String value) { assertCanAddAttribute().setValue(value); return this; } }
/** * Assert that the given {@link Element} is compatible with this class and * automatically typecast it. */ public static TextAreaElement as(Element elem) { assert is(elem); return (TextAreaElement) elem; }
@Override public int getMaxLength() { String maxLengthAtt = TextAreaElement.as(this.getElement()).getAttribute("maxLength"); if (maxLengthAtt != null && maxLengthAtt.length() > 0) { return Integer.valueOf(maxLengthAtt); } return -1; }
Style style = element.getStyle(); style.setFontSize(12, Style.Unit.PT); style.setTop(yPosition, Style.Unit.PX); element.setReadOnly(false); element.setValue(text); element.select(); element.removeFromParent();
@Override public TextAreaBuilder name(String name) { assertCanAddAttribute().setName(name); return this; }
@Override public TextAreaBuilder readOnly() { assertCanAddAttribute().setReadOnly(true); return this; }
@Override public TextAreaBuilder accessKey(String accessKey) { assertCanAddAttribute().setAccessKey(accessKey); return this; }
@Override public TextAreaBuilder cols(int cols) { assertCanAddAttribute().setCols(cols); return this; }
/** * Gets the requested width of the text box (this is not an exact value, as * not all characters are created equal). * * @return the requested width, in characters */ public int getCharacterWidth() { return getTextAreaElement().getCols(); }
public void setBuildingText(String content) { buildingTextArea.setValue(content); } }