Package org.apache.wicket.markup.head

Examples of org.apache.wicket.markup.head.IHeaderResponse


  }

  @Test
  public void shouldAddDefaultCssToResponse()
  {
    IHeaderResponse response = mock(IHeaderResponse.class);

    tooltip.renderHead(component, response);

    verify(response, times(1)).render(
      Mockito.eq(CssReferenceHeaderItem.forReference(tooltip.uiTooltipCss_1_10_3)));
View Full Code Here


  }

  @Test
  public void shouldAddCustomCssToResponse()
  {
    IHeaderResponse response = mock(IHeaderResponse.class);
    CssResourceReference customCssResourceReference = new CssResourceReference(
      JQueryUiTooltip.class, "test.css");

    tooltip.addCssResource(customCssResourceReference);
    tooltip.renderHead(component, response);
View Full Code Here

  @SuppressWarnings("static-access")
  @Test
  public void shouldAvoidAddingCssToResponseMultipleTimes()
  {
    IHeaderResponse response = mock(IHeaderResponse.class);
    CssResourceReference customCssResourceReference = new CssResourceReference(
      JQueryUiTooltip.class, "test.css");

    tooltip.renderHead(component, response);
    tooltip.addCssResource(customCssResourceReference);
View Full Code Here

  @SuppressWarnings("static-access")
  @Test
  public void shouldNotAddCssToResponse()
  {
    IHeaderResponse response = mock(IHeaderResponse.class);
    CssResourceReference customCssResourceReference = new CssResourceReference(
      JQueryUiTooltip.class, "test.css");

    tooltip.addCssResource(customCssResourceReference);
    tooltip.withoutCss();
View Full Code Here

  }

  @Test
  public void shouldBuildTheJQuerySelector()
  {
    IHeaderResponse response = mock(IHeaderResponse.class);

    tooltip.renderHead(component, response);

    verify(widget).buildJS("'#" + component.getMarkupId() + "'");
  }
View Full Code Here

      if (log.isDebugEnabled())
      {
        log.debug("renderHead: {}", toString(false));
      }

      IHeaderResponse response = container.getHeaderResponse();

      // Allow component to contribute
      if (response.wasRendered(this) == false)
      {
        StringResponse markupHeaderResponse = new StringResponse();
        Response oldResponse = getResponse();
        RequestCycle.get().setResponse(markupHeaderResponse);
        try
        {
          // Make sure the markup source strategy contributes to the header first
          // to be backward compatible. WICKET-3761
          getMarkupSourcingStrategy().renderHead(this, container);
          CharSequence headerContribution = markupHeaderResponse.getBuffer();
          if (Strings.isEmpty(headerContribution) == false)
          {
            response.render(StringHeaderItem.forString(headerContribution));
          }
        }
        finally
        {
          RequestCycle.get().setResponse(oldResponse);
        }
        // Then let the component itself to contribute to the header
        renderHead(this, response);

        response.markRendered(this);
      }

      // Than ask all behaviors
      for (Behavior behavior : getBehaviors())
      {
        if (isBehaviorAccepted(behavior))
        {
          if (response.wasRendered(behavior) == false)
          {
            behavior.renderHead(this, response);
            response.markRendered(behavior);
          }
        }
      }
    }
  }
View Full Code Here

   *            the response Wicket created
   * @return the response Wicket should use in IHeaderContributor traversal
   */
  public final IHeaderResponse decorateHeaderResponse(final IHeaderResponse response)
  {
    final IHeaderResponse aggregatingResponse = new ResourceAggregator(response);

    if (headerResponseDecorator == null)
    {
      return aggregatingResponse;
    }
View Full Code Here

      if (log.isDebugEnabled())
      {
        log.debug("renderHead: {}", toString(false));
      }

      IHeaderResponse response = container.getHeaderResponse();

      // Allow component to contribute
      if (response.wasRendered(this) == false)
      {
        StringResponse markupHeaderResponse = new StringResponse();
        Response oldResponse = getResponse();
        RequestCycle.get().setResponse(markupHeaderResponse);
        try
        {
          // Make sure the markup source strategy contributes to the header first
          // to be backward compatible. WICKET-3761
          getMarkupSourcingStrategy().renderHead(this, container);
          CharSequence headerContribution = markupHeaderResponse.getBuffer();
          if (Strings.isEmpty(headerContribution) == false)
          {
            response.render(StringHeaderItem.forString(headerContribution));
          }
        }
        finally
        {
          RequestCycle.get().setResponse(oldResponse);
        }
        // Then let the component itself to contribute to the header
        renderHead(this, response);

        response.markRendered(this);
      }

      // Then ask all behaviors
      for (Behavior behavior : getBehaviors())
      {
        if (isBehaviorAccepted(behavior))
        {
          if (response.wasRendered(behavior) == false)
          {
            behavior.renderHead(this, response);
            List<IClusterable> pair = Arrays.asList(this, behavior);
            response.markRendered(pair);
          }
        }
      }
    }
  }
View Full Code Here

   *            the response Wicket created
   * @return the response Wicket should use in IHeaderContributor traversal
   */
  public final IHeaderResponse decorateHeaderResponse(final IHeaderResponse response)
  {
    final IHeaderResponse aggregatingResponse = new ResourceAggregator(response);

    if (headerResponseDecorator == null)
    {
      return aggregatingResponse;
    }
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.head.IHeaderResponse

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.