OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 142 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
83 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.ui.light;
15
 
16
import java.awt.Color;
17
import java.io.Serializable;
18
import java.util.ArrayList;
19
import java.util.List;
20
 
21
public class TreeItem implements Serializable {
22
    /**
23
     *
24
     */
25
    private static final long serialVersionUID = 8087661728014786832L;
26
    private String id;
27
    private String label;
28
    private List<TreeItem> children;
29
    private boolean isSelected;
30
    private Color color;
31
    private boolean expanded;
32
    private String iconId;
33
 
34
    public TreeItem() {
35
    }
36
 
37
    public TreeItem(String id, String label) {
38
        this.id = id;
39
        this.label = label;
40
    }
41
 
42
    public final String getId() {
43
        return id;
44
    }
45
 
46
    public final void setId(String id) {
47
        this.id = id;
48
    }
49
 
50
    public String getLabel() {
51
        return label;
52
    }
53
 
54
    public void setLabel(String label) {
55
        this.label = label;
56
    }
57
 
58
    public TreeItem getChild(int i) {
59
        return children.get(i);
60
    }
61
 
62
    public int getChildCount() {
63
        return children.size();
64
    }
65
 
66
    public final List<TreeItem> getChildren() {
67
        return children;
68
    }
69
 
70
    public final void addChild(TreeItem item) {
71
        if (this.children == null) {
72
            this.children = new ArrayList<TreeItem>();
73
        }
74
        this.children.add(item);
75
    }
76
 
77
    public final void addChildren(List<TreeItem> items) {
78
        if (this.children == null) {
79
            this.children = new ArrayList<TreeItem>();
80
        }
81
        this.children.addAll(items);
82
    }
83
 
84
    public final void setChildren(List<TreeItem> children) {
85
        this.children = children;
86
    }
87
 
88
    public final boolean hasChildren() {
89
        return this.children != null && !this.children.isEmpty();
90
    }
91
 
92
    public final boolean isSelected() {
93
        return isSelected;
94
    }
95
 
96
    public final void setSelected(boolean isSelected) {
97
        this.isSelected = isSelected;
98
    }
99
 
100
    public final Color getColor() {
101
        return color;
102
    }
103
 
104
    public final void setColor(Color color) {
105
        this.color = color;
106
    }
107
 
108
    public final boolean isExpanded() {
109
        return expanded;
110
    }
111
 
112
    public final void setExpanded(boolean expanded) {
113
        this.expanded = expanded;
114
    }
115
 
116
    public final String getIconId() {
117
        return iconId;
118
    }
119
 
120
    public final void setRightIconId(String iconId) {
121
        this.iconId = iconId;
122
    }
123
 
124
}