All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.anrisoftware.prefdialog.csvimportdialog.previewpanel.PreviewPanelModule Maven / Gradle / Ivy

/*
 * Copyright 2013-2016 Erwin Müller 
 *
 * This file is part of prefdialog-csvimportdialog.
 *
 * prefdialog-csvimportdialog is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 *
 * prefdialog-csvimportdialog is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with prefdialog-csvimportdialog. If not, see .
 */
package com.anrisoftware.prefdialog.csvimportdialog.previewpanel;

import com.anrisoftware.globalpom.csvimport.CsvImportModule;
import com.anrisoftware.globalpom.data.DataModule;
import com.anrisoftware.globalpom.dataimport.DataImportModule;
import com.anrisoftware.resources.texts.defaults.TextsResourcesDefaultModule;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.assistedinject.FactoryModuleBuilder;

/**
 * Installs preview panel factory and dependent modules.
 *
 * @see PreviewPanel
 * @see PreviewPanelFactory
 *
 * @author Erwin Mueller, [email protected]
 * @since 3.1
 */
public class PreviewPanelModule extends AbstractModule {

    /**
     * @see #getFactory()
     */
    public static PreviewPanelFactory getPreviewPanelFactory() {
        return getFactory();
    }

    /**
     * Creates and returns the preview panel factory.
     *
     * @return the {@link PreviewPanelFactory}.
     */
    public static PreviewPanelFactory getFactory() {
        return SingletonHolder.factory;
    }

    private static class SingletonHolder {

        public static final Injector injector = Guice
                .createInjector(new PreviewPanelModule(),
                        new TextsResourcesDefaultModule(),
                        new CsvImportModule(), new DataModule(),
                        new DataImportModule());

        public static final PreviewPanelFactory factory = injector
                .getInstance(PreviewPanelFactory.class);

    }

    @Override
    protected void configure() {
        install(new FactoryModuleBuilder().implement(PreviewPanel.class,
                PreviewPanel.class).build(PreviewPanelFactory.class));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy