diff --git a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/raceboard/tagging/TagButtonDialog.java b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/raceboard/tagging/TagButtonDialog.java
index 0ebce35784b..5aa3b36e937 100644
--- a/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/raceboard/tagging/TagButtonDialog.java
+++ b/java/com.sap.sailing.gwt.ui/src/main/java/com/sap/sailing/gwt/ui/raceboard/tagging/TagButtonDialog.java
@@ -3,10 +3,14 @@ package com.sap.sailing.gwt.ui.raceboard.tagging;
import java.util.Arrays;
import java.util.List;
+import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.cell.client.FieldUpdater;
-import com.google.gwt.cell.client.ImageResourceCell;
import com.google.gwt.core.shared.GWT;
-import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.safehtml.client.SafeHtmlTemplates;
+import com.google.gwt.safehtml.shared.SafeHtml;
+import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
+import com.google.gwt.safehtml.shared.SafeHtmlUtils;
+import com.google.gwt.safehtml.shared.SafeUri;
import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.cellview.client.Column;
import com.google.gwt.user.cellview.client.TextColumn;
@@ -51,6 +55,30 @@ public class TagButtonDialog extends DialogBox {
}
}
+ protected interface ImageWithTextCellTemplate extends SafeHtmlTemplates {
+ @Template("
{1} ")
+ SafeHtml cell(SafeUri imageUrl, SafeHtml text);
+ }
+
+ private class ImageWithTextCell extends AbstractCell {
+
+ ImageWithTextCellTemplate template = GWT.create(ImageWithTextCellTemplate.class);
+
+ @Override
+ public void render(Context context, TagButton tagButton, SafeHtmlBuilder sb) {
+
+ SafeUri trustedImageURL;
+ SafeHtml safeTag = SafeHtmlUtils.fromString(tagButton.getTag());
+
+ if (tagButton.isVisibleForPublic()) {
+ trustedImageURL = resources.publicIcon().getSafeUri();
+ } else {
+ trustedImageURL = resources.privateIcon().getSafeUri();
+ }
+ sb.append(template.cell(trustedImageURL, safeTag));
+ }
+ }
+
private final TagPanelResources resources = TagPanelResources.INSTANCE;
private final TagPanelStyle style = resources.style();
private final TagButtonCellTableResources buttonTableResources = GWT.create(TagButtonCellTableResources.class);
@@ -115,10 +143,13 @@ public class TagButtonDialog extends DialogBox {
TagPreviewPanel tagPreviewPanel) {
CellTable tagButtonTable = new CellTable(15, buttonTableResources);
tagButtonTable.setStyleName(style.tagButtonTable());
- TextColumn tagColumn = new TextColumn() {
+
+ // columns
+ ImageWithTextCell imageWithTextCell = new ImageWithTextCell();
+ Column tagColumn = new Column(imageWithTextCell) {
@Override
- public String getValue(TagButton button) {
- return button.getTag();
+ public TagButton getValue(TagButton button) {
+ return button;
}
};
TextColumn imageURLColumn = new TextColumn() {
@@ -133,17 +164,6 @@ public class TagButtonDialog extends DialogBox {
return button.getComment();
}
};
- Column visibleForPublicColumn = new Column(
- new ImageResourceCell()) {
- @Override
- public ImageResource getValue(TagButton tagButton) {
- if (tagButton.isVisibleForPublic()) {
- return resources.publicIcon();
- } else {
- return resources.privateIcon();
- }
- }
- };
ImagesBarColumn actionsColumn = new ImagesBarColumn(
new EditTagButtonsImagesBarCell(stringMessages));
actionsColumn.setFieldUpdater(new FieldUpdater() {
@@ -184,15 +204,13 @@ public class TagButtonDialog extends DialogBox {
tagButtonTable.addColumn(tagColumn, stringMessages.tagLabelTag());
tagButtonTable.addColumn(imageURLColumn, stringMessages.tagLabelImageURL());
tagButtonTable.addColumn(commentColumn, stringMessages.tagLabelComment());
- tagButtonTable.addColumn(visibleForPublicColumn, stringMessages.tagVisibility());
tagButtonTable.addColumn(actionsColumn, stringMessages.tagLabelAction());
// set these width values manually as they are not accessable via CSS classes
- tagButtonTable.setColumnWidth(tagColumn, "20%");
+ tagButtonTable.setColumnWidth(tagColumn, "25%");
tagButtonTable.setColumnWidth(imageURLColumn, "20%");
tagButtonTable.setColumnWidth(commentColumn, "40%");
- tagButtonTable.setColumnWidth(visibleForPublicColumn, "10%");
- tagButtonTable.setColumnWidth(actionsColumn, "10%");
+ tagButtonTable.setColumnWidth(actionsColumn, "15%");
setRowData(tagButtonTable, taggingPanel.getTagButtons());