Package org.apache.wicket

Examples of org.apache.wicket.Page


   *
   */
  @Test
  public void assertComponentOnAjaxResponse()
  {
    final Page page = new MockPageWithLink();
    AjaxLink<Void> ajaxLink = new AjaxLink<Void>(MockPageWithLink.LINK_ID)
    {
      private static final long serialVersionUID = 1L;

      @Override
      public void onClick(AjaxRequestTarget target)
      {
        // Replace the link with a normal Link
        Link<Void> link = new Link<Void>(MockPageWithLink.LINK_ID)
        {
          private static final long serialVersionUID = 1L;

          @Override
          public void onClick()
          {
          }
        };
        link.setOutputMarkupId(true);

        page.replace(link);

        target.add(link);
      }
    };
    ajaxLink.setOutputMarkupId(true);

    page.add(ajaxLink);

    tester.startPage(page);

    // Click the link
    tester.clickLink(MockPageWithLink.LINK_ID);
View Full Code Here


    labelModel.setObject("Label 1");
    final Label label = new Label(MockPageWithLinkAndLabel.LABEL_ID, labelModel);
    label.setOutputMarkupId(true);

    final Page page = new MockPageWithLinkAndLabel();
    AjaxLink<Void> ajaxLink = new AjaxLink<Void>(MockPageWithLinkAndLabel.LINK_ID)
    {
      private static final long serialVersionUID = 1L;

      @Override
      public void onClick(AjaxRequestTarget target)
      {
        labelModel.setObject("Label which needs encoding: [] ][");
        target.add(label);
      }
    };
    ajaxLink.setOutputMarkupId(true);

    page.add(ajaxLink);
    ajaxLink.add(label);

    tester.startPage(page);

    // Click the link
View Full Code Here

      appendAssignment(buffer, "settings.heightUnit", getHeightUnit());
    }

    if (isCustomComponent() == false)
    {
      Page page = createPage();
      if (page == null)
      {
        throw new WicketRuntimeException("Error creating page for modal dialog.");
      }
      CharSequence pageUrl = null;
      RequestCycle requestCycle = RequestCycle.get();

      if (page.isPageStateless())
      {
        pageUrl = requestCycle.urlFor(page.getClass(), page.getPageParameters());
        appendAssignment(buffer, "settings.ie8_src", pageUrl);
      }
      else
      {
        IRequestHandler handler = new RenderPageRequestHandler(new PageProvider(page));
View Full Code Here

  }

  public void testPageProperties_stored()
  {
    TestMapperContext mapperContext = new TestMapperContext();
    Page page = new TestPage();
    mapperContext.getPageManager().touchPage(page);
    mapperContext.getPageManager().commitRequest();

    // by cleaning session cache we make sure of not being testing the same in-memory instance
    mapperContext.cleanSessionCache();

    PageProvider provider = mapperContext.new TestPageProvider(page.getPageId(), 0);
    assertTrue(provider.hasPageInstance());
    assertFalse(provider.isPageInstanceFresh());
  }
View Full Code Here

   * @return this
   */
  public final CheckBoxMultipleChoice<T> setPrefix(final String prefix)
  {
    // Tell the page that this component's prefix was changed
    final Page page = findPage();
    if (page != null)
    {
      addStateChange();
    }

View Full Code Here

   * @return this
   */
  public final CheckBoxMultipleChoice<T> setSuffix(final String suffix)
  {
    // Tell the page that this component's suffix was changed
    final Page page = findPage();
    if (page != null)
    {
      addStateChange();
    }

View Full Code Here

    IMarkupFragment pageMarkup)
  {
    Args.notNull(component, "component");

    // Create a page object and assign the markup
    Page page = createPage();
    if (page == null)
    {
      fail("The automatically created page should not be null.");
    }

    // Automatically create the page markup if not provided
    if (pageMarkup == null)
    {
      String markup = createPageMarkup(component.getId());
      if (markup == null)
      {
        fail("The markup for the automatically created page should not be null.");
      }

      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);
        pageMarkup = markupParser.parse();
      }
      catch (Exception e)
      {
        fail("Error while parsing the markup for the autogenerated page: " + e.getMessage());
      }
    }

    if (page instanceof StartComponentInPage)
    {
      ((StartComponentInPage)page).setPageMarkup(pageMarkup);
    }
    else
    {
      page.setMarkup(pageMarkup);
    }

    // Add the child component
    page.add(component);

    // Preserve 'componentInPage' because #startPage() needs to null-fy it
    ComponentInPage oldComponentInPage = componentInPage;

    // Process the page
View Full Code Here

   */
  public <C extends Page> Result isRenderedPage(Class<C> expectedRenderedPageClass)
  {
    Args.notNull(expectedRenderedPageClass, "expectedRenderedPageClass");

    Page page = getLastRenderedPage();
    if (page == null)
    {
      return Result.fail("page was null");
    }
    if (!expectedRenderedPageClass.isAssignableFrom(page.getClass()))
    {
      return Result.fail(String.format("classes not the same, expected '%s', current '%s'",
        expectedRenderedPageClass, page.getClass()));
    }
    return Result.pass();
  }
View Full Code Here

      appendAssignment(buffer, "settings.heightUnit", getHeightUnit());
    }

    if (isCustomComponent() == false)
    {
      Page page = createPage();
      if (page == null)
      {
        throw new WicketRuntimeException("Error creating page for modal dialog.");
      }
      CharSequence pageUrl;
      RequestCycle requestCycle = RequestCycle.get();

      page.getSession().getPageManager().touchPage(page);
      if (page.isPageStateless())
      {
        pageUrl = requestCycle.urlFor(page.getClass(), page.getPageParameters());
      }
      else
      {
        IRequestHandler handler = new RenderPageRequestHandler(new PageProvider(page));
        pageUrl = requestCycle.urlFor(handler);
View Full Code Here

    session.getPageManager().sessionExpired(session.getId());

    // fire a request to the ajax link on the expired page
    executeAjaxUrlWithLastBaseUrl(urlToAjaxLink);

    Page lastRenderedPage = tester.getLastRenderedPage();
    int lastRenderedPageId = lastRenderedPage.getPageId();
    assertTrue("A new page must be create ", lastRenderedPageId > initialPageId);
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.Page

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.