Package org.apache.wicket

Examples of org.apache.wicket.MockPageWithLinkAndComponent


  @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

  @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

  }

  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

   */
  public void testAddToAjaxUpdate()
  {
    Duration dur = Duration.seconds(20);
    final MyAjaxSelfUpdatingTimerBehavior timer = new MyAjaxSelfUpdatingTimerBehavior(dur);
    final MockPageWithLinkAndComponent page = new MockPageWithLinkAndComponent();

    page.add(new WebComponent<Void>(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<Void>(
          MockPageWithLinkAndComponent.COMPONENT_ID);
        wmc.setOutputMarkupId(true);
        wmc.add(timer);
        page.replace(wmc);
        target.addComponent(wmc);
      }
    });

    tester.startPage(new ITestPageSource()
View Full Code Here

   */
  public void testAddToWebPage()
  {
    Duration dur = Duration.seconds(20);
    final MyAjaxSelfUpdatingTimerBehavior timer = new MyAjaxSelfUpdatingTimerBehavior(dur);
    final MockPageWithLinkAndComponent page = new MockPageWithLinkAndComponent();
    Label<String> label = new Label<String>(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

  }

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

    page.add(new WebComponent<Void>(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(new Object[] { MockPageWithLinkAndComponent.COMPONENT_ID });
          page.replace(comp);
          comp.setOutputMarkupId(true);

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

   */
  public void testAddToAjaxUpdate()
  {
    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(MockPageWithLinkAndComponent.LINK_ID)
    {
      private static final long serialVersionUID = 1L;

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

    tester.startPage(new ITestPageSource()
View Full Code Here

   */
  public void testAddToAjaxUpdate()
  {
    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(MockPageWithLinkAndComponent.LINK_ID)
    {
      private static final long serialVersionUID = 1L;

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

    tester.startPage(new ITestPageSource()
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.