Package org.apache.wicket

Examples of org.apache.wicket.Page$IPageSerializer


   * @throws Exception
   */
  @Test
  public void panelWithAutoComponent() throws Exception
  {
    Page page = new MyPage();
    Panel panel = new MyPanelWithAutoComponent("panel");
    page.add(panel);

    // Get the associated markup file
    IMarkupFragment markup = panel.getAssociatedMarkup();
    compareMarkupWithFile(markup, "MyPanelWithAutoComponent_ExpectedResult.html");

    // The Page is missing the tag to "call" the panel
    assertNull(panel.getMarkup());

    // Create a Page with proper markup for the panel
    page = new MyPanelWithAutoComponentPage();
    panel = (Panel)page.get("panel");

    // getMarkup() returns the "calling" tags
    markup = panel.getMarkup();
    compareMarkupWithString(markup, "<span wicket:id=\"panel\">test</span>");

View Full Code Here


   * @throws Exception
   */
  @Test
  public void border() throws Exception
  {
    Page page = new MyBorderPage();
    Border border = (Border)page.get("border");

    // Get the associated markup file
    IMarkupFragment markup = border.getAssociatedMarkup();
    compareMarkupWithFile(markup, "MyBorder_ExpectedResult.html");

View Full Code Here

   * @throws Exception
   */
  @Test
  public void border2() throws Exception
  {
    Page page = new MyBorderPage();
    Border border = (Border)page.get("border2");

    // Get the associated markup file
    IMarkupFragment markup = border.getAssociatedMarkup();
    compareMarkupWithFile(markup, "MyBorder2_ExpectedResult.html");

View Full Code Here

   * @throws Exception
   */
  @Test
  public void fragments() throws Exception
  {
    Page page = new InlinePanelPage_1();
    Fragment fragment = (Fragment)page.get("myPanel1");

    // Get the associated markup file
    IMarkupFragment markup = fragment.getAssociatedMarkup();
    assertNull(markup);

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

   */
  private Component resolveAutomaticLink(final PathInfo pathInfo, final String id,
    final ComponentTag tag)
  {
    final MarkupContainer container = pathInfo.getContainer();
    final Page page = container.getPage();

    // Make the id (page-)unique
    final String autoId = id + Integer.toString(page.getAutoIndex());

    // get the tag name, which is something like 'a' or 'script'
    final String tagName = tag.getName();

    // By setting the component name, the tag becomes a Wicket component
View Full Code Here

  {
    Iterator<Component> iterator = markupIdToComponent.values().iterator();
    while (iterator.hasNext())
    {
      final Component component = iterator.next();
      final Page parentPage = component.findParent(Page.class);
      if (parentPage != null)
      {
        parentPage.detach();
        break;
      }
    }
  }
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.