19 |
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.product.element;
|
|
|
15 |
|
|
|
16 |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
|
|
|
17 |
import org.openconcerto.sql.element.BaseSQLComponent;
|
|
|
18 |
import org.openconcerto.sql.element.SQLComponent;
|
|
|
19 |
import org.openconcerto.sql.sqlobject.ElementComboBox;
|
|
|
20 |
import org.openconcerto.ui.DefaultGridBagConstraints;
|
|
|
21 |
|
|
|
22 |
import java.awt.GridBagConstraints;
|
|
|
23 |
import java.awt.GridBagLayout;
|
|
|
24 |
import java.util.ArrayList;
|
|
|
25 |
import java.util.List;
|
|
|
26 |
|
|
|
27 |
import javax.swing.JLabel;
|
|
|
28 |
import javax.swing.JTextField;
|
|
|
29 |
import javax.swing.SwingConstants;
|
|
|
30 |
|
|
|
31 |
public class ArticleDesignationSQLElement extends ComptaSQLConfElement {
|
|
|
32 |
|
|
|
33 |
public ArticleDesignationSQLElement() {
|
|
|
34 |
super("ARTICLE_DESIGNATION", "une désignation d'article", "désignation d'articles");
|
|
|
35 |
}
|
|
|
36 |
|
|
|
37 |
protected List<String> getListFields() {
|
|
|
38 |
final List<String> l = new ArrayList<String>();
|
|
|
39 |
l.add("ID_ARTICLE");
|
|
|
40 |
l.add("NOM");
|
|
|
41 |
l.add("ID_LANGUE");
|
|
|
42 |
return l;
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
protected List<String> getComboFields() {
|
|
|
46 |
final List<String> l = new ArrayList<String>();
|
|
|
47 |
l.add("NOM");
|
|
|
48 |
l.add("ID_LANGUE");
|
|
|
49 |
return l;
|
|
|
50 |
}
|
|
|
51 |
|
90 |
ilm |
52 |
@Override
|
|
|
53 |
protected String getParentFFName() {
|
|
|
54 |
return "ID_ARTICLE";
|
|
|
55 |
}
|
|
|
56 |
|
19 |
ilm |
57 |
/*
|
|
|
58 |
* (non-Javadoc)
|
|
|
59 |
*
|
|
|
60 |
* @see org.openconcerto.devis.SQLElement#getComponent()
|
|
|
61 |
*/
|
|
|
62 |
public SQLComponent createComponent() {
|
|
|
63 |
return new BaseSQLComponent(this) {
|
|
|
64 |
public void addViews() {
|
|
|
65 |
this.setLayout(new GridBagLayout());
|
|
|
66 |
final GridBagConstraints c = new DefaultGridBagConstraints();
|
|
|
67 |
|
|
|
68 |
// Nom
|
|
|
69 |
final JLabel labelNom = new JLabel(getLabelFor("NOM"), SwingConstants.RIGHT);
|
|
|
70 |
c.gridx = 0;
|
|
|
71 |
c.weightx = 0;
|
|
|
72 |
this.add(labelNom, c);
|
|
|
73 |
|
|
|
74 |
final JTextField textNom = new JTextField(15);
|
|
|
75 |
c.gridx++;
|
|
|
76 |
c.weightx = 1;
|
|
|
77 |
DefaultGridBagConstraints.lockMinimumSize(textNom);
|
|
|
78 |
this.add(textNom, c);
|
|
|
79 |
this.addRequiredSQLObject(textNom, "NOM");
|
|
|
80 |
|
|
|
81 |
// Famille père
|
|
|
82 |
final JLabel labelLangue = new JLabel(getLabelFor("ID_LANGUE"), SwingConstants.RIGHT);
|
|
|
83 |
c.gridx = 0;
|
|
|
84 |
c.gridy++;
|
|
|
85 |
c.weightx = 0;
|
|
|
86 |
this.add(labelLangue, c);
|
|
|
87 |
|
|
|
88 |
final ElementComboBox langueBox = new ElementComboBox(true, 25);
|
|
|
89 |
DefaultGridBagConstraints.lockMinimumSize(langueBox);
|
|
|
90 |
c.gridx++;
|
|
|
91 |
c.weightx = 1;
|
|
|
92 |
this.add(langueBox, c);
|
|
|
93 |
|
|
|
94 |
this.addSQLObject(langueBox, "ID_LANGUE");
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
};
|
|
|
98 |
}
|
|
|
99 |
|
57 |
ilm |
100 |
@Override
|
|
|
101 |
protected String createCode() {
|
|
|
102 |
return createCodeFromPackage() + ".name";
|
|
|
103 |
}
|
19 |
ilm |
104 |
}
|