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

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


                Helper.twitterIntentFav(tweet.getTwitterId())));

        add(new ExternalLink("tweetReply",
                Helper.twitterIntentReply(tweet.getTwitterId())));

        add(new AjaxFallbackLink("tweetRetweet") {

            @Override
            public void onClick(AjaxRequestTarget target) {
                onRetweet(tweet, target);
            }
        });
        IndicatingAjaxFallbackLink inReplyOfButton = new IndicatingAjaxFallbackLink("inreplyof") {

            @Override
            public void onClick(AjaxRequestTarget target) {
                if (target != null) {
                    subTweets.clear();
                    target.addComponent(OneTweet.this);
                    if (!inReplyOfClicked)
                        subTweets.addAll(onInReplyOfClick(tweet.getInReplyTwitterId()));

                    inReplyOfClicked = !inReplyOfClicked;
                }
            }
        };

        add(inReplyOfButton);
        if (JTweet.isDefaultInReplyId(tweet.getInReplyTwitterId()))
            inReplyOfButton.setVisible(false);

        IndicatingAjaxFallbackLink rtLink = new IndicatingAjaxFallbackLink("retweeters") {

            @Override
            public void onClick(AjaxRequestTarget target) {
                if (target != null) {
                    subTweets.clear();
                    target.addComponent(OneTweet.this);
                    if (!rtClicked)
                        subTweets.addAll(onReplyClick(tweet.getTwitterId(), true));

                    rtClicked = !rtClicked;
                }
            }
        };

        add(rtLink.add(new Label("retweetersLabel", "retweets " + tweet.getRetweetCount())));
        if (tweet.getRetweetCount() == 0)
            rtLink.setVisible(false);

        IndicatingAjaxFallbackLink replyLink = new IndicatingAjaxFallbackLink("replies") {

            @Override
            public void onClick(AjaxRequestTarget target) {
                if (target != null) {
                    subTweets.clear();
                    target.addComponent(OneTweet.this);
                    if (!rpClicked)
                        subTweets.addAll(onReplyClick(tweet.getTwitterId(), false));

                    rpClicked = !rpClicked;
                }
            }
        };

        add(replyLink.add(new Label("repliesLabel", "replies " + (tweet.getReplyCount() - tweet.getRetweetCount()))));
        if (tweet.getReplyCount() == tweet.getRetweetCount())
            replyLink.setVisible(false);

        add(new AjaxFallbackLink("similarLink") {

            @Override
            public void onClick(AjaxRequestTarget target) {
                onFindSimilarClick(tweet, target);
            }
View Full Code Here


            @Override
            public boolean isVisible() {
                return !getUserName().isEmpty();
            }
        }.add(new ExternalLink("userTwitterLink", oneUserLink, oneUserLabel)).
                add(new AjaxFallbackLink("userTwitterLinkRemove") {

            @Override
            public void onClick(AjaxRequestTarget target) {
                setSearchType(ALL);
                setResponsePage(TweetSearchPage.class, getParams(query, selectedIndex, null, loggedInUser));
View Full Code Here

                    if (index2 > 1)
                        title = title.substring(index2 + 1);
                }
                title = Helper.trimAll(title);
                title = Helper.htmlEntityDecode(title);
                Link contextLink = new AjaxFallbackLink("urlLink") {

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        onUrlClick(target, url.getKey());
                    }
                };
                contextLink.add(new AttributeAppender("title",
                        new Model("View Url in Context of " + url.getValue() + " tweets"), " "));
                item.add(contextLink);


                Link directLink = new AjaxFallbackLink("directLink") {

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        onDirectUrlClick(target, url.getKey());
                    }
                };
                item.add(directLink);
                directLink.add(new Label("urlLabel", title));
                directLink.add(new AttributeAppender("title", new Model(title), " "));
            }
        };
        add(urlListView);

        HeaderContributor c = new HeaderContributor(new IHeaderContributor() {
View Full Code Here

                }

                AttributeAppender app = new AttributeAppender("title", new Model(additionalDateInfo), " ");
                bar.add(app).add(new AttributeAppender("style", new Model("height:" + (int) (zoomer * entry.count) + "px"), " "));
                final boolean selected = isAlreadyFiltered(entry.key, entry.value);
                Link link = new /*Indicating*/ AjaxFallbackLink("itemLink") {

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        JSDateFilter.this.onFilterChange(target, entry.getFilter(), !selected);
                    }
                };
                link.add(app);
                Label label = new Label("itemLabel", displayName);
                link.add(bar).add(label);
                if (entry.count == 0) {
                    link.setEnabled(false);
                    link.add(new AttributeAppender("class", new Model("gray"), " "));
                }

                if (selected)
                    link.add(new AttributeAppender("class", new Model("filter-rm"), " "));
                else
                    link.add(new AttributeAppender("class", new Model("filter-add"), " "));
                item.add(link);
            }
        };

        add(items);
View Full Code Here

                SavedSearchPanel.this.onSave(target, new Date().getTime());
            }
        };
        add(saveSearch);

        AjaxFallbackLink link = new IndicatingAjaxFallbackLink("saveInfo") {

            @Override
            public void onClick(AjaxRequestTarget target) {
                SavedSearchPanel.this.onSave(target, new Date().getTime());
            }

            @Override
            public boolean isVisible() {
                return isInitialized && savedSearches.isEmpty();
            }
        };
        add(link.setOutputMarkupId(true));

        add(new WebMarkupContainer("indicatorImage") {

            @Override
            public boolean isVisible() {
                return !isInitialized;
            }
        }.setOutputMarkupId(true));

        // don't know how to utilize IAjaxIndicatorAware + getAjaxIndicatorMarkupId() { return indicator.getMarkupId();
        //add(indicator);

        savedSearchesView = new ListView("filterValues", savedSearches) {

            @Override
            protected void populateItem(ListItem li) {
                final FacetHelper<Long> h = (FacetHelper<Long>) li.getModelObject();
                long tmp = h.value;
                final long ssId = tmp;
                Link link = new IndicatingAjaxFallbackLink("filterValueLink") {

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        SavedSearchPanel.this.onClick(target, ssId);
                    }
                };

                String name = h.displayName;
                if (name.length() > 20)
                    name = name.substring(0, 20) + "..";
                else if (name.length() < 1)
                    name = "<empty>";

                if (ssId == 0)
                    name = "last:" + name;

                link.add(new Label("filterValue", name));
                link.add(new AttributeAppender("title", true, new Model(h.displayName), " "));
                Label label4count = new Label("filterCount", " (" + h.count + ")");
                if (h.count < 1) {
                    link.add(new AttributeAppender("class", new Model("gray"), " "));
                    label4count.add(new AttributeAppender("class", new Model("gray"), " "));
                }

                li.add(label4count);
                li.add(link);

                final Dialog dialog = new Dialog("confirmation").setWidth(400).
                        setTitle("Delete Saved Search " + name + "?");
                dialog.add(new AjaxFallbackLink("button") {

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        dialog.close(target);
                        SavedSearchPanel.this.onRemove(target, ssId);
                    }
                });
                li.add(dialog);
                Link removeLink = new AjaxFallbackLink("removeLink") {

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        if (target != null)
                            dialog.open(target);
View Full Code Here

                    public void onClick() {
                        onLogout();
                    }
                });

                add(new AjaxFallbackLink("showHomeline") {

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        onHomeline(target, user.getScreenName());
                    }
                });

                add(new AjaxFallbackLink("showTweets") {

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        onShowTweets(target, user.getScreenName());
                    }
View Full Code Here

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

      link.onClick(target);

      // process the request target
      target.respond(requestCycle);
      requestCycle.detach();
    }
    // 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
    {
      return new AjaxFallbackLink(id)
      {
        private static final long serialVersionUID = 1L;

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

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

      link.onClick(target);

      // process the request target
      target.respond(requestCycle);
      requestCycle.detach();
    }
    // 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

            objectReadOnlyComponent =
                    new Label("selectedValue",pSearchTextModel);
        }
        objectReadOnlyComponent.setOutputMarkupId(true);

        AjaxFallbackLink deleteLink = new AjaxFallbackLink("searchLink") {
            @Override
            public void onClick(AjaxRequestTarget target) {
                changeToSearchMode(target);
            }
        };

        Component linkImage = new Image("searchLinkImage").setVisible(false);
        if (pBuilder.imageResource != null || pBuilder.imageResourceReference != null) {
            linkImage = pBuilder.imageResource != null ?
                    new Image("searchLinkImage",pBuilder.imageResource) :
                    new Image("searchLinkImage",pBuilder.imageResourceReference);
            deleteLink.add(new Label(ObjectAutoCompleteBuilder.SEARCH_LINK_PANEL_ID).setVisible(false));
        } else if (pBuilder.searchLinkContent != null) {
            deleteLink.add(pBuilder.searchLinkContent);
        } else if (!pBuilder.unchangeable) {
            deleteLink.add(new Label(ObjectAutoCompleteBuilder.SEARCH_LINK_PANEL_ID,pBuilder.searchLinkText));
        }
        deleteLink.add(linkImage);

        if (pBuilder.searchOnClick) {
            deleteLink.setVisible(false);
            objectReadOnlyComponent.add(new AjaxEventBehavior("onclick") {
                @Override
                protected void onEvent(AjaxRequestTarget target) {
                    changeToSearchMode(target);
                }
View Full Code Here

TOP

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

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.