📄 jfreechart.java
字号:
*/
protected void notifyListeners(ChartChangeEvent event) {
if (this.notify) {
Object[] listeners = this.changeListeners.getListenerList();
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == ChartChangeListener.class) {
((ChartChangeListener) listeners[i + 1]).chartChanged(event);
}
}
}
}
/**
* Registers an object for notification of progress events relating to the chart.
*
* @param listener the object being registered.
*/
public void addProgressListener(ChartProgressListener listener) {
this.progressListeners.add(ChartProgressListener.class, listener);
}
/**
* Deregisters an object for notification of changes to the chart.
*
* @param listener the object being deregistered.
*/
public void removeProgressListener(ChartProgressListener listener) {
this.progressListeners.remove(ChartProgressListener.class, listener);
}
/**
* Sends a {@link ChartProgressEvent} to all registered listeners.
*
* @param event information about the event that triggered the notification.
*/
protected void notifyListeners(ChartProgressEvent event) {
Object[] listeners = this.progressListeners.getListenerList();
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == ChartProgressListener.class) {
((ChartProgressListener) listeners[i + 1]).chartProgress(event);
}
}
}
/**
* Receives notification that a chart title has changed, and passes this
* on to registered listeners.
*
* @param event information about the chart title change.
*/
public void titleChanged(TitleChangeEvent event) {
event.setChart(this);
notifyListeners(event);
}
/**
* Receives notification that the chart legend has changed, and passes this
* on to registered listeners.
*
* @param event information about the chart legend change.
*/
public void legendChanged(LegendChangeEvent event) {
event.setChart(this);
notifyListeners(event);
}
/**
* Receives notification that the plot has changed, and passes this on to
* registered listeners.
*
* @param event information about the plot change.
*/
public void plotChanged(PlotChangeEvent event) {
event.setChart(this);
notifyListeners(event);
}
/**
* Tests this chart for equality with another object.
*
* @param obj the object.
*
* @return <code>true</code> or <code>false</code>.
*/
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj == this) {
return true;
}
if (obj instanceof JFreeChart) {
JFreeChart c = (JFreeChart) obj;
boolean b0 = ObjectUtils.equal(this.title, c.title);
boolean b1 = ObjectUtils.equal(this.subtitles, c.subtitles);
boolean b2 = ObjectUtils.equal(this.legend, c.legend);
boolean b3 = ObjectUtils.equal(this.plot, c.plot);
boolean b4 = (this.antialias == c.antialias);
boolean b5 = ObjectUtils.equal(this.backgroundPaint, c.backgroundPaint);
boolean b6 = ObjectUtils.equal(this.backgroundImage, c.backgroundImage);
boolean b7 = (this.backgroundImageAlignment == c.backgroundImageAlignment);
boolean b8 = (this.backgroundImageAlpha == c.backgroundImageAlpha);
boolean b9 = (this.notify == c.notify);
return b0 && b1 && b2 && b3 && b4 && b5 && b6 && b7 && b8 && b9;
}
return false;
}
/**
* Provides serialization support.
*
* @param stream the output stream.
*
* @throws IOException if there is an I/O error.
*/
private void writeObject(ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
SerialUtilities.writeStroke(this.borderStroke, stream);
SerialUtilities.writePaint(this.borderPaint, stream);
SerialUtilities.writePaint(this.backgroundPaint, stream);
}
/**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.borderStroke = SerialUtilities.readStroke(stream);
this.borderPaint = SerialUtilities.readPaint(stream);
this.backgroundPaint = SerialUtilities.readPaint(stream);
this.progressListeners = new EventListenerList();
this.changeListeners = new EventListenerList();
this.renderingHints = new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
// register as a listener with sub-components...
if (this.title != null) {
this.title.addChangeListener(this);
}
for (int i = 0; i < getSubtitleCount(); i++) {
getSubtitle(i).addChangeListener(this);
}
if (this.legend != null) {
this.legend.addChangeListener(this);
}
if (this.plot != null) {
this.plot.addChangeListener(this);
}
}
/**
* Prints information about JFreeChart to standard output.
*
* @param args no arguments are honored.
*/
public static void main(String[] args) {
System.out.println(JFreeChart.INFO.toString());
}
/**
* Returns the flag that controls whether notification of chart change events is
* suppressed.
*
* @return The flag.
*
* @deprecated Use isNotify() instead.
*/
public boolean getSuppressChartChangeEvents() {
return isNotify();
}
/**
* Sets a flag that is used to suppress notification of chart change events.
*
* @param flag the flag.
*
* @deprecated Use setNotify(boolean) instead.
*/
public void setSuppressChartChangeEvents(boolean flag) {
setNotify(!flag);
}
}
/**
* Information about the JCommon project. One instance of this class is assigned to
* <code>JFreeChart.INFO<code>.
*
* @author David Gilbert
*/
class JFreeChartInfo extends ProjectInfo {
/** Default constructor. */
public JFreeChartInfo() {
// get a locale-specific resource bundle...
String baseResourceClass = "org.jfree.chart.resources.JFreeChartResources";
ResourceBundle resources = ResourceBundle.getBundle(baseResourceClass);
setName(resources.getString("project.name"));
setVersion(resources.getString("project.version"));
setInfo(resources.getString("project.info"));
setCopyright(resources.getString("project.copyright"));
setLogo(null); // load only when required
setLicenceName("LGPL");
setLicenceText(Licences.LGPL);
setContributors(Arrays.asList(
new Contributor[] {
new Contributor("Richard Atkinson", "richard_c_atkinson@ntlworld.com"),
new Contributor("David Berry", "-"),
new Contributor("Anthony Boulestreau", "-"),
new Contributor("Jeremy Bowman", "-"),
new Contributor("Nicolas Brodu", "-"),
new Contributor("David Browning", "-"),
new Contributor("S鴕en Caspersen", "-"),
new Contributor("Chuanhao Chiu", "-"),
new Contributor("Pascal Collet", "-"),
new Contributor("Martin Cordova", "-"),
new Contributor("Paolo Cova", "-"),
new Contributor("Mike Duffy", "-"),
new Contributor("Jonathan Gabbai", "-"),
new Contributor("David Gilbert", "david.gilbert@object-refinery.com"),
new Contributor("Serge V. Grachov", "-"),
new Contributor("Joao Guilherme Del Valle", "-"),
new Contributor("Hans-Jurgen Greiner", "-"),
new Contributor("Aiman Han", "-"),
new Contributor("Jon Iles", "-"),
new Contributor("Wolfgang Irler", "-"),
new Contributor("Xun Kang", "-"),
new Contributor("Bill Kelemen", "-"),
new Contributor("Norbert Kiesel", "-"),
new Contributor("Gideon Krause", "-"),
new Contributor("Arnaud Lelievre", "-"),
new Contributor("David Li", "-"),
new Contributor("Tin Luu", "-"),
new Contributor("Craig MacFarlane", "-"),
new Contributor("Achilleus Mantzios", "-"),
new Contributor("Thomas Meier", "-"),
new Contributor("Jim Moore", "-"),
new Contributor("Jonathan Nash", "-"),
new Contributor("Barak Naveh", "-"),
new Contributor("David M. O'Donnell", "-"),
new Contributor("Krzysztof Paz", "-"),
new Contributor("Tomer Peretz", "-"),
new Contributor("Andrzej Porebski", "-"),
new Contributor("Xavier Poinsard", "-"),
new Contributor("Viktor Rajewski", "-"),
new Contributor("Eduardo Ramalho", "-"),
new Contributor("Michael Rauch", "-"),
new Contributor("Cameron Riley", "-"),
new Contributor("Dan Rivett", "d.rivett@ukonline.co.uk"),
new Contributor("Thierry Saura", "-"),
new Contributor("Andreas Schneider", "-"),
new Contributor("Jean-Luc SCHWAB", "-"),
new Contributor("Bryan Scott", "-"),
new Contributor("Roger Studner", "-"),
new Contributor("Irv Thomae", "-"),
new Contributor("Eric Thomas", "-"),
new Contributor("Rich Unger", "-"),
new Contributor("Daniel van Enckevort", "-"),
new Contributor("Laurence Vanhelsuwe", "-"),
new Contributor("Sylvain Vieujot", "-"),
new Contributor("Mark Watson", "www.markwatson.com"),
new Contributor("Alex Weber", "-"),
new Contributor("Matthew Wright", "-"),
new Contributor("Benoit Xhenseval", "-"),
new Contributor("Christian W. Zuckschwerdt",
"Christian.Zuckschwerdt@Informatik.Uni-Oldenburg.de"),
new Contributor("Hari", "-"),
new Contributor("Sam (oldman)", "-"),
}
));
setLibraries(Arrays.asList(
new Library[] {
new Library(JCommon.INFO)
}
));
}
/**
* Returns the JFreeChart logo (a picture of a gorilla).
*
* @return the JFreeChart logo.
*/
public Image getLogo() {
Image logo = super.getLogo();
if (logo == null) {
URL imageURL = ClassLoader.getSystemResource("org/jfree/chart/gorilla.jpg");
if (imageURL != null) {
ImageIcon temp = new ImageIcon(imageURL); // use ImageIcon because it waits for
// the image to load...
logo = temp.getImage();
setLogo(logo);
}
}
return logo;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -