@Override
  public void shutdown() {

    persistenceSessionFactory.shutdown();
    authenticationManager.shutdown();
    specificationLoaderSpi.shutdown();
    templateImageLoader.shutdown();
    userProfileLoader.shutdown();
  }
Esempio n. 2
0
  public SplashWindow(final TemplateImageLoader loader) {
    super(new Frame());
    parent = (Frame) getParent();
    final String imageName = AboutIsis.getImageName();
    final TemplateImage templateImage = loader.getTemplateImage(imageName);
    if (templateImage == null) {
      throw new IsisException("Failed to find splash image " + imageName);
    }
    logo = templateImage.getImage();

    textFont = new Font("SansSerif", Font.PLAIN, 10);
    titleFont = new Font("SansSerif", Font.BOLD, 11);
    logoFont = new Font("Serif", Font.PLAIN, 36);
    textLineHeight = (int) (getFontMetrics(textFont).getHeight() * 0.85);
    titleLineHeight = (int) (getFontMetrics(titleFont).getHeight() * 1.20);

    int height = 0;
    int width = 0;

    if (logo != null) {
      width = logo.getWidth(this);
      height += logo.getHeight(this);
    } else {
      final FontMetrics metrics = getFontMetrics(logoFont);
      width = metrics.stringWidth(LOGO_TEXT);
      height = metrics.getHeight();
    }
    height += PADDING;

    final Dimension text = textBounds();
    width = Math.max(width, text.width);
    height += text.height;

    height = PADDING + height + PADDING;
    width = PADDING + width + PADDING;
    setSize(width, height);

    this.height = height;
    this.width = width;
    this.left = width / 2 - text.width / 2;

    setupCenterLocation();

    setVisible(true);
    // toFront();
  }
  /**
   * Wires components as necessary, and then {@link ApplicationScopedComponent#init() init}ializes
   * all.
   */
  @Override
  public void init() {
    templateImageLoader.init();

    specificationLoaderSpi.setContainer(container);
    specificationLoaderSpi.setServices(serviceList);
    specificationLoaderSpi.init();

    // must come after init of spec loader.
    specificationLoaderSpi.injectInto(persistenceSessionFactory);
    persistenceSessionFactory.setContainer(container);
    persistenceSessionFactory.setServices(serviceList);
    userProfileLoader.setServices(serviceList);

    authenticationManager.init();
    authorizationManager.init();
    persistenceSessionFactory.init();
  }