Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.ui / src / main / java / org / gvsig / gui / beans / listview / ListViewItem.java @ 40561

History | View | Annotate | Download (3.18 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.gui.beans.listview;
25

    
26
import java.awt.Rectangle;
27

    
28
/**
29
 * <code>ListViewItem</code> representa un item para ser usado desde
30
 * ListViewComponent
31
 *
32
 * @version 28/06/2007
33
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
34
 */
35
public class ListViewItem implements Comparable<ListViewItem> {
36
        IIconPaint icon          = null;
37
        String     name          = null;
38
        Rectangle  nameRectangle = null;
39
        Rectangle  itemRectangle = new Rectangle();
40
        boolean    selected      = false;
41
        boolean    showTooltip   = true;
42
        Object     tag           = null;
43

    
44
        /**
45
         * Construye un ListViewItem con un icono y su nombre.
46
         * @param icon
47
         * @param name
48
         */
49
        public ListViewItem(IIconPaint icon, String name) {
50
                this.icon = icon;
51
                this.name = name;
52
        }
53

    
54
        /**
55
         * Obtener el nombre del item
56
         * @return
57
         */
58
        public String getName() {
59
                return name;
60
        }
61

    
62
        /**
63
         * Definir el nombre del item
64
         * @param name
65
         */
66
        public void setName(String name) {
67
                this.name = name;
68
        }
69

    
70
        /**
71
         * Obtener el icono del item
72
         * @return
73
         */
74
        public IIconPaint getIcon() {
75
                return icon;
76
        }
77

    
78
        /**
79
         * Especificar el icono del item
80
         * @param icon
81
         */
82
        public void setIcon(IIconPaint icon) {
83
                this.icon = icon;
84
        }
85

    
86
        /**
87
         * Comprobar si el item esta seleccionado
88
         * @return
89
         */
90
        public boolean isSelected() {
91
                return selected;
92
        }
93

    
94
        /**
95
         * Definir si el item esta seleccionado
96
         * @param selected
97
         */
98
        public void setSelected(boolean selected) {
99
                this.selected = selected;
100
        }
101

    
102
        /**
103
         * Definir algun campo extra necesario por el programador
104
         * @return
105
         */
106
        public Object getTag() {
107
                return tag;
108
        }
109

    
110
        /**
111
         * Obtiene el campo extra
112
         * @return
113
         */
114
        public void setTag(Object tag) {
115
                this.tag = tag;
116
        }
117

    
118
        public boolean isShowTooltip() {
119
                return showTooltip;
120
        }
121

    
122
        public void setShowTooltip(boolean showTooltip) {
123
                this.showTooltip = showTooltip;
124
        }
125

    
126
        public Rectangle getNameRectangle() {
127
                return nameRectangle;
128
        }
129

    
130
        public void setNameRectangle(Rectangle nameRectangle) {
131
                this.nameRectangle = nameRectangle;
132
        }
133

    
134
        public Rectangle getItemRectangle() {
135
                return itemRectangle;
136
        }
137

    
138
        public void setItemRectangle(Rectangle itemRectangle) {
139
                this.itemRectangle = itemRectangle;
140
        }
141

    
142
        public int compareTo(ListViewItem listViewItem) {
143
                return getName().compareTo(listViewItem.getName());
144
        }
145
}