OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 18 | 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.humanresources.payroll.component;
15
 
16
import org.openconcerto.sql.model.SQLRow;
17
 
18
public class VariableRowTreeNode extends FormuleTreeNode {
19
 
20
    private SQLRow row;
156 ilm 21
    private String label;
18 ilm 22
 
23
    public VariableRowTreeNode(SQLRow row) {
24
        this.row = row;
156 ilm 25
        setLabelFromRow();
18 ilm 26
    }
27
 
156 ilm 28
    private void setLabelFromRow() {
29
        this.label = "";
30
        if (this.row != null) {
31
            if (this.row.contains("CODE")) {
32
                this.label = this.row.getString("CODE") + " - " + this.row.getString("NOM");
33
            } else {
34
                this.label = this.row.getString("NOM");
35
            }
36
        }
37
 
38
    }
39
 
18 ilm 40
    public String getName() {
156 ilm 41
        return this.label;
18 ilm 42
    }
43
 
156 ilm 44
    @Override
18 ilm 45
    public String toString() {
156 ilm 46
        return this.label;
18 ilm 47
    }
48
 
49
    public String getTextValue() {
156 ilm 50
        return this.label;
18 ilm 51
    }
52
 
53
    public String getTextInfosValue() {
54
        return (this.row == null) ? "" : this.row.getString("INFOS");
55
    }
56
 
57
    public SQLRow getRow() {
58
        return this.row;
59
    }
60
 
61
    public void setRow(SQLRow row) {
62
        this.row = row;
156 ilm 63
        setLabelFromRow();
18 ilm 64
    }
65
 
66
    public int getID() {
67
 
68
        return this.row == null ? 1 : row.getID();
69
    }
70
}