/** * Update the view data based on the current value. * * @param parent the parent element * @param viewData the {@link ViewData} object to update * @param isEditing true if in edit mode * @return the new value */ private String updateViewData(Element parent, ViewData viewData, boolean isEditing) { TextAreaElement input = (TextAreaElement) parent.getFirstChild(); String value = input.getValue(); viewData.setText(value); viewData.setEditing(isEditing); return value; }
public RichTextArea create(Element e) { String v = null; RichTextArea richArea = null; TextAreaElement textElement = null; if ($(e).widget(0) != null && $(e).widget(0) instanceof RichTextArea) { richArea = $(e).widget(0); v = richArea.getHTML(); } else if ("textarea".equalsIgnoreCase(e.getTagName())) { v = $(e).val(); textElement = TextAreaElement.as(e); } else if (WidgetsUtils.matchesTags(e, "div", "span")) { v = $(e).html(); } if (v != null) { final RichTextWithToolbar richWidget = new RichTextWithToolbar(richArea, textElement); richArea = richWidget.area; richArea.setHTML(v); if (textElement != null) { WidgetsUtils.hideAndAfter(textElement, richWidget); } else { WidgetsUtils.replaceOrAppend(e, richWidget); } return richArea; } return null; }
/** * Convert the cell to edit mode. * * @param context the {@link Context} of the cell * @param parent the parent element * @param value the current value */ protected void edit(Context context, Element parent, String value) { setValue(context, parent, value); TextAreaElement input = getInputElement(parent); input.focus(); input.select(); }