OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 153 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
47 ilm 1
package org.openconcerto.modules.google.docs;
2
 
3
import java.io.IOException;
153 ilm 4
import java.sql.SQLException;
47 ilm 5
import java.util.Arrays;
6
import java.util.List;
7
 
8
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureSQLElement;
9
import org.openconcerto.erp.core.sales.quote.element.DevisSQLElement;
10
import org.openconcerto.erp.modules.AbstractModule;
11
import org.openconcerto.erp.modules.ComponentsContext;
12
import org.openconcerto.erp.modules.DBContext;
13
import org.openconcerto.erp.modules.ModuleFactory;
14
import org.openconcerto.erp.modules.ModulePreferencePanelDesc;
15
import org.openconcerto.erp.storage.StorageEngines;
16
import org.openconcerto.sql.element.SQLElementDirectory;
172 ilm 17
import org.openconcerto.sql.model.DBRoot;
47 ilm 18
import org.openconcerto.ui.preferences.PreferencePanel;
19
 
20
public final class Module extends AbstractModule {
21
    private final GoogleDocsStorageEngine engine = new GoogleDocsStorageEngine();
22
 
23
    public Module(ModuleFactory f) throws IOException {
24
        super(f);
25
 
26
    }
27
 
28
    @Override
153 ilm 29
    protected void install(DBContext ctxt) throws SQLException, IOException {
47 ilm 30
        super.install(ctxt);
31
 
32
    }
33
 
34
    @Override
35
    protected void setupElements(SQLElementDirectory dir) {
36
        super.setupElements(dir);
37
 
38
    }
39
 
40
    @Override
41
    protected void setupComponents(ComponentsContext ctxt) {
42
        ctxt.addListAction(SaisieVenteFactureSQLElement.TABLENAME, new GoogleDocsListAction());
43
        ctxt.addListAction(DevisSQLElement.TABLENAME, new GoogleDocsListAction());
44
    }
45
 
46
    @Override
47
    protected void start() {
48
        StorageEngines.getInstance().addEngine(engine);
49
    }
50
 
51
    @Override
172 ilm 52
    public List<ModulePreferencePanelDesc> getPrefDescriptors(final DBRoot root) {
78 ilm 53
        return Arrays.<ModulePreferencePanelDesc> asList(new ModulePreferencePanelDesc("Google Docs") {
47 ilm 54
            @Override
55
            protected PreferencePanel createPanel() {
56
                return new GoogleDocsPreferencePanel();
57
            }
58
        });
59
    }
60
 
61
    @Override
62
    protected void stop() {
63
        StorageEngines.getInstance().removeEngine(engine);
64
    }
65
}