Package org.apache.wicket

Examples of org.apache.wicket.MockPageWithLinkAndComponent


  @Test
  public void addToAjaxUpdate()
  {
    Duration dur = Duration.seconds(20);
    final MyAjaxSelfUpdatingTimerBehavior timer = new MyAjaxSelfUpdatingTimerBehavior(dur);
    final MockPageWithLinkAndComponent page = new MockPageWithLinkAndComponent();

    page.add(new WebComponent(MockPageWithLinkAndComponent.COMPONENT_ID).setOutputMarkupId(true));


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

      @Override
      public void onClick(AjaxRequestTarget target)
      {
        WebMarkupContainer wmc = new WebMarkupContainer(
          MockPageWithLinkAndComponent.COMPONENT_ID);
        wmc.setOutputMarkupId(true);
        wmc.add(timer);
        page.replace(wmc);
        target.add(wmc);
      }
    });

    tester.startPage(page);
View Full Code Here


  @Test
  public void addToWebPage()
  {
    Duration dur = Duration.seconds(20);
    final MyAjaxSelfUpdatingTimerBehavior timer = new MyAjaxSelfUpdatingTimerBehavior(dur);
    final MockPageWithLinkAndComponent page = new MockPageWithLinkAndComponent();
    Label label = new Label(MockPageWithLinkAndComponent.COMPONENT_ID, "Hello");
    page.add(label);
    page.add(new Link<Void>(MockPageWithLinkAndComponent.LINK_ID)
    {
      private static final long serialVersionUID = 1L;

      @Override
      public void onClick()
View Full Code Here

        label.setDefaultModelObject(((Integer)label.getDefaultModelObject()) + 1);
        target.add(label);
      }
    };

    final MockPageWithLinkAndComponent page = new MockPageWithLinkAndComponent();
    page.add(label);
    page.add(new AjaxLink<Void>(MockPageWithLinkAndComponent.LINK_ID)
    {
      private static final long serialVersionUID = 1L;

      @Override
      public void onClick(AjaxRequestTarget target)
View Full Code Here

  }

  private <C extends Component> void executeHeaderTest(final Class<C> componentClass,
    String expectedFile) throws IOException
  {
    final MockPageWithLinkAndComponent page = new MockPageWithLinkAndComponent();

    page.add(new WebComponent(MockPageWithLinkAndComponent.COMPONENT_ID).setOutputMarkupId(true));

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

      @Override
      public void onClick(AjaxRequestTarget target)
      {
        // Create an instance of the component
        try
        {
          Constructor<? extends Component> con = componentClass.getConstructor(new Class[] { String.class });

          Component comp = con.newInstance(MockPageWithLinkAndComponent.COMPONENT_ID);
          page.replace(comp);
          comp.setOutputMarkupId(true);

          target.add(comp);
        }
        catch (Exception e)
View Full Code Here

  @Test
  public void addedInAjaxSetsTimout()
  {
    Duration dur = Duration.seconds(20);
    final AjaxSelfUpdatingTimerBehavior timer = new AjaxSelfUpdatingTimerBehavior(dur);
    final MockPageWithLinkAndComponent page = new MockPageWithLinkAndComponent();

    page.add(new WebComponent(MockPageWithLinkAndComponent.COMPONENT_ID)
      .setOutputMarkupId(true));


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

      @Override
      public void onClick(AjaxRequestTarget target)
      {
        WebMarkupContainer wmc = new WebMarkupContainer(
          MockPageWithLinkAndComponent.COMPONENT_ID);
        wmc.setOutputMarkupId(true);
        wmc.add(timer);
        page.replace(wmc);
        target.add(wmc);
      }
    });

    tester.startPage(page);
View Full Code Here

  @Test
  public void pageRenderSetsTimeout()
  {
    Duration dur = Duration.seconds(20);
    final AjaxSelfUpdatingTimerBehavior timer = new AjaxSelfUpdatingTimerBehavior(dur);
    final MockPageWithLinkAndComponent page = new MockPageWithLinkAndComponent();
    Label label = new Label(MockPageWithLinkAndComponent.COMPONENT_ID, "Hello");
    page.add(label);
    page.add(new Link<Void>(MockPageWithLinkAndComponent.LINK_ID)
    {
      private static final long serialVersionUID = 1L;

      @Override
      public void onClick()
View Full Code Here

  @Test
  public void ajaxUpdateDoesNotSetTimeout()
  {
    Duration dur = Duration.seconds(20);
    final AjaxSelfUpdatingTimerBehavior timer = new AjaxSelfUpdatingTimerBehavior(dur);
    final MockPageWithLinkAndComponent page = new MockPageWithLinkAndComponent();
    final Label label = new Label(MockPageWithLinkAndComponent.COMPONENT_ID, "Hello");
    page.add(label);
    page.add(new AjaxLink<Void>(MockPageWithLinkAndComponent.LINK_ID)
    {
      private static final long serialVersionUID = 1L;

      @Override
      public void onClick(AjaxRequestTarget target)
View Full Code Here

  @Test
  public void setVisibleSetsTimeout()
  {
    Duration dur = Duration.seconds(20);
    final AjaxSelfUpdatingTimerBehavior timer = new AjaxSelfUpdatingTimerBehavior(dur);
    final MockPageWithLinkAndComponent page = new MockPageWithLinkAndComponent();
    final Label label = new Label(MockPageWithLinkAndComponent.COMPONENT_ID, "Hello");
    page.add(label);
    page.add(new AjaxLink<Void>(MockPageWithLinkAndComponent.LINK_ID)
    {
      private static final long serialVersionUID = 1L;

      @Override
      public void onClick(AjaxRequestTarget target)
View Full Code Here

      public boolean isEnabled(Component component)
      {
        return enabled;
      }
    };
    final MockPageWithLinkAndComponent page = new MockPageWithLinkAndComponent();
    final Label label = new Label(MockPageWithLinkAndComponent.COMPONENT_ID, "Hello");
    page.add(label);
    page.add(new Link<Void>(MockPageWithLinkAndComponent.LINK_ID)
    {
      private static final long serialVersionUID = 1L;

      @Override
      public void onClick()
View Full Code Here

        label.setDefaultModelObject(((Integer)label.getDefaultModelObject()) + 1);
        target.add(label);
      }
    };

    final MockPageWithLinkAndComponent page = new MockPageWithLinkAndComponent();
    page.add(label);
    page.add(new AjaxLink<Void>(MockPageWithLinkAndComponent.LINK_ID)
    {
      private static final long serialVersionUID = 1L;

      @Override
      public void onClick(AjaxRequestTarget target)
View Full Code Here

TOP

Related Classes of org.apache.wicket.MockPageWithLinkAndComponent

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.