OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 80 | Rev 93 | 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;
18 ilm 23
import org.openconcerto.erp.preferences.GenerationDeclarationDocPreferencePanel;
57 ilm 24
import org.openconcerto.erp.preferences.GenerationDocGlobalPreferencePanel;
18 ilm 25
import org.openconcerto.erp.preferences.GenerationDocumentComptaPreferencePanel;
26
import org.openconcerto.erp.preferences.GenerationDocumentGestCommPreferencePanel;
27
import org.openconcerto.erp.preferences.GenerationDocumentPayePreferencePanel;
61 ilm 28
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
83 ilm 29
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel;
80 ilm 30
import org.openconcerto.erp.preferences.GestionPieceCommercialePanel;
18 ilm 31
import org.openconcerto.erp.preferences.ImpressionGestCommPreferencePanel;
32
import org.openconcerto.erp.preferences.ModeReglementDefautPrefPanel;
33
import org.openconcerto.erp.preferences.NumerotationPreferencePanel;
73 ilm 34
import org.openconcerto.erp.preferences.PayeGlobalPreferencePanel;
18 ilm 35
import org.openconcerto.erp.preferences.SauvegardeEnLignePreferencePanel;
36
import org.openconcerto.erp.preferences.SauvegardeFichierPreferencePanel;
37
import org.openconcerto.erp.preferences.SocietePreferencePanel;
38
import org.openconcerto.erp.preferences.TemplatePreferencePanel;
41 ilm 39
import org.openconcerto.erp.preferences.UIPreferencePanel;
18 ilm 40
import org.openconcerto.sql.Configuration;
41
import org.openconcerto.ui.preferences.EmailNode;
42
import org.openconcerto.ui.preferences.EmptyPreferencePanel;
43
import org.openconcerto.ui.preferences.PrefTreeNode;
44
 
19 ilm 45
import java.util.List;
46
import java.util.Map.Entry;
47
 
18 ilm 48
import javax.swing.tree.DefaultMutableTreeNode;
49
 
50
public class ComptaPrefTreeNode extends DefaultMutableTreeNode {
51
    public ComptaPrefTreeNode() {
52
        super(" Préférences");
53
 
54
        // Globale
55
        final PrefTreeNode nsGlobale = new PrefTreeNode(EmptyPreferencePanel.class, "Globales", new String[] {}, true);
56
        // Poste
57
        final PrefTreeNode nsPoste = new PrefTreeNode(EmptyPreferencePanel.class, "De l'ordinateur", new String[] {}, true);
41 ilm 58
        final PrefTreeNode nUI = new PrefTreeNode(UIPreferencePanel.class, "Interface", new String[] { "couleur", "color", "list" });
59
        nsPoste.add(nUI);
18 ilm 60
        // Sauvegarde
61
 
62
        final PrefTreeNode ns = new PrefTreeNode(EmptyPreferencePanel.class, "Sauvegarde", new String[] { "sauvegarde", "backup" });
63
        final PrefTreeNode n = new PrefTreeNode(SauvegardeEnLignePreferencePanel.class, "Sauvegarde en ligne", new String[] { "rien", "activer" });
64
        final PrefTreeNode n2 = new PrefTreeNode(SauvegardeFichierPreferencePanel.class, "Sauvegarde fichier", new String[] { "rien", "action" });
65
        ns.add(n2);
66
        ns.add(n);
67
        // nsGlobale.add(ns);
68
 
69
        // TVA
70
        final PrefTreeNode nTVA = new PrefTreeNode(TvaPreferencePanel.class, "TVA", new String[] { "TVA", "Taxe" });
71
 
72
        nsGlobale.add(nTVA);
73
 
74
        // Compte pour les saisies guidées
75
        final PrefTreeNode nCompte = new PrefTreeNode(EmptyPreferencePanel.class, "Préférences comptes", new String[] { "compte", "paye" });
76
        final PrefTreeNode nCompteCloture = new PrefTreeNode(CompteCloturePreferencePanel.class, "Clôture", new String[] { "compte", "cloture" });
77
        final PrefTreeNode nCompteGestComm = new PrefTreeNode(CompteGestCommPreferencePanel.class, "Gestion commerciale", new String[] { "compte" });
78
        final PrefTreeNode nComptePaye = new PrefTreeNode(ComptePayePreferencePanel.class, "Paye", new String[] { "compte" });
79
        nCompte.add(nCompteCloture);
80
        nCompte.add(nCompteGestComm);
81
        nCompte.add(nComptePaye);
82
 
83
        nsGlobale.add(nCompte);
84
 
85
        // Compte de règlement
86
        final PrefTreeNode nReglement = new PrefTreeNode(EmptyPreferencePanel.class, "Compte de règlement", new String[] { "règlement", "compte" });
87
        final PrefTreeNode nCompteAchatRegl = new PrefTreeNode(ReglementCompteAchatPreferencePanel.class, "Achats", new String[] { "compte", "règlement" });
88
        final PrefTreeNode nCompteVenteRegl = new PrefTreeNode(ReglementCompteVentePreferencePanel.class, "Ventes", new String[] { "compte", "règlement" });
89
        nReglement.add(nCompteAchatRegl);
90
        nReglement.add(nCompteVenteRegl);
91
 
92
        nsGlobale.add(nReglement);
93
 
73 ilm 94
        nsGlobale.add(new PrefTreeNode(PayeGlobalPreferencePanel.class, "Paye", new String[] { "paye", "csg" }));
95
 
80 ilm 96
        // Gestion commerciale
18 ilm 97
        final PrefTreeNode nGestionArticle = new PrefTreeNode(GestionArticlePreferencePanel.class, "Gestion des articles", new String[] { "articles", "gestion", "longueur", "largeur", "poids" });
80 ilm 98
        final PrefTreeNode nGestionPiece = new PrefTreeNode(GestionPieceCommercialePanel.class, "Gestion des pièces commerciales", new String[] { "mouvements", "pieces", "facture" });
18 ilm 99
        nsPoste.add(nGestionArticle);
80 ilm 100
        nsPoste.add(nGestionPiece);
18 ilm 101
 
102
        // Mode de règlement par défaut
103
        final PrefTreeNode nModeRegl = new PrefTreeNode(ModeReglementDefautPrefPanel.class, "Mode de règlement par défaut", new String[] { "mode", "règlement", "défaut" });
104
        nsGlobale.add(nModeRegl);
105
 
106
        // Société
107
        final PrefTreeNode nSociete = new PrefTreeNode(SocietePreferencePanel.class, "Société", new String[] { "société" });
108
        nsGlobale.add(nSociete);
109
 
110
        // Numérotation
111
        final PrefTreeNode nNum = new PrefTreeNode(NumerotationPreferencePanel.class, "Numérotation", new String[] { "numérotation" });
112
        nsGlobale.add(nNum);
113
 
61 ilm 114
        nsGlobale.add(new PrefTreeNode(GestionArticleGlobalPreferencePanel.class, "Gestion des articles", new String[] { "articles", "stock" }));
57 ilm 115
        nsGlobale.add(new PrefTreeNode(GenerationDocGlobalPreferencePanel.class, "Génération des Documents", new String[] { "documents" }));
83 ilm 116
        nsGlobale.add(new PrefTreeNode(GestionCommercialeGlobalPreferencePanel.class, "Gestion des piéces commericales", new String[] { "transfert", "numéro" }));
57 ilm 117
 
18 ilm 118
        // Impression
119
        final PrefTreeNode nPrint = new PrefTreeNode(EmptyPreferencePanel.class, "Impression", new String[] { "Impressions" });
120
        final PrefTreeNode nPrintGestComm = new PrefTreeNode(ImpressionGestCommPreferencePanel.class, "Gestion commerciale", new String[] { "impression" });
121
        final PrefTreeNode nPrintPaye = new PrefTreeNode(ImpressionPayePreferencePanel.class, "Paye", new String[] { "impression" });
122
        final PrefTreeNode nPrintCompta = new PrefTreeNode(ImpressionComptaPreferencePanel.class, "Comptabilité", new String[] { "impression" });
123
        nPrint.add(nPrintCompta);
124
        nPrint.add(nPrintGestComm);
125
        nPrint.add(nPrintPaye);
126
 
127
        nsPoste.add(nPrint);
128
 
129
        // Emplacement des modéles
130
        final PrefTreeNode nGeneration = new PrefTreeNode(EmptyPreferencePanel.class, "Génération des documents", new String[] { "générations", "document" });
61 ilm 131
        final PrefTreeNode nLocModele = new PrefTreeNode(TemplatePreferencePanel.class, "Modèles", new String[] { "destination", "modèle", "modele" });
18 ilm 132
        nGeneration.add(nLocModele);
133
 
134
        // Destination des documents générés
135
        final PrefTreeNode nDest = new PrefTreeNode(EmptyPreferencePanel.class, "Destination des documents", new String[] { "Destination", "document" });
136
        final PrefTreeNode nDestCompta = new PrefTreeNode(GenerationDocumentComptaPreferencePanel.class, "Comptabilité", new String[] { "destination" });
137
 
138
        final PrefTreeNode nDestGestComm = new PrefTreeNode(GenerationDocumentGestCommPreferencePanel.class, "Gestion commerciale", new String[] { "destination" });
139
        final PrefTreeNode nDestPaye = new PrefTreeNode(GenerationDocumentPayePreferencePanel.class, "Paye", new String[] { "destination" });
140
        final PrefTreeNode nDestEtat = new PrefTreeNode(GenerationDeclarationDocPreferencePanel.class, "Déclaration", new String[] { "Déclaration", "destination" });
141
 
142
        nDest.add(nDestCompta);
143
        nDest.add(nDestGestComm);
144
        nDest.add(nDestPaye);
145
        nDest.add(nDestEtat);
146
        nGeneration.add(nDest);
147
        nsPoste.add(nGeneration);
148
 
149
        // Mail
150
        final PrefTreeNode nMail = new PrefTreeNode(EmailNode.class, "EMail", new String[] { "email", "mail", "courriel" });
151
        nsPoste.add(nMail);
152
 
19 ilm 153
        // add preferences for modules
154
        for (final AbstractModule module : ModuleManager.getInstance().getRunningModules().values()) {
155
            for (final Entry<Boolean, List<ModulePreferencePanelDesc>> e : module.getPrefDescriptorsByLocation().entrySet()) {
156
                final DefaultMutableTreeNode node = e.getKey() ? nsPoste : nsGlobale;
157
                final List<ModulePreferencePanelDesc> descs = e.getValue();
158
                if (descs.size() > 1) {
159
                    // if there's more than one panel, create an additional level
160
                    final DefaultMutableTreeNode moduleNode = new PrefTreeNode(EmptyPreferencePanel.class, module.getName(), new String[] { module.getName() });
161
                    for (final ModulePreferencePanelDesc desc : descs) {
162
                        moduleNode.add(desc.createTreeNode(module.getFactory(), null));
163
                    }
164
                    node.add(moduleNode);
165
                } else if (descs.size() == 1) {
166
                    // if there's only one panel it should be named like the module
167
                    node.add(descs.get(0).createTreeNode(module.getFactory(), module.getName()));
168
                }
169
            }
170
        }
171
 
18 ilm 172
        this.add(nsGlobale);
173
        this.add(nsPoste);
174
    }
175
}