List of usage examples for com.google.gwt.safehtml.shared SafeHtmlBuilder append
public SafeHtmlBuilder append(SafeHtml html)
From source file:com.radoslavhusar.tapas.war.client.ui.NullableDatePickerCell.java
License:Apache License
@Override public void render(Context context, Date value, SafeHtmlBuilder sb) { // Get the view data. Object key = context.getKey(); Date viewData = getViewData(key); if (viewData != null && viewData.equals(value)) { clearViewData(key);/*from w w w . j ava2 s. com*/ viewData = null; } String s = null; if (viewData != null) { s = format.format(viewData); } else if (value != null) { s = format.format(value); } if (s != null) { sb.append(renderer.render(s)); } }
From source file:com.radoslavhusar.tapas.war.client.ui.SizeableEditTextCell.java
License:Apache License
@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);/* w ww.j a va2 s . com*/ viewData = null; } if (viewData != null) { String text = viewData.getText(); SafeHtml html = renderer.render(text); if (viewData.isEditing()) { // Note the template will not treat SafeHtml specially sb.append(template.input(html.asString(), size)); } else { // The user pressed enter, but view data still exists. sb.append(html); } } else if (value != null) { SafeHtml html = renderer.render(value); sb.append(html); } }
From source file:com.retech.reader.web.client.labs.LabsIconDecoratorCell.java
License:Apache License
@Override public void render(final com.google.gwt.cell.client.Cell.Context context, final LabsIconDecorator value, final SafeHtmlBuilder sb) { if (value == null) { return;//from www.j av a2 s . c om } SafeHtml image = AbstractImagePrototype.create(value.getImage()).getSafeHtml(); SafeHtml link = SafeHtmlUtils.fromTrustedString(value.getTitle()); sb.append(template.put(image, link, LabsResources.css().cellItemLeftDiv())); }
From source file:com.ritchey.athleticEventManage.client.ui.ClickTextCell.java
License:Apache License
@Override public void render(com.google.gwt.cell.client.Cell.Context context, String value, SafeHtmlBuilder sb) { if (value != null) {// String x = ""; if (clazz != null) { x = " class='" + clazz + "' "; }//w w w . j a v a 2s . c om SafeHtml html = SafeHtmlUtils.fromTrustedString("<div" + x + ">" + value + "</div>" + ""); sb.append(html); } }
From source file:com.ritchey.athleticEventManage.client.ui.HyperlinkCell.java
License:Apache License
@Override public void render(com.google.gwt.cell.client.Cell.Context context, Hyperlink value, SafeHtmlBuilder sb) { sb.append(SafeHtmlUtils.fromTrustedString(value.toString())); }
From source file:com.ritchey.attendance.client.view.ClickImageCell.java
License:Apache License
@Override public void render(com.google.gwt.cell.client.Cell.Context context, String value, SafeHtmlBuilder sb) { if (value != null) {// SafeHtml html = SafeHtmlUtils.fromTrustedString( "<div style='background:lightgray; min-height: 128px; max-width: 128px; min-width: 128px; text-align: center;'><img alt='No Photo Available' style='vertical-align: middle; width: 128px; height: 128px;' src='" + value + "' /></div>" + ""); sb.append(html); }/*from w ww .j av a 2 s . c om*/ }
From source file:com.ritchey.attendance.client.view.ClickImageResourceCell.java
License:Apache License
@Override public void render(Context context, ImageResource value, SafeHtmlBuilder sb) { if (value != null) { SafeHtml html = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(value).getHTML()); sb.append(html); }//w w w .j a va 2 s.c o m }
From source file:com.ritchey.attendance.client.view.ClickImageResourceTextCell.java
License:Apache License
@Override public void render(Context context, ImageResourceText value, SafeHtmlBuilder sb) { if (value != null) { String text = ""; if (value.value != null) { text = "<div>" + value.value + "</div>"; }//from w ww. jav a2 s . c o m SafeHtml html = SafeHtmlUtils .fromTrustedString(AbstractImagePrototype.create(value.image).getHTML() + text); sb.append(html); } }
From source file:com.ritchey.attendance.client.view.ClickTextCellWithSecondary.java
License:Apache License
@Override public void render(Context context, String value, SafeHtmlBuilder sb) { if (value != null) {// String x = ""; if (getClazz() != null) { x = " class='" + getClazz() + "' "; }// www . j a va 2 s . c o m String y = ""; if (getSecondaryClazz() != null) { y = " class='" + getSecondaryClazz() + "' "; } String values[] = value.split("~"); if (values.length == 1) { values[1] = ""; } SafeHtml html = SafeHtmlUtils.fromTrustedString( "<div" + x + ">" + values[0] + "</div><div" + y + ">" + values[1] + "</div>" + ""); sb.append(html); } }
From source file:com.ritchey.attendance.client.view.SelectionCell.java
License:Apache License
@Override public void render(Context context, String value, SafeHtmlBuilder sb) { // Get the view data. Object key = context.getKey(); String viewData = getViewData(key); if (viewData != null && viewData.equals(value)) { clearViewData(key);/*from w ww . j ava2s .c om*/ viewData = null; } int selectedIndex = getSelectedIndex(viewData == null ? value : viewData); sb.appendHtmlConstant("<select>"); int index = 0; for (String option : options) { if (index++ == selectedIndex) { sb.append(template.selected(option)); } else { sb.append(template.deselected(option)); } } sb.appendHtmlConstant("</select>"); }