/** * Returns <code>true</code> when running inside the normal GWT environment, * either in Development Mode or Production Mode. Returns <code>false</code> * 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. */ public static boolean isClient() { return com.google.gwt.core.shared.GWT.isClient(); }
@Override public String toString() { String type = exactTypeKnown ? typeName : (typeName + "(EXACT TYPE UNKNOWN)"); String msg = getMessage(); return msg == null ? type : (type + ": " + msg); }
/** * Logs a message to the development shell logger in Development Mode, or to * the console in Super Dev Mode. Calls are optimized out in Production Mode. */ public static void log(String message, Throwable e) { com.google.gwt.core.shared.GWT.log(message, e); }
/** * Create a new PlaceHistoryHandler with a {@link DefaultHistorian}. The * DefaultHistorian is created via a call to GWT.create(), so an alternative * default implementation can be provided through <replace-with> rules * in a {@code gwt.xml} file. * * @param mapper a {@link PlaceHistoryMapper} instance */ public PlaceHistoryHandler(PlaceHistoryMapper mapper) { this(mapper, (Historian) GWT.create(DefaultHistorian.class)); }
@GwtIncompatible public boolean isExceptionOf(Class<?> expectedException) { try { return thrown == null ? false : expectedException.isAssignableFrom(Class.forName(thrown.getDesignatedType())); } catch (Exception e) { return false; } }
/** * Logs a message to the development shell logger in Development Mode, or to * the JavaScript console in Super Dev Mode. Calls are optimized out in Production Mode. */ public static void log(String message, Throwable e) { if (sGWTBridge != null) { sGWTBridge.log(message, e); } else if (logger != null) { logger.log(message, e); } }
/** * Determines whether or not the running program is script or bytecode. */ public static boolean isScript() { return com.google.gwt.core.shared.GWT.isScript(); }
/** * Returns <code>true</code> when running in production mode. Returns * <code>false</code> when running either in development mode, or when running * in a plain JVM. */ public static boolean isProdMode() { return com.google.gwt.core.shared.GWT.isProdMode(); }
public void setException(Throwable exception) { thrown = SerializableThrowable.fromThrowable(exception); // Try to improve exception message if there is no class metadata available if (!thrown.isExactDesignatedTypeKnown()) { improveDesignatedType(thrown, exception); } }
/** * Returns <code>true</code> when running inside the normal GWT environment, * either in Development Mode or Production Mode. Returns <code>false</code> * 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. */ public static boolean isClient() { // Replaced with "true" by GWT compiler. return sGWTBridge != null && sGWTBridge.isClient(); }
/** * Get a human-readable representation of the GWT version used, or null if * this is running on the client. * * @return a human-readable version number, such as {@code "2.5"} */ public static String getVersion() { return sGWTBridge == null ? null : sGWTBridge.getVersion(); }
/** * Returns the empty string when running in Production Mode, but returns a * unique string for each thread in Development Mode (for example, different * windows accessing the dev mode server will each have a unique id, and * hitting refresh without restarting dev mode will result in a new unique id * for a particular window. * * TODO(unnurg): Remove this function once Dev Mode rewriting classes are in * gwt-dev. */ public static String getUniqueThreadId() { return com.google.gwt.core.shared.GWT.getUniqueThreadId(); }
/** * Returns the empty string when running in Production Mode, but returns a * unique string for each thread in Development Mode (for example, different * windows accessing the dev mode server will each have a unique id, and * hitting refresh without restarting dev mode will result in a new unique id * for a particular window. * * TODO(unnurg): Remove this function once Dev Mode rewriting classes are in * gwt-dev. */ public static String getUniqueThreadId() { if (sGWTBridge != null) { return sGWTBridge.getThreadUniqueID(); } return ""; }
public static String getVersion() { String version = com.google.gwt.core.shared.GWT.getVersion(); if (version == null) { version = getVersion0(); } return version; }
/** * Create a new {@link SerializableThrowable} from a provided throwable and its causes * recursively. * * @return a new SerializableThrowable or the passed object itself if it is {@code null} or * already a SerializableThrowable. */ public static SerializableThrowable fromThrowable(Throwable throwable) { if (throwable instanceof SerializableThrowable) { return (SerializableThrowable) throwable; } else if (throwable != null) { return createSerializable(throwable); } else { return null; } }
/** * Initializes the cause of this throwable. * <p> * This method will convert the cause to {@link SerializableThrowable} if it is not already. */ @Override public Throwable initCause(Throwable cause) { return super.initCause(fromThrowable(cause)); }
/** * Logs a message to the development shell logger in Development Mode, or to * the JavaScript console in Super Dev Mode. Calls are optimized out in Production Mode. */ public static void log(String message) { log(message, null); }
/** * Create a new PlaceController with a {@link DefaultDelegate}. The * DefaultDelegate is created via a call to GWT.create(), so an alternative * default implementation can be provided through <replace-with> rules * in a {@code .gwt.xml} file. * * @param eventBus the {@link EventBus} */ public PlaceController(EventBus eventBus) { this(eventBus, (Delegate) GWT.create(DefaultDelegate.class)); }
/** * Logs a message to the development shell logger in Development Mode, or to * the console in Super Dev Mode. Calls are optimized out in Production Mode. */ public static void log(String message) { com.google.gwt.core.shared.GWT.log(message); }