OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 19 | Rev 26 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 19 Rev 25
Line 13... Line 13...
13
 
13
 
14
 package org.openconcerto.erp.modules;
14
 package org.openconcerto.erp.modules;
15
 
15
 
16
import org.openconcerto.sql.Configuration;
16
import org.openconcerto.sql.Configuration;
17
import org.openconcerto.sql.model.DBRoot;
17
import org.openconcerto.sql.model.DBRoot;
18
import org.openconcerto.sql.preferences.SQLPreferences;
-
 
19
import org.openconcerto.sql.sqlobject.SQLSearchableTextCombo;
18
import org.openconcerto.sql.sqlobject.SQLSearchableTextCombo;
20
import org.openconcerto.sql.sqlobject.SQLSearchableTextCombo.ISQLListModel;
19
import org.openconcerto.sql.sqlobject.SQLSearchableTextCombo.ISQLListModel;
21
import org.openconcerto.sql.sqlobject.SQLTextCombo;
20
import org.openconcerto.sql.sqlobject.SQLTextCombo;
22
import org.openconcerto.sql.sqlobject.SQLTextCombo.ITextComboCacheSQL;
21
import org.openconcerto.sql.sqlobject.SQLTextCombo.ITextComboCacheSQL;
23
import org.openconcerto.ui.JDate;
22
import org.openconcerto.ui.JDate;
Line 25... Line 24...
25
import org.openconcerto.ui.preferences.JavaPrefPreferencePanel;
24
import org.openconcerto.ui.preferences.JavaPrefPreferencePanel;
26
import org.openconcerto.ui.preferences.PrefView;
25
import org.openconcerto.ui.preferences.PrefView;
27
import org.openconcerto.utils.PrefType;
26
import org.openconcerto.utils.PrefType;
28
 
27
 
29
import java.util.Date;
28
import java.util.Date;
30
import java.util.prefs.Preferences;
-
 
31
 
29
 
32
import javax.swing.JCheckBox;
30
import javax.swing.JCheckBox;
33
import javax.swing.JComponent;
31
import javax.swing.JComponent;
34
 
32
 
35
public abstract class ModulePreferencePanel extends JavaPrefPreferencePanel {
33
public abstract class ModulePreferencePanel extends JavaPrefPreferencePanel {
36
 
34
 
37
    static private DBRoot getRoot() {
35
    static public DBRoot getRoot() {
38
        return Configuration.getInstance().getRoot();
36
        return Configuration.getInstance().getRoot();
39
    }
37
    }
40
 
38
 
41
    static private String getAppPrefPath() {
39
    static String getAppPrefPath() {
42
        return Configuration.getInstance().getAppID() + '/';
40
        return Configuration.getInstance().getAppID() + '/';
43
    }
41
    }
44
 
42
 
45
    public static class SQLPrefView<T> extends PrefView<T> {
43
    public static class SQLPrefView<T> extends PrefView<T> {
46
 
44
 
Line 87... Line 85...
87
        super(title, null);
85
        super(title, null);
88
 
86
 
89
    }
87
    }
90
 
88
 
91
    public final void init(final ModuleFactory module, final boolean local) {
89
    public final void init(final ModuleFactory module, final boolean local) {
92
        final Preferences rootPrefs = local ? Preferences.userRoot() : new SQLPreferences(getRoot());
-
 
93
        // ID is a package name, transform to path to avoid bumping into the size limit
-
 
94
        this.setPrefs(rootPrefs.node(getAppPrefPath() + module.getID().replace('.', '/')));
90
        this.setPrefs(module.getPreferences(local, getRoot()));
95
    }
91
    }
96
}
92
}