]> source.dussan.org Git - vaadin-framework.git/commitdiff
fixes #1654
authorMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 15 May 2008 15:41:47 +0000 (15:41 +0000)
committerMatti Tahvonen <matti.tahvonen@itmill.com>
Thu, 15 May 2008 15:41:47 +0000 (15:41 +0000)
svn changeset:4513/svn branch:trunk

WebContent/ITMILL/themes/default/common/common.css
WebContent/ITMILL/themes/default/styles.css
src/com/itmill/toolkit/terminal/gwt/client/Caption.java

index 9edf777b0e2bd1f16aa7742879cab61ebe853875..55f2a78b086c3ed891107dfb43a3dc66f9c9c89a 100644 (file)
        filter: Alpha(opacity=30);
 }
 
-
+.i-required-field-indicator {
+       padding-left:2px;
+       color: red;
+}
 
 /**
  * Context menu styles 
index 98466629747d6e40bca4d6ee558a2887ecd3d653..c8454d72182eae789189bb1480ff5d700f45d96b 100644 (file)
        filter: Alpha(opacity=30);
 }
 
-
+.i-required-field-indicator {
+       padding-left:2px;
+       color: red;
+}
 
 /**
  * Context menu styles 
index e303cccae3c6c890a4c33a6925a3edcfcd197dd0..b9ea6afdbdc9067c8184dcc5fc079181083f6324 100644 (file)
@@ -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...