Package org.apache.wicket.ajax.markup.html

Examples of org.apache.wicket.ajax.markup.html.AjaxLink


      {
        fail("Link " + path + "is an AjaxLink and will "
            + "not be invoked when AJAX (javascript) is disabled.");
      }

      AjaxLink link = (AjaxLink)linkComponent;

      setupRequestAndResponse();
      RequestCycle requestCycle = createRequestCycle();
      AjaxRequestTarget target = new AjaxRequestTarget();
      requestCycle.setRequestTarget(target);

      link.onClick(target);

      // process the request target
      target.respond(requestCycle);
    }
    // AjaxFallbackLinks is processed like an AjaxLink if isAjax is true
    // If it's not handling of the linkComponent is passed through to the
    // Link.
    else if (linkComponent instanceof AjaxFallbackLink && isAjax)
    {
      AjaxFallbackLink link = (AjaxFallbackLink)linkComponent;

      setupRequestAndResponse();
      RequestCycle requestCycle = createRequestCycle();
      AjaxRequestTarget target = new AjaxRequestTarget();
      requestCycle.setRequestTarget(target);

      link.onClick(target);

      // process the request target
      target.respond(requestCycle);
    }
    // if the link is an AjaxSubmitLink, we need to find the form
    // from it using reflection so we know what to submit.
    else if (linkComponent instanceof AjaxSubmitLink)
    {
      // If it's not ajax we fail
      if (isAjax == false)
      {
        fail("Link " + path + "is an AjaxSubmitLink and "
            + "will not be invoked when AJAX (javascript) is disabled.");
      }

      AjaxSubmitLink link = (AjaxSubmitLink)linkComponent;

      // We cycle through the attached behaviors and select the
      // LAST matching behavior as the one we handle.
      List behaviors = link.getBehaviors();
      AjaxFormSubmitBehavior ajaxFormSubmitBehavior = null;
      for (Iterator iter = behaviors.iterator(); iter.hasNext();)
      {
        Object behavior = iter.next();
        if (behavior instanceof AjaxFormSubmitBehavior)
View Full Code Here


        }
      };
    }
    else if (getLinkType() == LinkType.AJAX)
    {
      return new AjaxLink(id)
      {
        private static final long serialVersionUID = 1L;

        /**
         * @see org.apache.wicket.ajax.markup.html.AjaxLink#onClick(org.apache.wicket.ajax.AjaxRequestTarget)
View Full Code Here

                final MembershipTO membershipTO = (MembershipTO) item.getDefaultModelObject();

                item.add(new Label("roleId", new Model<Long>(membershipTO.getRoleId())));
                item.add(new Label("roleName", new Model<String>(membershipTO.getRoleName())));

                AjaxLink editLink = new ClearIndicatingAjaxLink("editLink", pageRef) {

                    private static final long serialVersionUID = -7978723352517770644L;

                    @Override
                    protected void onClickInternal(final AjaxRequestTarget target) {
                        membWin.setPageCreator(new ModalWindow.PageCreator() {

                            private static final long serialVersionUID = -7834632442532690940L;

                            @Override
                            public Page createPage() {
                                return new MembershipModalPage(getPage().getPageReference(), membWin,
                                        membershipTO, templateMode);

                            }
                        });
                        membWin.show(target);
                    }
                };
                item.add(editLink);

                AjaxLink deleteLink = new IndicatingDeleteOnConfirmAjaxLink("deleteLink", pageRef) {

                    private static final long serialVersionUID = -7978723352517770644L;

                    @Override
                    protected void onClickInternal(final AjaxRequestTarget target) {
View Full Code Here

        paginatorForm.add(rowsChooser);
        add(paginatorForm);

        // create new user
        final AjaxLink createLink = new ClearIndicatingAjaxLink("createLink", pageRef) {

            private static final long serialVersionUID = -7978723352517770644L;

            @Override
            protected void onClickInternal(final AjaxRequestTarget target) {
View Full Code Here

        });

        paginatorForm.add(rowsChooser);
        add(paginatorForm);

        AjaxLink createLink = new ClearIndicatingAjaxLink("createLink", pageRef) {

            private static final long serialVersionUID = -7978723352517770644L;

            @Override
            protected void onClickInternal(final AjaxRequestTarget target) {
View Full Code Here

                new AjaxTextFieldPanel("name", "name", new PropertyModel<String>(roleTO, "name"));

        final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp");
        this.add(jexlHelp);

        final AjaxLink questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp, "questionMarkJexlHelp");
        this.add(questionMarkJexlHelp);

        if (!templateMode) {
            name.addRequiredLabel();
            questionMarkJexlHelp.setVisible(false);
        }
        this.add(name);

        userOwnerModel = new OwnerModel(roleTO, AttributableType.USER);
        final AjaxTextFieldPanel userOwner = new AjaxTextFieldPanel("userOwner", "userOwner", userOwnerModel);
View Full Code Here

        editConnectorWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
        editConnectorWin.setInitialHeight(WIN_HEIGHT);
        editConnectorWin.setInitialWidth(WIN_WIDTH);
        editConnectorWin.setCookieName("edit-conn-modal");

        AjaxLink createConnectorLink = new ClearIndicatingAjaxLink("createConnectorLink", getPageReference()) {

            private static final long serialVersionUID = -7978723352517770644L;

            @Override
            protected void onClickInternal(final AjaxRequestTarget target) {
View Full Code Here

   * Test that an AjaxLink's onClick method is actually invoked.
   */
  public void testBasicAjaxLinkClick()
  {
    // Create a link, which we test is actually invoked
    final AjaxLink ajaxLink = new AjaxLink("ajaxLink")
    {
      private static final long serialVersionUID = 1L;

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

   *
   */
  public void testAssertComponentOnAjaxResponse()
  {
    final Page page = new MockPageWithLink();
    AjaxLink ajaxLink = new AjaxLink(MockPageWithLink.LINK_ID)
    {
      private static final long serialVersionUID = 1L;

      @Override
      public void onClick(AjaxRequestTarget target)
      {
        // Replace the link with a normal Link
        Link link = new Link(MockPageWithLink.LINK_ID)
        {
          private static final long serialVersionUID = 1L;

          @Override
          public void onClick()
          {
            // Do nothing
          }
        };
        link.setOutputMarkupId(true);

        page.replace(link);

        target.addComponent(link);
      }
    };
    ajaxLink.setOutputMarkupId(true);

    page.add(ajaxLink);

    tester.startPage(new ITestPageSource()
    {
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 ajaxLink = new AjaxLink(MockPageWithLinkAndLabel.LINK_ID)
    {
      private static final long serialVersionUID = 1L;

      @Override
      public void onClick(AjaxRequestTarget target)
      {
        labelModel.setObject("Label which needs encoding: [] ][");
        target.addComponent(label);
      }
    };
    ajaxLink.setOutputMarkupId(true);

    page.add(ajaxLink);
    ajaxLink.add(label);

    tester.startPage(new ITestPageSource()
    {
      private static final long serialVersionUID = 1L;
View Full Code Here

TOP

Related Classes of org.apache.wicket.ajax.markup.html.AjaxLink

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.