All Implemented Interfaces:
Serializable, Iterable<Component>, IEventSink, IEventSource, IFeedbackContributor, IConverterLocator, IMetadataContext<Serializable,Component>, IHeaderContributor, IComponentResolver, IRequestableComponent, IHierarchical<Component>, IClusterable

public class HtmlTag extends TransparentWebMarkupContainer
A HtmlTag is a TransparentWebMarkupContainer that adds some attributes to the pages html tag. It will add a "lang" attribute, which value is provided by given locale, in a short form: Locale.ENGLISH = "en-en". Also it will add a "class" attribute that contains special css marker like active theme, browser identifier and a "no-js" flag which is used by modernizr to detect whether javascript is available or not.

Usage:


      class MyPage extends Page {
          public MyPage(PageParameters params) {
              // with chrome browser and bootstrap theme
              add(new HtmlTag("html-tag")); // <html lang="en-en" class="chrome22 bootstrap"
              // or with modernizr and different locale
              add(new HtmlTag("html-tag", Locale.GERMAN, true)); // <html lang="de-de" class="chrome22 bootstrap no-js"
              // or with an IE7
              add(new HtmlTag("html-tag", Locale.GERMAN, true)); // <html lang="de-de" class="ie7 lt-ie8 lt-ie9 bootstrap no-js"
          }
      }
 

      <!DOCTYPE html>
          <html wicket:id="html-tag">
              <head>
                  [...]
              </head>
 
Author:
miha
See Also:
  • Constructor Details

    • HtmlTag

      public HtmlTag(String markupId, Locale locale, boolean useModernizr)
      Construct.
      Parameters:
      markupId - The component' markup id
      locale - locale to use for "lang" attribute
      useModernizr - whether to use modernizr or not
    • HtmlTag

      public HtmlTag(String markupId, boolean useModernizr)
      Construct. Uses Locale.ENGLISH as default locale
      Parameters:
      markupId - the component id
      useModernizr - whether to use modernizr or not
    • HtmlTag

      public HtmlTag(String markupId, Locale locale)
      Construct. Doesn't add modernizr support.
      Parameters:
      markupId - the component id
      locale - locale to use for "lang" attribute
    • HtmlTag

      public HtmlTag(String markupId)
      Construct. Uses Locale.ENGLISH as default locale and doesn't add modernizr support.
      Parameters:
      markupId - the component id
  • Method Details