.getValue().toString())) / 100f;
float value = (Float.parseFloat(valueSlider.getValue()
.toString())) / 100f;
// Set the color
Color color = new Color(Color.HSVtoRGB(hue, saturation,
value));
setColor(color);
/*
* Set the background color of the hue gradient. This has to
* be done here since in the conversion the base color
* information is lost when color is black/white
*/
Color bgColor = new Color(Color.HSVtoRGB(hue, 1f, 1f));
hsvGradient.setBackgroundColor(bgColor);
}
}
});
sliders.addComponent(hueSlider);
saturationSlider = new Slider("Saturation", 0, 100);
try {
saturationSlider.setValue(((Float) hsv[1]).doubleValue());
} catch (ValueOutOfBoundsException e1) {
}
saturationSlider.setStyleName("hsv-slider");
saturationSlider.setWidth("220px");
saturationSlider.setImmediate(true);
saturationSlider.addValueChangeListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
if (!updatingColors) {
float hue = (Float.parseFloat(hueSlider.getValue()
.toString())) / 360f;
float saturation = (Float.parseFloat(event.getProperty()
.getValue().toString())) / 100f;
float value = (Float.parseFloat(valueSlider.getValue()
.toString())) / 100f;
Color color = new Color(Color.HSVtoRGB(hue, saturation,
value));
setColor(color);
}
}
});
sliders.addComponent(saturationSlider);
valueSlider = new Slider("Value", 0, 100);
try {
valueSlider.setValue(((Float) hsv[2]).doubleValue());
} catch (ValueOutOfBoundsException e1) {
}
valueSlider.setStyleName("hsv-slider");
valueSlider.setWidth("220px");
valueSlider.setImmediate(true);
valueSlider.addValueChangeListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
if (!updatingColors) {
float hue = (Float.parseFloat(hueSlider.getValue()
.toString())) / 360f;
float saturation = (Float.parseFloat(saturationSlider
.getValue().toString())) / 100f;
float value = (Float.parseFloat(event.getProperty()
.getValue().toString())) / 100f;
Color color = new Color(Color.HSVtoRGB(hue, saturation,
value));
setColor(color);
}
}
});