[kune-commits] r1403 - kune-sandbox/src/cc/kune/sandbox/client

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Mon Jun 13 18:17:20 CEST 2011


Author: vjrj_
Date: 2011-06-13 18:17:19 +0200 (Mon, 13 Jun 2011)
New Revision: 1403

Added:
   kune-sandbox/src/cc/kune/sandbox/client/CSSBasicUtils.java
Log:
CSS basic utils

Added: kune-sandbox/src/cc/kune/sandbox/client/CSSBasicUtils.java
===================================================================
--- kune-sandbox/src/cc/kune/sandbox/client/CSSBasicUtils.java	                        (rev 0)
+++ kune-sandbox/src/cc/kune/sandbox/client/CSSBasicUtils.java	2011-06-13 16:17:19 UTC (rev 1403)
@@ -0,0 +1,29 @@
+package cc.kune.sandbox.client;
+
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.LinkElement;
+import com.google.gwt.dom.client.StyleElement;
+
+public class CSSBasicUtils {
+
+    private LinkElement currentLink;
+
+    public CSSBasicUtils() {
+    }
+
+    public void addCss(String cssUrl) {
+        Element head = Document.get().getElementsByTagName("head").getItem(0);
+        LinkElement link = Document.get().createLinkElement();
+        link.setType("text/css");
+        link.setRel("stylesheet");
+        link.setHref(cssUrl);
+        link.setMedia("screen");
+        link.setTitle("dynamicLoadedSheet");
+        head.appendChild(link);
+        if (currentLink != null)
+            currentLink.removeFromParent();
+        currentLink = link;
+    }
+
+}




More information about the kune-commits mailing list