@Override public void render(Context context, String value, SafeHtmlBuilder sb) { // Get the view data. Object key = context.getKey(); ViewData viewData = getViewData(key); if (viewData != null && !viewData.isEditing() && value != null && value.equals(viewData.getText())) { clearViewData(key); viewData = null; } String toRender = value; if (viewData != null) { String text = viewData.getText(); if (viewData.isEditing()) { /* * Do not use the renderer in edit mode because the value of a text * input element is always treated as text. SafeHtml isn't valid in the * context of the value attribute. */ sb.append(template.input(text)); return; } else { // The user pressed enter, but view data still exists. toRender = text; } } if (toRender != null && toRender.trim().length() > 0) { sb.append(renderer.render(toRender)); } else { /* * Render a blank space to force the rendered element to have a height. * Otherwise it is not clickable. */ sb.appendHtmlConstant("\u00A0"); } }
public void render(Context context, T object, SafeHtmlBuilder sb) { renderer.render(getValue(object), sb); }