OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 156 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
18 ilm 1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
10
 *
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
13
 
14
 package org.openconcerto.erp.core.finance.accounting.ui;
15
 
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
17
import org.openconcerto.erp.core.finance.tax.ui.TvaPreferencePanel;
18
import org.openconcerto.erp.core.humanresources.payroll.ui.ImpressionPayePreferencePanel;
19
import org.openconcerto.erp.core.sales.product.ui.GestionArticlePreferencePanel;
19 ilm 20
import org.openconcerto.erp.modules.AbstractModule;
21
import org.openconcerto.erp.modules.ModuleManager;
22
import org.openconcerto.erp.modules.ModulePreferencePanelDesc;
142 ilm 23
import org.openconcerto.erp.preferences.AttachmentPreferencePanel;
18 ilm 24
import org.openconcerto.erp.preferences.GenerationDeclarationDocPreferencePanel;
57 ilm 25
import org.openconcerto.erp.preferences.GenerationDocGlobalPreferencePanel;
18 ilm 26
import org.openconcerto.erp.preferences.GenerationDocumentComptaPreferencePanel;
27
import org.openconcerto.erp.preferences.GenerationDocumentGestCommPreferencePanel;
28
import org.openconcerto.erp.preferences.GenerationDocumentPayePreferencePanel;
61 ilm 29
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
93 ilm 30
import org.openconcerto.erp.preferences.GestionClientPreferencePanel;
83 ilm 31
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel;
80 ilm 32
import org.openconcerto.erp.preferences.GestionPieceCommercialePanel;
18 ilm 33
import org.openconcerto.erp.preferences.ImpressionGestCommPreferencePanel;
34
import org.openconcerto.erp.preferences.ModeReglementDefautPrefPanel;
35
import org.openconcerto.erp.preferences.NumerotationPreferencePanel;
156 ilm 36
import org.openconcerto.erp.preferences.PayPalPreferencePanel;
73 ilm 37
import org.openconcerto.erp.preferences.PayeGlobalPreferencePanel;
18 ilm 38
import org.openconcerto.erp.preferences.SauvegardeEnLignePreferencePanel;
39
import org.openconcerto.erp.preferences.SauvegardeFichierPreferencePanel;
40
import org.openconcerto.erp.preferences.SocietePreferencePanel;
41
import org.openconcerto.erp.preferences.TemplatePreferencePanel;
41 ilm 42
import org.openconcerto.erp.preferences.UIPreferencePanel;
18 ilm 43
import org.openconcerto.sql.Configuration;
44
import org.openconcerto.ui.preferences.EmailNode;
45
import org.openconcerto.ui.preferences.EmptyPreferencePanel;
46
import org.openconcerto.ui.preferences.PrefTreeNode;
47
 
19 ilm 48
import java.util.List;
49
import java.util.Map.Entry;
50
 
18 ilm 51
import javax.swing.tree.DefaultMutableTreeNode;
52
 
53
public class ComptaPrefTreeNode extends DefaultMutableTreeNode {
156 ilm 54
    public ComptaPrefTreeNode(final ModuleManager moduleManager) {
18 ilm 55
        super(" Préférences");
56
 
57
        // Globale
58
        final PrefTreeNode nsGlobale = new PrefTreeNode(EmptyPreferencePanel.class, "Globales", new String[] {}, true);
59
        // Poste
60
        final PrefTreeNode nsPoste = new PrefTreeNode(EmptyPreferencePanel.class, "De l'ordinateur", new String[] {}, true);
41 ilm 61
        final PrefTreeNode nUI = new PrefTreeNode(UIPreferencePanel.class, "Interface", new String[] { "couleur", "color", "list" });
62
        nsPoste.add(nUI);
18 ilm 63
        // Sauvegarde
64
 
65
        final PrefTreeNode ns = new PrefTreeNode(EmptyPreferencePanel.class, "Sauvegarde", new String[] { "sauvegarde", "backup" });
66
        final PrefTreeNode n = new PrefTreeNode(SauvegardeEnLignePreferencePanel.class, "Sauvegarde en ligne", new String[] { "rien", "activer" });
67
        final PrefTreeNode n2 = new PrefTreeNode(SauvegardeFichierPreferencePanel.class, "Sauvegarde fichier", new String[] { "rien", "action" });
68
        ns.add(n2);
69
        ns.add(n);
70
        // nsGlobale.add(ns);
71
 
72
        // TVA
73
        final PrefTreeNode nTVA = new PrefTreeNode(TvaPreferencePanel.class, "TVA", new String[] { "TVA", "Taxe" });
74
 
75
        nsGlobale.add(nTVA);
76
 
77
        // Compte pour les saisies guidées
78
        final PrefTreeNode nCompte = new PrefTreeNode(EmptyPreferencePanel.class, "Préférences comptes", new String[] { "compte", "paye" });
79
        final PrefTreeNode nCompteCloture = new PrefTreeNode(CompteCloturePreferencePanel.class, "Clôture", new String[] { "compte", "cloture" });
80
        final PrefTreeNode nCompteGestComm = new PrefTreeNode(CompteGestCommPreferencePanel.class, "Gestion commerciale", new String[] { "compte" });
81
        final PrefTreeNode nComptePaye = new PrefTreeNode(ComptePayePreferencePanel.class, "Paye", new String[] { "compte" });
82
        nCompte.add(nCompteCloture);
83
        nCompte.add(nCompteGestComm);
84
        nCompte.add(nComptePaye);
85
 
86
        nsGlobale.add(nCompte);
87
 
88
        // Compte de règlement
89
        final PrefTreeNode nReglement = new PrefTreeNode(EmptyPreferencePanel.class, "Compte de règlement", new String[] { "règlement", "compte" });
90
        final PrefTreeNode nCompteAchatRegl = new PrefTreeNode(ReglementCompteAchatPreferencePanel.class, "Achats", new String[] { "compte", "règlement" });
91
        final PrefTreeNode nCompteVenteRegl = new PrefTreeNode(ReglementCompteVentePreferencePanel.class, "Ventes", new String[] { "compte", "règlement" });
92
        nReglement.add(nCompteAchatRegl);
93
        nReglement.add(nCompteVenteRegl);
94
 
95
        nsGlobale.add(nReglement);
96
 
73 ilm 97
        nsGlobale.add(new PrefTreeNode(PayeGlobalPreferencePanel.class, "Paye", new String[] { "paye", "csg" }));
98
 
80 ilm 99
        // Gestion commerciale
18 ilm 100
        final PrefTreeNode nGestionArticle = new PrefTreeNode(GestionArticlePreferencePanel.class, "Gestion des articles", new String[] { "articles", "gestion", "longueur", "largeur", "poids" });
80 ilm 101
        final PrefTreeNode nGestionPiece = new PrefTreeNode(GestionPieceCommercialePanel.class, "Gestion des pièces commerciales", new String[] { "mouvements", "pieces", "facture" });
18 ilm 102
        nsPoste.add(nGestionArticle);
80 ilm 103
        nsPoste.add(nGestionPiece);
18 ilm 104
 
105
        // Mode de règlement par défaut
106
        final PrefTreeNode nModeRegl = new PrefTreeNode(ModeReglementDefautPrefPanel.class, "Mode de règlement par défaut", new String[] { "mode", "règlement", "défaut" });
107
        nsGlobale.add(nModeRegl);
108
 
109
        // Société
110
        final PrefTreeNode nSociete = new PrefTreeNode(SocietePreferencePanel.class, "Société", new String[] { "société" });
111
        nsGlobale.add(nSociete);
112
 
113
        // Numérotation
114
        final PrefTreeNode nNum = new PrefTreeNode(NumerotationPreferencePanel.class, "Numérotation", new String[] { "numérotation" });
115
        nsGlobale.add(nNum);
116
 
61 ilm 117
        nsGlobale.add(new PrefTreeNode(GestionArticleGlobalPreferencePanel.class, "Gestion des articles", new String[] { "articles", "stock" }));
57 ilm 118
        nsGlobale.add(new PrefTreeNode(GenerationDocGlobalPreferencePanel.class, "Génération des Documents", new String[] { "documents" }));
93 ilm 119
        nsGlobale.add(new PrefTreeNode(GestionClientPreferencePanel.class, "Gestion des clients", new String[] { "client", "service" }));
83 ilm 120
        nsGlobale.add(new PrefTreeNode(GestionCommercialeGlobalPreferencePanel.class, "Gestion des piéces commericales", new String[] { "transfert", "numéro" }));
57 ilm 121
 
156 ilm 122
        // PayPal
123
        final PrefTreeNode nPayPall = new PrefTreeNode(PayPalPreferencePanel.class, "PayPal", new String[] { "paypal", "facture" });
124
        nsGlobale.add(nPayPall);
125
 
18 ilm 126
        // Impression
127
        final PrefTreeNode nPrint = new PrefTreeNode(EmptyPreferencePanel.class, "Impression", new String[] { "Impressions" });
128
        final PrefTreeNode nPrintGestComm = new PrefTreeNode(ImpressionGestCommPreferencePanel.class, "Gestion commerciale", new String[] { "impression" });
129
        final PrefTreeNode nPrintPaye = new PrefTreeNode(ImpressionPayePreferencePanel.class, "Paye", new String[] { "impression" });
130
        final PrefTreeNode nPrintCompta = new PrefTreeNode(ImpressionComptaPreferencePanel.class, "Comptabilité", new String[] { "impression" });
131
        nPrint.add(nPrintCompta);
132
        nPrint.add(nPrintGestComm);
133
        nPrint.add(nPrintPaye);
134
 
135
        nsPoste.add(nPrint);
136
 
137
        // Emplacement des modéles
138
        final PrefTreeNode nGeneration = new PrefTreeNode(EmptyPreferencePanel.class, "Génération des documents", new String[] { "générations", "document" });
61 ilm 139
        final PrefTreeNode nLocModele = new PrefTreeNode(TemplatePreferencePanel.class, "Modèles", new String[] { "destination", "modèle", "modele" });
18 ilm 140
        nGeneration.add(nLocModele);
141
 
142
        // Destination des documents générés
143
        final PrefTreeNode nDest = new PrefTreeNode(EmptyPreferencePanel.class, "Destination des documents", new String[] { "Destination", "document" });
144
        final PrefTreeNode nDestCompta = new PrefTreeNode(GenerationDocumentComptaPreferencePanel.class, "Comptabilité", new String[] { "destination" });
145
 
146
        final PrefTreeNode nDestGestComm = new PrefTreeNode(GenerationDocumentGestCommPreferencePanel.class, "Gestion commerciale", new String[] { "destination" });
147
        final PrefTreeNode nDestPaye = new PrefTreeNode(GenerationDocumentPayePreferencePanel.class, "Paye", new String[] { "destination" });
148
        final PrefTreeNode nDestEtat = new PrefTreeNode(GenerationDeclarationDocPreferencePanel.class, "Déclaration", new String[] { "Déclaration", "destination" });
142 ilm 149
        final PrefTreeNode nGED = new PrefTreeNode(AttachmentPreferencePanel.class, "GED", new String[] { "GED", "EDM" });
18 ilm 150
 
151
        nDest.add(nDestCompta);
142 ilm 152
        nDest.add(nGED);
18 ilm 153
        nDest.add(nDestGestComm);
154
        nDest.add(nDestPaye);
155
        nDest.add(nDestEtat);
156
        nGeneration.add(nDest);
157
        nsPoste.add(nGeneration);
158
 
159
        // Mail
160
        final PrefTreeNode nMail = new PrefTreeNode(EmailNode.class, "EMail", new String[] { "email", "mail", "courriel" });
161
        nsPoste.add(nMail);
162
 
19 ilm 163
        // add preferences for modules
156 ilm 164
        for (final AbstractModule module : moduleManager.getRunningModules().values()) {
165
            for (final Entry<Boolean, List<ModulePreferencePanelDesc>> e : module.getPrefDescriptorsByLocation(moduleManager.getRoot()).entrySet()) {
19 ilm 166
                final DefaultMutableTreeNode node = e.getKey() ? nsPoste : nsGlobale;
167
                final List<ModulePreferencePanelDesc> descs = e.getValue();
168
                if (descs.size() > 1) {
169
                    // if there's more than one panel, create an additional level
170
                    final DefaultMutableTreeNode moduleNode = new PrefTreeNode(EmptyPreferencePanel.class, module.getName(), new String[] { module.getName() });
171
                    for (final ModulePreferencePanelDesc desc : descs) {
172
                        moduleNode.add(desc.createTreeNode(module.getFactory(), null));
173
                    }
174
                    node.add(moduleNode);
175
                } else if (descs.size() == 1) {
176
                    // if there's only one panel it should be named like the module
177
                    node.add(descs.get(0).createTreeNode(module.getFactory(), module.getName()));
178
                }
179
            }
180
        }
181
 
18 ilm 182
        this.add(nsGlobale);
183
        this.add(nsPoste);
184
    }
185
}