JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.chart
Class JCDefaultChartLabelManager

java.lang.Object
  |
  +--com.klg.jclass.chart.JCDefaultChartLabelManager
All Implemented Interfaces:
JCChartLabelManager, Serializable

public class JCDefaultChartLabelManager
extends Object
implements JCChartLabelManager, Serializable

JCDefaultChartLabelManager provides the default implementation for managing ChartLabels on a chart.

See Also:
Serialized Form

Field Summary
protected  Hashtable autoLabelListHashtable
           
protected  com.klg.jclass.chart.JCChartLabel currentDwellLabel
           
protected  Vector dwellLabels
           
static String ERRMSG_INVALID_LABEL_INDEX
           
protected  Vector labels
           
protected  com.klg.jclass.chart.JCChart parentChart
           
 
Constructor Summary
JCDefaultChartLabelManager()
           
 
Method Summary
 void addAutoLabels(com.klg.jclass.chart.ChartDataView cdv, int addSeries, int addPoint)
          Adds some automatically created JCChartLabels.
 void addChartLabel(com.klg.jclass.chart.JCChartLabel label)
          Adds a chart labelin the process, it forces a recalc and a redraw of the parent chart.
 void addToDwellLabels(com.klg.jclass.chart.JCChartLabel label)
          Adds a new chart label to the list of dwell labels.
protected  void appendChartLabel(com.klg.jclass.chart.JCChartLabel label)
          Adds a chart label quietly.
 void clearAutoLabels(com.klg.jclass.chart.ChartDataView cdv)
          Clears the auto labels list for this data view.
protected  com.klg.jclass.chart.JCChartLabel createAutoLabel(String label, com.klg.jclass.chart.ChartDataViewSeries srs, int point)
          Creates one automatically generated chart label.
 String createAutoLabelText(com.klg.jclass.chart.ChartDataView cdv, int series, int point)
          Creates the text for an auto label given the series and point.
protected  void deleteChartLabel(com.klg.jclass.chart.JCChartLabel label)
          Removes a chart label with no update.
 void generateAutoLabels(com.klg.jclass.chart.ChartDataView cdv)
          Automatically creates JCChartLabels for every series and point, if requested.
 com.klg.jclass.chart.JCChartLabel[][] getAutoLabelList(com.klg.jclass.chart.ChartDataView cdv)
          Gets the AutoLabelList property for the ChartDataView object.
 List getChartLabels()
          Gets the value of the ChartLabels indexed property.
 com.klg.jclass.chart.JCChartLabel getChartLabels(int index)
          Gets a value of the ChartLabels indexed property.
 com.klg.jclass.chart.JCChartLabel getCurrentDwellLabel()
          Gets the current dwell label.
 Point getCurrentDwellLabelAttachPoint()
          Gets the AttachPoint property of the current dwell label, if one exists.
 JComponent getCurrentDwellLabelComponent()
          Gets the Component property of the current dwell label.
 int getNumChartLabels()
          Gets the current number of chart labels.
 com.klg.jclass.chart.JCChart getParentChart()
          Gets the parent chart, whose chart labels are managed by this class.
 boolean locateCurrentDwellLabel(int x, int y)
          Locates the current dwell label (setting the currentDwellLabel variable in the process) that is associated with the given coordinates.
 void markAllChartLabelsForRecalc()
          Marks all chart labels for later recalculation.
 void paintConnectors(Graphics gc)
          Paints the connectors between the chart labels and the points they are connected to.
 void recalcChangedChartLabels()
          Forces recalculation of any chart labels marked for a recalc.
 void removeAllChartLabels()
          Removes all of the chart labels.
 void removeAutoLabels(com.klg.jclass.chart.ChartDataView cdv)
          Removes all of the automatically created JCChartLabels.
 void removeAutoLabels(com.klg.jclass.chart.ChartDataView cdv, int remSeries, int remPoint)
          Removes some of the automatically created JCChartLabels.
 void removeChartLabel(com.klg.jclass.chart.JCChartLabel label)
          Removes a chart label, forcing a recalc of the label being removed and a redraw of the parent chart.
 void removeFromDwellLabels(com.klg.jclass.chart.JCChartLabel label)
          Removes a chart label to the list of dwell labels.
 void setAutoLabelText(com.klg.jclass.chart.ChartDataView cdv, int series, int point)
          Sets the text on an auto label given the series and point.
 void setChartLabels(int index, com.klg.jclass.chart.JCChartLabel lbl)
          Sets a value of the ChartLabels indexed property.
 void setChartLabels(List s)
          Sets the value of the ChartLabels indexed property.
 void setParentChart(com.klg.jclass.chart.JCChart chart)
          Sets the parent chart, whose chart labels are manged by this class.
 void updateParent(int cf)
          Updates the parent chart based on the type of change made to the child chart label.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERRMSG_INVALID_LABEL_INDEX

public static final String ERRMSG_INVALID_LABEL_INDEX
See Also:
Constant Field Values

labels

protected Vector labels

dwellLabels

protected Vector dwellLabels

currentDwellLabel

protected com.klg.jclass.chart.JCChartLabel currentDwellLabel

autoLabelListHashtable

protected Hashtable autoLabelListHashtable

parentChart

protected com.klg.jclass.chart.JCChart parentChart
Constructor Detail

JCDefaultChartLabelManager

public JCDefaultChartLabelManager()
Method Detail

setParentChart

public void setParentChart(com.klg.jclass.chart.JCChart chart)
Sets the parent chart, whose chart labels are manged by this class.

Specified by:
setParentChart in interface JCChartLabelManager
Parameters:
chart - parent JCChart instance

getParentChart

public com.klg.jclass.chart.JCChart getParentChart()
Gets the parent chart, whose chart labels are managed by this class.

Specified by:
getParentChart in interface JCChartLabelManager
Returns:
parent JCChart instance

paintConnectors

public void paintConnectors(Graphics gc)
Paints the connectors between the chart labels and the points they are connected to. Only used for dwell labels.

Specified by:
paintConnectors in interface JCChartLabelManager
Parameters:
gc - Graphics object of parent chart; used for painting connectors

addChartLabel

public void addChartLabel(com.klg.jclass.chart.JCChartLabel label)
Adds a chart labelin the process, it forces a recalc and a redraw of the parent chart.

Specified by:
addChartLabel in interface JCChartLabelManager
Parameters:
label - the JCChartLabel instance to add

appendChartLabel

protected void appendChartLabel(com.klg.jclass.chart.JCChartLabel label)
Adds a chart label quietly. If the label is a dwell label, it is also added to the list of dwell labels.

Parameters:
label -

addToDwellLabels

public void addToDwellLabels(com.klg.jclass.chart.JCChartLabel label)
Adds a new chart label to the list of dwell labels.

Specified by:
addToDwellLabels in interface JCChartLabelManager
Parameters:
label - the JCChartLabel instance being added to the dwell label list

locateCurrentDwellLabel

public boolean locateCurrentDwellLabel(int x,
                                       int y)
Locates the current dwell label (setting the currentDwellLabel variable in the process) that is associated with the given coordinates.

Specified by:
locateCurrentDwellLabel in interface JCChartLabelManager
Parameters:
x - the x coordinate within the JCChartArea
y - the y coordinate within the JCChartArea
Returns:
true if dwell label found; false otherwise

getCurrentDwellLabelAttachPoint

public Point getCurrentDwellLabelAttachPoint()
Gets the AttachPoint property of the current dwell label, if one exists.

Specified by:
getCurrentDwellLabelAttachPoint in interface JCChartLabelManager
Returns:
the AttachPoint property of the current dwell label, an instance of the Point object, or null.

getCurrentDwellLabelComponent

public JComponent getCurrentDwellLabelComponent()
Gets the Component property of the current dwell label.

Specified by:
getCurrentDwellLabelComponent in interface JCChartLabelManager
Returns:
the component part of the current dwell label, an instance of the JComponent class

getCurrentDwellLabel

public com.klg.jclass.chart.JCChartLabel getCurrentDwellLabel()
Gets the current dwell label.

Specified by:
getCurrentDwellLabel in interface JCChartLabelManager
Returns:
the current dwell label, an instance of the JCChartLabel class

removeChartLabel

public void removeChartLabel(com.klg.jclass.chart.JCChartLabel label)
Removes a chart label, forcing a recalc of the label being removed and a redraw of the parent chart.

Specified by:
removeChartLabel in interface JCChartLabelManager
Parameters:
label - the JCChartLabel instance to remove from the chart label list

deleteChartLabel

protected void deleteChartLabel(com.klg.jclass.chart.JCChartLabel label)
Removes a chart label with no update. If the label is a dwell label, it is also removed from the list of dwell labels.

Parameters:
label - the JCChartLabel instance to remove from the chart label list

removeFromDwellLabels

public void removeFromDwellLabels(com.klg.jclass.chart.JCChartLabel label)
Removes a chart label to the list of dwell labels.

Specified by:
removeFromDwellLabels in interface JCChartLabelManager
Parameters:
label - the JCChartLabel instance to remove from the dwell label list

getNumChartLabels

public int getNumChartLabels()
Gets the current number of chart labels.

Specified by:
getNumChartLabels in interface JCChartLabelManager
Returns:
the number of chart labels this manager holds

removeAllChartLabels

public void removeAllChartLabels()
Removes all of the chart labels. If the AutoLabel property has been set on any of the Chart's DataViews, the property will be set to false and the list of auto labels nulled out.

Specified by:
removeAllChartLabels in interface JCChartLabelManager

getChartLabels

public com.klg.jclass.chart.JCChartLabel getChartLabels(int index)
Gets a value of the ChartLabels indexed property. The ChartLabels property controls a list of chart labels managed by the chart.

Specified by:
getChartLabels in interface JCChartLabelManager
Parameters:
index - position at which to add the new object
Returns:
requested chart label

setChartLabels

public void setChartLabels(int index,
                           com.klg.jclass.chart.JCChartLabel lbl)
Sets a value of the ChartLabels indexed property. The ChartLabels property controls a list of chart labels managed by the chart.

Specified by:
setChartLabels in interface JCChartLabelManager
Parameters:
index - Position at which to add the new object. To add a new item at the end, set the position to the current size of the labels array.
lbl - new chart label to be added
Throws:
IllegalArgumentException - Thrown if the index is larger than the size of the array.

getChartLabels

public List getChartLabels()
Gets the value of the ChartLabels indexed property. The ChartLabels property controls a list of chart labels managed by the chart.

Specified by:
getChartLabels in interface JCChartLabelManager
Returns:
List object containing all the chart labels for this JCChart
Since:
JClass 4.0K for Java 2. If you are using JClass 4.0J, which is based on JDK 1.1, this field's or method's return type is based on the corresponding com.sun.java.util class.

setChartLabels

public void setChartLabels(List s)
Sets the value of the ChartLabels indexed property. The ChartLabels property controls a list of chart labels managed by the chart.

Specified by:
setChartLabels in interface JCChartLabelManager
Parameters:
s - list object containing chart labels to add to this JCChart
Since:
JClass 4.0K for Java 2. If you are using JClass 4.0J, which is based on JDK 1.1, this method's parameter must be a com.sun.java.util.collections.List.

markAllChartLabelsForRecalc

public void markAllChartLabelsForRecalc()
Marks all chart labels for later recalculation.

Specified by:
markAllChartLabelsForRecalc in interface JCChartLabelManager

recalcChangedChartLabels

public void recalcChangedChartLabels()
Forces recalculation of any chart labels marked for a recalc. This is necessary when chart label property changes force a chart layout.

Specified by:
recalcChangedChartLabels in interface JCChartLabelManager

getAutoLabelList

public com.klg.jclass.chart.JCChartLabel[][] getAutoLabelList(com.klg.jclass.chart.ChartDataView cdv)
Gets the AutoLabelList property for the ChartDataView object. The AutoLabelList property is a two-dimensional array of automatically-generated JCChartLabel instances, one for every point and series. The inner array is indexed by point; the outer array by series.

Specified by:
getAutoLabelList in interface JCChartLabelManager
Parameters:
cdv - the ChartDataView instance that defines the auto label list
Returns:
array of JCChartLabel objects representing the automatically generated chart labels

generateAutoLabels

public void generateAutoLabels(com.klg.jclass.chart.ChartDataView cdv)
Automatically creates JCChartLabels for every series and point, if requested. The result is saved in the autoLabelList hashtable.

Specified by:
generateAutoLabels in interface JCChartLabelManager
Parameters:
cdv - the ChartDataView instance that defines the auto label list

createAutoLabel

protected com.klg.jclass.chart.JCChartLabel createAutoLabel(String label,
                                                            com.klg.jclass.chart.ChartDataViewSeries srs,
                                                            int point)
Creates one automatically generated chart label.

Parameters:
srs -
point -
label -
Returns:
an automatically generated chart label

createAutoLabelText

public String createAutoLabelText(com.klg.jclass.chart.ChartDataView cdv,
                                  int series,
                                  int point)
Creates the text for an auto label given the series and point.

Specified by:
createAutoLabelText in interface JCChartLabelManager
Parameters:
cdv - the ChartDataView instance that defines the auto label list
series - the series number
point - the point number within the series
Returns:
text for an auto label

setAutoLabelText

public void setAutoLabelText(com.klg.jclass.chart.ChartDataView cdv,
                             int series,
                             int point)
Sets the text on an auto label given the series and point.

Specified by:
setAutoLabelText in interface JCChartLabelManager
Parameters:
cdv - the ChartDataView instance that defines the auto label list
series - the series number
point - the point number within the series

addAutoLabels

public void addAutoLabels(com.klg.jclass.chart.ChartDataView cdv,
                          int addSeries,
                          int addPoint)
Adds some automatically created JCChartLabels.

Specified by:
addAutoLabels in interface JCChartLabelManager
Parameters:
cdv - the ChartDataView instance that defines the auto label list
addSeries - The series number to which auto labels are added. If -1, add applies to all series.
addPoint - The point number within a series to which auto labels are added. If -1, auto labels are added to all points within the given series.

removeAutoLabels

public void removeAutoLabels(com.klg.jclass.chart.ChartDataView cdv,
                             int remSeries,
                             int remPoint)
Removes some of the automatically created JCChartLabels.

Specified by:
removeAutoLabels in interface JCChartLabelManager
Parameters:
cdv - the ChartDataView instance that defines the auto label list
remSeries - The series number to which auto labels are removed. If -1, remove applies to all series.
remPoint - The point number within a series for which auto labels are removed. If -1, auto labels are removed from all points within the given series.

removeAutoLabels

public void removeAutoLabels(com.klg.jclass.chart.ChartDataView cdv)
Removes all of the automatically created JCChartLabels.

Specified by:
removeAutoLabels in interface JCChartLabelManager
Parameters:
cdv - the ChartDataView instance that defines the auto label list

clearAutoLabels

public void clearAutoLabels(com.klg.jclass.chart.ChartDataView cdv)
Clears the auto labels list for this data view. Simply removes the list's reference in the internal hashtable.
Note: It does not actually remove the labels from the chart.

Specified by:
clearAutoLabels in interface JCChartLabelManager
Parameters:
cdv - ChartDataView instance from which the auto labels are to be cleared

updateParent

public void updateParent(int cf)
Updates the parent chart based on the type of change made to the child chart label.

Specified by:
updateParent in interface JCChartLabelManager
Parameters:
cf - the changed flag

Copyright © 2004 Quest Software Inc..
All rights reserved.