001/*
002 *  Copyright 2012 GWT-Bootstrap
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package com.github.gwtbootstrap.client.ui.resources;
017
018import com.google.gwt.dom.client.Document;
019import com.google.gwt.dom.client.HeadElement;
020import com.google.gwt.dom.client.MetaElement;
021
022/**
023 * Methods to put a meta tag into the document header.
024 * 
025 * @since 2.0.4.0
026 * 
027 * @author Dominik Mayer
028 * 
029 */
030public class MetaInjector extends AbstractInjector {
031
032        /**
033         * Puts a meta tag with the given name and content into the document header.
034         * 
035         * @param name
036         *            the value of the {@code name} attribute.
037         * @param content
038         *            the value of the {@code content} attribute.
039         */
040        public static void inject(String name, String content) {
041                HeadElement head = getHead();
042                MetaElement element = createMetaElement();
043                element.setName(name);
044                element.setContent(content);
045                head.appendChild(element);
046        }
047
048        private static MetaElement createMetaElement() {
049                return Document.get().createMetaElement();
050        }
051}