com.google.gwt.core.shared.GWT.isClient()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中com.google.gwt.core.shared.GWT.isClient()方法的一些代码示例,展示了GWT.isClient()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GWT.isClient()方法的具体详情如下:
包路径:com.google.gwt.core.shared.GWT
类名称:GWT
方法名:isClient

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

  1. /**
  2. * Returns <code>true</code> when running inside the normal GWT environment,
  3. * either in Development Mode or Production Mode. Returns <code>false</code>
  4. * if this code is running in a plain JVM. This might happen when running
  5. * shared code on the server, or during the bootstrap sequence of a
  6. * GWTTestCase test.
  7. */
  8. public static boolean isClient() {
  9. return com.google.gwt.core.shared.GWT.isClient();
  10. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. private static Impl impl() {
  2. if (impl == null) {
  3. if (GWT.isClient()) {
  4. impl = GWT.create(Impl.class);
  5. } else {
  6. impl = new ImplServer();
  7. }
  8. }
  9. return impl;
  10. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. /**
  2. * Return the built DOM as an {@link Element}.
  3. *
  4. * @return the {@link Element} that was built
  5. */
  6. public Element finish() {
  7. if (!GWT.isClient()) {
  8. throw new RuntimeException("asElement() can only be called from GWT client code.");
  9. }
  10. if (asElementCalled) {
  11. throw new IllegalStateException("asElement() can only be called once.");
  12. }
  13. asElementCalled = true;
  14. // End all open tags.
  15. endAllTags();
  16. return doFinishImpl();
  17. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. /**
  2. * Get the instance of the {@link ElementBuilderFactory}.
  3. *
  4. * @return the {@link ElementBuilderFactory}
  5. */
  6. public static ElementBuilderFactory get() {
  7. if (instance == null) {
  8. if (GWT.isClient()) {
  9. instance = GWT.create(ElementBuilderFactory.class);
  10. } else {
  11. // The DOM implementation will not work on the server.
  12. instance = HtmlBuilderFactory.get();
  13. }
  14. }
  15. return instance;
  16. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. GWT.isClient() ? SerializabilityUtil.class.getClassLoader() : Thread.currentThread()
  2. .getContextClassLoader();

代码示例来源:origin: net.wetheinter/gwt-user

  1. /**
  2. * Returns <code>true</code> when running inside the normal GWT environment,
  3. * either in Development Mode or Production Mode. Returns <code>false</code>
  4. * if this code is running in a plain JVM. This might happen when running
  5. * shared code on the server, or during the bootstrap sequence of a
  6. * GWTTestCase test.
  7. */
  8. public static boolean isClient() {
  9. return com.google.gwt.core.shared.GWT.isClient();
  10. }

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

  1. /**
  2. * Returns <code>true</code> when running inside the normal GWT environment,
  3. * either in Development Mode or Production Mode. Returns <code>false</code>
  4. * if this code is running in a plain JVM. This might happen when running
  5. * shared code on the server, or during the bootstrap sequence of a
  6. * GWTTestCase test.
  7. */
  8. public static boolean isClient() {
  9. return com.google.gwt.core.shared.GWT.isClient();
  10. }

代码示例来源:origin: com.google.web.bindery/requestfactory-server

  1. /**
  2. * Returns <code>true</code> when running inside the normal GWT environment,
  3. * either in Development Mode or Production Mode. Returns <code>false</code>
  4. * if this code is running in a plain JVM. This might happen when running
  5. * shared code on the server, or during the bootstrap sequence of a
  6. * GWTTestCase test.
  7. */
  8. public static boolean isClient() {
  9. return com.google.gwt.core.shared.GWT.isClient();
  10. }

代码示例来源:origin: apache/incubator-wave

  1. private String getModuleName() {
  2. if (GWT.isClient()) {
  3. return com.google.gwt.core.client.GWT.getModuleName();
  4. }
  5. return "";
  6. }
  7. }

代码示例来源:origin: bedatadriven/activityinfo

  1. public ResourceLocatorAdaptor() {
  2. if(!GWT.isClient()) {
  3. throw new IllegalStateException("Can only be called in client code.");
  4. }
  5. this.client = new ActivityInfoClientAsyncImpl();
  6. }

代码示例来源:origin: com.google.web.bindery/requestfactory-server

  1. /**
  2. * Returns {@code true} if {@code clazz} is assignable to any of the value
  3. * types.
  4. */
  5. static boolean canDecode(Class<?> clazz) {
  6. assert !GWT.isClient();
  7. for (Class<?> valueType : ValueCodex.getAllValueTypes()) {
  8. if (valueType.isAssignableFrom(clazz)) {
  9. return true;
  10. }
  11. }
  12. return false;
  13. }
  14. }

代码示例来源:origin: fr.lteconsulting/hexa.core

  1. public static DateTimeFormat getFormat( String pattern )
  2. {
  3. DateTimeFormat fmt = instances.get( pattern );
  4. if( fmt == null )
  5. {
  6. if( GWT.isClient() )
  7. fmt = new DateTimeFormatGWT( pattern );
  8. else
  9. fmt = new DateTimeFormatJRE( pattern );
  10. }
  11. return fmt;
  12. }

代码示例来源:origin: fr.lteconsulting/hexa.core

  1. public static NumberFormat getFormat( String pattern )
  2. {
  3. NumberFormat fmt = instances.get( pattern );
  4. if( fmt == null )
  5. {
  6. if( GWT.isClient() )
  7. fmt = new NumberFormatGWT( pattern );
  8. else
  9. fmt = new NumberFormatJRE( pattern );
  10. }
  11. return fmt;
  12. }

代码示例来源:origin: ltearno/hexa.tools

  1. public static DateTimeFormat getFormat( String pattern )
  2. {
  3. DateTimeFormat fmt = instances.get( pattern );
  4. if( fmt == null )
  5. {
  6. if( GWT.isClient() )
  7. fmt = new DateTimeFormatGWT( pattern );
  8. else
  9. fmt = new DateTimeFormatJRE( pattern );
  10. }
  11. return fmt;
  12. }

代码示例来源:origin: ltearno/hexa.tools

  1. public static NumberFormat getFormat( String pattern )
  2. {
  3. NumberFormat fmt = instances.get( pattern );
  4. if( fmt == null )
  5. {
  6. if( GWT.isClient() )
  7. fmt = new NumberFormatGWT( pattern );
  8. else
  9. fmt = new NumberFormatJRE( pattern );
  10. }
  11. return fmt;
  12. }

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

  1. private static Impl impl() {
  2. if (impl == null) {
  3. if (GWT.isClient()) {
  4. impl = GWT.create(Impl.class);
  5. } else {
  6. impl = new ImplServer();
  7. }
  8. }
  9. return impl;
  10. }

代码示例来源:origin: net.wetheinter/gwt-user

  1. private static Impl impl() {
  2. if (impl == null) {
  3. if (GWT.isClient()) {
  4. impl = GWT.create(Impl.class);
  5. } else {
  6. impl = new ImplServer();
  7. }
  8. }
  9. return impl;
  10. }

代码示例来源:origin: apache/incubator-wave

  1. /**
  2. * Clears the statistics.
  3. */
  4. static public void clearStatistics() {
  5. if (GWT.isClient()) {
  6. statsRecorder.getGlobalStore().clear();
  7. } else {
  8. statsRecorder.getSessionStore().clear();
  9. }
  10. }

代码示例来源:origin: apache/incubator-wave

  1. /**
  2. * Records an http request call tree.
  3. */
  4. void recordRequest(ExecutionNode node) {
  5. if (!GWT.isClient() && getSessionContext() != null && getSessionContext().isAuthenticated()) {
  6. getSessionStore().storeRequest(node);
  7. }
  8. globalStore.storeRequest(node);
  9. }

代码示例来源:origin: apache/incubator-wave

  1. /**
  2. * Records a single incident of measure and duration in millis with threshold.
  3. */
  4. void record(String name, String module, int duration, int threshold) {
  5. if (!GWT.isClient() && getSessionContext() != null && getSessionContext().isAuthenticated()) {
  6. getSessionStore().recordMeasurement(name, module, duration, threshold);
  7. }
  8. globalStore.recordMeasurement(name, module, duration, threshold);
  9. }

相关文章