コード例 #1
0
  @Override
  public void onModuleLoad() {
    Profiler.initialize();
    Profiler.enter("ApplicationConfiguration.onModuleLoad");

    BrowserInfo browserInfo = BrowserInfo.get();

    // Enable iOS6 cast fix (see #10460)
    if (browserInfo.isIOS()
        && browserInfo.isWebkit()
        && browserInfo.getBrowserMajorVersion() == 6) {
      enableIOS6castFix();
    }

    // Prepare VConsole for debugging
    if (isDebugMode()) {
      Console console = GWT.create(Console.class);
      console.setQuietMode(isQuietDebugMode());
      console.init();
      VConsole.setImplementation(console);
    } else {
      VConsole.setImplementation((Console) GWT.create(NullConsole.class));
    }
    /*
     * Display some sort of error of exceptions in web mode to debug
     * console. After this, exceptions are reported to VConsole and possible
     * GWT hosted mode.
     */
    GWT.setUncaughtExceptionHandler(
        new UncaughtExceptionHandler() {

          @Override
          public void onUncaughtException(Throwable e) {
            /*
             * Note in case of null console (without ?debug) we eat
             * exceptions. "a1 is not an object" style errors helps nobody,
             * especially end user. It does not work tells just as much.
             */
            VConsole.getImplementation().error(e);
          }
        });
    Profiler.leave("ApplicationConfiguration.onModuleLoad");

    if (SuperDevMode.enableBasedOnParameter()) {
      // Do not start any application as super dev mode will refresh the
      // page once done compiling
      return;
    }
    registerCallback(GWT.getModuleName());
  }
コード例 #2
0
  @Override
  public void onModuleLoad() {
    Profiler.initialize();
    Profiler.enter("ApplicationConfiguration.onModuleLoad");

    BrowserInfo browserInfo = BrowserInfo.get();

    // Enable iOS6 cast fix (see #10460)
    if (browserInfo.isIOS6() && browserInfo.isWebkit()) {
      enableIOS6castFix();
    }

    // Prepare the debugging window
    if (isDebugMode()) {
      /*
       * XXX Lots of implementation details here right now. This should be
       * cleared up when an API for extending the debug window is
       * implemented.
       */
      VDebugWindow window = GWT.create(VDebugWindow.class);

      if (LogConfiguration.loggingIsEnabled()) {
        window.addSection((Section) GWT.create(LogSection.class));
      }
      window.addSection((Section) GWT.create(InfoSection.class));
      window.addSection((Section) GWT.create(HierarchySection.class));
      window.addSection((Section) GWT.create(NetworkSection.class));
      if (Profiler.isEnabled()) {
        window.addSection((Section) GWT.create(ProfilerSection.class));
      }

      if (isQuietDebugMode()) {
        window.close();
      } else {
        window.init();
      }

      // Connect to the legacy API
      VConsole.setImplementation(window);

      Handler errorNotificationHandler = GWT.create(ErrorNotificationHandler.class);
      Logger.getLogger("").addHandler(errorNotificationHandler);
    }

    if (LogConfiguration.loggingIsEnabled()) {
      GWT.setUncaughtExceptionHandler(
          new UncaughtExceptionHandler() {

            @Override
            public void onUncaughtException(Throwable e) {
              /*
               * If the debug window is not enabled (?debug), this will
               * not show anything to normal users. "a1 is not an object"
               * style errors helps nobody, especially end user. It does
               * not work tells just as much.
               */
              getLogger().log(Level.SEVERE, e.getMessage(), e);
            }
          });

      if (isProductionMode()) {
        // Disable all logging if in production mode
        Logger.getLogger("").setLevel(Level.OFF);
      }
    }
    Profiler.leave("ApplicationConfiguration.onModuleLoad");

    if (SuperDevMode.enableBasedOnParameter()) {
      // Do not start any application as super dev mode will refresh the
      // page once done compiling
      return;
    }
    registerCallback(GWT.getModuleName());
  }
コード例 #3
0
  @Override
  public void onModuleLoad() {

    // Don't run twice if the module has been inherited several times.
    if (moduleLoaded) {
      return;
    }
    moduleLoaded = true;

    Profiler.initialize();
    Profiler.enter("ApplicationConfiguration.onModuleLoad");

    BrowserInfo browserInfo = BrowserInfo.get();

    // Enable iOS6 cast fix (see #10460)
    if (browserInfo.isIOS6() && browserInfo.isWebkit()) {
      enableIOS6castFix();
    }

    // Enable IE prompt fix (#13367)
    if (browserInfo.isIE() && browserInfo.getBrowserMajorVersion() >= 10) {
      enableIEPromptFix();
    }

    // Register pointer events (must be done before any events are used)
    PointerEventSupport.init();

    // Prepare the debugging window
    if (isDebugMode()) {
      /*
       * XXX Lots of implementation details here right now. This should be
       * cleared up when an API for extending the debug window is
       * implemented.
       */
      VDebugWindow window = GWT.create(VDebugWindow.class);

      if (LogConfiguration.loggingIsEnabled()) {
        window.addSection((Section) GWT.create(LogSection.class));
      }
      window.addSection((Section) GWT.create(InfoSection.class));
      window.addSection((Section) GWT.create(HierarchySection.class));
      window.addSection((Section) GWT.create(NetworkSection.class));
      window.addSection((Section) GWT.create(TestBenchSection.class));
      if (Profiler.isEnabled()) {
        window.addSection((Section) GWT.create(ProfilerSection.class));
      }

      if (isQuietDebugMode()) {
        window.close();
      } else {
        // Load debug window styles asynchronously
        GWT.runAsync(
            new RunAsyncCallback() {
              @Override
              public void onSuccess() {
                DebugWindowStyles dws = GWT.create(DebugWindowStyles.class);
                dws.css().ensureInjected();
              }

              @Override
              public void onFailure(Throwable reason) {
                Window.alert("Failed to load Vaadin debug window styles");
              }
            });

        window.init();
      }

      // Connect to the legacy API
      VConsole.setImplementation(window);

      Handler errorNotificationHandler = GWT.create(ErrorNotificationHandler.class);
      Logger.getLogger("").addHandler(errorNotificationHandler);
    }

    if (LogConfiguration.loggingIsEnabled()) {
      GWT.setUncaughtExceptionHandler(
          new UncaughtExceptionHandler() {

            @Override
            public void onUncaughtException(Throwable e) {
              /*
               * If the debug window is not enabled (?debug), this will
               * not show anything to normal users. "a1 is not an object"
               * style errors helps nobody, especially end user. It does
               * not work tells just as much.
               */
              getLogger().log(Level.SEVERE, e.getMessage(), e);
            }
          });

      if (isProductionMode()) {
        // Disable all logging if in production mode
        Logger.getLogger("").setLevel(Level.OFF);
      }
    }
    Profiler.leave("ApplicationConfiguration.onModuleLoad");

    if (SuperDevMode.enableBasedOnParameter()) {
      // Do not start any application as super dev mode will refresh the
      // page once done compiling
      return;
    }
    registerCallback(GWT.getModuleName());
  }