aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorArtur <artur@vaadin.com>2017-02-22 13:36:45 +0200
committerAleksi Hietanen <aleksi@vaadin.com>2017-02-22 13:36:45 +0200
commitf3d768252903b8c184cc7d8a77b70ccddc5ef20f (patch)
treed6c04079289e66e548f780d9eae6cef52f2edbc7 /client
parent1718666cd6a0aac7273e12d5bad459dea9fe997c (diff)
downloadvaadin-framework-f3d768252903b8c184cc7d8a77b70ccddc5ef20f.tar.gz
vaadin-framework-f3d768252903b8c184cc7d8a77b70ccddc5ef20f.zip
Add support for rendering HTML in ButtonRenderer (#8606)
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/connectors/ButtonRendererConnector.java7
-rw-r--r--client/src/main/java/com/vaadin/client/renderers/ButtonRenderer.java16
2 files changed, 22 insertions, 1 deletions
diff --git a/client/src/main/java/com/vaadin/client/connectors/ButtonRendererConnector.java b/client/src/main/java/com/vaadin/client/connectors/ButtonRendererConnector.java
index 6fbe428edc..170c32a616 100644
--- a/client/src/main/java/com/vaadin/client/connectors/ButtonRendererConnector.java
+++ b/client/src/main/java/com/vaadin/client/connectors/ButtonRendererConnector.java
@@ -16,6 +16,7 @@
package com.vaadin.client.connectors;
import com.google.gwt.event.shared.HandlerRegistration;
+import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.renderers.ButtonRenderer;
import com.vaadin.client.renderers.ClickableRenderer.RendererClickHandler;
import com.vaadin.shared.ui.Connect;
@@ -48,4 +49,10 @@ public class ButtonRendererConnector
public ButtonRendererState getState() {
return (ButtonRendererState) super.getState();
}
+
+ @Override
+ public void onStateChanged(StateChangeEvent stateChangeEvent) {
+ super.onStateChanged(stateChangeEvent);
+ getRenderer().setHtmlContentAllowed(getState().htmlContentAllowed);
+ }
}
diff --git a/client/src/main/java/com/vaadin/client/renderers/ButtonRenderer.java b/client/src/main/java/com/vaadin/client/renderers/ButtonRenderer.java
index 3c4560ff36..09d388dd93 100644
--- a/client/src/main/java/com/vaadin/client/renderers/ButtonRenderer.java
+++ b/client/src/main/java/com/vaadin/client/renderers/ButtonRenderer.java
@@ -29,6 +29,8 @@ import com.vaadin.client.widget.grid.RendererCellReference;
*/
public class ButtonRenderer extends ClickableRenderer<String, Button> {
+ private boolean htmlContentAllowed = false;
+
@Override
public Button createWidget() {
Button b = GWT.create(Button.class);
@@ -37,8 +39,20 @@ public class ButtonRenderer extends ClickableRenderer<String, Button> {
return b;
}
+ public void setHtmlContentAllowed(boolean htmlContentAllowed) {
+ this.htmlContentAllowed = htmlContentAllowed;
+ }
+
+ public boolean isHtmlContentAllowed() {
+ return htmlContentAllowed;
+ }
+
@Override
public void render(RendererCellReference cell, String text, Button button) {
- button.setText(text);
+ if (htmlContentAllowed) {
+ button.setHTML(text);
+ } else {
+ button.setText(text);
+ }
}
}