Package org.apache.wicket

Examples of org.apache.wicket.Page


    // create the htmlheadercontainer if needed
    if (header == null)
    {
      header = new AjaxHtmlHeaderContainer(this);
      final Page parentPage = component.getPage();
      parentPage.addOrReplace(header);
    }

    RequestCycle requestCycle = component.getRequestCycle();

    // save old response, set new
View Full Code Here


        supportedPageExtensions.contains(pathInfo.extension))
      {
        // Obviously a href like href="myPkg.MyLabel.html" will do as
        // well. Wicket will not throw an exception. It accepts it.

        Page page = container.getPage();
        final IClassResolver defaultClassResolver = page.getApplication()
          .getApplicationSettings()
          .getClassResolver();
        String className = Packages.absolutePath(page.getClass(), pathInfo.path);
        className = Strings.replaceAll(className, "/", ".").toString();
        if (className.startsWith("."))
        {
          className = className.substring(1);
        }

        try
        {
          final Class<? extends Page> clazz = (Class<? extends Page>)defaultClassResolver.resolveClass(className);
          return new AutolinkBookmarkablePageLink<Void>(autoId, clazz,
            pathInfo.pageParameters, pathInfo.anchor);
        }
        catch (ClassNotFoundException ex)
        {
          log.warn("Did not find corresponding java class: " + className);
          // fall through
        }

        // Make sure base markup pages (inheritance) are handled correct
        MarkupContainer parentWithContainer = container;
        if (container.getParent() != null)
        {
          parentWithContainer = container.findParentWithAssociatedMarkup();
        }
        if ((parentWithContainer instanceof Page) && !pathInfo.path.startsWith("/") &&
          new MarkupStream(page.getMarkup()).isMergedMarkup())
        {
          IMarkupFragment containerMarkup = container.getMarkup();
          MarkupStream containerMarkupStream = new MarkupStream(containerMarkup);
          if (containerMarkupStream.atTag())
          {
View Full Code Here

  public void testRender10() throws Exception
  {
    Class<? extends Page> clazz = EnclosurePage_10.class;
    executeTest(clazz, "EnclosurePageExpectedResult_10.html");

    Page page = tester.getLastRenderedPage();
    page.get("input").setVisible(false);
    tester.startPage(page);
    tester.assertRenderedPage(clazz);
    tester.assertResultPage(getClass(), "EnclosurePageExpectedResult_10-2.html");

    page.get("input").setVisible(true);
    tester.startPage(page);
    tester.assertRenderedPage(clazz);
    tester.assertResultPage(getClass(), "EnclosurePageExpectedResult_10.html");

    page.get("label").setVisible(false);
    tester.startPage(page);
    tester.assertRenderedPage(clazz);
    tester.assertResultPage(getClass(), "EnclosurePageExpectedResult_10-3.html");

    page.get("input").setVisible(false);
    tester.startPage(page);
    tester.assertRenderedPage(clazz);
    tester.assertResultPage(getClass(), "EnclosurePageExpectedResult_10-2.html");

    page.get("input").setVisible(true);
    tester.startPage(page);
    tester.assertRenderedPage(clazz);
    tester.assertResultPage(getClass(), "EnclosurePageExpectedResult_10-3.html");

    page.get("label").setVisible(true);
    tester.startPage(page);
    tester.assertRenderedPage(clazz);
    tester.assertResultPage(getClass(), "EnclosurePageExpectedResult_10.html");
  }
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

    return true;
  }

  public static void markPageWithConversationId(IRequestHandler handler, String cid)
  {
    Page page = getPage(handler);
    if (page != null)
    {
      page.setMetaData(CONVERSATION_ID_KEY, cid);
    }
  }
View Full Code Here

  @Test
  public void test1() throws Exception
  {
    // How does the test work: Make sure you have a page, form and form component properly set
    // up (getRelativePath() etc.). See #before().
    final Page page = tester.getLastRenderedPage();

    // Get the form and form component created
    final TestForm form = (TestForm)page.get("form");
    final TextField<String> textField = (TextField<String>)form.get("input");

    // Right after init, the requests and responses cookie lists must be empty
    assertEquals(0, getRequestCookies().size());
    assertEquals(0, getResponseCookies().size());
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

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.