Search in sources :

Example 6 with PluginProvider

use of com.ramussoft.common.PluginProvider in project ramus by Vitaliy-Yakovchuk.

the class Client method run.

public void run(final String[] args) {
    final SplashScreen screen = new SplashScreen() {

        /**
         */
        private static final long serialVersionUID = -4641958771849938048L;

        @Override
        protected String getImageName() {
            for (String s : args) if (s.equals("-season"))
                return "/com/ramussoft/season/about.png";
            return "/com/ramussoft/gui/about.png";
        }
    };
    if (Metadata.CLIENT) {
        Metadata.REGISTERED_FOR = ClientConnection.getName();
        Metadata.DEMO_REGISTERED = ClientConnection.getName() != null;
    }
    screen.setLocationRelativeTo(null);
    boolean hide = false;
    for (String s : args) if ("--hide-splash".equals(s))
        hide = true;
    if (!hide)
        screen.setVisible(true);
    Thread t = new Thread(new Runnable() {

        @Override
        public void run() {
            List<PluginProvider> suits = new ArrayList<PluginProvider>();
            suits.add(new SimpleAttributePluginSuit());
            initAdditionalPluginSuits(suits);
            PluginFactory factory = createPluginFactory(suits);
            PersistentFactory persistentFactory = new PersistentFactory(null, factory.getAttributePlugins(), null);
            persistentFactory.reinit();
            Engine engine = getEngine(factory, persistentFactory);
            AccessRules rules = getAccessRules();
            e = engine;
            e.setPluginProperty("Core", "PluginList", factory.getPlugins());
            e.setPluginProperty("Core", "PluginFactory", factory);
            LightClient.staticEngine = e;
            LightClient.staticAccessRules = rules;
            List<GUIPlugin> list = new ArrayList<GUIPlugin>();
            QualifierPluginSuit.addPlugins(list, e, rules);
            initAdditionalGuiPlugins(list);
            User me = getMe();
            List<Group> groups = me.getGroups();
            String[] grps = new String[groups.size()];
            for (int i = 0; i < grps.length; i++) grps[i] = groups.get(i).getName();
            AbstractGUIPluginFactory factory1;
            String ws = Options.getString("WindowsControl", "simple");
            if (ws.equals("simple"))
                factory1 = new SimleGUIPluginFactory(list, e, rules, getType(), grps, loadPlugins);
            else
                factory1 = new GUIPluginFactory(list, e, rules, getType(), grps, loadPlugins);
            framework = factory1.getFramework();
            framework.addCloseMainFrameListener(new CloseMainFrameAdapter() {

                @Override
                public void afterClosed() {
                    Client.this.close();
                }
            });
            final JFrame frame = factory1.getMainFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            String title = getTitle();
            frame.setTitle(title);
            SwingUtilities.invokeLater(new Runnable() {

                public void run() {
                    frame.setVisible(true);
                    screen.setVisible(false);
                }
            });
        }
    });
    t.start();
    Thread thread = new Thread("Icons-buffer-cleaner") {

        @Override
        public void run() {
            while (true) {
                try {
                    Thread.sleep(20000);
                    IconFactory.clearIconsBuffer(LightClient.staticEngine);
                    IconFactory.clearQualifierIconsBuffer(LightClient.staticEngine);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    };
    thread.setDaemon(true);
    thread.setPriority(Thread.MIN_PRIORITY);
    thread.start();
}
Also used : PersistentFactory(com.ramussoft.core.persistent.PersistentFactory) SimleGUIPluginFactory(com.ramussoft.gui.core.simple.SimleGUIPluginFactory) User(com.ramussoft.net.common.User) AbstractGUIPluginFactory(com.ramussoft.gui.common.AbstractGUIPluginFactory) SimleGUIPluginFactory(com.ramussoft.gui.core.simple.SimleGUIPluginFactory) GUIPluginFactory(com.ramussoft.gui.core.GUIPluginFactory) PluginProvider(com.ramussoft.common.PluginProvider) CloseMainFrameAdapter(com.ramussoft.gui.common.event.CloseMainFrameAdapter) SimpleAttributePluginSuit(com.ramussoft.core.attribute.simple.SimpleAttributePluginSuit) JFrame(javax.swing.JFrame) SplashScreen(com.ramussoft.gui.common.SplashScreen) AccessRules(com.ramussoft.common.AccessRules) ArrayList(java.util.ArrayList) List(java.util.List) AbstractGUIPluginFactory(com.ramussoft.gui.common.AbstractGUIPluginFactory) SimleGUIPluginFactory(com.ramussoft.gui.core.simple.SimleGUIPluginFactory) GUIPluginFactory(com.ramussoft.gui.core.GUIPluginFactory) PluginFactory(com.ramussoft.common.PluginFactory) Engine(com.ramussoft.common.Engine) GUIPlugin(com.ramussoft.gui.common.GUIPlugin) AbstractGUIPluginFactory(com.ramussoft.gui.common.AbstractGUIPluginFactory)

Example 7 with PluginProvider

use of com.ramussoft.common.PluginProvider in project ramus by Vitaliy-Yakovchuk.

the class Client method createPluginFactory.

private PluginFactory createPluginFactory(List<PluginProvider> list) {
    ArrayList<Plugin> plugins = new ArrayList<Plugin>();
    for (PluginProvider suit : list) {
        plugins.addAll(suit.getPlugins());
    }
    PluginFactory factory = new PluginFactory(plugins);
    return factory;
}
Also used : ArrayList(java.util.ArrayList) PluginProvider(com.ramussoft.common.PluginProvider) AbstractGUIPluginFactory(com.ramussoft.gui.common.AbstractGUIPluginFactory) SimleGUIPluginFactory(com.ramussoft.gui.core.simple.SimleGUIPluginFactory) GUIPluginFactory(com.ramussoft.gui.core.GUIPluginFactory) PluginFactory(com.ramussoft.common.PluginFactory) Plugin(com.ramussoft.common.Plugin) GUIPlugin(com.ramussoft.gui.common.GUIPlugin)

Example 8 with PluginProvider

use of com.ramussoft.common.PluginProvider in project ramus by Vitaliy-Yakovchuk.

the class AbstractDatabase method createPluginFactory.

protected PluginFactory createPluginFactory(List<PluginProvider> list) {
    ArrayList<Plugin> plugins = new ArrayList<Plugin>();
    for (PluginProvider suit : list) {
        plugins.addAll(suit.getPlugins());
    }
    PluginFactory factory = new PluginFactory(plugins);
    return factory;
}
Also used : ArrayList(java.util.ArrayList) PluginProvider(com.ramussoft.common.PluginProvider) PluginFactory(com.ramussoft.common.PluginFactory) Plugin(com.ramussoft.common.Plugin)

Example 9 with PluginProvider

use of com.ramussoft.common.PluginProvider in project ramus by Vitaliy-Yakovchuk.

the class NDataPluginFactory method createTemplateDataPlugin.

private static DataPlugin createTemplateDataPlugin() {
    MemoryDatabase database = new MemoryDatabase() {

        @Override
        protected Collection<? extends PluginProvider> getAdditionalSuits() {
            ArrayList<PluginProvider> ps = new ArrayList<PluginProvider>(1);
            ps.add(new IDEF0PluginProvider());
            return ps;
        }

        @Override
        protected String getJournalDirectoryName(String tmp) {
            return null;
        }

        @Override
        protected FileIEngineImpl createFileIEngine(PluginFactory factory) throws ClassNotFoundException, ZipException, IOException {
            return createNotSessionedFileIEngine(factory);
        }
    };
    Engine e = database.getEngine(null);
    AccessRules rules = database.getAccessRules(null);
    Qualifier q = e.createQualifier();
    IDEF0Plugin.installFunctionAttributes(q, e);
    return getDataPlugin(q, e, rules);
}
Also used : MemoryDatabase(com.ramussoft.database.MemoryDatabase) ArrayList(java.util.ArrayList) AccessRules(com.ramussoft.common.AccessRules) Qualifier(com.ramussoft.common.Qualifier) PluginProvider(com.ramussoft.common.PluginProvider) PluginFactory(com.ramussoft.common.PluginFactory) Engine(com.ramussoft.common.Engine)

Example 10 with PluginProvider

use of com.ramussoft.common.PluginProvider in project ramus by Vitaliy-Yakovchuk.

the class Navigator method createPluginFactory.

private PluginFactory createPluginFactory(List<PluginProvider> list) {
    ArrayList<Plugin> plugins = new ArrayList<Plugin>();
    for (PluginProvider suit : list) {
        plugins.addAll(suit.getPlugins());
    }
    PluginFactory factory = new PluginFactory(plugins);
    return factory;
}
Also used : ArrayList(java.util.ArrayList) IDEF0PluginProvider(com.ramussoft.idef0.IDEF0PluginProvider) ReportPluginProvider(com.ramussoft.report.ReportPluginProvider) PluginProvider(com.ramussoft.common.PluginProvider) NDataPluginFactory(com.ramussoft.idef0.NDataPluginFactory) PluginFactory(com.ramussoft.common.PluginFactory) DataPlugin(com.ramussoft.pb.DataPlugin) Plugin(com.ramussoft.common.Plugin)

Aggregations

PluginProvider (com.ramussoft.common.PluginProvider)16 ArrayList (java.util.ArrayList)15 PluginFactory (com.ramussoft.common.PluginFactory)13 Engine (com.ramussoft.common.Engine)8 Plugin (com.ramussoft.common.Plugin)7 IDEF0PluginProvider (com.ramussoft.idef0.IDEF0PluginProvider)6 SQLException (java.sql.SQLException)6 MemoryDatabase (com.ramussoft.database.MemoryDatabase)5 IOException (java.io.IOException)5 AccessRules (com.ramussoft.common.AccessRules)4 IEngine (com.ramussoft.common.IEngine)4 SimpleAttributePluginSuit (com.ramussoft.core.attribute.simple.SimpleAttributePluginSuit)4 PersistentFactory (com.ramussoft.core.persistent.PersistentFactory)4 JournaledEngine (com.ramussoft.common.journal.JournaledEngine)3 FileIEngineImpl (com.ramussoft.core.impl.FileIEngineImpl)3 PersistentsPlugin (com.ramussoft.core.persistent.PersistentsPlugin)3 PersistentsPluginProvider (com.ramussoft.core.persistent.PersistentsPluginProvider)3 AbstractGUIPluginFactory (com.ramussoft.gui.common.AbstractGUIPluginFactory)3 GUIPluginFactory (com.ramussoft.gui.core.GUIPluginFactory)3 SimleGUIPluginFactory (com.ramussoft.gui.core.simple.SimleGUIPluginFactory)3