Package org.apache.wicket.markup.html.internal

Examples of org.apache.wicket.markup.html.internal.HtmlHeaderContainer


   */
  private void validateHeaders()
  {
    // search for HtmlHeaderContainer in the first level of children or deeper
    // if there are transparent resolvers used
    HtmlHeaderContainer header = visitChildren(new IVisitor<Component, HtmlHeaderContainer>()
    {
      @Override
      public void component(final Component component, final IVisit<HtmlHeaderContainer> visit)
      {
        if (component instanceof HtmlHeaderContainer)
        {
          visit.stop((HtmlHeaderContainer)component);
        }
        else if (component instanceof TransparentWebMarkupContainer == false)
        {
          visit.dontGoDeeper();
        }
      }
    });

    if (header == null)
    {
      // the markup must at least contain a <body> tag for wicket to automatically
      // create a HtmlHeaderContainer. Log an error if no header container
      // was created but any of the components or behaviors want to contribute
      // something to the header.
      header = new HtmlHeaderContainer(HtmlHeaderSectionHandler.HEADER_ID);
      add(header);

      Response orgResponse = getRequestCycle().getResponse();
      try
      {
View Full Code Here


   */
  private void validateHeaders()
  {
    // search for HtmlHeaderContainer in the first level of children or deeper
    // if there are transparent resolvers used
    HtmlHeaderContainer header = visitChildren(new IVisitor<Component, HtmlHeaderContainer>()
    {
      @Override
      public void component(final Component component, final IVisit<HtmlHeaderContainer> visit)
      {
        if (component instanceof HtmlHeaderContainer)
        {
          visit.stop((HtmlHeaderContainer)component);
        }
        else if (component instanceof TransparentWebMarkupContainer == false)
        {
          visit.dontGoDeeper();
        }
      }
    });

    if (header == null)
    {
      // the markup must at least contain a <body> tag for wicket to automatically
      // create a HtmlHeaderContainer. Log an error if no header container
      // was created but any of the components or behaviors want to contribute
      // something to the header.
      header = new HtmlHeaderContainer(HtmlHeaderSectionHandler.HEADER_ID);
      add(header);

      Response orgResponse = getRequestCycle().getResponse();
      try
      {
View Full Code Here

      // If we found <wicket:head> without surrounding <head> on a Page,
      // then we have to add wicket:head into a automatically generated
      // head first.
      if (container instanceof WebPage)
      {
        HtmlHeaderContainer header = container.visitChildren(new IVisitor<Component, HtmlHeaderContainer>()
        {
          @Override
          public void component(final Component component, final IVisit<HtmlHeaderContainer> visit)
          {
            if (component instanceof HtmlHeaderContainer)
            {
              visit.stop((HtmlHeaderContainer) component);
            } else if (component instanceof TransparentWebMarkupContainer == false)
            {
              visit.dontGoDeeper();
            }
          }
        });

        // It is <wicket:head>. Because they do not provide any
        // additional functionality they are merely a means of surrounding relevant
        // markup. Thus we simply create a WebMarkupContainer to handle
        // the tag.
        WebMarkupContainer wicketHeadContainer = new WicketHeadContainer();

        if (header == null)
        {
          // Create a special header component which will gather
          // additional input the <head> from 'contributors'.
          header = newHtmlHeaderContainer(HtmlHeaderSectionHandler.HEADER_ID +
            page.getAutoIndex(), tag);
          header.add(wicketHeadContainer);
          return header;
        }

        header.add(wicketHeadContainer);
        return wicketHeadContainer;
      }
      else if (container instanceof HtmlHeaderContainer)
      {
        // It is <wicket:head>. Because they do not provide any
View Full Code Here

   * @deprecated Use #newHtmlHeaderContainer(String, ComponentTag) instead
   */
  @Deprecated
  protected HtmlHeaderContainer newHtmlHeaderContainer(String id)
  {
    return new HtmlHeaderContainer(id);
  }
View Full Code Here

   * @param id
   * @return HtmlHeaderContainer
   */
  protected HtmlHeaderContainer newHtmlHeaderContainer(String id, ComponentTag tag)
  {
    HtmlHeaderContainer htmlHeaderContainer;
    if (HtmlHeaderResolver.HEADER_ITEMS.equalsIgnoreCase(tag.getName()))
    {
      htmlHeaderContainer = new HtmlHeaderItemsContainer(id);
    }
    else
View Full Code Here

   * Validate that each component which wanted to contribute to the header section actually was
   * able to do so.
   */
  private void validateHeaders()
  {
    HtmlHeaderContainer header = visitChildren(new IVisitor<Component, HtmlHeaderContainer>()
    {
      public void component(final Component component, final IVisit<HtmlHeaderContainer> visit)
      {
        if (component instanceof HtmlHeaderContainer)
        {
          visit.stop((HtmlHeaderContainer)component);
        }
        else
        {
          visit.dontGoDeeper();
        }
      }
    });

    if (header == null)
    {
      // the markup must at least contain a <body> tag for wicket to automatically
      // create a HtmlHeaderContainer. Log an error if no header container
      // was created but any of the components or behaviors want to contribute
      // something to the header.
      header = new HtmlHeaderContainer(HtmlHeaderSectionHandler.HEADER_ID);
      add(header);

      Response orgResponse = getRequestCycle().getResponse();
      try
      {
View Full Code Here

   * @param id
   * @return HtmlHeaderContainer
   */
  protected HtmlHeaderContainer newHtmlHeaderContainer(String id)
  {
    return new HtmlHeaderContainer(id);
  }
View Full Code Here

   * Validate that each component which wanted to contribute to the header section actually was
   * able to do so.
   */
  private void validateHeaders()
  {
    HtmlHeaderContainer header = visitChildren(new IVisitor<Component, HtmlHeaderContainer>()
    {
      public void component(final Component component, final IVisit<HtmlHeaderContainer> visit)
      {
        if (component instanceof HtmlHeaderContainer)
        {
          visit.stop((HtmlHeaderContainer)component);
        }
        else
        {
          visit.dontGoDeeper();
        }
      }
    });

    if (header == null)
    {
      // the markup must at least contain a <body> tag for wicket to automatically
      // create a HtmlHeaderContainer. Log an error if no header container
      // was created but any of the components or behaviors want to contribute
      // something to the header.
      header = new HtmlHeaderContainer(HtmlHeaderSectionHandler.HEADER_ID);
      add(header);

      Response orgResponse = getRequestCycle().getResponse();
      try
      {
        final StringResponse response = new StringResponse();
        getRequestCycle().setResponse(response);

        // Render all header sections of all components on the page
        renderHead(header);

        // Make sure all Components interested in contributing to the header
        // and there attached behaviors are asked.
        final HtmlHeaderContainer finalHeader = header;
        visitChildren(new IVisitor<Component, Void>()
        {
          /**
           * @see org.apache.wicket.IVisitor#component(org.apache.wicket.Component)
           */
 
View Full Code Here

    // Only <head> component tags have the id == "_header"
    if (tag.getId().equals(HtmlHeaderSectionHandler.HEADER_ID))
    {
      // Create a special header component which will gather additional
      // input the <head> from 'contributors'.
      final WebMarkupContainer header = new HtmlHeaderContainer(
        HtmlHeaderSectionHandler.HEADER_ID + container.getPage().getAutoIndex());
      container.autoAdd(header, markupStream);

      // Yes, we handled the tag
      return true;
    }
    else if ((tag instanceof WicketTag) && ((WicketTag)tag).isHeadTag())
    {
      // If we found <wicket:head> without surrounding <head> on a Page,
      // than we have to add wicket:head into a automatically generated
      // head first.
      if (container instanceof WebPage)
      {
        // Create a special header component which will gather
        // additional input the <head> from 'contributors'.
        final MarkupContainer header = new HtmlHeaderContainer(
          HtmlHeaderSectionHandler.HEADER_ID + container.getPage().getAutoIndex());

        // It is <wicket:head>. Because they do not provide any
        // additional functionality they are merely a means of surrounding relevant
        // markup. Thus we simply create a WebMarkupContainer to handle
        // the tag.
        final WebMarkupContainer header2 = new WebMarkupContainer(
          HtmlHeaderSectionHandler.HEADER_ID)
        {
          private static final long serialVersionUID = 1L;

          public boolean isTransparentResolver()
          {
            return true;
          }
        };

        header2.setRenderBodyOnly(true);

        header.add(header2);

        container.autoAdd(header, markupStream);
      }
      else if (container instanceof HtmlHeaderContainer)
      {
        // It is <wicket:head>. Because they do not provide any
        // additional functionality there are merely a means of surrounding
        // relevant markup. Thus we simply create a WebMarkupContainer to handle
        // the tag.
        final WebMarkupContainer header = new WebMarkupContainer(
          HtmlHeaderSectionHandler.HEADER_ID)
        {
          private static final long serialVersionUID = 1L;

          public boolean isTransparentResolver()
          {
            return true;
          }
        };
        header.setRenderBodyOnly(true);

        try
        {
          container.autoAdd(header, markupStream);
        }
View Full Code Here

  protected void onAfterRender()
  {
    super.onAfterRender();
    if (Application.DEVELOPMENT.equals(getApplication().getConfigurationType()))
    {
      HtmlHeaderContainer header = (HtmlHeaderContainer)visitChildren(new IVisitor()
      {
        public Object component(Component component)
        {
          if (component instanceof HtmlHeaderContainer)
          {
            return component;
          }
          return IVisitor.CONTINUE_TRAVERSAL;
        }
      });
      if (header == null)
      {
        // the markup must at least contain a <body> tag for wicket to automatically
        // create a HtmlHeaderContainer. Log an error if no header container
        // was created but any of the components or behavior want to contribute
        // something to the header.
        header = new HtmlHeaderContainer(HtmlHeaderSectionHandler.HEADER_ID);
        add(header);

        Response orgResponse = getRequestCycle().getResponse();
        try
        {
          final StringResponse response = new StringResponse();
          getRequestCycle().setResponse(response);

          // Render all header sections of all components on the page
          renderHead(header);

          // Make sure all Components interested in contributing to the header
          // and there attached behaviors are asked.
          final HtmlHeaderContainer finalHeader = header;
          visitChildren(new IVisitor()
          {
            /**
             * @see org.apache.wicket.Component.IVisitor#component(org.apache.wicket.Component)
             */
 
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.html.internal.HtmlHeaderContainer

Copyright © 2018 www.massapicom. 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.