OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 149 | 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.sales.quote.element;
15
 
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
17
import org.openconcerto.erp.config.Gestion;
73 ilm 18
import org.openconcerto.erp.core.common.component.TransfertBaseSQLComponent;
18 ilm 19
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
94 ilm 20
import org.openconcerto.erp.core.common.ui.AbstractVenteArticleItemTable;
18 ilm 21
import org.openconcerto.erp.core.sales.invoice.component.SaisieVenteFactureSQLComponent;
65 ilm 22
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
18 ilm 23
import org.openconcerto.erp.core.sales.quote.component.DevisSQLComponent;
61 ilm 24
import org.openconcerto.erp.core.sales.quote.report.DevisXmlSheet;
83 ilm 25
import org.openconcerto.erp.core.sales.quote.ui.QuoteEditGroup;
93 ilm 26
import org.openconcerto.erp.core.sales.quote.ui.QuoteSQLComponent;
65 ilm 27
import org.openconcerto.erp.core.supplychain.stock.element.MouvementStockSQLElement;
61 ilm 28
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
149 ilm 29
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel;
18 ilm 30
import org.openconcerto.sql.Configuration;
93 ilm 31
import org.openconcerto.sql.element.GlobalMapper;
18 ilm 32
import org.openconcerto.sql.element.SQLComponent;
33
import org.openconcerto.sql.element.SQLElement;
132 ilm 34
import org.openconcerto.sql.element.SQLElementLink.LinkType;
35
import org.openconcerto.sql.element.SQLElementLinksSetup;
90 ilm 36
import org.openconcerto.sql.model.FieldPath;
65 ilm 37
import org.openconcerto.sql.model.SQLField;
38
import org.openconcerto.sql.model.SQLInjector;
39
import org.openconcerto.sql.model.SQLRow;
80 ilm 40
import org.openconcerto.sql.model.SQLRowAccessor;
18 ilm 41
import org.openconcerto.sql.model.SQLRowValues;
80 ilm 42
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
43
import org.openconcerto.sql.model.SQLSelect;
65 ilm 44
import org.openconcerto.sql.model.SQLTable;
80 ilm 45
import org.openconcerto.sql.model.Where;
90 ilm 46
import org.openconcerto.sql.model.graph.Path;
149 ilm 47
import org.openconcerto.sql.preferences.SQLPreferences;
18 ilm 48
import org.openconcerto.sql.request.ListSQLRequest;
94 ilm 49
import org.openconcerto.sql.users.UserManager;
93 ilm 50
import org.openconcerto.sql.users.rights.UserRightsManager;
18 ilm 51
import org.openconcerto.sql.view.EditFrame;
65 ilm 52
import org.openconcerto.sql.view.EditPanel;
90 ilm 53
import org.openconcerto.sql.view.EditPanel.EditMode;
54
import org.openconcerto.sql.view.EditPanelListener;
55
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
65 ilm 56
import org.openconcerto.sql.view.list.IListe;
90 ilm 57
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
65 ilm 58
import org.openconcerto.sql.view.list.RowAction;
90 ilm 59
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
142 ilm 60
import org.openconcerto.sql.view.list.SQLTableModelSource;
83 ilm 61
import org.openconcerto.ui.light.ActivationOnSelectionControler;
62
import org.openconcerto.ui.light.ColumnSpec;
63
import org.openconcerto.ui.light.ColumnsSpec;
64
import org.openconcerto.ui.light.CustomEditorProvider;
65
import org.openconcerto.ui.light.LightControler;
149 ilm 66
import org.openconcerto.ui.light.LightUIButtonUnmanaged;
132 ilm 67
import org.openconcerto.ui.light.LightUIComboBox;
83 ilm 68
import org.openconcerto.ui.light.LightUIElement;
69
import org.openconcerto.ui.light.LightUILine;
94 ilm 70
import org.openconcerto.ui.light.LightUIPanel;
71
import org.openconcerto.ui.light.LightUITable;
83 ilm 72
import org.openconcerto.ui.light.LightUITextField;
73
import org.openconcerto.ui.light.Row;
94 ilm 74
import org.openconcerto.ui.light.RowSelectionSpec;
83 ilm 75
import org.openconcerto.ui.light.TableContent;
76
import org.openconcerto.ui.light.TableSpec;
90 ilm 77
import org.openconcerto.ui.table.TimestampTableCellRenderer;
78
import org.openconcerto.utils.CollectionUtils;
79
import org.openconcerto.utils.DecimalUtils;
80 ilm 80
import org.openconcerto.utils.ExceptionHandler;
90 ilm 81
import org.openconcerto.utils.FileUtils;
83 ilm 82
import org.openconcerto.utils.ListMap;
80 ilm 83
import org.openconcerto.utils.cc.ITransformer;
94 ilm 84
import org.openconcerto.utils.ui.StringWithId;
18 ilm 85
 
93 ilm 86
import java.awt.Desktop;
65 ilm 87
import java.awt.event.ActionEvent;
90 ilm 88
import java.io.File;
93 ilm 89
import java.io.IOException;
67 ilm 90
import java.math.BigDecimal;
90 ilm 91
import java.net.URI;
65 ilm 92
import java.sql.SQLException;
18 ilm 93
import java.util.ArrayList;
93 ilm 94
import java.util.Arrays;
90 ilm 95
import java.util.Calendar;
96
import java.util.Date;
18 ilm 97
import java.util.HashSet;
98
import java.util.List;
132 ilm 99
import java.util.Map;
18 ilm 100
import java.util.Set;
101
 
65 ilm 102
import javax.swing.AbstractAction;
18 ilm 103
import javax.swing.ImageIcon;
104
import javax.swing.JFrame;
80 ilm 105
import javax.swing.JOptionPane;
106
import javax.swing.SwingWorker;
18 ilm 107
 
132 ilm 108
import org.jdom2.Document;
109
import org.jdom2.Element;
110
import org.jdom2.input.DOMBuilder;
94 ilm 111
 
18 ilm 112
public class DevisSQLElement extends ComptaSQLConfElement {
113
 
25 ilm 114
    public static final String TABLENAME = "DEVIS";
93 ilm 115
    public static final String FACTURE_TAG_RIGHT = "TAG_FACTURE_DEVIS";
25 ilm 116
 
90 ilm 117
    public static enum Month {
118
 
132 ilm 119
        JANVIER("01", "Janvier"), FEVRIER("02", "Février"), MARS("03", "Mars"), AVRIL("04", "Avril"), MAI("05", "Mai"), JUIN("06", "Juin"), JUILLET("07", "Juillet"), AOUT("08",
120
                "Août"), SEPTEMBRE("09", "Septembre"), OCTOBRE("10", "Octobre"), NOVEMBRE("11", "Novembre"), DECEMBRE("12", "Décembre");
90 ilm 121
 
122
        private String number;
123
        private String name;
124
 
125
        Month(String number, String name) {
126
            this.number = number;
127
            this.name = name;
128
        }
129
 
130
        public String getName() {
131
            return this.name;
132
        }
133
 
134
        public String getNumber() {
135
            return this.number;
136
        }
137
 
138
        public String getPath() {
139
            return this.getNumber() + "-" + this.getName();
140
        }
141
    };
142
 
18 ilm 143
    public DevisSQLElement() {
73 ilm 144
        this("un devis", "devis");
145
    }
61 ilm 146
 
73 ilm 147
    public DevisSQLElement(String singular, String plural) {
148
        super(TABLENAME, singular, plural);
93 ilm 149
 
65 ilm 150
        getRowActions().addAll(getDevisRowActions());
93 ilm 151
        final QuoteEditGroup group = new QuoteEditGroup();
152
        GlobalMapper.getInstance().map(QuoteSQLComponent.ID, group);
153
        setDefaultGroup(group);
154
 
18 ilm 155
    }
156
 
149 ilm 157
    @Override
158
    public Set<String> getReadOnlyFields() {
159
        Set<String> s = new HashSet<String>();
160
        s.add("T_ACOMPTE");
161
        return s;
162
    }
90 ilm 163
 
65 ilm 164
    private List<RowAction> getDevisRowActions() {
165
 
166
        List<RowAction> rowsActions = new ArrayList<RowAction>();
167
 
168
        // List<RowAction> list = new ArrayList<RowAction>();
169
        // Transfert vers facture
170
        RowAction factureAction = getDevis2FactureAction();
171
 
172
        rowsActions.add(factureAction);
173
 
149 ilm 174
        SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
175
        if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.ACOMPTE_DEVIS, false)) {
176
            PredicateRowAction actionClient = new PredicateRowAction(new AbstractAction("Saisir un acompte") {
177
                EditFrame edit;
178
 
179
                public void actionPerformed(ActionEvent e) {
180
                    final SQLElement eltEncaisser = Configuration.getInstance().getDirectory()
181
                            .getElement(((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete().getTable("ENCAISSER_MONTANT"));
182
 
183
                    if (this.edit == null) {
184
                        this.edit = new EditFrame(eltEncaisser, EditMode.CREATION);
185
                    }
186
                    final SQLRowAccessor selRow = IListe.get(e).getSelectedRow();
187
                    SQLRowValues rowVals = new SQLRowValues(eltEncaisser.getTable());
188
                    rowVals.put("ACOMPTE", true);
189
                    rowVals.put("NOM", "Acompte devis " + selRow.getString("NUMERO"));
190
                    rowVals.put("ID_CLIENT", selRow.getForeignID("ID_CLIENT"));
191
                    rowVals.put("ID_DEVIS", selRow.getID());
192
                    SQLRowValues rowValsElt = new SQLRowValues(eltEncaisser.getTable().getTable("ENCAISSER_MONTANT_ELEMENT"));
193
                    rowValsElt.put("MONTANT_A_REGLER", selRow.getLong("T_TTC"));
194
                    rowValsElt.put("DATE", selRow.getObject("DATE"));
195
                    rowValsElt.put("ID_ENCAISSER_MONTANT", rowVals);
196
                    this.edit.getSQLComponent().select(rowVals);
197
                    this.edit.setVisible(true);
198
                    this.edit.addEditPanelListener(new EditPanelListener() {
199
 
200
                        @Override
201
                        public void modified() {
202
                            // TODO Auto-generated method stub
203
 
204
                        }
205
 
206
                        @Override
207
                        public void inserted(int id) {
208
                            // Put id devis and refresh devis.t_acompte
209
                            SQLRow rowE = eltEncaisser.getTable().getRow(id);
210
                            String up = "UPDATE " + selRow.getTable().getSQLName().quote() + " set \"T_ACOMPTE\"=(SELECT COALESCE(SUM(\"MONTANT\"),0) from " + rowE.getTable().getSQLName().quote()
211
                                    + " where \"ARCHIVE\"=0 and \"ID_DEVIS\"=" + selRow.getID() + ") where \"ID_DEVIS\"=" + selRow.getID();
212
                            eltEncaisser.getTable().getDBSystemRoot().getDataSource().execute(up);
213
                        }
214
 
215
                        @Override
216
                        public void deleted() {
217
                            // TODO Auto-generated method stub
218
 
219
                        }
220
 
221
                        @Override
222
                        public void cancelled() {
223
                            // TODO Auto-generated method stub
224
 
225
                        }
226
                    });
227
                }
228
            }, false);
229
            actionClient.setPredicate(IListeEvent.getSingleSelectionPredicate());
230
            rowsActions.add(actionClient);
231
        }
232
 
90 ilm 233
        PredicateRowAction actionClient = new PredicateRowAction(new AbstractAction("Détails client") {
234
            EditFrame edit;
235
            private SQLElement eltClient = Configuration.getInstance().getDirectory().getElement(((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete().getTable("CLIENT"));
236
 
237
            public void actionPerformed(ActionEvent e) {
94 ilm 238
                if (this.edit == null) {
239
                    this.edit = new EditFrame(this.eltClient, EditMode.MODIFICATION);
90 ilm 240
                }
94 ilm 241
                this.edit.selectionId(IListe.get(e).getSelectedRow().getForeignID("ID_CLIENT"));
242
                this.edit.setVisible(true);
90 ilm 243
            }
244
        }, false);
245
        actionClient.setPredicate(IListeEvent.getSingleSelectionPredicate());
246
        rowsActions.add(actionClient);
247
 
248
 
65 ilm 249
        // Voir le document
250
        RowAction actionTransfertCmd = getDevis2CmdFournAction();
251
        rowsActions.add(actionTransfertCmd);
252
 
253
        // Transfert vers commande
254
        RowAction commandeAction = getDevis2CmdCliAction();
255
 
256
        rowsActions.add(commandeAction);
257
 
258
        RowAction accepteEtCmdAction = getAcceptAndCmdClientAction();
259
        rowsActions.add(accepteEtCmdAction);
260
 
261
        // Marqué accepté
262
        RowAction accepteAction = getAcceptAction();
263
 
264
        rowsActions.add(accepteAction);
265
 
266
        // Marqué accepté
267
        RowAction refuseAction = getRefuseAction();
268
 
269
        rowsActions.add(refuseAction);
270
 
271
        // // Dupliquer
272
        RowAction cloneAction = getCloneAction();
273
 
274
        rowsActions.add(cloneAction);
275
 
276
        MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(DevisXmlSheet.class);
277
        mouseSheetXmlListeListener.setGenerateHeader(true);
278
        mouseSheetXmlListeListener.setShowHeader(true);
279
 
280
        rowsActions.addAll(mouseSheetXmlListeListener.getRowActions());
281
 
282
        return rowsActions;
283
    }
284
 
93 ilm 285
    public static void davBrowse(String s) throws Exception {
286
        final boolean windows = System.getProperty("os.name").startsWith("Windows");
287
        if (windows) {
288
            Desktop.getDesktop().browse(new URI(s));
289
        } else {
290
            String[] cmdarray = new String[] { "xdg-open", s };
291
            final int res = Runtime.getRuntime().exec(cmdarray).waitFor();
292
            if (res != 0)
293
                throw new IOException("error (" + res + ") executing " + Arrays.asList(cmdarray));
294
        }
295
    }
296
 
65 ilm 297
    public RowAction getCloneAction() {
67 ilm 298
        return new RowAction(new AbstractAction() {
65 ilm 299
 
300
            public void actionPerformed(ActionEvent e) {
80 ilm 301
                SQLRowAccessor selectedRow = IListe.get(e).getSelectedRow();
65 ilm 302
 
93 ilm 303
                SQLElement eltFact = Configuration.getInstance().getDirectory().getElement("DEVIS");
304
                EditFrame editFrame = new EditFrame(eltFact, EditPanel.CREATION);
65 ilm 305
 
93 ilm 306
                ((DevisSQLComponent) editFrame.getSQLComponent()).loadDevisExistant(selectedRow.getID());
307
                editFrame.setVisible(true);
65 ilm 308
            }
67 ilm 309
        }, true, "sales.quote.clone") {
93 ilm 310
            public boolean enabledFor(java.util.List<org.openconcerto.sql.model.SQLRowValues> selection) {
65 ilm 311
                return (selection != null && selection.size() == 1);
312
            };
313
        };
314
    }
315
 
316
    public RowAction getRefuseAction() {
67 ilm 317
        return new RowAction(new AbstractAction() {
65 ilm 318
            public void actionPerformed(ActionEvent e) {
80 ilm 319
                SQLRowValues rowVals = IListe.get(e).getSelectedRow().asRow().createEmptyUpdateRow();
65 ilm 320
                rowVals.put("ID_ETAT_DEVIS", EtatDevisSQLElement.REFUSE);
321
                try {
322
                    rowVals.update();
323
                } catch (SQLException e1) {
324
                    // TODO Auto-generated catch block
325
                    e1.printStackTrace();
326
                }
327
            }
67 ilm 328
        }, false, "sales.quote.refuse") {
93 ilm 329
            public boolean enabledFor(java.util.List<org.openconcerto.sql.model.SQLRowValues> selection) {
65 ilm 330
                if (selection != null && selection.size() == 1) {
93 ilm 331
                    if (selection.get(0).getForeignID("ID_ETAT_DEVIS") == EtatDevisSQLElement.EN_ATTENTE) {
65 ilm 332
                        return true;
333
                    }
334
                }
335
                return false;
336
            };
337
        };
338
    }
339
 
340
    public RowAction getAcceptAction() {
67 ilm 341
        return new RowAction(new AbstractAction() {
65 ilm 342
            public void actionPerformed(ActionEvent e) {
80 ilm 343
                SQLRow selectedRow = IListe.get(e).getSelectedRow().asRow();
65 ilm 344
                SQLRowValues rowVals = selectedRow.createEmptyUpdateRow();
345
                rowVals.put("ID_ETAT_DEVIS", EtatDevisSQLElement.ACCEPTE);
346
                try {
347
                    rowVals.update();
348
                } catch (SQLException e1) {
349
                    // TODO Auto-generated catch block
350
                    e1.printStackTrace();
351
                }
352
            }
67 ilm 353
        }, false, "sales.quote.accept") {
93 ilm 354
            public boolean enabledFor(java.util.List<org.openconcerto.sql.model.SQLRowValues> selection) {
65 ilm 355
                if (selection != null && selection.size() == 1) {
93 ilm 356
                    final int int1 = selection.get(0).getForeignID("ID_ETAT_DEVIS");
90 ilm 357
                    if (int1 != EtatDevisSQLElement.REFUSE && int1 != EtatDevisSQLElement.ACCEPTE) {
65 ilm 358
                        return true;
359
                    }
360
                }
361
                return false;
362
            };
363
        };
364
    }
365
 
366
    public RowAction getDevis2FactureAction() {
67 ilm 367
        return new RowAction(new AbstractAction() {
65 ilm 368
            public void actionPerformed(ActionEvent e) {
93 ilm 369
                TransfertBaseSQLComponent.openTransfertFrame(IListe.get(e).getSelectedRows(), "SAISIE_VENTE_FACTURE");
90 ilm 370
 
65 ilm 371
            }
67 ilm 372
        }, true, "sales.quote.create.invoice") {
93 ilm 373
            public boolean enabledFor(java.util.List<org.openconcerto.sql.model.SQLRowValues> selection) {
90 ilm 374
                boolean b = selection.size() > 0;
375
                for (SQLRowAccessor sqlRowAccessor : selection) {
93 ilm 376
                    b &= sqlRowAccessor.getForeignID("ID_ETAT_DEVIS") == EtatDevisSQLElement.ACCEPTE;
65 ilm 377
                }
90 ilm 378
 
379
                return b;
65 ilm 380
            };
381
        };
382
    }
383
 
384
    public RowAction getDevis2CmdFournAction() {
67 ilm 385
        return new RowAction(new AbstractAction() {
65 ilm 386
            public void actionPerformed(ActionEvent e) {
80 ilm 387
                final SQLRow selectedRow = IListe.get(e).fetchSelectedRow();
73 ilm 388
                ComptaPropsConfiguration.getInstanceCompta().getNonInteractiveSQLExecutor().execute(new Runnable() {
389
 
390
                    @Override
391
                    public void run() {
392
                        transfertCommande(selectedRow);
393
 
394
                    }
395
                });
396
 
65 ilm 397
            }
67 ilm 398
        }, false, "sales.quote.create.supplier.order") {
93 ilm 399
            public boolean enabledFor(java.util.List<org.openconcerto.sql.model.SQLRowValues> selection) {
65 ilm 400
                if (selection != null && selection.size() == 1) {
93 ilm 401
                    if (selection.get(0).getForeignID("ID_ETAT_DEVIS") == EtatDevisSQLElement.ACCEPTE) {
65 ilm 402
                        return true;
403
                    }
404
                }
405
                return false;
406
            };
407
        };
408
    }
409
 
410
    public RowAction getDevis2CmdCliAction() {
67 ilm 411
        return new RowAction(new AbstractAction() {
65 ilm 412
            public void actionPerformed(ActionEvent e) {
80 ilm 413
 
93 ilm 414
                final List<SQLRowValues> copySelectedRows = IListe.get(e).getSelectedRows();
80 ilm 415
                transfertCommandeClient(copySelectedRows);
65 ilm 416
            }
80 ilm 417
 
67 ilm 418
        }, true, "sales.quote.create.customer.order") {
93 ilm 419
            public boolean enabledFor(java.util.List<org.openconcerto.sql.model.SQLRowValues> selection) {
65 ilm 420
                if (selection != null && selection.size() == 1) {
93 ilm 421
                    if (selection.get(0).getForeignID("ID_ETAT_DEVIS") == EtatDevisSQLElement.ACCEPTE) {
65 ilm 422
                        return true;
423
                    }
424
                }
425
                return false;
426
            };
427
        };
428
    }
429
 
430
    public RowAction getAcceptAndCmdClientAction() {
67 ilm 431
        return new RowAction(new AbstractAction() {
65 ilm 432
            public void actionPerformed(ActionEvent e) {
80 ilm 433
                SQLRow selectedRow = IListe.get(e).fetchSelectedRow();
65 ilm 434
                SQLRowValues rowVals = selectedRow.createEmptyUpdateRow();
435
                rowVals.put("ID_ETAT_DEVIS", EtatDevisSQLElement.ACCEPTE);
436
                try {
437
                    rowVals.update();
438
                } catch (SQLException e1) {
80 ilm 439
                    ExceptionHandler.handle("Erreur la de la mise à jour de l'état du devis!", e1);
440
 
65 ilm 441
                }
93 ilm 442
                transfertCommandeClient(IListe.get(e).getSelectedRows());
65 ilm 443
            }
67 ilm 444
        }, false, "sales.quote.accept.create.customer.order") {
93 ilm 445
            public boolean enabledFor(java.util.List<org.openconcerto.sql.model.SQLRowValues> selection) {
65 ilm 446
                if (selection != null && selection.size() == 1) {
93 ilm 447
                    if (selection.get(0).getForeignID("ID_ETAT_DEVIS") == EtatDevisSQLElement.EN_ATTENTE) {
65 ilm 448
                        return true;
449
                    }
450
                }
451
                return false;
452
            };
453
        };
454
    }
455
 
93 ilm 456
    public void transfertCommandeClient(final List<SQLRowValues> copySelectedRows) {
80 ilm 457
 
458
        SwingWorker<Boolean, Object> worker = new SwingWorker<Boolean, Object>() {
459
            @Override
460
            protected Boolean doInBackground() throws Exception {
461
 
462
                final SQLTable tableTransfert = getTable().getTable("TR_DEVIS");
463
                SQLRowValues rowVals = new SQLRowValues(tableTransfert);
464
                rowVals.put("ID_DEVIS", new SQLRowValues(getTable()).put("NUMERO", null));
465
                rowVals.put("ID_COMMANDE", null);
466
                rowVals.put("ID", null);
467
 
468
                final List<Number> lID = new ArrayList<Number>();
469
                for (SQLRowValues sqlRowValues : copySelectedRows) {
470
                    lID.add(sqlRowValues.getID());
471
                }
472
 
473
                SQLRowValuesListFetcher fetch = SQLRowValuesListFetcher.create(rowVals);
474
                fetch.setSelTransf(new ITransformer<SQLSelect, SQLSelect>() {
475
 
476
                    @Override
477
                    public SQLSelect transformChecked(SQLSelect input) {
478
                        Where w = new Where(tableTransfert.getField("ID_DEVIS"), lID);
479
                        w = w.and(new Where(tableTransfert.getField("ID_COMMANDE_CLIENT"), "IS NOT", (Object) null));
480
                        input.setWhere(w);
481
                        return input;
482
                    }
483
                });
484
 
485
                List<SQLRowValues> rows = fetch.fetch();
486
                if (rows != null && rows.size() > 0) {
487
                    String numero = "";
488
 
489
                    for (SQLRowValues sqlRow : rows) {
490
                        numero += sqlRow.getForeign("ID_DEVIS").getString("NUMERO") + " ,";
491
                    }
492
 
493
                    numero = numero.substring(0, numero.length() - 2);
494
                    String label = "Attention ";
495
                    if (rows.size() > 1) {
496
                        label += " les devis " + numero + " ont déjà été transféré en commande!";
497
                    } else {
498
                        label += " le devis " + numero + " a déjà été transféré en commande!";
499
                    }
500
                    label += "\n Voulez vous continuer?";
501
 
502
                    int ans = JOptionPane.showConfirmDialog(null, label, "Transfert devis en commande", JOptionPane.YES_NO_OPTION);
503
                    if (ans == JOptionPane.NO_OPTION) {
504
                        return Boolean.FALSE;
505
                    }
506
 
507
                }
508
                return Boolean.TRUE;
509
 
510
            }
511
 
512
            @Override
513
            protected void done() {
514
 
515
                try {
516
                    Boolean b = get();
517
                    if (b != null && b) {
518
                        TransfertBaseSQLComponent.openTransfertFrame(copySelectedRows, "COMMANDE_CLIENT");
519
                    }
520
                } catch (Exception e) {
521
                    ExceptionHandler.handle("Erreur lors du transfert des devis en commande!", e);
522
                }
523
                super.done();
524
            }
525
        };
526
        worker.execute();
527
    }
528
 
18 ilm 529
    protected List<String> getComboFields() {
530
        List<String> l = new ArrayList<String>();
531
        l.add("NUMERO");
532
        return l;
533
    }
534
 
83 ilm 535
    private void transfertCommande(final SQLRow row) {
536
        ComptaPropsConfiguration.getInstanceCompta().getNonInteractiveSQLExecutor().execute(new Runnable() {
537
 
538
            @Override
539
            public void run() {
540
                DevisItemSQLElement elt = (DevisItemSQLElement) Configuration.getInstance().getDirectory().getElement("DEVIS_ELEMENT");
541
                SQLTable tableCmdElt = Configuration.getInstance().getDirectory().getElement("COMMANDE_ELEMENT").getTable();
542
                SQLElement eltArticle = Configuration.getInstance().getDirectory().getElement("ARTICLE");
543
                List<SQLRow> rows = row.getReferentRows(elt.getTable());
544
                final ListMap<SQLRow, SQLRowValues> map = new ListMap<SQLRow, SQLRowValues>();
545
                SQLRow rowDeviseF = null;
546
                for (SQLRow sqlRow : rows) {
547
                    // on récupére l'article qui lui correspond
548
                    SQLRowValues rowArticle = new SQLRowValues(eltArticle.getTable());
549
                    for (SQLField field : eltArticle.getTable().getFields()) {
550
                        if (sqlRow.getTable().getFieldsName().contains(field.getName())) {
551
                            rowArticle.put(field.getName(), sqlRow.getObject(field.getName()));
552
                        }
553
                    }
554
 
555
                    // rowArticle.loadAllSafe(rowEltFact);
556
                    int idArticle = ReferenceArticleSQLElement.getIdForCNM(rowArticle, true);
557
                    SQLRow rowArticleFind = eltArticle.getTable().getRow(idArticle);
132 ilm 558
                    if (rowArticleFind != null) {
559
                        SQLInjector inj = SQLInjector.getInjector(rowArticle.getTable(), tableCmdElt);
560
                        SQLRowValues rowValsElt = new SQLRowValues(inj.createRowValuesFrom(rowArticleFind));
561
                        rowValsElt.put("ID_STYLE", sqlRow.getObject("ID_STYLE"));
562
                        rowValsElt.put("QTE", sqlRow.getObject("QTE"));
563
                        rowValsElt.put("T_POIDS", rowValsElt.getLong("POIDS") * rowValsElt.getInt("QTE"));
564
                        rowValsElt.put("T_PA_HT", ((BigDecimal) rowValsElt.getObject("PA_HT")).multiply(new BigDecimal(rowValsElt.getInt("QTE"), DecimalUtils.HIGH_PRECISION)));
565
                        rowValsElt.put("T_PA_TTC",
566
                                ((BigDecimal) rowValsElt.getObject("T_PA_HT")).multiply(new BigDecimal(rowValsElt.getForeign("ID_TAXE").getFloat("TAUX") / 100.0 + 1.0), DecimalUtils.HIGH_PRECISION));
83 ilm 567
 
132 ilm 568
                        // gestion de la devise
569
                        rowDeviseF = sqlRow.getForeignRow("ID_DEVISE");
570
                        SQLRow rowDeviseHA = rowArticleFind.getForeignRow("ID_DEVISE_HA");
571
                        BigDecimal qte = new BigDecimal(rowValsElt.getInt("QTE"));
572
                        if (rowDeviseF != null && !rowDeviseF.isUndefined()) {
573
                            if (rowDeviseF.getID() == rowDeviseHA.getID()) {
574
                                rowValsElt.put("PA_DEVISE", rowArticleFind.getObject("PA_DEVISE"));
575
                                rowValsElt.put("PA_DEVISE_T", ((BigDecimal) rowArticleFind.getObject("PA_DEVISE")).multiply(qte, DecimalUtils.HIGH_PRECISION));
576
                                rowValsElt.put("ID_DEVISE", rowDeviseF.getID());
577
                            } else {
578
                                BigDecimal taux = (BigDecimal) rowDeviseF.getObject("TAUX");
579
                                rowValsElt.put("PA_DEVISE", taux.multiply((BigDecimal) rowValsElt.getObject("PA_HT")));
580
                                rowValsElt.put("PA_DEVISE_T", ((BigDecimal) rowValsElt.getObject("PA_DEVISE")).multiply(qte, DecimalUtils.HIGH_PRECISION));
581
                                rowValsElt.put("ID_DEVISE", rowDeviseF.getID());
582
                            }
583
                        }
83 ilm 584
 
132 ilm 585
                        map.add(rowArticleFind.getForeignRow("ID_FOURNISSEUR"), rowValsElt);
83 ilm 586
                    }
65 ilm 587
                }
83 ilm 588
                MouvementStockSQLElement.createCommandeF(map, rowDeviseF);
65 ilm 589
            }
83 ilm 590
        });
65 ilm 591
 
592
    }
593
 
18 ilm 594
    protected List<String> getListFields() {
595
        List<String> l = new ArrayList<String>();
596
        l.add("NUMERO");
597
        l.add("DATE");
598
        l.add("ID_CLIENT");
599
        l.add("OBJET");
41 ilm 600
        l.add("ID_COMMERCIAL");
94 ilm 601
        if (UserRightsManager.getCurrentUserRights().haveRight(AbstractVenteArticleItemTable.SHOW_PRIX_ACHAT_CODE)) {
602
            l.add("T_HA");
603
        }
18 ilm 604
        l.add("T_HT");
605
        l.add("T_TTC");
149 ilm 606
        SQLPreferences prefs = SQLPreferences.getMemCached(getTable().getDBRoot());
607
        if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.ACOMPTE_DEVIS, false)) {
608
            l.add("T_ACOMPTE");
609
        }
18 ilm 610
        l.add("INFOS");
93 ilm 611
        if (getTable().contains("DUNNING_DATE")) {
612
            l.add("DUNNING_DATE");
613
        }
18 ilm 614
        return l;
615
    }
616
 
94 ilm 617
    @Override
142 ilm 618
    protected synchronized void _initTableSource(final SQLTableModelSource table) {
619
        super._initTableSource(table);
94 ilm 620
 
151 ilm 621
            final BaseSQLTableModelColumn colAdrLiv = new BaseSQLTableModelColumn("Adresse de livraison", String.class) {
94 ilm 622
 
151 ilm 623
                @Override
624
                protected Object show_(SQLRowAccessor r) {
94 ilm 625
 
151 ilm 626
                    SQLRowAccessor rowAd;
627
                    if (!r.isForeignEmpty("ID_ADRESSE_LIVRAISON")) {
628
                        rowAd = r.getForeign("ID_ADRESSE_LIVRAISON");
629
                    } else if (r.getForeign("ID_CLIENT").getObject("ID_ADRESSE_L") != null && !r.getForeign("ID_CLIENT").isForeignEmpty("ID_ADRESSE_L")) {
630
                        rowAd = r.getForeign("ID_CLIENT").getForeign("ID_ADRESSE_L");
631
                    } else {
632
                        rowAd = r.getForeign("ID_CLIENT").getForeign("ID_ADRESSE");
633
                    }
94 ilm 634
 
151 ilm 635
                    String lib = rowAd.getString("LIBELLE") + " " + rowAd.getString("VILLE");
94 ilm 636
 
151 ilm 637
                    return lib;
638
                }
94 ilm 639
 
151 ilm 640
                @Override
641
                public Set<FieldPath> getPaths() {
642
                    SQLTable devisTable = getTable();
643
                    Path p = new Path(devisTable);
644
                    p = p.add(devisTable.getField("ID_CLIENT"));
645
                    p = p.add(p.getLast().getField("ID_ADRESSE_L"));
94 ilm 646
 
151 ilm 647
                    Path p2 = new Path(devisTable);
648
                    p2 = p2.add(devisTable.getField("ID_CLIENT"));
649
                    p2 = p2.add(p2.getLast().getField("ID_ADRESSE"));
94 ilm 650
 
151 ilm 651
                    Path p3 = new Path(devisTable);
652
                    p3 = p3.add(devisTable.getField("ID_ADRESSE_LIVRAISON"));
94 ilm 653
 
151 ilm 654
                    return CollectionUtils.createSet(new FieldPath(p, "LIBELLE"), new FieldPath(p, "VILLE"), new FieldPath(p2, "LIBELLE"), new FieldPath(p2, "VILLE"), new FieldPath(p3, "LIBELLE"),
655
                            new FieldPath(p3, "VILLE"));
656
                }
657
            };
658
            table.getColumns().add(3, colAdrLiv);
94 ilm 659
    }
660
 
18 ilm 661
    @Override
132 ilm 662
    public ListMap<String, String> getShowAs() {
663
        return ListMap.singleton(null, "NUMERO");
28 ilm 664
    }
665
 
666
    @Override
132 ilm 667
    protected void _initListRequest(ListSQLRequest req) {
668
        super._initListRequest(req);
669
        req.addToGraphToFetch("ID_ETAT_DEVIS");
18 ilm 670
    }
671
 
672
    @Override
132 ilm 673
    protected void setupLinks(SQLElementLinksSetup links) {
674
        super.setupLinks(links);
675
        if (getTable().contains("ID_ADRESSE")) {
676
            links.get("ID_ADRESSE").setType(LinkType.ASSOCIATION);
677
        }
678
        if (getTable().contains("ID_ADRESSE_LIVRAISON")) {
679
            links.get("ID_ADRESSE_LIVRAISON").setType(LinkType.ASSOCIATION);
680
        }
18 ilm 681
    }
682
 
683
    /*
684
     * (non-Javadoc)
685
     *
686
     * @see org.openconcerto.devis.SQLElement#getComponent()
687
     */
688
    public SQLComponent createComponent() {
93 ilm 689
        return new DevisSQLComponent(this);
18 ilm 690
    }
691
 
692
    /**
693
     * Transfert d'un devis en facture
694
     *
695
     * @param devisID
696
     */
90 ilm 697
    public void transfertFacture(final int devisID) {
18 ilm 698
 
699
        SQLElement elt = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
700
        EditFrame editFactureFrame = new EditFrame(elt);
701
        editFactureFrame.setIconImage(new ImageIcon(Gestion.class.getResource("frameicon.png")).getImage());
702
 
703
        SaisieVenteFactureSQLComponent comp = (SaisieVenteFactureSQLComponent) editFactureFrame.getSQLComponent();
704
 
705
        comp.setDefaults();
706
        comp.loadDevis(devisID);
707
 
90 ilm 708
 
18 ilm 709
        editFactureFrame.pack();
710
        editFactureFrame.setState(JFrame.NORMAL);
711
        editFactureFrame.setVisible(true);
712
    }
713
 
83 ilm 714
    @Override
142 ilm 715
    protected Map<String, CustomEditorProvider> _getDefaultCustomEditorProvider(final Configuration configuration, final SQLRowAccessor sqlRow, final String sessionSecurityToken)
716
            throws IllegalArgumentException {
717
        final Map<String, CustomEditorProvider> map = super._getDefaultCustomEditorProvider(configuration, sqlRow, sessionSecurityToken);
132 ilm 718
        map.put("sales.quote.items.list", new CustomEditorProvider() {
83 ilm 719
 
720
            @Override
132 ilm 721
            public LightUIElement createUIElement(final String id) {
83 ilm 722
 
132 ilm 723
                final ColumnSpec c1 = new ColumnSpec("sales.quote.item.style", StringWithId.class, "Style", new StringWithId(2, "Normal"), true, new LightUIComboBox("sales.quote.item.style"));
94 ilm 724
                final ColumnSpec c2 = new ColumnSpec("sales.quote.item.code", String.class, "Code", "", true, new LightUITextField("sales.quote.item.code"));
725
                final ColumnSpec c3 = new ColumnSpec("sales.quote.item.label", String.class, "Nom", "", true, new LightUITextField("sales.quote.item.name"));
726
                final ColumnSpec c4 = new ColumnSpec("sales.quote.item.description", String.class, "Descriptif", "", true, new LightUITextField("sales.quote.item.description"));
132 ilm 727
                final ColumnSpec c5 = new ColumnSpec("sales.quote.item.purchase.unit.price", BigDecimal.class, "P.U. Achat HT", new BigDecimal(0), true,
728
                        new LightUITextField("sales.quote.item.purchase.unit.price"));
729
                final ColumnSpec c6 = new ColumnSpec("sales.quote.item.sales.unit.price", BigDecimal.class, "P.U. Vente HT", new BigDecimal(0), true,
730
                        new LightUITextField("sales.quote.item.sales.unit.price"));
94 ilm 731
                final ColumnSpec c7 = new ColumnSpec("sales.quote.item.quantity", Integer.class, "Quantité", new BigDecimal(1), true, new LightUITextField("sales.quote.item.quantity"));
83 ilm 732
 
94 ilm 733
                final List<ColumnSpec> columnsSpec = new ArrayList<ColumnSpec>();
734
                final List<String> possibleColumnIds = new ArrayList<String>();
735
 
736
                columnsSpec.add(c1);
737
                columnsSpec.add(c2);
738
                columnsSpec.add(c3);
739
                columnsSpec.add(c4);
740
                columnsSpec.add(c5);
741
                columnsSpec.add(c6);
742
                columnsSpec.add(c7);
743
 
744
                for (ColumnSpec c : columnsSpec) {
745
                    possibleColumnIds.add(c.getId());
83 ilm 746
                }
747
 
94 ilm 748
                final String lId = "sales.quote.items";
749
                final long userId = UserManager.getUserID();
750
                Document columnsPrefs = null;
751
                try {
752
                    final DOMBuilder in = new DOMBuilder();
753
                    final org.w3c.dom.Document w3cDoc = Configuration.getInstance().getXMLConf(userId, lId);
754
                    if (w3cDoc != null) {
755
                        columnsPrefs = in.build(w3cDoc);
756
                    }
142 ilm 757
                    if (columnsPrefs == null) {
758
                        throw new IllegalStateException("Columns Prefs is null");
759
                    }
94 ilm 760
                } catch (Exception ex) {
132 ilm 761
                    throw new IllegalArgumentException(
762
                            "DevisSQLElement getItemsCustomEditorProvider - Failed to get ColumnPrefs for descriptor " + lId + " and for user " + userId + "\n" + ex.getMessage());
94 ilm 763
                }
83 ilm 764
 
94 ilm 765
                final Element rootElement = columnsPrefs.getRootElement();
766
                if (!rootElement.getName().equals("list")) {
767
                    throw new IllegalArgumentException("invalid xml, roots node list expected but " + rootElement.getName() + " found");
768
                }
769
                final List<Element> xmlColumns = rootElement.getChildren();
770
                final int columnsCount = columnsSpec.size();
771
                if (xmlColumns.size() != columnsCount) {
772
                    throw new IllegalArgumentException("incorrect columns count in xml");
773
                }
774
 
775
                for (int i = 0; i < columnsCount; i++) {
776
                    final ColumnSpec columnSpec = columnsSpec.get(i);
777
                    final String columnId = columnSpec.getId();
778
                    boolean find = false;
779
 
780
                    for (int j = 0; j < columnsCount; j++) {
781
                        final Element xmlColumn = xmlColumns.get(j);
782
                        final String xmlColumnId = xmlColumn.getAttribute("id").getValue();
783
 
784
                        if (xmlColumnId.equals(columnId)) {
785
 
786
                            if (!xmlColumn.getName().equals("column")) {
787
                                throw new IllegalArgumentException("ColumnSpec setPrefs - Invalid xml, element node column expected but " + xmlColumn.getName() + " found");
788
                            }
789
                            if (xmlColumn.getAttribute("width") == null || xmlColumn.getAttribute("min-width") == null || xmlColumn.getAttribute("max-width") == null) {
790
                                throw new IllegalArgumentException("ColumnSpec setPrefs - Invalid column node for " + columnId + ", it must have attribute width, min-width, max-width");
791
                            }
792
 
793
                            final int width = Integer.parseInt(xmlColumn.getAttribute("width").getValue());
794
                            final int maxWidth = Integer.parseInt(xmlColumn.getAttribute("max-width").getValue());
795
                            final int minWidth = Integer.parseInt(xmlColumn.getAttribute("min-width").getValue());
796
 
797
                            columnSpec.setPrefs(width, maxWidth, minWidth);
798
                            if (i != j) {
799
                                final ColumnSpec swap = columnsSpec.get(i);
800
                                columnsSpec.set(i, columnsSpec.get(j));
801
                                columnsSpec.set(j, swap);
802
                            }
803
                            find = true;
804
                            break;
805
                        }
806
                    }
807
                    if (!find) {
808
                        throw new IllegalArgumentException("xml contain unknow column: " + columnId);
809
                    }
810
                }
811
                final ColumnsSpec cSpec = new ColumnsSpec(lId, columnsSpec, possibleColumnIds, null);
812
                cSpec.setAllowMove(true);
813
                cSpec.setAllowResize(true);
814
                final RowSelectionSpec selectionSpec = new RowSelectionSpec(id);
815
                final TableSpec tSpec = new TableSpec(id, selectionSpec, cSpec);
816
                tSpec.setColumns(cSpec);
817
 
132 ilm 818
                if (sqlRow != null) {
83 ilm 819
                    // send: id,value
142 ilm 820
                    final SQLElement elem = configuration.getDirectory().getElement("DEVIS_ELEMENT");
821
                    final SQLTable table = elem.getTable();
822
                    final List<String> fieldsToFetch = new ArrayList<String>();
94 ilm 823
                    for (ColumnSpec cs : columnsSpec) {
83 ilm 824
                        String colId = cs.getId();
825
                        SQLField f = configuration.getFieldMapper().getSQLFieldForItem(colId);
826
                        if (f != null) {
142 ilm 827
                            fieldsToFetch.add(f.getName());
83 ilm 828
                        } else {
829
                            throw new IllegalStateException("No field in " + table + " for column id " + colId);
830
                        }
831
                    }
832
 
142 ilm 833
                    final Where where = new Where(table.getField("ID_DEVIS"), "=", sqlRow.getID());
834
                    final ListSQLRequest req = elem.createListRequest(fieldsToFetch, where, configuration.getShowAs());
835
                    List<SQLRowValues> fetchedRows = req.getValues();
83 ilm 836
 
837
                    List<Row> rows = new ArrayList<Row>();
838
                    for (final SQLRowValues vals : fetchedRows) {
94 ilm 839
                        Row r = new Row(vals.getID(), columnsSpec.size());
83 ilm 840
                        List<Object> values = new ArrayList<Object>();
94 ilm 841
                        for (ColumnSpec cs : columnsSpec) {
83 ilm 842
                            String colId = cs.getId();
843
                            SQLField f = configuration.getFieldMapper().getSQLFieldForItem(colId);
844
                            if (f != null) {
845
                                Object object = vals.getObject(f.getName());
846
                                System.out.println("DevisSQLElement.getItemsCustomEditorProvider(...).createUIElement()" + f.getName() + ":" + object + ":" + object.getClass().getCanonicalName());
847
                                if (object instanceof SQLRowValues) {
848
                                    SQLRowValues sqlRowValues = (SQLRowValues) object;
849
                                    long rowId = sqlRowValues.getIDNumber().longValue();
850
                                    List<SQLField> fieldsToExpand = configuration.getShowAs().getFieldExpand(sqlRowValues.getTable());
851
                                    String strValue = "";
852
                                    for (SQLField sqlField : fieldsToExpand) {
853
                                        strValue += sqlRowValues.getObject(sqlField.getName()).toString() + " ";
854
                                    }
855
                                    strValue = strValue.trim();
856
                                    StringWithId str = new StringWithId(rowId, strValue);
857
                                    object = str;
858
                                }
859
                                values.add(object);
860
                            } else {
861
                                throw new IllegalStateException("No field in " + table + " for column id " + colId);
862
                            }
863
                        }
864
                        r.setValues(values);
865
                        rows.add(r);
866
                    }
867
 
868
                    TableContent tableContent = new TableContent();
869
                    tableContent.setRows(rows);
870
                    // tableContent.setSpec(new RowSpec());
94 ilm 871
                    tSpec.setContent(tableContent);
83 ilm 872
 
873
                }
874
 
94 ilm 875
                final LightUITable eList = new LightUITable(id);
876
                eList.setTableSpec(tSpec);
83 ilm 877
 
132 ilm 878
                LightUIPanel panel = new LightUIPanel("sales.quote.items.list");
879
                panel.setGridWidth(1);
880
                panel.setFillWidth(true);
83 ilm 881
 
882
                LightUILine toolbarLine = new LightUILine();
883
 
149 ilm 884
                LightUIButtonUnmanaged b1 = new LightUIButtonUnmanaged("up");
83 ilm 885
                b1.setIcon("up.png");
132 ilm 886
                panel.addControler(new ActivationOnSelectionControler(id, b1.getId()));
887
                panel.addControler(new LightControler(LightControler.TYPE_UP, id, b1.getId()));
888
                toolbarLine.addChild(b1);
83 ilm 889
 
149 ilm 890
                final LightUIButtonUnmanaged b2 = new LightUIButtonUnmanaged("down");
83 ilm 891
                b2.setIcon("down.png");
132 ilm 892
                panel.addControler(new ActivationOnSelectionControler(id, b2.getId()));
893
                panel.addControler(new LightControler(LightControler.TYPE_DOWN, id, b2.getId()));
894
                toolbarLine.addChild(b2);
83 ilm 895
                // Add
149 ilm 896
                LightUIElement addButton = new LightUIButtonUnmanaged("add", "Ajouter une ligne");
132 ilm 897
                panel.addControler(new LightControler(LightControler.TYPE_ADD_DEFAULT, id, addButton.getId()));
898
                toolbarLine.addChild(addButton);
83 ilm 899
                // Insert
149 ilm 900
                LightUIElement insertButton = new LightUIButtonUnmanaged("insert", "Insérer une ligne");
132 ilm 901
                panel.addControler(new LightControler(LightControler.TYPE_INSERT_DEFAULT, id, insertButton.getId()));
902
                toolbarLine.addChild(insertButton);
83 ilm 903
 
904
                // Copy
149 ilm 905
                LightUIElement copyButton = new LightUIButtonUnmanaged("copy", "Dupliquer");
132 ilm 906
                panel.addControler(new ActivationOnSelectionControler(id, copyButton.getId()));
907
                panel.addControler(new LightControler(LightControler.TYPE_COPY, id, copyButton.getId()));
908
                toolbarLine.addChild(copyButton);
83 ilm 909
 
910
                // Remove
149 ilm 911
                LightUIElement removeButton = new LightUIButtonUnmanaged("remove", "Supprimer");
132 ilm 912
                panel.addControler(new ActivationOnSelectionControler(id, removeButton.getId()));
913
                panel.addControler(new LightControler(LightControler.TYPE_REMOVE, id, removeButton.getId()));
914
                toolbarLine.addChild(removeButton);
83 ilm 915
 
132 ilm 916
                panel.addChild(toolbarLine);
83 ilm 917
                final LightUILine listLine = new LightUILine();
918
                listLine.setWeightY(1);
919
                listLine.setFillHeight(true);
132 ilm 920
                listLine.addChild(eList);
83 ilm 921
 
922
                //
132 ilm 923
                panel.addChild(listLine);
83 ilm 924
 
132 ilm 925
                return panel;
83 ilm 926
            }
927
 
132 ilm 928
        });
929
        return map;
83 ilm 930
    }
18 ilm 931
}