JHotDraw 7.4.1

org.jhotdraw.color
Class DefaultColorSliderModel

java.lang.Object
  extended by org.jhotdraw.beans.AbstractBean
      extended by org.jhotdraw.color.AbstractColorSlidersModel
          extended by org.jhotdraw.color.DefaultColorSliderModel
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ColorSliderModel

public class DefaultColorSliderModel
extends AbstractColorSlidersModel

DefaultColorSliderModel.

Author:
Werner Randelshofer  @version $Id: DefaultColorSliderModel.java 527 2009-06-07 14:28:19Z rawcoder $
See Also:
Serialized Form

Field Summary
protected  javax.swing.DefaultBoundedRangeModel[] componentModels
          Components of the color model.
protected  java.util.LinkedList<javax.swing.JSlider> sliders
          JSlider's associated to this AbstractColorSystem.
protected  ColorSystem system
           
 
Fields inherited from class org.jhotdraw.color.AbstractColorSlidersModel
listeners
 
Fields inherited from class org.jhotdraw.beans.AbstractBean
propertySupport
 
Constructor Summary
DefaultColorSliderModel()
           
DefaultColorSliderModel(ColorSystem sys)
           
 
Method Summary
protected  void addColorSlider(javax.swing.JSlider slider)
           
 void configureSlider(int componentIndex, javax.swing.JSlider slider)
          Configures a JSlider for this AbstractColorSystem.
protected  void fireColorChanged(int componentIndex)
           
 javax.swing.DefaultBoundedRangeModel getBoundedRangeModel(int componentIndex)
          Returns the bounded range model of the specified color componentIndex.
 java.awt.Color getColor()
          Returns the color value of the model.
 ColorSystem getColorSystem()
          Returns the ColorSystem used by this ColorSliderModel.
 int getComponentCount()
          Returns the number of components used by this ColorSliderModel.
 float getComponentValue(int componentIndex)
          Gets a value of an individual component.
 CompositeColor getCompositeColor()
          Returns a CompositeColor representing the current value of the ColorSliderModel.
 int getInterpolatedRGB(int componentIndex, float componentValue)
          Returns an RGB value based on the value of the specified component index and value, based on the values of all other components of the model.
 int getSliderValue(int componentIndex)
          Returns the value of the specified color componentIndex.
protected  void removeColorSlider(javax.swing.JSlider slider)
           
 void setColor(java.awt.Color newValue)
          Sets the color value of the model.
 void setColorSystem(ColorSystem newValue)
          Changes the ColorSystem used by this ColorSliderModel.
 void setComponentValue(int componentIndex, float newValue)
          Sets a value for an individual component.
 void setCompositeColor(CompositeColor newValue)
          Sets the composite color value of the model.
 void setSliderValue(int componentIndex, int value)
          Sets the value of the specified color componentIndex.
 void unconfigureSlider(javax.swing.JSlider slider)
          Unconfigures a JSlider from this AbstractColorSystem.
 
Methods inherited from class org.jhotdraw.color.AbstractColorSlidersModel
addChangeListener, fireStateChanged, removeChangeListener
 
Methods inherited from class org.jhotdraw.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

system

protected ColorSystem system

sliders

protected java.util.LinkedList<javax.swing.JSlider> sliders
JSlider's associated to this AbstractColorSystem.


componentModels

protected javax.swing.DefaultBoundedRangeModel[] componentModels
Components of the color model.

Constructor Detail

DefaultColorSliderModel

public DefaultColorSliderModel()

DefaultColorSliderModel

public DefaultColorSliderModel(ColorSystem sys)
Method Detail

setColorSystem

public void setColorSystem(ColorSystem newValue)
Description copied from interface: ColorSliderModel
Changes the ColorSystem used by this ColorSliderModel.

Parameters:
newValue - ColorSystem.

configureSlider

public void configureSlider(int componentIndex,
                            javax.swing.JSlider slider)
Configures a JSlider for this AbstractColorSystem. If the JSlider is already configured for another AbstractColorSystem, it is unconfigured first.


unconfigureSlider

public void unconfigureSlider(javax.swing.JSlider slider)
Unconfigures a JSlider from this AbstractColorSystem.


getBoundedRangeModel

public javax.swing.DefaultBoundedRangeModel getBoundedRangeModel(int componentIndex)
Returns the bounded range model of the specified color componentIndex.

Parameters:
componentIndex - .
Returns:
BoundedRangeModel.

getSliderValue

public int getSliderValue(int componentIndex)
Returns the value of the specified color componentIndex.


setSliderValue

public void setSliderValue(int componentIndex,
                           int value)
Sets the value of the specified color componentIndex.


addColorSlider

protected void addColorSlider(javax.swing.JSlider slider)

removeColorSlider

protected void removeColorSlider(javax.swing.JSlider slider)

fireColorChanged

protected void fireColorChanged(int componentIndex)

getColorSystem

public ColorSystem getColorSystem()
Description copied from interface: ColorSliderModel
Returns the ColorSystem used by this ColorSliderModel.

Returns:
ColorSystem.

getComponentCount

public int getComponentCount()
Description copied from interface: ColorSliderModel
Returns the number of components used by this ColorSliderModel.

Returns:
Component count.

getCompositeColor

public CompositeColor getCompositeColor()
Description copied from interface: ColorSliderModel
Returns a CompositeColor representing the current value of the ColorSliderModel.

Returns:
CompositeColor.

getInterpolatedRGB

public int getInterpolatedRGB(int componentIndex,
                              float componentValue)
Description copied from interface: ColorSliderModel
Returns an RGB value based on the value of the specified component index and value, based on the values of all other components of the model.

Returns:
RGB value.

setComponentValue

public void setComponentValue(int componentIndex,
                              float newValue)
Description copied from interface: ColorSliderModel
Sets a value for an individual component.


getComponentValue

public float getComponentValue(int componentIndex)
Description copied from interface: ColorSliderModel
Gets a value of an individual component.

Returns:
Value

setCompositeColor

public void setCompositeColor(CompositeColor newValue)
Description copied from interface: ColorSliderModel
Sets the composite color value of the model.

Parameters:
newValue - .

getColor

public java.awt.Color getColor()
Description copied from interface: ColorSliderModel
Returns the color value of the model. This is a convenience method for calling getCompositeColor().getColor().

Returns:
color.

setColor

public void setColor(java.awt.Color newValue)
Description copied from interface: ColorSliderModel
Sets the color value of the model. This is a convenience method for calling setCompositeColor(new CompositeColor(getColorSystem(), color.getRGB());

Parameters:
newValue - .

Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.