Java Code Examples for com.google.gwt.user.client.Window.Location#getParameter()

The following examples show how to use com.google.gwt.user.client.Window.Location#getParameter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JTSWebAppEntry.java    From jts with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void onLoad() {
	String mode = Location.getParameter("mode");
	
	if(mode == null) {
		new SimpleDemo().start();
		return;
	}
	
	switch(mode) {
	case "test":
		new TestRunner().run();
		break;
	case "geojson":
		new GeoJson().check();
		break;
	default:
		new SimpleDemo().start();
		break;
	}
}
 
Example 2
Source File: SuggestionsPage.java    From unitime with Apache License 2.0 5 votes vote down vote up
public SelectedAssignment getLocationAssignment() {
	SelectedAssignment ret = new SelectedAssignment();
	if (Location.getParameter("id") != null)
		ret.setClassId(Long.valueOf(Location.getParameter("id")));
	else
		return null;
	if (Location.getParameter("days") != null)
		ret.setDays(Integer.valueOf(Location.getParameter("days")));
	else
		return null;
	if (Location.getParameter("slot") != null)
		ret.setStartSlot(Integer.valueOf(Location.getParameter("slot")));
	else
		return null;
	if (Location.getParameter("pid") != null)
		ret.setPatternId(Long.valueOf(Location.getParameter("pid")));
	else
		return null;
	if (Location.getParameter("did") != null)
		ret.setDatePatternId(Long.valueOf(Location.getParameter("did")));
	else
		return null;
	if (Location.getParameter("room") != null) {
		for (String id: Location.getParameter("room").split(","))
			ret.addRoomId(Long.valueOf(id));
	}
	return ret;
}
 
Example 3
Source File: EventResourceTimetable.java    From unitime with Apache License 2.0 5 votes vote down vote up
public HistoryToken(PageType type) {
	iType = type.name();
	
	// 1. take page type defaults --> DEFAULTS
	if (type.getParams() != null)
		for (int i = 0; 1 + i < type.getParams().length; i += 2)
			iDefaults.put(type.getParams()[i], type.getParams()[i + 1]);

	// 2. take page parameters --> DEFAULTS (on top of the page type defaults)
	for (Map.Entry<String, List<String>> params: Window.Location.getParameterMap().entrySet())
		iDefaults.put(params.getKey(), params.getValue().get(0));
	
	// 3. take cookie --> PARAMS (override defaults)
	String cookie = EventCookie.getInstance().getHash(iType);
	if (cookie != null) {
		for (String pair: cookie.split("\\&")) {
			int idx = pair.indexOf('=');
			if (idx >= 0) {
				String key = pair.substring(0, idx);
				if (Location.getParameter(key) == null)
					iParams.put(key, URL.decodeQueryString(pair.substring(idx + 1)));
			}
		}
	}			
	
	// 4. take page token (hash) --> PARAMS (override cookie)
	parse(History.getToken());
}