本文整理了Java中com.google.gwt.core.client.GWT.isClient()
方法的一些代码示例,展示了GWT.isClient()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GWT.isClient()
方法的具体详情如下:
包路径:com.google.gwt.core.client.GWT
类名称:GWT
方法名:isClient
[英]Returns true
when running inside the normal GWT environment, either in Development Mode or Production Mode. Returns false
if this code is running in a plain JVM. This might happen when running shared code on the server, or during the bootstrap sequence of a GWTTestCase test.
[中]在开发模式或生产模式下,在正常GWT环境中运行时返回true
。如果此代码在普通JVM中运行,则返回false
。这可能发生在服务器上运行共享代码时,或者在GWTTestCase测试的引导序列期间。
代码示例来源:origin: com.google.gwt/gwt-servlet
private static void maybeInitializeScrollHandlers() {
if (GWT.isClient() && !scrollHandlersInitialized) {
impl.initWindowScrollHandler();
scrollHandlersInitialized = true;
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
private static void maybeInitializeCloseHandlers() {
if (GWT.isClient() && !closeHandlersInitialized) {
impl.initWindowCloseHandler();
closeHandlersInitialized = true;
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
private static void maybeInitializeResizeHandlers() {
if (GWT.isClient() && !resizeHandlersInitialized) {
impl.initWindowResizeHandler();
resizeHandlersInitialized = true;
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Creates the loader stored as {@link #BROWSER_LOADER}.
*
* @returns {@code null} if not in GWT client code, where
* {@link GWT#create(Class)} cannot be used, or a fragment loader for
* the user's application otherwise.
*/
private static AsyncFragmentLoader makeBrowserLoader(int numFragments, int initialLoad[]) {
if (GWT.isClient()) {
return new AsyncFragmentLoader(numFragments, initialLoad,
(LoadingStrategy) GWT.create(LoadingStrategy.class), (Logger) GWT.create(Logger.class),
(OnSuccessExecutor) GWT.create(OnSuccessExecutor.class));
} else {
return null;
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
public void configureClientSideLogging() {
assert GWT.isClient();
root = Logger.getLogger("");
// In DevMode, this root logger will have a parent and we do not want this
// root logger to pass messages to it's parent, so we set
// useParentHandlers to false here.
root.setUseParentHandlers(false);
setLevels(root);
setDefaultHandlers(root);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Calls a native JS <code>equals</code> method if any, otherwise
* returns <code>true</code> if the objects are JavaScript identical
* (triple-equals).
*/
@Override
public final boolean equals(Object other) {
if (!GWT.isClient()) {
return super.equals(other);
}
return hasEquals(this) ? callEquals(this, other) : super.equals(other);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Calls a native JS <code>hashCode</code> method if any, otherwise
* uses a monotonically increasing counter to assign a hash code to the
* underlying JavaScript object. Do not call this method on non-modifiable
* JavaScript objects.
*
* @return the hash code of the object
*/
@Override
public final int hashCode() {
if (!GWT.isClient()) {
return super.hashCode();
}
return hasHashCode(this) ? callHashCode(this) : super.hashCode();
};
代码示例来源:origin: com.google.gwt/gwt-servlet
private static void reportUncaughtException(
Throwable e, boolean reportSwallowedExceptionToBrowser) {
if (Impl.uncaughtExceptionHandlerForTest != null) {
Impl.uncaughtExceptionHandlerForTest.onUncaughtException(e);
}
UncaughtExceptionHandler handler = GWT.getUncaughtExceptionHandler();
if (handler != null) {
if (handler == Impl.uncaughtExceptionHandlerForTest) {
return; // Already reported so we're done.
}
// TODO(goktug): Handler might throw an exception but catching and reporting it to browser
// here breaks assumptions of some existing hybrid apps that uses UCE for exception
// conversion. We don't have an alternative functionality (yet) and it is too risky to include
// the change in the release at last minute.
handler.onUncaughtException(e);
return; // Done.
}
// Make sure that the exception is not swallowed
if (GWT.isClient() && reportSwallowedExceptionToBrowser) {
reportToBrowser(e);
} else {
System.err.print("Uncaught exception ");
e.printStackTrace(System.err);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* IE6 does not allow direct access to event handlers on the parent window,
* so we must embed a script in the parent window that will set the event
* handlers in the correct context.
*
* @param initFunc the string representation of the init function
* @param cmd the command to execute the init function
*/
private void initHandler(String initFunc, ScheduledCommand cmd) {
if (GWT.isClient()) {
// Embed the init script on the page
ScriptElement scriptElem = Document.get().createScriptElement(initFunc);
Document.get().getBody().appendChild(scriptElem);
// Initialize the handler
cmd.execute();
// Remove the script element
Document.get().getBody().removeChild(scriptElem);
}
}
代码示例来源:origin: resty-gwt/resty-gwt
private Logger getLogger() {
if (GWT.isClient() && LogConfiguration.loggingIsEnabled() && logger == null) {
logger = Logger.getLogger(AbstractAsyncCallback.class.getName());
}
return logger;
}
代码示例来源:origin: resty-gwt/resty-gwt
private Logger getLogger() {
if (GWT.isClient() && LogConfiguration.loggingIsEnabled() && logger == null) {
logger = Logger.getLogger(AbstractRequestCallback.class.getName());
}
return logger;
}
代码示例来源:origin: org.fusesource.restygwt/restygwt
private Logger getLogger() {
if (GWT.isClient() && LogConfiguration.loggingIsEnabled() && logger == null) {
logger = Logger.getLogger(AbstractRequestCallback.class.getName());
}
return logger;
}
代码示例来源:origin: org.fusesource.restygwt/restygwt
private void doRemove(CacheKey key, String scope) {
if (GWT.isClient() && LogConfiguration.loggingIsEnabled()) {
Logger.getLogger(DefaultQueueableCacheStorage.class.getName())
.finer("removing cache-key " + key + " from scope \"" + scope + "\"");
}
HashMap<CacheKey, Response> scoped = cache.get(scope);
if (null != scoped) {
scoped.remove(key);
}
}
}
代码示例来源:origin: resty-gwt/resty-gwt
private Logger getLogger() {
if (GWT.isClient() && LogConfiguration.loggingIsEnabled() && logger == null) {
logger = Logger.getLogger(Method.class.getName());
}
return logger;
}
代码示例来源:origin: resty-gwt/resty-gwt
private void doRemove(CacheKey key, String scope) {
if (GWT.isClient() && LogConfiguration.loggingIsEnabled()) {
Logger.getLogger(DefaultQueueableCacheStorage.class.getName())
.finer("removing cache-key " + key + " from scope \"" + scope + "\"");
}
HashMap<CacheKey, Response> scoped = cache.get(scope);
if (null != scoped) {
scoped.remove(key);
}
}
}
代码示例来源:origin: resty-gwt/resty-gwt
@Override
public void onResponseReceived(Request request, Response response) {
if (GWT.isClient() && LogConfiguration.loggingIsEnabled()) {
Logger.getLogger(CachingCallbackFilter.class.getName())
.finer("call " + removedCallbacks.size() + " more queued callbacks for " + ck);
}
// call all callbacks found in cache
for (RequestCallback cb : removedCallbacks) {
cb.onResponseReceived(request, response);
}
}
代码示例来源:origin: org.fusesource.restygwt/restygwt
@Override
public void run() {
try {
method.builder.send();
} catch (RequestException ex) {
if (GWT.isClient() && LogConfiguration.loggingIsEnabled()) {
Logger.getLogger(RetryingFilterawareRequestCallback.class.getName())
.severe(ex.getMessage());
}
}
}
};
代码示例来源:origin: stephenh/tessell
private void renderNeeded() {
if (!GWT.isClient() || view.isAttached()) {
// in unit tests, render should be cheap
render();
} else {
// Wait until we're attached
needsRender = true;
}
}
代码示例来源:origin: resty-gwt/resty-gwt
protected void cacheResult(Method method, Response response) {
CacheKey cacheKey = cacheKey(method.builder);
if (GWT.isClient() && LogConfiguration.loggingIsEnabled()) {
Logger.getLogger(CachingCallbackFilter.class.getName()).finer("cache to " + cacheKey + ": " + response);
}
cache.putResult(cacheKey, response, getCacheDomains(method));
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Setup clonable elements.
*/
void initializeClonableElements() {
if (GWT.isClient()) {
// Create the base table element that will be cloned.
BASE_INTERNAL_ELEM = DOM.createTable();
Element contentElem = DOM.createDiv();
Element tbody = DOM.createTBody(), tr = DOM.createTR();
Element tdImg = DOM.createTD(), tdContent = DOM.createTD();
DOM.appendChild(BASE_INTERNAL_ELEM, tbody);
DOM.appendChild(tbody, tr);
DOM.appendChild(tr, tdImg);
DOM.appendChild(tr, tdContent);
tdImg.getStyle().setProperty("verticalAlign", "middle");
tdContent.getStyle().setProperty("verticalAlign", "middle");
DOM.appendChild(tdContent, contentElem);
contentElem.getStyle().setProperty("display", "inline");
setStyleName(contentElem, "gwt-TreeItem");
BASE_INTERNAL_ELEM.getStyle().setProperty("whiteSpace", "nowrap");
// Create the base element that will be cloned
BASE_BARE_ELEM = DOM.createDiv();
// Simulates padding from table element.
BASE_BARE_ELEM.getStyle().setProperty("padding", "3px");
DOM.appendChild(BASE_BARE_ELEM, contentElem);
Roles.getTreeitemRole().set(contentElem);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!