root / trunk / libraries / libUIComponent / src / org / gvsig / gui / beans / colorslideredition / ItemColorSlider.java @ 13022
History | View | Annotate | Download (2.87 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 |
private String name = ""; |
29 |
|
30 |
/**
|
31 |
* Seleted:
|
32 |
* -1: No seleccionado
|
33 |
* 1: Seleccionado el item
|
34 |
* 2: Seleccionado la interpolacion izquierda
|
35 |
*/
|
36 |
private int selected = -1; |
37 |
|
38 |
public ItemColorSlider(double value, Color color) { |
39 |
setValue(value); |
40 |
setColor(color); |
41 |
} |
42 |
|
43 |
/**
|
44 |
* @return the color
|
45 |
*/
|
46 |
public Color getColor() { |
47 |
return color;
|
48 |
} |
49 |
|
50 |
/**
|
51 |
* @param color the color to set
|
52 |
*/
|
53 |
public void setColor(Color color) { |
54 |
this.color = color;
|
55 |
} |
56 |
|
57 |
/**
|
58 |
* @return the interpolation
|
59 |
*/
|
60 |
public double getInterpolated() { |
61 |
return interpolated;
|
62 |
} |
63 |
|
64 |
/**
|
65 |
* @param interpolation the interpolation to set
|
66 |
*/
|
67 |
public void setInterpolated(double interpolation) { |
68 |
this.interpolated = interpolation;
|
69 |
if (this.interpolated < 5) |
70 |
this.interpolated = 5; |
71 |
if (this.interpolated > 95) |
72 |
this.interpolated = 95; |
73 |
} |
74 |
|
75 |
/**
|
76 |
* @return the value
|
77 |
*/
|
78 |
public double getValue() { |
79 |
return value;
|
80 |
} |
81 |
|
82 |
/**
|
83 |
* @param value the value to set
|
84 |
*/
|
85 |
public void setValue(double value) { |
86 |
this.value = value;
|
87 |
if (this.value < 0) |
88 |
this.value = 0; |
89 |
if (this.value > 100) |
90 |
this.value = 100; |
91 |
} |
92 |
|
93 |
/**
|
94 |
* @return the visible
|
95 |
*/
|
96 |
public boolean isVisible() { |
97 |
return visible;
|
98 |
} |
99 |
|
100 |
/**
|
101 |
* @param visible the visible to set
|
102 |
*/
|
103 |
public void setVisible(boolean visible) { |
104 |
this.visible = visible;
|
105 |
} |
106 |
|
107 |
/**
|
108 |
* @return the selected
|
109 |
*/
|
110 |
public int getSelected() { |
111 |
return selected;
|
112 |
} |
113 |
|
114 |
/**
|
115 |
* @param selected the selected to set
|
116 |
*/
|
117 |
public void setSelected(int selected) { |
118 |
switch (selected) {
|
119 |
case 1: |
120 |
case 2: |
121 |
this.selected = selected;
|
122 |
break;
|
123 |
default:
|
124 |
this.selected = -1; |
125 |
break;
|
126 |
} |
127 |
} |
128 |
|
129 |
/**
|
130 |
* @return the name
|
131 |
*/
|
132 |
public String getName() { |
133 |
return name;
|
134 |
} |
135 |
|
136 |
/**
|
137 |
* @param name the name to set
|
138 |
*/
|
139 |
public void setName(String name) { |
140 |
this.name = name;
|
141 |
} |
142 |
} |