185 |
ilm |
1 |
/*
|
|
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
|
|
3 |
*
|
|
|
4 |
* Copyright 2011-2019 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.supplychain.order.ui;
|
|
|
15 |
|
|
|
16 |
import org.openconcerto.sql.model.SQLRowAccessor;
|
|
|
17 |
import org.openconcerto.sql.model.SQLRowValues;
|
|
|
18 |
import org.openconcerto.sql.sqlobject.itemview.VWRowItemView;
|
|
|
19 |
import org.openconcerto.ui.component.InteractionMode;
|
|
|
20 |
import org.openconcerto.ui.valuewrapper.ValueWrapper;
|
|
|
21 |
|
|
|
22 |
public class EtatCommandeFournisseurRowItemView extends VWRowItemView<EtatCommandeFournisseur> {
|
|
|
23 |
|
|
|
24 |
public EtatCommandeFournisseurRowItemView(ValueWrapper<EtatCommandeFournisseur> wrapper) {
|
|
|
25 |
super(wrapper);
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
@Override
|
|
|
29 |
public void setEditable(InteractionMode b) {
|
|
|
30 |
if (this.getComp() != null) {
|
|
|
31 |
this.getComp().setEnabled(b.isEnabled());
|
|
|
32 |
}
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
@Override
|
|
|
36 |
public void show(SQLRowAccessor r) {
|
|
|
37 |
|
|
|
38 |
if (r.getObject(getField().getName()) != null) {
|
|
|
39 |
this.getWrapper().setValue(EtatCommandeFournisseur.fromID(r.getInt(getField().getName())));
|
|
|
40 |
} else {
|
|
|
41 |
this.getWrapper().setValue(null);
|
|
|
42 |
}
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
@Override
|
|
|
46 |
public void update(SQLRowValues vals) {
|
|
|
47 |
vals.put(getField().getName(), this.isEmpty() ? SQLRowValues.SQL_DEFAULT : this.getWrapper().getValue().getId());
|
|
|
48 |
}
|
|
|
49 |
|
|
|
50 |
}
|