Java Code Examples for com.google.gwt.core.shared.GWT#isClient()

The following examples show how to use com.google.gwt.core.shared.GWT#isClient() . 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: ViewOnBase.java    From vertxui with GNU General Public License v3.0 5 votes vote down vote up
public ViewOnBase sync() {
	// the 'if' below prevents throwing away inner viewOn's with a outer
	// state. Because, if sync is called fromout fluent when adding inside a
	// viewon, the attached dom is thrown away, which is not supposed to
	// happen then. (for parent!=null&&parent.elemnt!=null)
	//
	// However, it prevents testing against the virtual dom, so we leave it
	// on in pure java (!gwt.isClient()).
	if (!GWT.isClient() || (parent != null && parent.element != null)) {
		Renderer.syncChild(parent, this, view);
		isRendered(true);
	}
	return this;
}
 
Example 2
Source File: StatRecorder.java    From swellrt with Apache License 2.0 5 votes vote down vote up
/**
 * Records a single incident of measure and duration in millis with threshold.
 */
void record(String name, String module, int duration, int threshold) {
  if (!GWT.isClient() && getSessionContext() != null && getSessionContext().isAuthenticated()) {
    getSessionStore().recordMeasurement(name, module, duration, threshold);
  }
  globalStore.recordMeasurement(name, module, duration, threshold);
}
 
Example 3
Source File: StatRecorder.java    From swellrt with Apache License 2.0 5 votes vote down vote up
/**
 * Records an http request call tree.
 */
void recordRequest(ExecutionNode node) {
  if (!GWT.isClient() && getSessionContext() != null && getSessionContext().isAuthenticated()) {
    getSessionStore().storeRequest(node);
  }
  globalStore.storeRequest(node);
}
 
Example 4
Source File: Timing.java    From swellrt with Apache License 2.0 5 votes vote down vote up
/**
 * Clears the statistics.
 */
static public void clearStatistics() {
  if (GWT.isClient()) {
    statsRecorder.getGlobalStore().clear();
  } else {
    statsRecorder.getSessionStore().clear();
  }
}
 
Example 5
Source File: AbstractProfileManager.java    From swellrt with Apache License 2.0 5 votes vote down vote up
/** Internal helper that rotates through the colours. */
private RgbColor getNextColour(String id) {
  if (GWT.isClient()) {
    int colorIndex = id.hashCode() % RgbColorPalette.PALETTE.length;
    colorIndex = colorIndex < 0 ? -colorIndex : colorIndex;
    RgbColor colour = RgbColorPalette.PALETTE[colorIndex].get("400");
    return colour;
  } else {
    return RgbColor.WHITE;
  }
}
 
Example 6
Source File: WebSocket.java    From gwt-websockets with Apache License 2.0 5 votes vote down vote up
/**
 * Create a WebSocket if supported by the platform.
 *
 * This method will use the registered factory to create the WebSocket instance.
 *
 * @return a WebSocket instance, if supported by the platform, null otherwise.
 */
public static WebSocket newWebSocketIfSupported()
{
  if ( null == g_factory && GWT.isClient() && getSupportDetector().isSupported() )
  {
    register( getSupportDetector().newFactory() );
    return g_factory.newWebSocket();
  }
  return ( null != g_factory ) ? g_factory.newWebSocket() : null;
}
 
Example 7
Source File: StatRecorder.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
/**
 * Records a single incident of measure and duration in millis with threshold.
 */
void record(String name, String module, int duration, int threshold) {
  if (!GWT.isClient() && getSessionContext() != null && getSessionContext().isAuthenticated()) {
    getSessionStore().recordMeasurement(name, module, duration, threshold);
  }
  globalStore.recordMeasurement(name, module, duration, threshold);
}
 
Example 8
Source File: StatRecorder.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
/**
 * Records an http request call tree.
 */
void recordRequest(ExecutionNode node) {
  if (!GWT.isClient() && getSessionContext() != null && getSessionContext().isAuthenticated()) {
    getSessionStore().storeRequest(node);
  }
  globalStore.storeRequest(node);
}
 
Example 9
Source File: Timing.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
/**
 * Clears the statistics.
 */
static public void clearStatistics() {
  if (GWT.isClient()) {
    statsRecorder.getGlobalStore().clear();
  } else {
    statsRecorder.getSessionStore().clear();
  }
}
 
Example 10
Source File: ApplicationCache.java    From gwt-appcache with Apache License 2.0 5 votes vote down vote up
@Nullable
public static ApplicationCache getApplicationCacheIfSupported()
{
  if ( null == g_cache )
  {
    if ( GWT.isClient() && getSupportDetector().isSupported() && getSupportDetector().hasManifest() )
    {
      register( new Html5ApplicationCache() );
    }
  }
  return g_cache;
}
 
Example 11
Source File: ExecutionTree.java    From swellrt with Apache License 2.0 4 votes vote down vote up
private String getModuleName() {
  if (GWT.isClient()) {
    return com.google.gwt.core.client.GWT.getModuleName();
  }
  return "";
}
 
Example 12
Source File: StatRenderer.java    From swellrt with Apache License 2.0 4 votes vote down vote up
StatRenderer() {
  this.showModule = GWT.isClient();
}
 
Example 13
Source File: WebSocket.java    From gwt-websockets with Apache License 2.0 4 votes vote down vote up
/**
 * @return true if newWebSocketIfSupported() will return a non-null value, false otherwise.
 */
public static boolean isSupported()
{
  return ( null != g_factory ) || GWT.isClient() && getSupportDetector().isSupported();
}
 
Example 14
Source File: ExecutionTree.java    From incubator-retired-wave with Apache License 2.0 4 votes vote down vote up
private String getModuleName() {
  if (GWT.isClient()) {
    return com.google.gwt.core.client.GWT.getModuleName();
  }
  return "";
}
 
Example 15
Source File: StatRenderer.java    From incubator-retired-wave with Apache License 2.0 4 votes vote down vote up
StatRenderer() {
  this.showModule = GWT.isClient();
}