/**
   * Handle tag <head>
   *
   * @param tag
   */
  private void handleHeadTag(ComponentTag tag) {
    // we found <head>
    if (tag.isOpen()) {
      if (foundHead) {
        throw new MarkupException(
            new MarkupStream(markup),
            "Tag <head> is not allowed at this position (do you have multiple <head> tags in your markup?).");
      }

      foundHead = true;

      if (tag.getId() == null) {
        tag.setId(HEADER_ID);
        tag.setAutoComponentTag(true);
        tag.setModified(true);
      }
    } else if (tag.isClose()) {
      if (foundHeaderItemsTag) {
        // revert the settings from above
        ComponentTag headOpenTag = tag.getOpenTag();
        // change the id because it is special. See HtmlHeaderResolver
        headOpenTag.setId(HEADER_ID + "-Ignored");
        headOpenTag.setAutoComponentTag(false);
        headOpenTag.setModified(false);
        headOpenTag.setFlag(ComponentTag.RENDER_RAW, true);
      }

      foundClosingHead = true;
    }
  }
Esempio n. 2
0
 /** @param auto True, if wicket:id has been automatically created (internal component) */
 public void setAutoComponentTag(boolean auto) {
   setFlag(AUTO_COMPONENT, auto);
 }
Esempio n. 3
0
 /**
  * Sets ignore.
  *
  * @param ignore If true than MarkupParser will remove it from the markup
  */
 public void setIgnore(boolean ignore) {
   setFlag(IGNORE, ignore);
 }
Esempio n. 4
0
 /**
  * True if the HTML tag (e.g. br) has no close tag
  *
  * @param hasNoCloseTag
  */
 public void setHasNoCloseTag(boolean hasNoCloseTag) {
   setFlag(NO_CLOSE_TAG, hasNoCloseTag);
 }
Esempio n. 5
0
 /**
  * Manually mark the ComponentTag being modified. Flagging the tag being modified does not happen
  * automatically.
  *
  * @param modified
  */
 public final void setModified(final boolean modified) {
   setFlag(MODIFIED, modified);
 }
Esempio n. 6
0
 /**
  * If autolink is set to true, href attributes will automatically be converted into Wicket
  * bookmarkable URLs.
  *
  * @param autolink enable/disable automatic href conversion
  */
 public final void enableAutolink(final boolean autolink) {
   setFlag(AUTOLINK, autolink);
 }