Class ColorSliderModel
- java.lang.Object
-
- org.pushingpixels.radiance.theming.internal.contrib.randelshofer.quaqua.colorchooser.ColorSliderModel
-
- Direct Known Subclasses:
GrayColorSliderModel,HSBColorSliderModel,ICC_CMYKColorSliderModel,NominalCMYKColorSliderModel,RGBColorSliderModel
public abstract class ColorSliderModel extends java.lang.ObjectAbstract super class for ColorModels which can be used in conjunction with ColorSliderUI user interface delegates.Colors are represented as arrays of color components represented as BoundedRangeModel's. Each BoundedRangeModel can be visualized using a JSlider having a ColorSliderUI.
- Version:
- 1.0 May 22, 2005 Created.
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.swing.DefaultBoundedRangeModel[]componentsComponents of the color model.private java.util.LinkedList<javax.swing.event.ChangeListener>listenersChangeListener's listening to changes in this ColorSliderModel.private java.util.LinkedList<javax.swing.JSlider>slidersJSlider's associated to this ColorSliderModel.protected int[]valuesSpeed optimization.
-
Constructor Summary
Constructors Modifier Constructor Description protectedColorSliderModel(javax.swing.DefaultBoundedRangeModel[] components)Creates a new ColorSliderModel with an array of BoundedRangeModel's for the color components.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddChangeListener(javax.swing.event.ChangeListener l)protected voidaddColorSlider(javax.swing.JSlider slider)voidconfigureColorSlider(int component, javax.swing.JSlider slider)Configures a JSlider for this ColorSliderModel.protected voidfireColorChanged(int componentIndex)voidfireStateChanged()javax.swing.DefaultBoundedRangeModelgetBoundedRangeModel(int component)Returns the bounded range model of the specified color component.java.awt.ColorgetColor()intgetComponentCount()Returns the number of components of this color component model.intgetInterpolatedRGB(int component, float ratio)Returns an interpolated RGB value by using the values of the color components of this ColorSliderModel except for the component specified as an argument.abstract intgetRGB()intgetValue(int component)Returns the value of the specified color component.voidremoveChangeListener(javax.swing.event.ChangeListener l)protected voidremoveColorSlider(javax.swing.JSlider slider)voidsetColor(java.awt.Color color)abstract voidsetRGB(int rgb)voidsetValue(int component, int value)Sets the value of the specified color component.abstract inttoRGB(int[] values)voidunconfigureColorSlider(javax.swing.JSlider slider)Unconfigures a JSlider from this ColorSliderModel.
-
-
-
Field Detail
-
sliders
private java.util.LinkedList<javax.swing.JSlider> sliders
JSlider's associated to this ColorSliderModel.
-
listeners
private java.util.LinkedList<javax.swing.event.ChangeListener> listeners
ChangeListener's listening to changes in this ColorSliderModel.
-
components
protected javax.swing.DefaultBoundedRangeModel[] components
Components of the color model.
-
values
protected int[] values
Speed optimization. This way, we do not need to create a new array for each invocation of method getInterpolatedRGB(). Note: This variable must not use in reentrant methods.
-
-
Method Detail
-
configureColorSlider
public void configureColorSlider(int component, javax.swing.JSlider slider)Configures a JSlider for this ColorSliderModel. If the JSlider is already configured for another ColorSliderModel, it is unconfigured first.
-
unconfigureColorSlider
public void unconfigureColorSlider(javax.swing.JSlider slider)
Unconfigures a JSlider from this ColorSliderModel.
-
getComponentCount
public int getComponentCount()
Returns the number of components of this color component model.
-
getBoundedRangeModel
public javax.swing.DefaultBoundedRangeModel getBoundedRangeModel(int component)
Returns the bounded range model of the specified color component.
-
getValue
public int getValue(int component)
Returns the value of the specified color component.
-
setValue
public void setValue(int component, int value)Sets the value of the specified color component.
-
getInterpolatedRGB
public int getInterpolatedRGB(int component, float ratio)Returns an interpolated RGB value by using the values of the color components of this ColorSliderModel except for the component specified as an argument. For this component the ratio between zero and the maximum of its BoundedRangeModel is used.
-
addColorSlider
protected void addColorSlider(javax.swing.JSlider slider)
-
removeColorSlider
protected void removeColorSlider(javax.swing.JSlider slider)
-
addChangeListener
public void addChangeListener(javax.swing.event.ChangeListener l)
-
removeChangeListener
public void removeChangeListener(javax.swing.event.ChangeListener l)
-
fireColorChanged
protected void fireColorChanged(int componentIndex)
-
fireStateChanged
public void fireStateChanged()
-
getColor
public java.awt.Color getColor()
-
setColor
public void setColor(java.awt.Color color)
-
setRGB
public abstract void setRGB(int rgb)
-
getRGB
public abstract int getRGB()
-
toRGB
public abstract int toRGB(int[] values)
-
-