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

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


    // 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;

          @Override
          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;

          @Override
          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<Component>()
      {
        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<Component>()
          {
            /**
             * @see org.apache.wicket.Component.IVisitor#component(org.apache.wicket.Component)
             */
 
View Full Code Here

  protected void onAfterRender()
  {
    super.onAfterRender();
    if (getApplication().getConfigurationType() == Application.DEVELOPMENT)
    {
      HtmlHeaderContainer header = (HtmlHeaderContainer)visitChildren(new IVisitor()
      {
        public Object component(Component component)
        {
          if (component instanceof HtmlHeaderContainer)
          {
            return component;
          }
          return IVisitor.CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
        }
      });
      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

    // 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.autoAdd(header);

      // 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);
       
        // 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);
        }
        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);
        }
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 = (HtmlHeaderContainer)visitChildren(new IVisitor<Component>()
    {
      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 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>()
        {
          /**
           * @see org.apache.wicket.Component.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;

          @Override
          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;

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

        try
        {
          container.autoAdd(header, markupStream);
        }
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>()
    {
      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

    // 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

    // header.onEndRequest() is executed inside an iterator
    // and you can only call container.remove() which
    // is != iter.remove(). And the iterator is not available
    // inside onEndRequest(). Obviously WebPage.onEndRequest()
    // is invoked outside the iterator loop.
    HtmlHeaderContainer header = (HtmlHeaderContainer)get(HtmlHeaderSectionHandler.HEADER_ID);
    if (header != null)
    {
      this.remove(header);
    }
    else if (getApplication().getConfigurationType() == Application.DEVELOPMENT)
    {
      // 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

   * @param id
   * @return HtmlHeaderContainer
   */
  protected HtmlHeaderContainer newHtmlHeaderContainer(String id)
  {
    return new HtmlHeaderContainer(id);
  }
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.