@Nonnull protected Collection<BuilderCustomizer> resolveBuilderCustomizers( @Nonnull GriffonApplication application) { Collection<BuilderCustomizer> customizerInstances = application.getInjector().getInstances(BuilderCustomizer.class); return sortByDependencies(customizerInstances, BUILDER_CUSTOMIZER, "customizer").values(); }
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; } }); } }
private static void createSplashScreen(GriffonApplication app) { INSTANCE = new SplashScreen(app); app.addApplicationEventListener(INSTANCE); }
public void onReadyEnd(GriffonApplication app) { hide(); app.removeApplicationEventListener(this); }
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)); } }