コード例 #1
0
 @Nonnull
 protected Collection<BuilderCustomizer> resolveBuilderCustomizers(
     @Nonnull GriffonApplication application) {
   Collection<BuilderCustomizer> customizerInstances =
       application.getInjector().getInstances(BuilderCustomizer.class);
   return sortByDependencies(customizerInstances, BUILDER_CUSTOMIZER, "customizer").values();
 }
コード例 #2
0
  public void init(@Nonnull GriffonApplication application) {
    boolean preferencesWereRead = false;
    try {
      preferencesPersistor.read(preferencesManager);
      preferencesWereRead = true;
    } catch (FileNotFoundException fnfe) {
      // most likely means preferences have not been initialized yet
      // let it continue
      preferencesWereRead = true;
    } catch (IOException e) {
      if (getLog().isWarnEnabled()) {
        getLog().warn("Cannot read preferences", sanitize(e));
      }
    }

    if (preferencesWereRead) {
      application
          .getEventRouter()
          .addEventListener(
              ApplicationEvent.SHUTDOWN_START.getName(),
              new CallableWithArgs<Void>() {
                @Override
                @Nullable
                public Void call(@Nullable Object... args) {
                  try {
                    preferencesPersistor.write(preferencesManager);
                  } catch (IOException e) {
                    if (getLog().isWarnEnabled()) {
                      getLog().warn("Cannot persist preferences", sanitize(e));
                    }
                  }
                  return null;
                }
              });
    }
  }
コード例 #3
0
 private static void createSplashScreen(GriffonApplication app) {
   INSTANCE = new SplashScreen(app);
   app.addApplicationEventListener(INSTANCE);
 }
コード例 #4
0
 public void onReadyEnd(GriffonApplication app) {
   hide();
   app.removeApplicationEventListener(this);
 }
コード例 #5
0
 private void fireApplicationEvent(Level level, String message, Throwable throwable) {
   GriffonApplication app = ApplicationHolder.getApplication();
   if (app != null) {
     app.eventAsync(EVENT_NAME, Arrays.asList(level.toString(), message, throwable));
   }
 }