root / trunk / libraries / libUIComponent / src / org / gvsig / gui / beans / colorslideredition / ItemColorSlider.java @ 12898
History | View | Annotate | Download (2.67 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*/
|
19 |
package org.gvsig.gui.beans.colorslideredition; |
20 |
|
21 |
import java.awt.Color; |
22 |
|
23 |
public class ItemColorSlider { |
24 |
private double value = 0; |
25 |
private double interpolated = 50; // Atencion, es la interpolacion izquierda |
26 |
private Color color = Color.black; |
27 |
private boolean visible = true; |
28 |
/**
|
29 |
* Seleted:
|
30 |
* -1: No seleccionado
|
31 |
* 1: Seleccionado el item
|
32 |
* 2: Seleccionado la interpolacion izquierda
|
33 |
*/
|
34 |
private int selected = -1; |
35 |
|
36 |
public ItemColorSlider(double value, Color color) { |
37 |
setValue(value); |
38 |
setColor(color); |
39 |
} |
40 |
|
41 |
/**
|
42 |
* @return the color
|
43 |
*/
|
44 |
public Color getColor() { |
45 |
return color;
|
46 |
} |
47 |
|
48 |
/**
|
49 |
* @param color the color to set
|
50 |
*/
|
51 |
public void setColor(Color color) { |
52 |
this.color = color;
|
53 |
} |
54 |
|
55 |
/**
|
56 |
* @return the interpolation
|
57 |
*/
|
58 |
public double getInterpolated() { |
59 |
return interpolated;
|
60 |
} |
61 |
|
62 |
/**
|
63 |
* @param interpolation the interpolation to set
|
64 |
*/
|
65 |
public void setInterpolated(double interpolation) { |
66 |
this.interpolated = interpolation;
|
67 |
if (this.interpolated < 5) |
68 |
this.interpolated = 5; |
69 |
if (this.interpolated > 95) |
70 |
this.interpolated = 95; |
71 |
} |
72 |
|
73 |
/**
|
74 |
* @return the value
|
75 |
*/
|
76 |
public double getValue() { |
77 |
return value;
|
78 |
} |
79 |
|
80 |
/**
|
81 |
* @param value the value to set
|
82 |
*/
|
83 |
public void setValue(double value) { |
84 |
this.value = value;
|
85 |
if (this.value < 0) |
86 |
this.value = 0; |
87 |
if (this.value > 100) |
88 |
this.value = 100; |
89 |
} |
90 |
|
91 |
/**
|
92 |
* @return the visible
|
93 |
*/
|
94 |
public boolean isVisible() { |
95 |
return visible;
|
96 |
} |
97 |
|
98 |
/**
|
99 |
* @param visible the visible to set
|
100 |
*/
|
101 |
public void setVisible(boolean visible) { |
102 |
this.visible = visible;
|
103 |
} |
104 |
|
105 |
/**
|
106 |
* @return the selected
|
107 |
*/
|
108 |
public int getSelected() { |
109 |
return selected;
|
110 |
} |
111 |
|
112 |
/**
|
113 |
* @param selected the selected to set
|
114 |
*/
|
115 |
public void setSelected(int selected) { |
116 |
switch (selected) {
|
117 |
case 1: |
118 |
case 2: |
119 |
this.selected = selected;
|
120 |
break;
|
121 |
default:
|
122 |
this.selected = -1; |
123 |
break;
|
124 |
} |
125 |
} |
126 |
} |