Examples of HeadElement


Examples of com.google.gwt.dom.client.HeadElement

      public String resolveURL(String s) {
         return intrinsics.getCachedUrl(s);
      }
    });
   
    final HeadElement he = HeadElement.as(Document.get().getElementsByTagName("head").getItem(0));
    StyleElement se = Document.get().createStyleElement();
    se.setAttribute("href", "Chronoscope.css");
    se.setAttribute("src", "Chronoscope.css");
    he.appendChild(se);
   
    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
      public void onUncaughtException(Throwable e) {
        RootPanel.get()
            .add(new Label("There was an error parsing the spreadsheet data."));
View Full Code Here

Examples of com.google.gwt.dom.client.HeadElement

    if (!injectedLoader) {
      final ScriptElement se = Document.get().createScriptElement();
//      se.setSrc(intrinsics.getCachedUrl("http://www.google.com/jsapi?callback=" + JSAPI_CALLBACK));
      se.setSrc("http://www.google.com/jsapi?callback=" + JSAPI_CALLBACK);
     
      final HeadElement he = HeadElement.as(Document.get().getElementsByTagName("head").getItem(0));
      exportHandler(new Command() {

        public void execute() {
          injectedLoader=true;
          he.removeChild(se);
          nativeLoad(libName, version, callback);
        }
      });
    
      he.appendChild(se);
    } else {
      nativeLoad(libName, version, callback);
    }
  }
View Full Code Here

Examples of com.google.gwt.dom.client.HeadElement

   }
  
   private static void injectJavascript(String source)
   {
      Document doc = Document.get();
      HeadElement head = (HeadElement) doc.getElementsByTagName("head").getItem(0);
      if (head == null)
      {
         head = doc.createHeadElement();
         doc.insertBefore(head, doc.getBody());
      }
      ScriptElement script = doc.createScriptElement(
            source);
      script.setType("text/javascript");
      head.appendChild(script);
   }
View Full Code Here

Examples of com.google.gwt.dom.client.HeadElement

    private static HeadElement head;

    public static void inject( String javascript )
    {
        HeadElement head = getHead();
        ScriptElement element = createScriptElement();
        element.setText( javascript );
        head.appendChild( element );
    }
View Full Code Here

Examples of com.google.gwt.dom.client.HeadElement

    {
        if ( head == null )
        {
            Element element = Document.get().getElementsByTagName( "head" ).getItem( 0 );
            assert element != null : "HTML Head element required";
            HeadElement head = HeadElement.as( element );
            JavaScriptInjector.head = head;
        }
        return JavaScriptInjector.head;
    }
View Full Code Here

Examples of com.google.gwt.dom.client.HeadElement

        // "_rtl.css");
        // }

        // Find existing style sheets that need to be removed
        boolean styleSheetsFound = false;
        final HeadElement headElem = StyleSheetLoader.getHeadElement();
        final List<Element> toRemove = new ArrayList<Element>();
        NodeList<Node> children = headElem.getChildNodes();
        for (int i = 0; i < children.getLength(); i++) {
            Node node = children.getItem(i);
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                Element elem = Element.as(node);
                if (elem.getTagName().equalsIgnoreCase("link")
                        && elem.getPropertyString("rel").equalsIgnoreCase("stylesheet")) {
                    styleSheetsFound = true;
                    String href = elem.getPropertyString("href");
                    // If the correct style sheets are already loaded, then we
                    // should have nothing to remove.
                    // if (!href.contains(gwtStyleSheet) &&
                    // !href.contains(showcaseStyleSheet)) {
                    if (!href.contains(gwtStyleSheet)) {
                        toRemove.add(elem);
                    }
                }
            }
        }

        if (styleSheetsFound && toRemove.size() == 0) {
            GenClient.showError("Return since we already have the correct style sheets");
            return;
        }

        // Detach the app while we manipulate the styles to avoid rendering
        // issues
        RootPanel.get().remove(vPanel);

        // Remove the old style sheets
        for (Element elem : toRemove) {
            headElem.removeChild(elem);
        }

        // Load the GWT theme style sheet
        String modulePath = GWT.getModuleBaseURL();
        Command callback = new Command() {
View Full Code Here

Examples of com.google.gwt.dom.client.HeadElement

    }
  }-*/;

  private static void injectStyles(IFrameElement sourceFrame, String styleText) {
    Document iframeDocument = sourceFrame.getContentDocument();
    HeadElement head = iframeDocument.getElementsByTagName("head").getItem(0).cast();
    StyleElement styleTag = iframeDocument.createStyleElement();
    styleTag.setInnerText(styleText);
    head.appendChild(styleTag);
  }
View Full Code Here

Examples of com.google.gwt.dom.client.HeadElement

    private JsInjector() {

    }

    public static void intject(String javaScript) {
        HeadElement head = getHead();
        ScriptElement element = createScriptElement();
        element.setText(javaScript);
        head.appendChild(element);
    }
View Full Code Here

Examples of com.google.gwt.dom.client.HeadElement

    private static HeadElement getHead() {
        if (head == null) {
            Element element = Document.get().getElementsByTagName("head").getItem(0);
            assert element != null : "HTML Head element required";
            HeadElement headElement = HeadElement.as(element);
            head = headElement;
        }
        return head;
    }
View Full Code Here

Examples of com.google.gwt.dom.client.HeadElement

      showcaseStyleSheet = showcaseStyleSheet.replace(".css", "_rtl.css");
    }

    // Find existing style sheets that need to be removed
    boolean styleSheetsFound = false;
    final HeadElement headElem = StyleSheetLoader.getHeadElement();
    final List<Element> toRemove = new ArrayList<Element>();
    NodeList<Node> children = headElem.getChildNodes();
    for (int i = 0; i < children.getLength(); i++) {
      Node node = children.getItem(i);
      if (node.getNodeType() == Node.ELEMENT_NODE) {
        Element elem = Element.as(node);
        if (elem.getTagName().equalsIgnoreCase("link")
            && elem.getPropertyString("rel").equalsIgnoreCase("stylesheet")) {
          styleSheetsFound = true;
          String href = elem.getPropertyString("href");
          // If the correct style sheets are already loaded, then we should have
          // nothing to remove.
          if (!href.contains(gwtStyleSheet)
              && !href.contains(showcaseStyleSheet)) {
            toRemove.add(elem);
          }
        }
      }
    }

    // Return if we already have the correct style sheets
    if (styleSheetsFound && toRemove.size() == 0) {
      return;
    }

    // Detach the app while we manipulate the styles to avoid rendering issues
    RootPanel.get().remove(app);

    // Remove the old style sheets
    for (Element elem : toRemove) {
      headElem.removeChild(elem);
    }

    // Load the GWT theme style sheet
    String modulePath = GWT.getModuleBaseURL();
    Command callback = new Command() {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.