From 48dfead0f1f0c80eab9999077c9d2c8997b3481f Mon Sep 17 00:00:00 2001 From: Yuriy Artamonov Date: Fri, 10 Apr 2015 09:45:41 +0000 Subject: [PATCH] Style "empty-caption" for button without caption #PL-5218 --- .../ui/client/button/CubaButtonWidget.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/web-toolkit/src/com/haulmont/cuba/web/toolkit/ui/client/button/CubaButtonWidget.java b/modules/web-toolkit/src/com/haulmont/cuba/web/toolkit/ui/client/button/CubaButtonWidget.java index 6c1543b63b..c17cb1f8cc 100644 --- a/modules/web-toolkit/src/com/haulmont/cuba/web/toolkit/ui/client/button/CubaButtonWidget.java +++ b/modules/web-toolkit/src/com/haulmont/cuba/web/toolkit/ui/client/button/CubaButtonWidget.java @@ -18,6 +18,10 @@ import com.vaadin.client.ui.VButton; */ public class CubaButtonWidget extends VButton { + public CubaButtonWidget() { + addStyleDependentName("empty-caption"); + } + @Override public void onClick(ClickEvent event) { if (BrowserInfo.get().isIE() && BrowserInfo.get().getIEVersion() >= 11) { @@ -28,6 +32,17 @@ public class CubaButtonWidget extends VButton { super.onClick(event); } + @Override + public void setText(String text) { + if (text == null || "".equals(text)) { + addStyleDependentName("empty-caption"); + } else { + removeStyleDependentName("empty-caption"); + } + + super.setText(text); + } + @Override protected boolean handleKeyboardEvents(Event event) { int type = DOM.eventGetType(event);