|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.progeeks.util.beans.BeanChangeSupport
org.progeeks.util.DefaultViewContext
org.progeeks.util.DefaultObjectViewContext
org.progeeks.jfreechart.ChartContext
public class ChartContext
Context which allows rendering of a List of data objects in a chart using the JFreeChart package.
Field Summary | |
---|---|
protected static Log |
log
|
static java.lang.String |
PROP_CHART
Property storing the generated JFreeChart. |
static java.lang.String |
PROP_CHART_CONFIG
Property storing the configurator for the chart. |
static java.lang.String |
PROP_CHART_PLOT
Property storing the plot the chart. |
static java.lang.String |
PROP_DATA_TRANSFORM
Property storing the DataTransformer for the input data object. |
static java.lang.String |
PROP_DATASET_PRODUCERS
Property storing the DatasetProducer s for the chart. |
static java.lang.String |
PROP_PANEL_CONFIG
Property storing the panel configuration for the chart. |
Fields inherited from interface org.progeeks.util.FocusedContext |
---|
PROP_FOCUS |
Fields inherited from interface org.progeeks.util.ObjectViewContext |
---|
PROP_OBJECT |
Constructor Summary | |
---|---|
ChartContext()
|
|
ChartContext(java.lang.Object obj)
Init the ChartContext. |
Method Summary | |
---|---|
protected void |
addDatasetsToChart(org.jfree.chart.JFreeChart chart,
org.jfree.data.general.Dataset[] datasets)
Extract the plot(s) and set the datasets to it |
protected void |
addDatasetsToPlot(org.jfree.chart.plot.Plot chartPlot,
org.jfree.data.general.Dataset[] datasets)
Determines what type of plot this is and casts the datasets appropriately. |
protected void |
addDatasetsToPlots(java.util.List chartPlots,
org.jfree.data.general.Dataset[] datasets)
Distribute the Datasets into a list of plots. |
protected void |
createChart()
Generate the chart with current data and configuration |
protected void |
createTransform()
Update the listeners on the transform |
org.jfree.chart.JFreeChart |
getChart()
Invoked by corresponding view to (if necessary) and return it. |
BeanConfigurator |
getChartConfig()
|
MetaDatasetProducer |
getDatasetProducer()
Return the primary dataset producer. |
java.util.List |
getDatasetProducers()
|
BeanConfigurator |
getDataTransformConfig()
|
java.lang.Object |
getFocus()
Returns the object that is the current focus of this context. |
ChartFocusHandler |
getFocusHandler()
|
BeanConfigurator |
getPanelConfig()
|
org.jfree.chart.plot.Plot |
getPlot()
|
protected void |
handleFocus(java.lang.Object focus)
Invokes the focus handler and actually sets the focus property. |
void |
setChartConfig(BeanConfigurator chartConfig)
|
void |
setDatasetProducer(MetaDatasetProducer producer)
Set the PROP_DATASET_PRODUCERS property. |
void |
setDatasetProducers(java.util.List datasetProducers)
Set the PROP_DATASET_PRODUCERS property. |
void |
setDataTransformConfig(BeanConfigurator chartDataTransform)
|
void |
setFocus(java.lang.Object focus)
Handles setting the focus by both outside objects and if the user clicks in the ChartPanel. |
void |
setFocusHandler(ChartFocusHandler focusHandler)
|
void |
setPanelConfig(BeanConfigurator panelConfig)
|
void |
setPlot(org.jfree.chart.plot.Plot chartPlot)
Set the PROP_CHART_CONFIG property. |
void |
setPlots(java.util.List chartPlots)
Set the PROP_CHART_CONFIG property with the first Plot in the
list. |
void |
setUserFocus(org.jfree.chart.entity.ChartEntity entity)
Called by corresponding panel when the user clicks in the chart. |
protected void |
updateDatasets(java.util.List dataList)
Create or update the datasets that will be used in the chart. |
protected void |
updateDatasets(java.lang.Object value)
Create or update the dataset that will be used in the chart. |
Methods inherited from class org.progeeks.util.DefaultObjectViewContext |
---|
getObject, setObject |
Methods inherited from class org.progeeks.util.DefaultViewContext |
---|
findContext, getBooleanProperty, getDoubleProperty, getIntProperty, getObjectProperty, getObjectProperty, getParentContext, getRootContext, getStringProperty, setBooleanProperty, setDoubleProperty, setIntProperty, setObjectProperty, setParentContext, setStringProperty |
Methods inherited from class org.progeeks.util.beans.BeanChangeSupport |
---|
addPropertyChangeListener, addPropertyChangeListener, clearAllListeners, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, hasListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.progeeks.util.ViewContext |
---|
getParentContext, setParentContext |
Methods inherited from interface org.progeeks.util.beans.StandardBean |
---|
addPropertyChangeListener, addPropertyChangeListener, hasListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener |
Field Detail |
---|
protected static final Log log
public static final java.lang.String PROP_CHART_CONFIG
public static final java.lang.String PROP_CHART_PLOT
public static final java.lang.String PROP_PANEL_CONFIG
ChartContextPanel
will check the context to see if this exists and create its
ChartPanel
with it if so. Otherwise, it will create a ChartPanel with default
settings.
public static final java.lang.String PROP_DATASET_PRODUCERS
DatasetProducer
s for the chart. Most charts will only
have a single DatasetProducer
. However, if multiple Dataset
s
are desired (for example, to render the data using two different renderers), then multiple
DatasetProducer
s can be passed in. The type of Dataset
created
by each producer must match the type that the Plot
generated by
plotConfig
expects.
public static final java.lang.String PROP_DATA_TRANSFORM
DatasetProducer
. If the main object is the actual list that contains the data
items, this field can be left unset. A DefaultChartDataTransform
will automatically
be created, and it will just pass the List straight through to the DatasetProducer
.
public static final java.lang.String PROP_CHART
Constructor Detail |
---|
public ChartContext()
public ChartContext(java.lang.Object obj)
obj
- Either a List of data objects or an object that a ChartDataTransform
can extract a list fromMethod Detail |
---|
public org.jfree.chart.JFreeChart getChart()
protected void createChart()
protected void createTransform()
localList
- protected void updateDatasets(java.util.List dataList) throws de.laures.cewolf.DatasetProduceException
dataList
- List of items to give to each DatasetProducer
de.laures.cewolf.DatasetProduceException
protected void updateDatasets(java.lang.Object value) throws de.laures.cewolf.DatasetProduceException
value
- A new or changed value for the dataset
de.laures.cewolf.DatasetProduceException
protected void addDatasetsToChart(org.jfree.chart.JFreeChart chart, org.jfree.data.general.Dataset[] datasets)
chart
- dataset
- protected void addDatasetsToPlot(org.jfree.chart.plot.Plot chartPlot, org.jfree.data.general.Dataset[] datasets)
chartPlot
- dataset
- protected void addDatasetsToPlots(java.util.List chartPlots, org.jfree.data.general.Dataset[] datasets)
Datasets
into a list of plots. Useful with combined charts.
chartPlot
- datasets
- public void setFocus(java.lang.Object focus)
setFocus
in interface FocusedContext
public java.lang.Object getFocus()
FocusedContext
getFocus
in interface FocusedContext
FocusedContext.getFocus()
public void setUserFocus(org.jfree.chart.entity.ChartEntity entity)
entity
- protected void handleFocus(java.lang.Object focus)
setFocus(Object)
which will then call here. When
the user sets the focus directly (by clicking on the chart), the chart panel will call
setUserFocus(ChartEntity)
which will then call here. Both methods first translate
the focus object into a standard form for acting upon.
focus
- An object that is already translated into the proper form for passing to the
focusHandler (and the DatasetProducer).public java.util.List getDatasetProducers()
public MetaDatasetProducer getDatasetProducer()
setDatasetProducer
call.
public void setDatasetProducer(MetaDatasetProducer producer)
PROP_DATASET_PRODUCERS
property. This is a shortcut method
for when only a single DatasetProducer
will be used. Do not use both
this call and setDatasetProducers
on the same object.
Also set the focusHandler's producer property to the first item in the list.
producer
- The MetaDatasetProducer to user.public void setDatasetProducers(java.util.List datasetProducers)
PROP_DATASET_PRODUCERS
property. The passed in list should contain
DatasetProducers
objects. Do not use both this call and
setDatasetProducer
on the same object.
Also set the focusHandler's producer property to the first item in the list.
datasetProducers
- The DatasetProducerspublic BeanConfigurator getChartConfig()
public void setChartConfig(BeanConfigurator chartConfig)
chartConfig
- The chartConfig to set.public BeanConfigurator getPanelConfig()
public void setPanelConfig(BeanConfigurator panelConfig)
panelConfig
- The panelConfig to set.public BeanConfigurator getDataTransformConfig()
public void setDataTransformConfig(BeanConfigurator chartDataTransform)
chartDataTransform
- The chartDataTransform to set.public org.jfree.chart.plot.Plot getPlot()
public void setPlot(org.jfree.chart.plot.Plot chartPlot)
PROP_CHART_CONFIG
property. This is a shortcut method for when only a
single Plot
will be used (which is the case all the time unless a combined
plot is used. Do not use both this call and setPlotConfigs
on the same object.
chartPlot
- The plot to set.public void setPlots(java.util.List chartPlots)
PROP_CHART_CONFIG
property with the first Plot
in the
list. If the first Plot
is one of the combined plot types, then any additional
Plot
s in the list are added as sub-plots to the primary one. Otherwise, additional
plots are ignored.
Note: At this time, there is no way to set the weight (i.e. percentage of space occupied) by
individual sub-plots. They are all displayed with equal size.
chartPlots
- public ChartFocusHandler getFocusHandler()
public void setFocusHandler(ChartFocusHandler focusHandler)
focusHandler
- The focusHandler to set.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |