180 |
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 |
/*
|
|
|
15 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
|
|
16 |
*
|
|
|
17 |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
|
|
|
18 |
*
|
|
|
19 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
|
|
20 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
|
|
|
21 |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
|
|
|
22 |
* language governing permissions and limitations under the License.
|
|
|
23 |
*
|
|
|
24 |
* When distributing the software, include this License Header Notice in each file.
|
|
|
25 |
*/
|
|
|
26 |
|
|
|
27 |
package org.openconcerto.erp.core.sales.product.ui;
|
|
|
28 |
|
|
|
29 |
import org.openconcerto.sql.Configuration;
|
|
|
30 |
import org.openconcerto.sql.element.SQLElement;
|
|
|
31 |
import org.openconcerto.sql.model.SQLRowValues;
|
|
|
32 |
import org.openconcerto.sql.view.list.RowValuesTable;
|
|
|
33 |
import org.openconcerto.sql.view.list.RowValuesTableControlPanel;
|
|
|
34 |
import org.openconcerto.sql.view.list.RowValuesTableModel;
|
|
|
35 |
import org.openconcerto.sql.view.list.RowValuesTablePanel;
|
|
|
36 |
import org.openconcerto.sql.view.list.RowValuesTableRenderer;
|
|
|
37 |
import org.openconcerto.sql.view.list.SQLTableElement;
|
|
|
38 |
import org.openconcerto.ui.DefaultGridBagConstraints;
|
|
|
39 |
import org.openconcerto.ui.table.PercentTableCellRenderer;
|
|
|
40 |
|
|
|
41 |
import java.awt.GridBagConstraints;
|
|
|
42 |
import java.awt.GridBagLayout;
|
|
|
43 |
import java.math.BigDecimal;
|
|
|
44 |
import java.util.List;
|
|
|
45 |
import java.util.Vector;
|
|
|
46 |
|
|
|
47 |
import javax.swing.JPanel;
|
|
|
48 |
import javax.swing.JScrollPane;
|
|
|
49 |
import javax.swing.ScrollPaneConstants;
|
|
|
50 |
|
|
|
51 |
public class CustomerProductFamilyQtyPriceListTable extends RowValuesTablePanel {
|
|
|
52 |
|
|
|
53 |
public CustomerProductFamilyQtyPriceListTable() {
|
|
|
54 |
|
|
|
55 |
init();
|
|
|
56 |
uiInit();
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
/**
|
|
|
60 |
*
|
|
|
61 |
*/
|
|
|
62 |
protected void init() {
|
|
|
63 |
|
|
|
64 |
final SQLElement e = getSQLElement();
|
|
|
65 |
|
|
|
66 |
final List<SQLTableElement> list = new Vector<SQLTableElement>();
|
|
|
67 |
|
|
|
68 |
final SQLTableElement tableElementFamille = new SQLTableElement(e.getTable().getField("ID_FAMILLE_ARTICLE"));
|
|
|
69 |
list.add(tableElementFamille);
|
|
|
70 |
|
|
|
71 |
// final SQLTableElement eQuantity = new SQLTableElement(e.getTable().getField("QUANTITE"))
|
|
|
72 |
// {
|
|
|
73 |
// @Override
|
|
|
74 |
// protected Object getDefaultNullValue() {
|
|
|
75 |
// return BigDecimal.ONE;
|
|
|
76 |
// }
|
|
|
77 |
// };
|
|
|
78 |
// list.add(eQuantity);
|
|
|
79 |
|
|
|
80 |
SQLTableElement eltPourcent = new SQLTableElement(e.getTable().getField("POURCENT_REMISE"));
|
|
|
81 |
list.add(eltPourcent);
|
|
|
82 |
|
|
|
83 |
this.model = new RowValuesTableModel(e, list, e.getTable().getField("ID_FAMILLE_ARTICLE"), false, this.defaultRowVals);
|
|
|
84 |
|
|
|
85 |
this.table = new RowValuesTable(this.model, null);
|
|
|
86 |
|
|
|
87 |
eltPourcent.setRenderer(new PercentTableCellRenderer());
|
|
|
88 |
|
|
|
89 |
}
|
|
|
90 |
|
|
|
91 |
public SQLElement getSQLElement() {
|
|
|
92 |
return Configuration.getInstance().getDirectory().getElement("TARIF_FAMILLE_ARTICLE_CLIENT");
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
public void insertFrom(String field, SQLRowValues row) {
|
|
|
96 |
this.table.insertFrom(field, row);
|
|
|
97 |
}
|
|
|
98 |
|
|
|
99 |
protected void uiInit() {
|
|
|
100 |
// Ui init
|
|
|
101 |
this.setLayout(new GridBagLayout());
|
|
|
102 |
this.setOpaque(false);
|
|
|
103 |
final GridBagConstraints c = new DefaultGridBagConstraints();
|
|
|
104 |
c.weightx = 1;
|
|
|
105 |
c.gridx = 0;
|
|
|
106 |
final JPanel control = new RowValuesTableControlPanel(this.table);
|
|
|
107 |
control.setOpaque(false);
|
|
|
108 |
this.add(control, c);
|
|
|
109 |
|
|
|
110 |
c.gridy++;
|
|
|
111 |
c.fill = GridBagConstraints.BOTH;
|
|
|
112 |
c.weighty = 1;
|
|
|
113 |
c.weightx = 1;
|
|
|
114 |
JScrollPane comp = new JScrollPane(this.table);
|
|
|
115 |
comp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
|
|
116 |
this.add(comp, c);
|
|
|
117 |
this.table.setDefaultRenderer(Long.class, new RowValuesTableRenderer());
|
|
|
118 |
}
|
|
|
119 |
|
|
|
120 |
}
|