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

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


   * 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


   * 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

   * 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

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

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

   * 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

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