Package org.apache.wicket.markup

Examples of org.apache.wicket.markup.MarkupResourceStream


        when(component.getId()).thenReturn("id");
        when(component.getPath()).thenReturn("path");

        IMarkupFragment markupFragment = mock(IMarkupFragment.class);
        when(markupFragment.getMarkupResourceStream()).thenReturn(
                new MarkupResourceStream(new StringResourceStream("markup")));
        when(component.getMarkup()).thenReturn(markupFragment);

        return component;
    }
View Full Code Here


      public void component(final MarkupContainer comp, final IVisit<Void> visit)
      {
        IMarkupFragment associatedMarkup = comp.getAssociatedMarkup();
        if (associatedMarkup != null)
        {
          MarkupResourceStream rs = associatedMarkup.getMarkupResourceStream();
          if (rs.isHtml5() == false)
          {
            rtn[0] = false;
            visit.stop();
          }
        }
View Full Code Here

      try
      {
        // set a ContainerInfo to be able to use HtmlHeaderContainer so header contribution
        // still work. WICKET-3700
        ContainerInfo containerInfo = new ContainerInfo(page);
        MarkupResourceStream markupResourceStream = new MarkupResourceStream(
          new StringResourceStream(markup), containerInfo, page.getClass());

        MarkupParser markupParser = getApplication().getMarkupSettings()
          .getMarkupFactory()
          .newMarkupParser(markupResourceStream);
View Full Code Here

    final String style = owner.getStyle();
    final String variation = owner.getVariation();
    final Locale locale = owner.getLocale();

    MarkupResourceStream markupResourceStream = null;
    Class<?> containerClass = getClass();

    while (!(containerClass.equals(BorderBehavior.class)))
    {
      String path = containerClass.getName().replace('.', '/');
      IResourceStream resourceStream = locator.locate(containerClass, path, style, variation,
        locale, markupType.getExtension(), false);

      // Did we find it already?
      if (resourceStream != null)
      {
        ContainerInfo ci = new ContainerInfo(containerClass, locale, style, variation,
          markupType);
        markupResourceStream = new MarkupResourceStream(resourceStream, ci, containerClass);
        break;
      }

      // Walk up the class hierarchy one level, if markup has not
      // yet been found
      containerClass = containerClass.getSuperclass();
    }

    if (markupResourceStream == null)
    {
      throw new WicketRuntimeException("Could not find markup for component border `" +
        getClass().getName() + "`");
    }

    try
    {
      IMarkupFragment markup = MarkupFactory.get()
        .newMarkupParser(markupResourceStream)
        .parse();

      return new MarkupStream(markup);
    }
    catch (Exception e)
    {
      throw new WicketRuntimeException(
        "Could not parse markup from markup resource stream: " +
          markupResourceStream.toString(), e);
    }
    finally
    {
      try
      {
        markupResourceStream.close();
      }
      catch (IOException e)
      {
        throw new WicketRuntimeException("Cannot close markup resource stream: " +
          markupResourceStream, e);
View Full Code Here

    final String style = owner.getStyle();
    final String variation = owner.getVariation();
    final Locale locale = owner.getLocale();

    MarkupResourceStream markupResourceStream = null;
    Class<?> containerClass = getClass();

    while (!(containerClass.equals(BorderBehavior.class)))
    {
      String path = containerClass.getName().replace('.', '/');
      IResourceStream resourceStream = locator.locate(containerClass, path, style, variation,
        locale, markupType.getExtension(), false);

      // Did we find it already?
      if (resourceStream != null)
      {
        ContainerInfo ci = new ContainerInfo(containerClass, locale, style, variation,
          markupType);
        markupResourceStream = new MarkupResourceStream(resourceStream, ci, containerClass);
        break;
      }

      // Walk up the class hierarchy one level, if markup has not
      // yet been found
      containerClass = containerClass.getSuperclass();
    }

    if (markupResourceStream == null)
    {
      throw new WicketRuntimeException("Could not find markup for component border `" +
        getClass().getName() + "`");
    }

    try
    {
      IMarkupFragment markup = MarkupFactory.get()
        .newMarkupParser(markupResourceStream)
        .parse();

      return new MarkupStream(markup);
    }
    catch (Exception e)
    {
      throw new WicketRuntimeException(
        "Could not parse markup from markup resource stream: " +
          markupResourceStream.toString(), e);
    }
    finally
    {
      try
      {
        markupResourceStream.close();
      }
      catch (IOException e)
      {
        throw new WicketRuntimeException("Cannot close markup resource stream: " +
          markupResourceStream, e);
View Full Code Here

      try
      {
        // set a ContainerInfo to be able to use HtmlHeaderContainer so header contribution
        // still work. WICKET-3700
        ContainerInfo containerInfo = new ContainerInfo(page);
        MarkupResourceStream markupResourceStream = new MarkupResourceStream(
          new StringResourceStream(markup), containerInfo, page.getClass());

        MarkupParser markupParser = getApplication().getMarkupSettings()
          .getMarkupFactory()
          .newMarkupParser(markupResourceStream);
View Full Code Here

    final String style = owner.getStyle();
    final String variation = owner.getVariation();
    final Locale locale = owner.getLocale();

    MarkupResourceStream markupResourceStream = null;
    Class<?> containerClass = getClass();

    while (!(containerClass.equals(BorderBehavior.class)))
    {
      String path = containerClass.getName().replace('.', '/');
      IResourceStream resourceStream = locator.locate(containerClass, path, style, variation,
        locale, markupType.getExtension(), false);

      // Did we find it already?
      if (resourceStream != null)
      {
        ContainerInfo ci = new ContainerInfo(containerClass, locale, style, variation,
          markupType);
        markupResourceStream = new MarkupResourceStream(resourceStream, ci, containerClass);
        break;
      }

      // Walk up the class hierarchy one level, if markup has not
      // yet been found
      containerClass = containerClass.getSuperclass();
    }

    if (markupResourceStream == null)
    {
      throw new WicketRuntimeException("Could not find markup for component border `" +
        getClass().getName() + "`");
    }

    try
    {
      IMarkupFragment markup = MarkupFactory.get()
        .newMarkupParser(markupResourceStream)
        .parse();

      return new MarkupStream(markup);
    }
    catch (Exception e)
    {
      throw new WicketRuntimeException(
        "Could not parse markup from markup resource stream: " +
          markupResourceStream.toString(), e);
    }
    finally
    {
      try
      {
        markupResourceStream.close();
      }
      catch (IOException e)
      {
        throw new WicketRuntimeException("Cannot close markup resource stream: " +
          markupResourceStream, e);
View Full Code Here

      try
      {
        // set a ContainerInfo to be able to use HtmlHeaderContainer so header contribution
        // still work. WICKET-3700
        ContainerInfo containerInfo = new ContainerInfo(page);
        MarkupResourceStream markupResourceStream = new MarkupResourceStream(
          new StringResourceStream(markup), containerInfo, page.getClass());

        MarkupParser markupParser = getApplication().getMarkupSettings()
          .getMarkupFactory()
          .newMarkupParser(markupResourceStream);
View Full Code Here

      public void component(final MarkupContainer comp, final IVisit<Void> visit)
      {
        IMarkupFragment associatedMarkup = comp.getAssociatedMarkup();
        if (associatedMarkup != null)
        {
          MarkupResourceStream rs = associatedMarkup.getMarkupResourceStream();
          if (rs.isHtml5() == false)
          {
            rtn[0] = false;
            visit.stop();
          }
        }
View Full Code Here

  @Test
  public void test1()
  {
    Page page = new SubPageWithoutMarkup();
    Markup markup = page.getAssociatedMarkup();
    MarkupResourceStream stream = markup.getMarkupResourceStream();
    assertEquals("utf-8", stream.getEncoding());
    assertEquals(MarkupParser.WICKET, stream.getWicketNamespace());
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.MarkupResourceStream

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.