Package org.apache.wicket

Examples of org.apache.wicket.Page$IPageSerializer


  @Test
  public void fromAjaxRequestToNormalPage()
  {
    tester.startPage(AjaxLinkPageToNormalPage.class);
    tester.assertRenderedPage(AjaxLinkPageToNormalPage.class);
    Page page = tester.getLastRenderedPage();
    Component ajaxLink = page.get("ajaxLink");
    AbstractAjaxBehavior behavior = (AbstractAjaxBehavior)ajaxLink.getBehaviors().get(0);
    tester.executeBehavior(behavior);
    tester.assertRenderedPage(NormalPage.class);
  }
View Full Code Here


  @Test
  public void page_2() throws Exception
  {
    executeTest(AjaxPage2.class, "AjaxPage2_ExpectedResult.html");

    Page page = tester.getLastRenderedPage();
    Component ajaxLink = page.get("pageLayout:pageLayout_body:ajaxLink");
    AbstractAjaxBehavior behavior = (AbstractAjaxBehavior)ajaxLink.getBehaviors().get(0);

    executeBehavior(behavior, "AjaxPage2-1_ExpectedResult.html");
  }
View Full Code Here

  @Test
  public void renderHomePage_2() throws Exception
  {
    executeTest(AjaxLinkWithBorderPage.class, "AjaxLinkWithBorderPageExpectedResult.html");

    Page page = tester.getLastRenderedPage();
    Component ajaxLink = page.get("border:border_body:ajaxLink");
    AbstractAjaxBehavior behavior = (AbstractAjaxBehavior)ajaxLink.getBehaviors().get(0);

    executeBehavior(behavior, "AjaxLinkWithBorderPage-1ExpectedResult.html");
  }
View Full Code Here

  {
    tester.startPage(OnFormValidateModelObjectsPage.class);
    FormTester formTester = tester.newFormTester("parentForm");
    formTester.submit("parentSubmitBtn");

    Page page = tester.getLastRenderedPage();
    OnFormValidateModelObjectsPage.ParentModel parentModel = (OnFormValidateModelObjectsPage.ParentModel) page.getDefaultModelObject();
    assertThat(parentModel.isParentValidated(), is(true));

    AddressFormPanel.ChildModel childPanel = (AddressFormPanel.ChildModel) page.get("parentForm:addressInfo").getDefaultModelObject();
    assertThat(childPanel.isChildValidated(), is(true));
  }
View Full Code Here

      ((FormComponent)tester.getComponentFromLastRenderedPage("form:inputPropertiesLabel")).getLabel()
        .getObject());
    tester.assertContains("label from properties DE");

    Session.get().setLocale(Locale.FRENCH); // change locale to see whether it picks it up
    Page page = tester.getLastRenderedPage();
    page.detach(); // make sure everything is detached after we just talked to that label model
    tester.startPage(page); // just re-render the same page instance with the new locale
    assertEquals(
      "label from properties FR",
      ((FormComponent)tester.getComponentFromLastRenderedPage("form:inputPropertiesLabel")).getLabel()
        .getObject());
View Full Code Here

      ((FormComponent)tester.getComponentFromLastRenderedPage("form:inputWithDefaultLabel")).getLabel()
        .getObject());
    tester.assertContains("propertiesDefaultLabel DE");

    Session.get().setLocale(Locale.FRENCH); // change locale to see whether it picks it up
    Page page = tester.getLastRenderedPage();
    page.detach(); // make sure everything is detached after we just talked to that label model
    tester.startPage(page); // just re-render the same page instance with the new locale
    assertEquals(
      "propertiesDefaultLabel FR",
      ((FormComponent)tester.getComponentFromLastRenderedPage("form:inputWithDefaultLabel")).getLabel()
        .getObject());
View Full Code Here

   */
  @Test
  public void viewBook() throws Exception
  {
    Book mockBook = new Book("xxId", "xxName");
    Page page = new ViewBook(mockBook);
    tester.startPage(page);

    // assertion
    tester.assertRenderedPage(ViewBook.class);
    tester.assertLabel("id", "xxId");
View Full Code Here

   */
  @Test
  public void pageConstructor() throws Exception
  {
    Book mockBook = new Book("xxId", "xxName");
    Page page = new ViewBook(mockBook);
    tester.startPage(page);

    // assertion
    tester.assertRenderedPage(ViewBook.class);
    tester.clickLink("link");
View Full Code Here

   *
   */
  @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

TOP

Related Classes of org.apache.wicket.Page$IPageSerializer

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.