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


Java JavaScriptException类代码示例

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


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

示例1: setLocalDescription

import com.google.gwt.core.client.JavaScriptException; //导入依赖的package包/类
@NotNull
@Override
public Promise<WebRTCSessionDescription> setLocalDescription(@NotNull final WebRTCSessionDescription description) {
    return new Promise<>(new PromiseFunc<WebRTCSessionDescription>() {
        @Override
        public void exec(@NotNull final PromiseResolver<WebRTCSessionDescription> resolver) {
            peerConnection.setLocalDescription(JsSessionDescription.create(description.getType(),
                    description.getSdp()), new JsClosure() {
                @Override
                public void callback() {
                    resolver.result(description);
                }
            }, new JsClosureError() {
                @Override
                public void onError(JavaScriptObject error) {
                    resolver.error(new JavaScriptException(error));
                }
            });
        }
    });
}
 
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:22,代码来源:PeerConnection.java

示例2: setRemoteDescription

import com.google.gwt.core.client.JavaScriptException; //导入依赖的package包/类
@NotNull
@Override
public Promise<WebRTCSessionDescription> setRemoteDescription(@NotNull final WebRTCSessionDescription description) {
    return new Promise<>(new PromiseFunc<WebRTCSessionDescription>() {
        @Override
        public void exec(@NotNull final PromiseResolver<WebRTCSessionDescription> resolver) {
            peerConnection.setRemoteDescription(JsSessionDescription.create(description.getType(),
                    description.getSdp()), new JsClosure() {
                @Override
                public void callback() {
                    resolver.result(description);
                }
            }, new JsClosureError() {
                @Override
                public void onError(JavaScriptObject error) {
                    resolver.error(new JavaScriptException(error));
                }
            });
        }
    });
}
 
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:22,代码来源:PeerConnection.java

示例3: onUnload

import com.google.gwt.core.client.JavaScriptException; //导入依赖的package包/类
@Override
protected void onUnload() {
    boolean deferUnloading = false;
    try {
        if (!uninitialize()) {
            addPendingUnload();
            deferUnloading = true;
        }
    } catch (JavaScriptException e) {
        GWT.log("Unable to clean up TinyMCE editor.", e);
    } finally {
        if (!deferUnloading) {
            super.onUnload();
        }
    }
}
 
开发者ID:harvardpan,项目名称:hftinymce-gwt,代码行数:17,代码来源:HFRichTextEditor.java

示例4: initialize

import com.google.gwt.core.client.JavaScriptException; //导入依赖的package包/类
private boolean initialize() {
    try {
        if (!isInitialized() && !isInitializing()) {
            initTinyMce(elementId, options.getJavaScriptObject());
            setInitializing(true); // set this after since the above call is asynchronous. We don't want it to be true and an exception to be thrown
            
            // Even though this entry was set in the constructor, it could have been unset
            // in the unload function. We ensure that we have a valid reference while this
            // editor is initialized
            activeEditors.put(elementId, this);
            getInitializationTimeoutTimer().schedule(1000); // give TinyMCE 1 second to initialize the editor
            return true;
        }
    } catch (JavaScriptException e) {
        GWT.log("Unable to initialize the TinyMCE editor.", e);
    }
    return false;
}
 
开发者ID:harvardpan,项目名称:hftinymce-gwt,代码行数:19,代码来源:HFRichTextEditor.java

示例5: uninitialize

import com.google.gwt.core.client.JavaScriptException; //导入依赖的package包/类
private boolean uninitialize() {
     if (isInitialized()) {
        try {
            unloadTinyMce(elementId);            
        } catch (JavaScriptException e) {
            GWT.log("Unable to uninitialize the TinyMCE editor.", e);
        } finally {
            setInitialized(false);
            setInitializing(false);
            
            // Clear the entry in activeEditors so that we don't hold the memory if it needs to be cleaned up.
            activeEditors.put(elementId, null);
            activeEditors.remove(elementId);
        }
        return true;
    }                
    return false;        
}
 
开发者ID:harvardpan,项目名称:hftinymce-gwt,代码行数:19,代码来源:HFRichTextEditor.java

示例6: getHTML

import com.google.gwt.core.client.JavaScriptException; //导入依赖的package包/类
public SafeHtml getHTML() {
    SafeHtml result = null;
    if (libraryLoaded && initialized) {
        try {
            String contentHtml = getContentHtml(elementId); // TinyMCE takes care of the sanitization.
            if (contentHtml == null || contentHtml.trim().isEmpty()) {
                return SafeHtmlUtils.fromSafeConstant("");
            }
            // Remove the root block <p></p> that gets added automatically by TinyMCE
            if (contentHtml.startsWith("<p>") && contentHtml.endsWith("</p>")) {
                contentHtml = contentHtml.substring(3, contentHtml.length() - 4);
            }
            result = SafeHtmlUtils.fromTrustedString(contentHtml); 
        } catch (JavaScriptException e) {
            GWT.log("Unable to get the content from the TinyMCE editor.", e);
        }
    } else {
        String text = super.getText();
        if (text == null || text.trim().isEmpty()) {
            return SafeHtmlUtils.fromSafeConstant("");
        } else {
            return SafeHtmlUtils.fromString(text);
        }
    }
    return result;        
}
 
开发者ID:harvardpan,项目名称:hftinymce-gwt,代码行数:27,代码来源:HFRichTextEditor.java

示例7: getText

import com.google.gwt.core.client.JavaScriptException; //导入依赖的package包/类
public String getText()
{
    String result = "";
    if (libraryLoaded && initialized) {
        try {
            String contentText = getContentText(elementId);
            if (contentText == null) {
                contentText = "";
            }
            result = SafeHtmlUtils.fromString(contentText).asString(); // requested as text, so we need to escape the string
        } catch (JavaScriptException e) {
            GWT.log("Unable to get the content from the TinyMCE editor.", e);
        }
    } else {
        result = super.getText();
        if (result == null || result.trim().isEmpty()) {
            result = "";
        } else {
            result = SafeHtmlUtils.fromString(result).asString();
        }
    }
    return result;
}
 
开发者ID:harvardpan,项目名称:hftinymce-gwt,代码行数:24,代码来源:HFRichTextEditor.java

示例8: setHTML

import com.google.gwt.core.client.JavaScriptException; //导入依赖的package包/类
public void setHTML(SafeHtml html) {
    String text = html == null ? null: html.asString();
    if (libraryLoaded && (isInitialized() || isInitializing())) {
        if (isInitializing()) {
            pendingSetHtmlText = html;
            addPendingSetHtml();
            return;
        }
        try {
            setContent(elementId, text);
        } catch (JavaScriptException e) {
            // Don't do anything, just allow it to return.
            GWT.log("Unable to set the content on the TinyMCE editor.", e);
        }
        return;
    } else {
        super.setText(text);
    }
}
 
开发者ID:harvardpan,项目名称:hftinymce-gwt,代码行数:20,代码来源:HFRichTextEditor.java

示例9: doGetText

import com.google.gwt.core.client.JavaScriptException; //导入依赖的package包/类
@Override
protected void doGetText(final String path, final ResourceCallback<String> callback) {
  final String fullPath = pathPrefix + path;
  /*
   * Except for IE, all browsers support on-domain and cross-domain XHR via
   * {@code XMLHTTPRequest}. IE, on the other hand, not only requires the use
   * of a non-standard {@code XDomainRequest} for cross-domain requests, but
   * doesn't allow on-domain requests to be issued via {@code XMLHTTPRequest},
   * even when {@code Access-Control-Allow-Origin} includes the current
   * document origin. Since we here don't always know if the current request
   * will be cross domain, we try XHR, and then fall back to XDR if the we're
   * running on IE.
   */
  try {
    doXhr(fullPath, callback);
  } catch (JavaScriptException e) {
    if (Window.Navigator.getUserAgent().indexOf("MSIE") != -1) {
      doXdr(fullPath, callback);
    } else {
      throw e;
    }
  }
}
 
开发者ID:fredsa,项目名称:forplay,代码行数:24,代码来源:HtmlAssetManager.java

示例10: initialize

import com.google.gwt.core.client.JavaScriptException; //导入依赖的package包/类
public void initialize() {
    Element element = getElement();
    initialize(element);

    Map<String, Object> failures = new HashMap<>();
    for(Map.Entry<String, Object> entry : optionFailures.entrySet()) {
        String option = entry.getKey();
        Object value = entry.getValue();
        try {
            setOption(element, option, value);
            logger.fine("Successfully set failed option: '" + option + "' to '" + value + "'");
        } catch (JavaScriptException ex) {
            failures.put(option, value);
            logger.log(Level.FINE, "Failed to set wrapper option", ex);
        }
    }
    optionFailures = failures;
}
 
开发者ID:BenDol,项目名称:gwt-jui,代码行数:19,代码来源:JuiWrapper.java

示例11: logExceptionString

import com.google.gwt.core.client.JavaScriptException; //导入依赖的package包/类
private void logExceptionString(TestLogger logger, Throwable e) {
    StackTraceElement[] stack = e.getStackTrace();
    // The first stack frames are gwt internal exception creation functions that just make it
    // harder to see the real error. Skip them.
    int start = e instanceof JavaScriptException ? 1 : 4;
    if (debug) {
       start = 0;
    }
    int end = stack.length;
    logger.log(TestLogger.RESULTS, e.getMessage());
    for (int i = start; i < end; i++) {
        StackTraceElement ste = stack[i];
        if (debug) logger.log(TestLogger.WARNING, ste.toString());
        logger.log(TestLogger.RESULTS, "at " + stackFrameString(ste));
    }
}
 
开发者ID:chromium,项目名称:dom-distiller,代码行数:17,代码来源:JsTestSuiteBase.java

示例12: notify

import com.google.gwt.core.client.JavaScriptException; //导入依赖的package包/类
public static void notify(String title, final String msg, final UserClick click ) {
    final String notifyTitle= (title==null) ? "Background Manager" : title;
    if (active && supported) {
        try {
            if (scriptLoaded) {
                notifyInternal(notifyTitle,msg);
            }
            else {
                loadJS(new InitComplete() {
                    public void done() {
                        notifyInternal(notifyTitle,msg);
                    }
                });
            }
        } catch (JavaScriptException e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:lsst,项目名称:firefly,代码行数:20,代码来源:Notifications.java

示例13: findCallerUrl

import com.google.gwt.core.client.JavaScriptException; //导入依赖的package包/类
String findCallerUrl() {
  JavaScriptException err = makeException();
  if (hasStack(err)) {
    return PluginNameMoz.getUrl(err);
  }

  String baseUrl = baseUrl();
  StackTraceElement[] trace = getTrace(err);
  for (int i = trace.length - 1; i >= 0; i--) {
    String u = trace[i].getFileName();
    if (u != null && u.startsWith(baseUrl)) {
      return u;
    }
  }
  return UNKNOWN;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:17,代码来源:PluginName.java

示例14: getUrl

import com.google.gwt.core.client.JavaScriptException; //导入依赖的package包/类
private static String getUrl(JavaScriptException e) {
  String baseUrl = baseUrl();
  JsArrayString stack = getStack(e);
  for (int i = stack.length() - 1; i >= 0; i--) {
    String frame = stack.get(i);
    int at = frame.indexOf(baseUrl);
    if (at >= 0) {
      int end = frame.indexOf(':', at + baseUrl.length());
      if (end < 0) {
        end = frame.length();
      }
      return frame.substring(at, end);
    }
  }
  return UNKNOWN;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:17,代码来源:PluginName.java

示例15: start

import com.google.gwt.core.client.JavaScriptException; //导入依赖的package包/类
public void start() {
	if (isWebSocketUsed()) {
		try {
			webSocket = WebSocket.create(Constant.WEB_SOCKET_URL + path);
		} catch (JavaScriptException e) {
			// WebSocket is not supported.
		}
	}

	if (webSocket == null) {
		status = Status.RPC;
		Scheduler.get().scheduleFixedDelay(commandUpdate, intervalMs);
	} else {
		status = Status.WEB_SOCKET;
		webSocket.setOnMessage(messageHandler);
		webSocket.setOnClose(closeHandler);
		webSocket.setOnError(errorHandler);
	}
}
 
开发者ID:nodchip,项目名称:QMAClone,代码行数:20,代码来源:StatusUpdater.java


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