JIDE 3.5.15

com.jidesoft.chart.model
Class ModelMorpher

java.lang.Object
  extended by com.jidesoft.chart.model.ModelMorpher

public class ModelMorpher
extends Object

A class to manage the transition ('morphing') from one ChartModel to another.

Note: This class is in Beta status and is subject to change.


Nested Class Summary
static class ModelMorpher.TransitionPoint
          A class specialised for the transition task - it knows where it is moving from and where to, as well as its current position.
 
Field Summary
static String PROPERTY_MORPH_ENDED
           
static String PROPERTY_MORPH_MODELS
           
static String PROPERTY_MORPH_STARTED
           
 
Constructor Summary
ModelMorpher()
          This constructor is provided mainly for Java Bean compatibility.
ModelMorpher(Chart chart)
          Create a ModelMorpher instance and inform it of the chart object containing the model to transform.
ModelMorpher(Chart chart, int numSteps, int delay)
          Create a ModelMorpher instance on the supplied Chart.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a property change listener to this object.
protected  Chartable createIntermediate(Chartable source, Chartable target, double position)
          Creates an intermediate point to be used during the transition
 Chart getChart()
          Returns the chart object used by this class
 ChartStyle getSourceStyle()
          Deprecated. this is unused and will be removed some time after 3.2.4
 ChartStyle getTargetStyle()
          Deprecated. this is unused and will be removed some time after 3.2.4
 boolean isAutoRepaint()
           
 boolean isMorphing()
          Returns true if a morph is currently in progress
 void morph(ChartModel[] sourceModels, ChartStyle[] sourceStyles, ChartModel[] targetModels, ChartStyle[] targetStyles)
           
 void morph(ChartModel[] sourceModels, ChartStyle[] sourceStyles, ListSelectionModel[] selectionModels, ChartModel[] targetModels, ChartStyle[] targetStyles)
           
 void morph(ChartModel sourceModel, ChartStyle sourceStyle, ChartModel targetModel, ChartStyle targetStyle)
          Perform a transition from the sourceModel to the targetModel.
 void morph(ChartModel sourceModel, ChartStyle sourceStyle, ListSelectionModel selectionModel, ChartModel targetModel, ChartStyle targetStyle)
          Perform a transition from the sourceModel to the targetModel.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove a property change listener from this object.
 void setAutoRepaint(boolean autoRepaint)
           
 void setChart(Chart chart)
          Specify the chart object to be used by this morpher
 void setSourceStyle(ChartStyle sourceStyle)
          Deprecated. this is unused and will be removed some time after 3.2.4
 void setTargetStyle(ChartStyle targetStyle)
          Deprecated. this is unused and will be removed some time after 3.2.4
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_MORPH_STARTED

public static final String PROPERTY_MORPH_STARTED
See Also:
Constant Field Values

PROPERTY_MORPH_ENDED

public static final String PROPERTY_MORPH_ENDED
See Also:
Constant Field Values

PROPERTY_MORPH_MODELS

public static final String PROPERTY_MORPH_MODELS
See Also:
Constant Field Values
Constructor Detail

ModelMorpher

public ModelMorpher()
This constructor is provided mainly for Java Bean compatibility. If you use it, make sure you call setChart to inform the object of the chart on which it operates.


ModelMorpher

public ModelMorpher(Chart chart)
Create a ModelMorpher instance and inform it of the chart object containing the model to transform. A default number of steps of 10 is used, with a delay of 40ms.

Parameters:
chart - the chart object containing the model of interest

ModelMorpher

public ModelMorpher(Chart chart,
                    int numSteps,
                    int delay)
Create a ModelMorpher instance on the supplied Chart.

Parameters:
chart - the chart object containing the model(s) to be transformed
numSteps - the number of steps in a transition
delay - the delay between the steps, in milliseconds
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Add a property change listener to this object. Property events are fired at the beginning and at the end of a transition.

Parameters:
listener - the property change listener

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Remove a property change listener from this object.

Parameters:
listener - the property change listener to remove

morph

public void morph(ChartModel sourceModel,
                  ChartStyle sourceStyle,
                  ChartModel targetModel,
                  ChartStyle targetStyle)
Perform a transition from the sourceModel to the targetModel. The sourceModel uses the supplied sourceStyle, and the targetModel has the supplied targetStyle. By supplying these styles, colors can be morphed as well as positions.

Parameters:
sourceModel - the original position before the morph
sourceStyle - the original ChartStyle before the morph
targetModel - the end ChartModel, after the transition
targetStyle - the end ChartStyle, after the transition

morph

public void morph(ChartModel[] sourceModels,
                  ChartStyle[] sourceStyles,
                  ChartModel[] targetModels,
                  ChartStyle[] targetStyles)

morph

public void morph(ChartModel sourceModel,
                  ChartStyle sourceStyle,
                  ListSelectionModel selectionModel,
                  ChartModel targetModel,
                  ChartStyle targetStyle)
Perform a transition from the sourceModel to the targetModel. The sourceModel uses the supplied sourceStyle, and the targetModel has the supplied targetStyle. By supplying these styles, colors can be morphed as well as positions.

Parameters:
sourceModel - the original position before the morph
sourceStyle - the original ChartStyle before the morph
selectionModel - the selection model to use during the transition
targetModel - the end ChartModel, after the transition
targetStyle - the end ChartStyle, after the transition

morph

public void morph(ChartModel[] sourceModels,
                  ChartStyle[] sourceStyles,
                  ListSelectionModel[] selectionModels,
                  ChartModel[] targetModels,
                  ChartStyle[] targetStyles)

getChart

public Chart getChart()
Returns the chart object used by this class

Returns:
the chart object

setChart

public void setChart(Chart chart)
Specify the chart object to be used by this morpher

Parameters:
chart - the chart object

getSourceStyle

public ChartStyle getSourceStyle()
Deprecated. this is unused and will be removed some time after 3.2.4

Returns the style of the chart prior to the transition

Returns:
the chart style before the transition

setSourceStyle

public void setSourceStyle(ChartStyle sourceStyle)
Deprecated. this is unused and will be removed some time after 3.2.4

Specify the style of the chart prior to the transition

Parameters:
sourceStyle - the ChartStyle before the transition

getTargetStyle

public ChartStyle getTargetStyle()
Deprecated. this is unused and will be removed some time after 3.2.4

Returns the style of the ChartModel at the end of the transition

Returns:
the chart style after the transition

setTargetStyle

public void setTargetStyle(ChartStyle targetStyle)
Deprecated. this is unused and will be removed some time after 3.2.4

Specify the chart style at the end of the transition

Parameters:
targetStyle - the chart style to use at the end of the transition

isAutoRepaint

public boolean isAutoRepaint()

setAutoRepaint

public void setAutoRepaint(boolean autoRepaint)

isMorphing

public boolean isMorphing()
Returns true if a morph is currently in progress

Returns:
a boolean to indicate whether a morph is in progress.

createIntermediate

protected Chartable createIntermediate(Chartable source,
                                       Chartable target,
                                       double position)
Creates an intermediate point to be used during the transition

Parameters:
source - the source point
target - the corresponding target point
position - the position on a scale from 0 (source) to 1 (target)
Returns:
a Chartable point representing the given position during the transition

JIDE 3.5.15