Statistics
| Revision:

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

History | View | Annotate | Download (3.33 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.colorslideredition;
25

    
26
import java.awt.Color;
27
/**
28
 * 
29
 * @version 26/09/2007
30
 * @author BorSanZa - Borja S?nchez Zamorano (borja.sanchez@iver.es)
31
 */
32
public class ItemColorSlider {
33
        private double value = 0;
34
        private double interpolated = 50; // Atencion, es la interpolacion izquierda
35
        private Color color = Color.black;
36
        private boolean visible = true;
37
        private String name = "";
38
        private Object tag = null;
39

    
40
        /**
41
         * Seleted:
42
         * -1: No seleccionado
43
         * 1: Seleccionado el item
44
         * 2: Seleccionado la interpolacion izquierda
45
         */
46
        private int selected = -1;
47

    
48
        public ItemColorSlider(double value, Color color) {
49
                setValue(value);
50
                setColor(color);
51
        }
52

    
53
        /**
54
         * @return the color
55
         */
56
        public Color getColor() {
57
                return color;
58
        }
59

    
60
        /**
61
         * @param color the color to set
62
         */
63
        public void setColor(Color color) {
64
                this.color = color;
65
        }
66

    
67
        /**
68
         * @return the interpolation
69
         */
70
        public double getInterpolated() {
71
                return interpolated;
72
        }
73

    
74
        /**
75
         * @param interpolation the interpolation to set
76
         */
77
        public void setInterpolated(double interpolation) {
78
                this.interpolated = interpolation;
79
                if (this.interpolated < 5)
80
                        this.interpolated = 5;
81
                if (this.interpolated > 95)
82
                        this.interpolated = 95;
83
        }
84

    
85
        /**
86
         * @return the value
87
         */
88
        public double getValue() {
89
                return value;
90
        }
91

    
92
        /**
93
         * @param value the value to set
94
         */
95
        public void setValue(double value) {
96
                this.value = value;
97
                if (this.value < 0)
98
                        this.value = 0;
99
                if (this.value > 100)
100
                        this.value = 100;
101
        }
102

    
103
        /**
104
         * @return the visible
105
         */
106
        public boolean isVisible() {
107
                return visible;
108
        }
109

    
110
        /**
111
         * @param visible the visible to set
112
         */
113
        public void setVisible(boolean visible) {
114
                this.visible = visible;
115
        }
116

    
117
        /**
118
         * @return the selected
119
         */
120
        public int getSelected() {
121
                return selected;
122
        }
123

    
124
        /**
125
         * @param selected the selected to set
126
         */
127
        public void setSelected(int selected) {
128
                switch (selected) {
129
                        case 1:
130
                        case 2:
131
                                this.selected = selected;
132
                                break;
133
                        default:
134
                                this.selected = -1;
135
                                break;
136
                }
137
        }
138

    
139
        /**
140
         * @return the name
141
         */
142
        public String getName() {
143
                return name;
144
        }
145

    
146
        /**
147
         * @param name the name to set
148
         */
149
        public void setName(String name) {
150
                this.name = name;
151
        }
152

    
153
        /**
154
         * Obtiene el campo extra de cada elemento
155
         * @return
156
         */
157
        public Object getTag() {
158
          return tag;
159
  }
160

    
161
        /**
162
         * Especifica un campo extra a cada elemento
163
         * @param tag
164
         */
165
        public void setTag(Object tag) {
166
          this.tag = tag;
167
  }
168
}