From ee4013ff918754d0e3f60092d251f6db65bb7dea Mon Sep 17 00:00:00 2001 From: Matti Tahvonen Date: Thu, 15 May 2008 15:41:47 +0000 Subject: [PATCH] fixes #1654 svn changeset:4513/svn branch:trunk --- .../ITMILL/themes/default/common/common.css | 5 ++++- WebContent/ITMILL/themes/default/styles.css | 5 ++++- .../toolkit/terminal/gwt/client/Caption.java | 17 +++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/WebContent/ITMILL/themes/default/common/common.css b/WebContent/ITMILL/themes/default/common/common.css index 9edf777b0e..55f2a78b08 100644 --- a/WebContent/ITMILL/themes/default/common/common.css +++ b/WebContent/ITMILL/themes/default/common/common.css @@ -49,7 +49,10 @@ filter: Alpha(opacity=30); } - +.i-required-field-indicator { + padding-left:2px; + color: red; +} /** * Context menu styles diff --git a/WebContent/ITMILL/themes/default/styles.css b/WebContent/ITMILL/themes/default/styles.css index 9846662974..c8454d7218 100644 --- a/WebContent/ITMILL/themes/default/styles.css +++ b/WebContent/ITMILL/themes/default/styles.css @@ -127,7 +127,10 @@ filter: Alpha(opacity=30); } - +.i-required-field-indicator { + padding-left:2px; + color: red; +} /** * Context menu styles diff --git a/src/com/itmill/toolkit/terminal/gwt/client/Caption.java b/src/com/itmill/toolkit/terminal/gwt/client/Caption.java index e303cccae3..b9ea6afdbd 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/Caption.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/Caption.java @@ -18,6 +18,8 @@ public class Caption extends HTML { private Element errorIndicatorElement; + private Element requiredFieldIndicator; + private Icon icon; private Element captionText; @@ -107,6 +109,21 @@ public class Caption extends HTML { setTitle(uidl.getStringAttribute("description")); } } + + if (uidl.getBooleanAttribute("required")) { + if (requiredFieldIndicator == null) { + requiredFieldIndicator = DOM.createSpan(); + DOM.setInnerText(requiredFieldIndicator, "*"); + DOM.setElementProperty(requiredFieldIndicator, "className", + "i-required-field-indicator"); + DOM.appendChild(getElement(), requiredFieldIndicator); + } + } else { + if (requiredFieldIndicator != null) { + DOM.removeChild(getElement(), requiredFieldIndicator); + } + } + // Workaround for IE weirdness, sometimes returns bad height in some // circumstances when Caption is empty. See #1444 // IE7 bugs more often. I wonder what happens when IE8 arrives... -- 2.39.5