]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed #1022 , at least for all layouts that use caption (wrapper) when handling gener...
authorJani Laakso <jani.laakso@itmill.com>
Sun, 21 Oct 2007 12:43:56 +0000 (12:43 +0000)
committerJani Laakso <jani.laakso@itmill.com>
Sun, 21 Oct 2007 12:43:56 +0000 (12:43 +0000)
svn changeset:2565/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/client/Caption.java

index c16db41e58de27b73cf2f606efcb7375c80cd216..7a5887cd93f83dcdcf81dcbe98990822a9a0e0e8 100644 (file)
@@ -14,6 +14,8 @@ public class Caption extends HTML {
 
        private Element errorIndicatorElement;
 
+       private Element icon;
+
        private Element captionText;
 
        private ErrorMessage errorMessage;
@@ -50,12 +52,26 @@ public class Caption extends HTML {
                        DOM.setStyleAttribute(errorIndicatorElement, "display", "none");
                }
 
+               if (uidl.hasAttribute("icon")) {
+                       if (icon == null) {
+                               icon = DOM.createImg();
+                               DOM.appendChild(getElement(), icon);
+                       }
+                       DOM.setElementAttribute(icon, "src", uidl
+                                       .getStringAttribute("icon"));
+               } else {
+                       if (icon != null)
+                               DOM.removeChild(getElement(), icon);
+               }
+
                if (uidl.hasAttribute("caption")) {
                        if (captionText == null) {
                                captionText = DOM.createSpan();
                                DOM.appendChild(getElement(), captionText);
                        }
                        DOM.setInnerText(captionText, uidl.getStringAttribute("caption"));
+               } else {
+                       // TODO should span also be removed
                }
 
                if (uidl.hasAttribute("description")) {