List of usage examples for com.google.gwt.dom.client LinkElement setRel
public void setRel(String rel)
From source file:cc.kune.common.client.utils.CSSUtils.java
License:GNU Affero Public License
/** * Sets the css./*w ww .ja v a 2 s . c o m*/ * * @param cssUrl the css url * @return the link element */ public static LinkElement setCss(final String cssUrl) { final Element head = Document.get().getElementsByTagName("head").getItem(0); final LinkElement link = Document.get().createLinkElement(); link.setType("text/css"); link.setRel("stylesheet"); link.setHref(cssUrl); link.setMedia("screen"); link.setTitle("dynamicLoadedSheet"); head.insertAfter(head.getLastChild(), link); // you can use removeFromParent return link; }
From source file:cc.kune.core.client.i18n.I18nStyles.java
License:GNU Affero Public License
/** * Load a style sheet onto the page.//from w w w . ja v a 2s .c o m * * @param href * the url of the style sheet */ private static void loadStyleSheet(final String href) { final LinkElement linkElem = Document.get().createLinkElement(); linkElem.setRel("stylesheet"); linkElem.setType("text/css"); linkElem.setHref(href); getHeadElement().appendChild(linkElem); }
From source file:ch.unifr.pai.twice.layout.client.mobile.MobileUtils.java
License:Apache License
/** * Add necessary html tags to ensure unified initial zoom levels of the web page, fullscreen establishment and add proprietary tags (e.g. * "apple-mobile-web-app-capable" for extended functionalities). * //from ww w .j a va 2 s. c o m * The main purpose is to establish a "native" look of the application even within the boundaries of the web browser. */ public static void preparePage() { RootPanel.getBodyElement().getStyle().setHeight(100, Unit.PCT); RootPanel.getBodyElement().getStyle().setOverflow(Overflow.HIDDEN); RootPanel.getBodyElement().getStyle().setMargin(0, Unit.PX); RootPanel.getBodyElement().getStyle().setPadding(0, Unit.PX); Document.get().getDocumentElement().getStyle().setProperty("minHeight", "300px"); Document.get().getDocumentElement().getStyle().setHeight(100, Unit.PCT); NodeList<Element> tags = Document.get().getElementsByTagName("head"); Element head; if (tags.getLength() > 0) { head = tags.getItem(0); } else { head = DOM.createElement("head"); Document.get().insertFirst(head); } Element meta = DOM.createElement("meta"); meta.setAttribute("name", "viewport"); meta.setAttribute("content", "width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"); head.appendChild(meta); LinkElement e = Document.get().createLinkElement(); e.setRel("stylesheet"); e.setHref(GWT.getModuleBaseURL() + "master.css"); head.appendChild(e); Element iphoneFullscreen = DOM.createElement("meta"); iphoneFullscreen.setAttribute("name", "apple-touch-fullscreen"); iphoneFullscreen.setAttribute("content", "yes"); head.appendChild(iphoneFullscreen); Element iphoneWebAppCapable = DOM.createElement("meta"); iphoneWebAppCapable.setAttribute("name", "apple-mobile-web-app-capable"); iphoneWebAppCapable.setAttribute("content", "yes"); head.appendChild(iphoneWebAppCapable); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { Window.scrollTo(0, 1); } }); }
From source file:cing.client.StyleSheetLoader.java
License:Apache License
/** * Load a style sheet onto the page.//from ww w . ja v a2 s.co m * * @param href * the url of the style sheet */ public static void loadStyleSheet(String href) { LinkElement linkElem = Document.get().createLinkElement(); linkElem.setRel("stylesheet"); linkElem.setType("text/css"); linkElem.setHref(href); getHeadElement().appendChild(linkElem); }
From source file:com.ait.ext4j.client.util.CSS.java
License:Apache License
private static LinkElement createLinkElement() { LinkElement link = Document.get().createLinkElement(); link.setRel("stylesheet"); link.setType("text/css"); return link;/* w ww. ja va2 s. co m*/ }
From source file:com.ait.toolkit.core.client.CSSUtil.java
License:Open Source License
private static LinkElement createLinkElement() { LinkElement link = Document.get().createLinkElement(); link.setRel("stylesheet"); link.setType("text/css"); return link;// www. jav a 2 s. co m }
From source file:com.dingziran.effective.client.Showcase.java
License:Apache License
/** * Inject the GWT theme style sheet based on the RTL direction of the current * locale./*from ww w. java 2 s . com*/ */ private void injectThemeStyleSheet() { // Choose the name style sheet based on the locale. String styleSheet = "gwt/" + THEME + "/" + THEME; styleSheet += LocaleInfo.getCurrentLocale().isRTL() ? "_rtl.css" : ".css"; // Load the GWT theme style sheet String modulePath = GWT.getModuleBaseURL(); LinkElement linkElem = Document.get().createLinkElement(); linkElem.setRel("stylesheet"); linkElem.setType("text/css"); linkElem.setHref(modulePath + styleSheet); getHeadElement().appendChild(linkElem); }
From source file:com.dotweblabs.friendscube.app.client.local.util.CssHelper.java
License:Apache License
/** Load CSS file from url */ public static void loadCss(String url) { LinkElement link = Document.get().createLinkElement(); link.setRel("stylesheet"); link.setHref(url);// w w w . j a v a 2s . c om nativeAttachToHead(link); styles.put(url, link); }
From source file:com.emitrom.pilot.core.formfactor.client.ResourceInjector.java
License:Apache License
/** * Loads a css file base on the file url * // w ww . j a v a2 s .com * @param url * , url of the file to load */ public void loadCss(String url) { LinkElement link = Document.get().createLinkElement(); link.setRel("stylesheet"); link.setHref(url); attachToHead(link); }
From source file:com.github.gwtbootstrap.client.ui.resources.ResourceInjector.java
License:Apache License
/** * Inject public resource css file as a file. * @param filename inject file name/*from w w w.ja v a 2s. c o m*/ */ public static void injectResourceCssAsFile(String filename) { LinkElement link = Document.get().createLinkElement(); link.setType("text/css"); link.setRel("stylesheet"); link.setHref(GWT.getModuleName() + "/css/" + filename); getHead().appendChild(link); }