Examples of AjaxFallbackLink


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

    protected void populateItem(LoopItem item)
    {
      // Use an AjaxFallbackLink for rating to make voting work even
      // without Ajax.
      AjaxFallbackLink link = new AjaxFallbackLink("link")
      {
        private static final long serialVersionUID = 1L;

        public void onClick(AjaxRequestTarget target)
        {
          LoopItem item = (LoopItem)getParent();

          // adjust the rating, and provide the target to the subclass
          // of our rating component, so other components can also get
          // updated in case of an AJAX event.

          onRated(item.getIteration() + 1, target);

          // if we process an AJAX event, update this panel
          if (target != null)
          {
            target.addComponent(RatingPanel.this.get("rater"));
          }
        }

        public boolean isEnabled()
        {
          return !((Boolean)hasVoted.getObject()).booleanValue();
        }
      };

      int iteration = item.getIteration();

      // add the star image, which is either active (highlighted) or
      // inactive (no star)
      link.add(new WebMarkupContainer("star").add(new SimpleAttributeModifier("src",
          (onIsStarActive(iteration)
              ? getActiveStarUrl(iteration)
              : getInactiveStarUrl(iteration)))));
      item.add(link);
    }
View Full Code Here

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

    setVersioned(false);
  }

  protected WebMarkupContainer newLink(String linkId, final int index)
  {
    return new AjaxFallbackLink(linkId)
    {

      private static final long serialVersionUID = 1L;

      public void onClick(AjaxRequestTarget target)
View Full Code Here

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

      super(id);
      ListView lv = new ListView("file", new PackagedResourcesModel())
      {
        protected void populateItem(ListItem item)
        {
          AjaxFallbackLink link = new AjaxFallbackLink("link", item.getModel())
          {
            public void onClick(AjaxRequestTarget target)
            {
              setName(getModelObjectAsString());

              if (target != null)
              {
                target.addComponent(codePanel);
                target.addComponent(filename);
              }
            }
          };
          link.add(new Label("name", item.getModelObjectAsString()));
          item.add(link);
        }
      };
      add(lv);
    }
View Full Code Here

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

        counter1++;
        target.addComponent(c1);
      }
    });

    add(new AjaxFallbackLink("c2-link")
    {
      public void onClick(AjaxRequestTarget target)
      {
        counter2++;
        // notice that for a fallback link we need to makesure the
View Full Code Here

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

        getRequestCycle().setResponsePage(new ResultPage("A special label"));
      }
    });

    // AjaxFallbackLink
    add(new AjaxFallbackLink("ajaxFallbackLinkWithSetResponsePageClass")
    {
      private static final long serialVersionUID = 1L;

      @Override
      public void onClick(AjaxRequestTarget target)
      {
        getRequestCycle().setResponsePage(ResultPage.class);
      }
    });

    add(new AjaxFallbackLink("ajaxFallbackLinkWithSetResponsePage")
    {
      private static final long serialVersionUID = 1L;

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

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

public class LinkCounterAjax extends BaseWebPage {
    private int counter;

    public LinkCounterAjax() {
        final Label label = new Label("label", new PropertyModel(this, "counter"));
        add(new AjaxFallbackLink("link") {
            @Override
            public void onClick(final AjaxRequestTarget target) {
                counter++;
                if (target != null) {
                    target.addComponent(label);
View Full Code Here

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

    // 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(true);
      WebRequestCycle requestCycle = createRequestCycle();
      AjaxRequestTarget target = new AjaxRequestTarget(link.getPage());
      requestCycle.setRequestTarget(target);

      link.onClick(target);

      // process the request target
      processRequestCycle(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

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

    public void setSort(String sortString) {
        sort = sortString;
    }

    public AjaxFallbackLink createSortLink(String id, final String sorting) {
        AjaxFallbackLink link = new AjaxFallbackLink(id) {

            @Override
            public void onClick(AjaxRequestTarget target) {
                if (target != null)
                    onSortClicked(target, sorting);
            }
        };
        link.add(new AttributeAppender("class", new Model() {

            @Override
            public Serializable getObject() {
                return sorting.equals(sort) ? "selected" : "";
            }
View Full Code Here

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

            _sortVal = sortVal;
        }
    }

    public Link createHitLink(final int hits) {
        Link link = new AjaxFallbackLink("hits" + hits) {

            @Override
            public void onClick(AjaxRequestTarget target) {
                PageParameters pp = new PageParameters();
                pp.add("hits", "" + hits);
                pp.add("user", user);
                pp.add("q", query);
                setResponsePage(TweetSearchPage.class, pp);
            }
        };

        link.add(new AttributeAppender("class", new Model() {

            @Override
            public Serializable getObject() {
                return hits == hitsPerPage ? "selected" : "";
            }
View Full Code Here

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

        return link;
    }

    public AjaxFallbackLink createSortLink(String id, final String sortKey, final String sortVal) {
        AjaxFallbackLink link = new AjaxFallbackLink(id) {

            @Override
            public void onClick(AjaxRequestTarget target) {
                if (target != null)
                    onSortClicked(target, sortKey, sortVal);
            }
        };
        link.add(new AttributeAppender("class", new Model() {

            @Override
            public Serializable getObject() {
                return sortKey.equals(_sortKey) && sortVal.equals(_sortVal) ? "selected" : "";
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.