]> source.dussan.org Git - vaadin-framework.git/commitdiff
Window (caption) can have icon (fixes #1761)
authorMarc Englund <marc.englund@itmill.com>
Wed, 11 Jun 2008 08:39:57 +0000 (08:39 +0000)
committerMarc Englund <marc.englund@itmill.com>
Wed, 11 Jun 2008 08:39:57 +0000 (08:39 +0000)
svn changeset:4855/svn branch:trunk

WebContent/ITMILL/themes/default/styles.css
WebContent/ITMILL/themes/default/window/window.css
src/com/itmill/toolkit/terminal/gwt/client/ui/IWindow.java

index 60616baa7688a81daea01b3eadb8c938ad245bbd..85397ac5a67ef1a5adf9bee8d9c0716f4a6a6758 100644 (file)
@@ -1854,6 +1854,11 @@ input.i-modified,
        overflow:hidden;
 }
 
+.i-window-header .i-icon {
+       vertical-align: bottom;
+}
+
+
 .i-window-outerheader:before {
        display: block;
        content: "";
index 25d2ae3bf6176f39682363e947a5b9c23433ead9..8ca85ac7273380fe367b25242524dd4960c97459 100644 (file)
        overflow:hidden;
 }
 
+.i-window-header .i-icon {
+       vertical-align: bottom;
+}
+
+
 .i-window-outerheader:before {
        display: block;
        content: "";
index 1df4f0f68360be3588a75641302dc40ddbf13229..420719d5d186d63bbb52bb07a6ed1d3e25b3c75e 100644 (file)
@@ -253,7 +253,8 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
         }
 
         if (uidl.hasAttribute("caption")) {
-            setCaption(uidl.getStringAttribute("caption"));
+            setCaption(uidl.getStringAttribute("caption"), uidl
+                    .getStringAttribute("icon"));
         }
 
         boolean showingUrl = false;
@@ -472,7 +473,16 @@ public class IWindow extends PopupPanel implements Paintable, ScrollListener {
     }
 
     public void setCaption(String c) {
-        DOM.setInnerText(headerText, c);
+        setCaption(c, null);
+    }
+
+    public void setCaption(String c, String icon) {
+        String html = c;
+        if (icon != null) {
+            icon = client.translateToolkitUri(icon);
+            html = "<img src=\"" + icon + "\" class=\"i-icon\" />" + html;
+        }
+        DOM.setInnerHTML(headerText, html);
     }
 
     protected Element getContainerElement() {