本文整理汇总了Java中com.google.gwt.user.client.Window.Location类的典型用法代码示例。如果您正苦于以下问题:Java Location类的具体用法?Java Location怎么用?Java Location使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Location类属于com.google.gwt.user.client.Window包,在下文中一共展示了Location类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupVersionChecker
import com.google.gwt.user.client.Window.Location; //导入依赖的package包/类
private void setupVersionChecker() {
versionChecker = new ClientVersionChecker(new ClientVersionChecker.Listener() {
@Override
public void onClientUpdated() {
UpdateIndicatorWidget.create(RootPanel.get("banner"), new UpdateIndicatorWidget.Listener() {
@Override
public void refresh() {
completeWave(new Command() {
@Override
public void execute() {
Location.assign(GWT.getHostPageBaseURL());
}
});
}
});
}
}, LOG);
}
示例2: getUiSwitcherUrl
import com.google.gwt.user.client.Window.Location; //导入依赖的package包/类
private static String getUiSwitcherUrl(String token) {
UrlBuilder builder = new UrlBuilder();
builder.setProtocol(Location.getProtocol());
builder.setHost(Location.getHost());
String port = Location.getPort();
if (port != null && !port.isEmpty()) {
builder.setPort(Integer.parseInt(port));
}
String[] tokens = token.split("@", 2);
if (Location.getPath().endsWith("/") && tokens[0].startsWith("/")) {
tokens[0] = tokens[0].substring(1);
}
builder.setPath(Location.getPath() + tokens[0]);
if (tokens.length == 2) {
builder.setHash(tokens[1]);
}
builder.setParameter("polygerrit", "1");
return builder.buildString();
}
示例3: loadContactDetails
import com.google.gwt.user.client.Window.Location; //导入依赖的package包/类
private void loadContactDetails(final JSONObject self) {
final String addContactToken = Location.getParameter("id");
CollaborationClient.getInstance().getContactDetails(addContactToken, new JsonCallback() {
public void onJsonReceived(JSONValue jsonValue) {
if (jsonValue.isObject().containsKey("error")) {
SC.say("Error", "This invitation is no longer valid");
} else {
JSONObject contact = jsonValue.isObject();
if (self.get("localId").isString().stringValue().equals(contact.get("localId").isString().stringValue()) && self.get("accountType").isNumber().equals(contact.get("accountType").isNumber())) {
SC.say("You cannot add your own account as a contact. <br> Login with a different account to ARLearn to accept this invitation.");
} else {
buildPage(jsonValue.isObject(), addContactToken);
}
}
}
});
}
示例4: appendToApplicationUrl
import com.google.gwt.user.client.Window.Location; //导入依赖的package包/类
/**
* Appends an additional path to the application URL.
*
* @param additionalPath
* The additional path to append to the application URL.
* @return the new URL.
*/
public static String appendToApplicationUrl(String additionalPath) {
final UrlBuilder urlBuilder = new UrlBuilder();
urlBuilder.setProtocol(Location.getProtocol());
urlBuilder.setHost(Location.getHost());
final Integer port = asInt(Location.getPort());
if (port != null) {
urlBuilder.setPort(port);
}
urlBuilder.setPath(Location.getPath() + additionalPath);
return urlBuilder.buildString();
}
示例5: launchDownload
import com.google.gwt.user.client.Window.Location; //导入依赖的package包/类
/**
* <p>
* Launches the given {@code downloadUrl} corresponding download action (simple {@code GET} access on the URL).
* </p>
* <p>
* In <em>script</em> mode, assigns window location to the given {@code downloadUrl}.<br>
* In <em>hosted</em> (dev) mode, opens a new window to avoid loosing the entire JS application context in case of
* error.
* </p>
*
* @param downloadUrl
* The download URL.
* @throws IllegalArgumentException
* If the given {@code downloadUrl} is blank.
*/
public static final void launchDownload(final String downloadUrl) {
if (isBlank(downloadUrl)) {
throw new IllegalArgumentException("Invalid download URL '" + downloadUrl + "'.");
}
if (GWT.isScript()) {
// Production mode: switch to new page.
Window.Location.assign(downloadUrl);
} else {
// Hosted mode: avoid loosing the entire JS application context in case of error.
openWindow(downloadUrl);
}
}
示例6: emailUser
import com.google.gwt.user.client.Window.Location; //导入依赖的package包/类
private void emailUser() {
UserInfo user = UserAccountController.getInstance().getUserInfo();
if (user != null) {
EmailInfo email = new EmailInfo();
String message = WELCOME_EMAIL_TEXT;
message = message.replace("%lg", "http://" + Window.Location.getHostName());
message = message.replace("%un", user.getUserName());
email.setToAddressString(user.getUserName());
email.setFromString("[email protected]");
email.setSubjectString("Rise Vision - A Web Platform for Digital Signage");
email.setMessageString(message);
userService.sendEmail(email, new RpcSendUserEmailCallBackHandler());
}
}
示例7: buildUrlAndGoToGraphPage
import com.google.gwt.user.client.Window.Location; //导入依赖的package包/类
private void buildUrlAndGoToGraphPage(List<ResourceListItem> reports) {
StringBuilder sb = new StringBuilder();
sb.append(m_baseUrl + "graph/results.htm?reports=all&resourceId=");
boolean first = true;
for(ResourceListItem item : reports) {
if(!first) {
sb.append("&resourceId=");
}
sb.append(item.getId());
first = false;
}
Location.assign(sb.toString());
}
示例8: buildReloadContent
import com.google.gwt.user.client.Window.Location; //导入依赖的package包/类
/**
* This method is called by the default {@link #deactivate()}
* implementation to build the contents of this overlay when the
* device goes online and the online app was not loaded previously.
*
* The simplest method to customize this view mode is to override
* this method and add a custom app to the panel returned by the
* {@link #getPanel()} method.
*/
protected void buildReloadContent() {
getPanel().clear();
FlowPanel fp = new FlowPanel();
getPanel().add(fp);
fp.setStyleName("v-touchkit-offlinemode-panel");
fp.add(new HTML("<h1>" + msg.networkBack() + "<h1>"));
VNativeButton vButton = new VNativeButton();
vButton.setText(msg.reload());
vButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
overlay.hide();
Location.reload();
}
});
fp.add(vButton);
}
示例9: SolverPage
import com.google.gwt.user.client.Window.Location; //导入依赖的package包/类
public SolverPage() {
addStyleName("unitime-SolverPage");
iType = SolverType.valueOf(Location.getParameter("type").toUpperCase());
switch (iType) {
case COURSE:
UniTimePageLabel.getInstance().setPageName(MESSAGES.pageCourseTimetablingSolver());
break;
case EXAM:
UniTimePageLabel.getInstance().setPageName(MESSAGES.pageExaminationTimetablingSolver());
break;
case INSTRUCTOR:
UniTimePageLabel.getInstance().setPageName(MESSAGES.pageInstructorSchedulingSolver());
break;
case STUDENT:
UniTimePageLabel.getInstance().setPageName(MESSAGES.pageStudentSchedulingSolver());
break;
}
iSolverHeader = new UniTimeHeaderPanel(CONSTANTS.solverType()[iType.ordinal()]);
addHeaderRow(iSolverHeader);
iSolverButtons = new UniTimeHeaderPanel();
iSolverButtons.addButton("load", MESSAGES.opSolverLoad(), createClickHandler(SolverOperation.LOAD));
iSolverButtons.addButton("start", MESSAGES.opSolverStart(), createClickHandler(SolverOperation.START));
iSolverButtons.addButton("stop", MESSAGES.opSolverStop(), createClickHandler(SolverOperation.STOP));
iSolverButtons.addButton("sectioning", MESSAGES.opSolverStudentSectioning(), createClickHandler(SolverOperation.STUDENT_SECTIONING));
iSolverButtons.addButton("reload", MESSAGES.opSolverReload(), createClickHandler(SolverOperation.RELOAD));
iSolverButtons.addButton("save", MESSAGES.opSolverSave(), createClickHandler(SolverOperation.SAVE));
iSolverButtons.addButton("save new", MESSAGES.opSolverSaveAsNew(), createClickHandler(SolverOperation.SAVE_AS_NEW));
iSolverButtons.addButton("commit", MESSAGES.opSolverSaveCommit(), createClickHandler(SolverOperation.SAVE_COMMIT));
iSolverButtons.addButton("uncommit", MESSAGES.opSolverSaveUncommit(), createClickHandler(SolverOperation.SAVE_UNCOMMIT));
iSolverButtons.addButton("clear", MESSAGES.opSolverClear(), createClickHandler(SolverOperation.CLEAR));
iSolverButtons.addButton("csv", MESSAGES.opSolverExportCSV(), createClickHandler(SolverOperation.EXPORT_CSV));
iSolverButtons.addButton("unload", MESSAGES.opSolverUnload(), createClickHandler(SolverOperation.UNLOAD));
iSolverButtons.addButton("refresh", MESSAGES.opSolverRefresh(), createClickHandler(SolverOperation.CHECK));
execute(SolverOperation.INIT);
}
示例10: HistoryToken
import com.google.gwt.user.client.Window.Location; //导入依赖的package包/类
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());
}
示例11: execute
import com.google.gwt.user.client.Window.Location; //导入依赖的package包/类
@Override
public void execute() {
final DialogBox db = new DialogBox(false, true);
db.setText("About The Companion");
db.setStyleName("ode-DialogBox");
db.setHeight("200px");
db.setWidth("400px");
db.setGlassEnabled(true);
db.setAnimationEnabled(true);
db.center();
String downloadinfo = "";
if (!YaVersion.COMPANION_UPDATE_URL1.equals("")) {
String url = "http://" + Window.Location.getHost() + YaVersion.COMPANION_UPDATE_URL1;
downloadinfo = "<br/>\n<a href=" + url + ">Download URL: " + url + "</a><br/>\n";
downloadinfo += BlocklyPanel.getQRCode(url);
}
VerticalPanel DialogBoxContents = new VerticalPanel();
HTML message = new HTML(
"Companion Version " + BlocklyPanel.getCompVersion() + downloadinfo
);
SimplePanel holder = new SimplePanel();
Button ok = new Button("Close");
ok.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
db.hide();
}
});
holder.add(ok);
DialogBoxContents.add(message);
DialogBoxContents.add(holder);
db.setWidget(DialogBoxContents);
db.show();
}
示例12: setupLocaleSelect
import com.google.gwt.user.client.Window.Location; //导入依赖的package包/类
private void setupLocaleSelect() {
final SelectElement select = (SelectElement) Document.get().getElementById(LANG_ELEMENT_ID);
String currentLocale = LocaleInfo.getCurrentLocale().getLocaleName();
String[] localeNames = LocaleInfo.getAvailableLocaleNames();
for (String locale : localeNames) {
if (!DEFAULT_LOCALE.equals(locale)) {
String displayName = LocaleInfo.getLocaleNativeDisplayName(locale);
OptionElement option = Document.get().createOptionElement();
option.setValue(locale);
option.setText(displayName);
select.add(option, null);
if (locale.equals(currentLocale)) {
select.setSelectedIndex(select.getLength() - 1);
}
}
}
EventDispatcherPanel.of(select).registerChangeHandler(null, new WaveChangeHandler() {
@Override
public boolean onChange(ChangeEvent event, Element context) {
UrlBuilder builder = Location.createUrlBuilder().setParameter(
LOCALE_URLBUILDER_PARAMETER, select.getValue());
Window.Location.replace(builder.buildString());
localeService.storeLocale(select.getValue());
return true;
}
});
}
示例13: requestNavigateTo
import com.google.gwt.user.client.Window.Location; //导入依赖的package包/类
@Override
public void requestNavigateTo(String url) {
log("GW.requestNavigateTo: url=" + url);
// NOTE(user): Currently only allow the gadgets to change the fragment part of the URL.
String newFragment = url.replaceFirst(BEFORE_FRAGMENT_PATTERN, "");
if (newFragment.matches(FRAGMENT_VALIDATION_PATTERN)) {
Location.replace(Location.getHref().replaceFirst(FRAGMENT_PATTERN, "") + "#" + newFragment);
} else {
log("Navigate request denied.");
}
}
示例14: testIframeUri
import com.google.gwt.user.client.Window.Location; //导入依赖的package包/类
/**
* Tests the IFrame URI generator of Gadget class.
*/
public void testIframeUri() {
String href = "http://" + Location.getHost();
String hrefEscaped = href.replace("?", "%3F");
if (hrefEscaped.endsWith("/")) {
hrefEscaped = hrefEscaped.substring(0, hrefEscaped.length() - 1);
}
int clientInstanceId = 1234;
GadgetUserPrefs userPrefs = GadgetUserPrefs.create();
userPrefs.put("pref1", "value1");
userPrefs.put("pref2", "value2");
WaveId waveId = WaveId.of("wave.google.com", "123");
WaveletId waveletId = WaveletId.of("wave.google.com", "conv+root");
WaveletName name = WaveletName.of(waveId, waveletId);
GadgetWidget gadget = GadgetWidget.createForTesting(clientInstanceId, userPrefs, name,
new FakeLocale());
int gadgetInstanceId = -12345;
String url = gadget.buildIframeUrl(gadgetInstanceId, "http://test.com/gadget.xml");
String expectedValue =
"//0" + GADGET_SERVER + "/gadgets"
+ "/ifr?url=http://test.com/gadget.xml&view=canvas&nocache=1&mid=" + gadgetInstanceId
+ "&lang=wizard&country=OZ&parent=" + hrefEscaped + "&wave=1&waveId="
+ URL.encodeQueryString(ModernIdSerialiser.INSTANCE.serialiseWaveId(waveId))
+ "#rpctoken=" + gadget.getRpcToken()
+ "&up_pref1=value1&up_pref2=value2";
assertEquals(expectedValue, url);
}
示例15: selfRedirect
import com.google.gwt.user.client.Window.Location; //导入依赖的package包/类
public static String selfRedirect(String suffix) {
// Clean up the path. Users seem to like putting extra slashes into the URL
// which can break redirections by misinterpreting at either client or server.
String path = Location.getPath();
if (path == null || path.isEmpty()) {
path = "/";
} else {
while (path.startsWith("//")) {
path = path.substring(1);
}
while (path.endsWith("//")) {
path = path.substring(0, path.length() - 1);
}
if (!path.endsWith("/")) {
path = path + "/";
}
}
if (suffix != null) {
while (suffix.startsWith("/")) {
suffix = suffix.substring(1);
}
path += suffix;
}
UrlBuilder builder = new UrlBuilder();
builder.setProtocol(Location.getProtocol());
builder.setHost(Location.getHost());
String port = Location.getPort();
if (port != null && !port.isEmpty()) {
builder.setPort(Integer.parseInt(port));
}
builder.setPath(path);
return builder.buildString();
}