当前位置: 首页>>代码示例>>Java>>正文


Java JsonpRequestBuilder类代码示例

本文整理汇总了Java中com.google.gwt.jsonp.client.JsonpRequestBuilder的典型用法代码示例。如果您正苦于以下问题:Java JsonpRequestBuilder类的具体用法?Java JsonpRequestBuilder怎么用?Java JsonpRequestBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JsonpRequestBuilder类属于com.google.gwt.jsonp.client包,在下文中一共展示了JsonpRequestBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStartDate

import com.google.gwt.jsonp.client.JsonpRequestBuilder; //导入依赖的package包/类
private void getStartDate(){

        String url = Consts.HOST_URL + "/summary/startTime";

        JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
        // Set timeout for 30 seconds (30000 milliseconds)
        jsonp.setTimeout(30000);
        jsonp.requestObject(url, new AsyncCallback<TweetTimes>() {

            @Override
            public void onFailure(Throwable caught) {
                Window.alert("Failure: " + caught.getMessage());
            }

            @Override
            public void onSuccess(TweetTimes result) {
                // Fire SetDateEvent to change date picker to default date from server
                DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
                Date startDate = dateTimeFormat.parse(result.getStartDate());
                Date endDate = dateTimeFormat.parse(result.getEndDate());

                presenter.getEventBus().fireEvent(new SetDateEvent(startDate, endDate));

            }
        });
    }
 
开发者ID:WSDOT,项目名称:social-analytics,代码行数:27,代码来源:AnalyticsViewImpl.java

示例2: doJsonpRequest

import com.google.gwt.jsonp.client.JsonpRequestBuilder; //导入依赖的package包/类
private void doJsonpRequest(String url, JSONPControllerCallback callback, Integer timeout) {
	JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
	if (timeout != null) {
		jsonp.setTimeout(timeout);
	}
	jsonp.requestObject(url, callback);
}
 
开发者ID:openremote,项目名称:WebConsole,代码行数:8,代码来源:JSONPControllerConnector.java

示例3: getRetweets

import com.google.gwt.jsonp.client.JsonpRequestBuilder; //导入依赖的package包/类
public static void getRetweets(String account, Date start, Date end, final MaterialCollection list, final String listType){

        list.clear();

        DateTimeFormat fmt = DateTimeFormat.getFormat("/yyyy/M/d");
        String startDate = fmt.format(start);
        String endDate = fmt.format(end);
        String screenName = account;

        String url = Consts.HOST_URL + "/summary/statuses/retweets/" + listType + "/" + screenName + startDate + endDate;

        loader.setVisible(true);

        JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
        // Set timeout for 30 seconds (30000 milliseconds)
        jsonp.setTimeout(30000);
        jsonp.requestObject(url, new AsyncCallback<Mention>() {

            @Override
            public void onFailure(Throwable caught) {
                Window.alert("Failure: " + caught.getMessage());
                loader.setVisible(false);
            }

            @Override
            public void onSuccess(Mention mention) {
                if (mention.getMentions() != null) {
                    list.clear();
                    updateRetweetList(mention.getMentions(), list, listType);
                    loader.setVisible(false);
                }
            }
        });
    }
 
开发者ID:WSDOT,项目名称:social-analytics,代码行数:35,代码来源:RankingView.java

示例4: getLikes

import com.google.gwt.jsonp.client.JsonpRequestBuilder; //导入依赖的package包/类
public static void getLikes(String account, Date start, Date end, final MaterialCollection list, final String listType){

        list.clear();

        DateTimeFormat fmt = DateTimeFormat.getFormat("/yyyy/M/d");
        String startDate = fmt.format(start);
        String endDate = fmt.format(end);
        String screenName = account;

        String url = Consts.HOST_URL + "/summary/statuses/favorites/" + listType + "/" + screenName + startDate + endDate;

        loader.setVisible(true);

        JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
        // Set timeout for 30 seconds (30000 milliseconds)
        jsonp.setTimeout(30000);
        jsonp.requestObject(url, new AsyncCallback<Mention>() {

            @Override
            public void onFailure(Throwable caught) {
                Window.alert("Failure: " + caught.getMessage());
                loader.setVisible(false);
            }

            @Override
            public void onSuccess(Mention mention) {
                if (mention.getMentions() != null) {
                    list.clear();
                    updateLikesList(mention.getMentions(), list, listType);
                    loader.setVisible(false);
                }
            }
        });
    }
 
开发者ID:WSDOT,项目名称:social-analytics,代码行数:35,代码来源:RankingView.java

示例5: updateSentiment

import com.google.gwt.jsonp.client.JsonpRequestBuilder; //导入依赖的package包/类
private void updateSentiment(final String sentimentType){

        String url = JSON_URL + this.id + "/" + sentimentType;

        JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
        // Set timeout for 30 seconds (30000 milliseconds)
        jsonp.setTimeout(30000);
        jsonp.requestObject(url, new AsyncCallback<Mention>() {

        @Override
        public void onFailure(Throwable caught) {
            Window.alert("Failure: " + caught.getMessage());
        }

        @Override
        public void onSuccess(Mention result) {
            if (sentimentType.equalsIgnoreCase("positive")) {
                sentiment.setIconType(IconType.SENTIMENT_SATISFIED);
                sentiment.setIconColor("teal accent-4");
            } else if (sentimentType.equalsIgnoreCase("negative")) {
                sentiment.setIconType(IconType.SENTIMENT_DISSATISFIED);
                sentiment.setIconColor("deep-orange");
            }else {
                sentiment.setIconType(IconType.SENTIMENT_NEUTRAL);
                sentiment.setIconColor("black");
            }
        }});
    }
 
开发者ID:WSDOT,项目名称:social-analytics,代码行数:29,代码来源:TweetView.java

示例6: onMore

import com.google.gwt.jsonp.client.JsonpRequestBuilder; //导入依赖的package包/类
@UiHandler("moreSearchBtn")
public void onMore(ClickEvent e){

    int nextPage = pageNum + 1;

    searchLoader.setVisible(true);

    JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
    // Set timeout for 30 seconds (30000 milliseconds)
    jsonp.setTimeout(30000);
    jsonp.requestObject(url + nextPage, new AsyncCallback<Mention>() {

        @Override
        public void onFailure(Throwable caught) {
            Window.alert("Failure: " + caught.getMessage());
            searchLoader.setVisible(false);
        }

        @Override
        public void onSuccess(Mention mention) {
            if (mention.getMentions() != null) {
                pageNum++;
                updateSearch(mention.getMentions());
                searchLoader.setVisible(false);
            }
        }
    });
}
 
开发者ID:WSDOT,项目名称:social-analytics,代码行数:29,代码来源:SearchView.java

示例7: onSearch

import com.google.gwt.jsonp.client.JsonpRequestBuilder; //导入依赖的package包/类
@EventHandler
void onSearch(SearchEvent e) {
    pageNum = 1;
    backToSearchTopBtn.setVisible(false);
    searchText = e.getSearchText();
    searchList.clear();
    moreSearchBtn.setVisible(false);
    exportLink.setVisible(false);

    tweetSearch.setText(e.getSearchText());

    String url = getUrl(e);

    searchLoader.setVisible(true);

    JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
    // Set timeout for 30 seconds (30000 milliseconds)
    jsonp.setTimeout(30000);
    jsonp.requestObject(url + pageNum, new AsyncCallback<Mention>() {

        @Override
        public void onFailure(Throwable caught) {
            Window.alert("Failure: " + caught.getMessage());
            searchLoader.setVisible(false);
        }

        @Override
        public void onSuccess(Mention mention) {
            if (mention.getMentions() != null) {
                updateSearch(mention.getMentions());
                searchLoader.setVisible(false);
            }
        }
    });
}
 
开发者ID:WSDOT,项目名称:social-analytics,代码行数:36,代码来源:SearchView.java

示例8: getSuggestions

import com.google.gwt.jsonp.client.JsonpRequestBuilder; //导入依赖的package包/类
public void getSuggestions(String searchText) {
    String url = JSON_URL_SUGGESTION;
    String searchString = SafeHtmlUtils.htmlEscape(searchText.trim().replace("'", ""));

    // Append the name of the callback function to the JSON URL.
    url += searchString;
    url = URL.encode(url);
    JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
    // Set timeout for 30 seconds (30000 milliseconds)
    jsonp.setTimeout(30000);
    jsonp.requestObject(url, new AsyncCallback<Words>() {

        @Override
        public void onFailure(Throwable caught) {
            // Just fail silently here.
        }

        @Override
        public void onSuccess(Words words) {
            if (words.getWords() != null) {

                List<SearchObject> searchHints = new ArrayList<SearchObject>();

                for (int i = 0; i < words.getWords().length(); i++){
                    SearchObject search = new SearchObject();
                    search.setKeyword(words.getWords().get(i));
                    searchHints.add(search);
                }

                updateSuggestions(searchHints);
            }
        }
    });
}
 
开发者ID:WSDOT,项目名称:social-analytics,代码行数:35,代码来源:SearchView.java

示例9: onSentimentDisplay

import com.google.gwt.jsonp.client.JsonpRequestBuilder; //导入依赖的package包/类
@EventHandler
void onSentimentDisplay(SentimentDisplayEvent event){
    pageNum = 1;
    tweetsList.clear();
    moreTweetsBtn.setVisible(false);

    String url = Consts.HOST_URL + "/mentions/" + event.getSentiment() + "/" + currentAccount + startDate + endDate + "/";
    currentUrl = url;

    tweetsLoader.setVisible(true);

    JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
    // Set timeout for 30 seconds (30000 milliseconds)
    jsonp.setTimeout(30000);
    jsonp.requestObject(url + pageNum, new AsyncCallback<Mention>() {

        @Override
        public void onFailure(Throwable caught) {
            Window.alert("Failure: " + caught.getMessage());
            tweetsLoader.setVisible(false);
        }

        @Override
        public void onSuccess(Mention mention) {
            if (mention.getMentions() != null) {
                updateTweetsList(mention.getMentions());
                tweetsLoader.setVisible(false);
            }
        }
    });
}
 
开发者ID:WSDOT,项目名称:social-analytics,代码行数:32,代码来源:TweetsView.java

示例10: onMore

import com.google.gwt.jsonp.client.JsonpRequestBuilder; //导入依赖的package包/类
/**
 * Loads in the next set of 10 tweets using the values of currentAccount, currentDate and pageNum.
 * @param e
 */
@UiHandler("moreTweetsBtn")
public void onMore(ClickEvent e){

    int nextPage = pageNum + 1;

    tweetsLoader.setVisible(true);

    JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
    // Set timeout for 30 seconds (30000 milliseconds)
    jsonp.setTimeout(30000);
    jsonp.requestObject(currentUrl + nextPage, new AsyncCallback<Mention>() {

        @Override
        public void onFailure(Throwable caught) {
            Window.alert("Failure: " + caught.getMessage());
            tweetsLoader.setVisible(false);
        }

        @Override
        public void onSuccess(Mention mention) {
            if (mention.getMentions() != null) {
                pageNum++;
                updateTweetsList(mention.getMentions());
                tweetsLoader.setVisible(false);
            }
        }
    });
}
 
开发者ID:WSDOT,项目名称:social-analytics,代码行数:33,代码来源:TweetsView.java

示例11: updateTweets

import com.google.gwt.jsonp.client.JsonpRequestBuilder; //导入依赖的package包/类
/**
 * Updates the list of tweets through a jsonp request.
 *
 * @param startDate
 * @param endDate
 * @param account : The account, can be "All" for all accounts
 */
public static void updateTweets(String startDate, String endDate, String account){

    tweetsList.clear();
    moreTweetsBtn.setVisible(false);

    DateTimeFormat fmt = DateTimeFormat.getFormat("/yyyy/M/d");
    String screenName = account;

    String url = Consts.HOST_URL + "/summary/mentions/" + screenName + startDate + endDate + "/";
    currentUrl = url;

    tweetsLoader.setVisible(true);

    JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
    // Set timeout for 30 seconds (30000 milliseconds)
    jsonp.setTimeout(30000);
    jsonp.requestObject(url + pageNum, new AsyncCallback<Mention>() {

        @Override
        public void onFailure(Throwable caught) {
            Window.alert("Failure: " + caught.getMessage());
            tweetsLoader.setVisible(false);
        }

        @Override
        public void onSuccess(Mention mention) {
            if (mention.getMentions() != null) {
                updateTweetsList(mention.getMentions());
                tweetsLoader.setVisible(false);
            }
        }
    });
}
 
开发者ID:WSDOT,项目名称:social-analytics,代码行数:41,代码来源:TweetsView.java

示例12: resolveDomain

import com.google.gwt.jsonp.client.JsonpRequestBuilder; //导入依赖的package包/类
private void resolveDomain(String domain, com.google.gwt.user.client.rpc.AsyncCallback<DnsResult> callback) {
	String url = getResolverUrl();
	// adding parameters for resolver to process
	url += "?version=2";
	url += "&domain=" + URL.encodeQueryString(domain);
	JsonpRequestBuilder builder = new JsonpRequestBuilder();
	builder.requestObject(url, callback);		
}
 
开发者ID:horsefaced,项目名称:jaxmpp-android,代码行数:9,代码来源:WebDnsResolver.java

示例13: jsonpRequest

import com.google.gwt.jsonp.client.JsonpRequestBuilder; //导入依赖的package包/类
public static <T extends JavaScriptObject> void jsonpRequest(String baseUrl,
                                                             String cmd,
                                                             List<Param> paramList,
                                                             AsyncCallback<T> cb) {
    String url = makeURL(baseUrl, cmd, paramList, true);
    JsonpRequestBuilder builder = new JsonpRequestBuilder();
    builder.setTimeout(TIMEOUT);
    builder.requestObject(url, cb);
}
 
开发者ID:lsst,项目名称:firefly,代码行数:10,代码来源:JsonUtils.java

示例14: doGet

import com.google.gwt.jsonp.client.JsonpRequestBuilder; //导入依赖的package包/类
void doGet(final String url) {
	JsonpRequestBuilder builder = new JsonpRequestBuilder();
	//builder.setCallbackParam("json_callback");

	mRequestHandle = builder.requestObject(url, new AsyncCallback<JavaScriptObject>() {
		public void onFailure(Throwable caught) {

			mSink.completed(FAILED);
			log.debug("fail! {} {}", mRequestHandle, caught.getMessage());
			//mRequestHandle.cancel();
		}

		public void onSuccess(JavaScriptObject jso) {
			if (mTile.state(State.NONE)) {
				log.debug("tile cleared {}", url);
				mSink.completed(FAILED);
				return;
			}

			if (jso == null) {
				log.debug("Couldn't retrieve JSON for {}", url);
				mSink.completed(FAILED);
				return;
			}

			try {
				if (mTileDecoder.decode(mTile, mSink, jso)) {
					mSink.completed(SUCCESS);
					return;
				}
			} catch (Exception e) {
				log.debug("Couldn't retrieve JSON for {} {}" + url, e);
				// FIXME need to check where it might be thrown
				mSink.completed(FAILED);
			}
		}
	});
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:39,代码来源:JsonTileDataSource.java

示例15: updateChart

import com.google.gwt.jsonp.client.JsonpRequestBuilder; //导入依赖的package包/类
/**
 * Requests data from the server
 * @param dateRange
 * @param account
 */
public static void updateChart(final String dateRange, final String account) {
    cardContent.clear();

    String url = "";
    String screenName = account;

    sentimentLoader.setVisible(true);

    url = JSON_URL + "/sentiment/" + screenName + dateRange;

    JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
    // Set timeout for 30 seconds (30000 milliseconds)
    jsonp.setTimeout(30000);
    jsonp.requestObject(url, new AsyncCallback<SentimentSummary>() {

        @Override
        public void onFailure(Throwable caught) {
            Window.alert("Failure: " + caught.getMessage());
            sentimentLoader.setVisible(false);
        }

        @Override
        public void onSuccess(SentimentSummary result) {
            // Create a callback to be called when the visualization API
            // has been loaded.
            sentimentSummary = result.getSentimentSummary();

            // Create the API Loader
            ChartLoader chartLoader = new ChartLoader(ChartPackage.CORECHART);
            chartLoader.loadApi(new Runnable() {
                @Override
                public void run() {
                    cardContent.add(getPieChart());
                    drawPieChart(sentimentSummary);
                    sentimentLoader.setVisible(false);
                }
            });
        }
    });
}
 
开发者ID:WSDOT,项目名称:social-analytics,代码行数:46,代码来源:SentimentPieChart.java


注:本文中的com.google.gwt.jsonp.client.JsonpRequestBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。