KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > chart > ui > PlotPropertyEditPanel


1 /* ===========================================================
2  * JFreeChart : a free chart library for the Java(tm) platform
3  * ===========================================================
4  *
5  * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
6  *
7  * Project Info: http://www.jfree.org/jfreechart/index.html
8  *
9  * This library is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17  * License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this library; if not, write to the Free Software Foundation,
21  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
24  * in the United States and other countries.]
25  *
26  * --------------------------
27  * PlotPropertyEditPanel.java
28  * --------------------------
29  * (C) Copyright 2000-2005, by Object Refinery Limited.
30  *
31  * Original Author: David Gilbert (for Object Refinery Limited);
32  * Contributor(s): Andrzej Porebski;
33  * Arnaud Lelievre;
34  * Daniel Gredler;
35  *
36  * $Id: PlotPropertyEditPanel.java,v 1.7 2005/04/21 12:51:20 mungady Exp $
37  *
38  * Changes (from 24-Aug-2001)
39  * --------------------------
40  * 24-Aug-2001 : Added standard source header. Fixed DOS encoding problem (DG);
41  * 07-Nov-2001 : Separated the JCommon Class Library classes, JFreeChart now
42  * requires jcommon.jar (DG);
43  * 21-Nov-2001 : Allowed for null axes (DG);
44  * 27-Aug-2002 : Small update to get existing axis properties working
45  * again (DG);
46  * 26-Nov-2002 : Changes by David M. O'Donnell for ContourPlot (DG);
47  * 17-Jan-2003 : Plot classes have been moved into a separate package (DG);
48  * 08-Sep-2003 : Added internationalization via use of properties
49  * resourceBundle (RFE 690236) (AL);
50  * 24-Aug-2004 : Applied patch 1014378 (DG);
51  * 17-Apr-2005 : Replaced 'new Boolean' with 'BooleanUtilities.valueOf' (DG);
52  *
53  */

54
55 package org.jfree.chart.ui;
56
57 import java.awt.BasicStroke JavaDoc;
58 import java.awt.BorderLayout JavaDoc;
59 import java.awt.Color JavaDoc;
60 import java.awt.Paint JavaDoc;
61 import java.awt.Stroke JavaDoc;
62 import java.awt.event.ActionEvent JavaDoc;
63 import java.awt.event.ActionListener JavaDoc;
64 import java.util.ResourceBundle JavaDoc;
65
66 import javax.swing.BorderFactory JavaDoc;
67 import javax.swing.JButton JavaDoc;
68 import javax.swing.JCheckBox JavaDoc;
69 import javax.swing.JColorChooser JavaDoc;
70 import javax.swing.JComboBox JavaDoc;
71 import javax.swing.JLabel JavaDoc;
72 import javax.swing.JOptionPane JavaDoc;
73 import javax.swing.JPanel JavaDoc;
74 import javax.swing.JTabbedPane JavaDoc;
75
76 import org.jfree.chart.axis.Axis;
77 import org.jfree.chart.axis.ColorBar;
78 import org.jfree.chart.plot.CategoryPlot;
79 import org.jfree.chart.plot.ContourPlot;
80 import org.jfree.chart.plot.Plot;
81 import org.jfree.chart.plot.PlotOrientation;
82 import org.jfree.chart.plot.XYPlot;
83 import org.jfree.chart.renderer.category.CategoryItemRenderer;
84 import org.jfree.chart.renderer.category.LineAndShapeRenderer;
85 import org.jfree.chart.renderer.xy.StandardXYItemRenderer;
86 import org.jfree.chart.renderer.xy.XYItemRenderer;
87 import org.jfree.layout.LCBLayout;
88 import org.jfree.ui.PaintSample;
89 import org.jfree.ui.RectangleInsets;
90 import org.jfree.ui.StrokeChooserPanel;
91 import org.jfree.ui.StrokeSample;
92 import org.jfree.util.BooleanUtilities;
93
94 /**
95  * A panel for editing the properties of a {@link Plot}.
96  */

97 public class PlotPropertyEditPanel extends JPanel JavaDoc implements ActionListener JavaDoc {
98
99     /** Orientation constants. */
100     private final static String JavaDoc[] orientationNames = {"Vertical", "Horizontal"};
101     private final static int ORIENTATION_VERTICAL = 0;
102     private final static int ORIENTATION_HORIZONTAL = 1;
103
104     /** The paint (color) used to fill the background of the plot. */
105     private PaintSample backgroundPaintSample;
106
107     /** The stroke (pen) used to draw the outline of the plot. */
108     private StrokeSample outlineStrokeSample;
109
110     /** The paint (color) used to draw the outline of the plot. */
111     private PaintSample outlinePaintSample;
112
113     /**
114      * A panel used to display/edit the properties of the domain axis (if any).
115      */

116     private AxisPropertyEditPanel domainAxisPropertyPanel;
117
118     /**
119      * A panel used to display/edit the properties of the range axis (if any).
120      */

121     private AxisPropertyEditPanel rangeAxisPropertyPanel;
122
123     /**
124      * A panel used to display/edit the properties of the colorbar axis (if
125      * any).
126      */

127     private ColorBarPropertyEditPanel colorBarAxisPropertyPanel;
128
129     /** An array of stroke samples to choose from. */
130     private StrokeSample[] availableStrokeSamples;
131
132     /** The insets for the plot. */
133     private RectangleInsets plotInsets;
134
135 // /** The insets text field. */
136
// private InsetsTextField insetsTextField;
137

138     /**
139      * The orientation for the plot (for <tt>CategoryPlot</tt>s and
140      * <tt>XYPlot</tt>s).
141      */

142     private PlotOrientation plotOrientation;
143
144     /**
145      * The orientation combo box (for <tt>CategoryPlot</tt>s and
146      * <tt>XYPlot</tt>s).
147      */

148     private JComboBox JavaDoc orientationCombo;
149
150     /** Whether or not to draw lines between each data point (for
151      * <tt>LineAndShapeRenderer</tt>s and <tt>StandardXYItemRenderer</tt>s).
152      */

153     private Boolean JavaDoc drawLines;
154
155     /**
156      * The checkbox for whether or not to draw lines between each data point.
157      */

158     private JCheckBox JavaDoc drawLinesCheckBox;
159
160     /** Whether or not to draw shapes at each data point (for
161      * <tt>LineAndShapeRenderer</tt>s and <tt>StandardXYItemRenderer</tt>s).
162      */

163     private Boolean JavaDoc drawShapes;
164
165     /**
166      * The checkbox for whether or not to draw shapes at each data point.
167      */

168     private JCheckBox JavaDoc drawShapesCheckBox;
169
170     /** The resourceBundle for the localization. */
171     protected static ResourceBundle JavaDoc localizationResources
172         = ResourceBundle.getBundle("org.jfree.chart.ui.LocalizationBundle");
173
174     /**
175      * Standard constructor - constructs a panel for editing the properties of
176      * the specified plot.
177      * <P>
178      * In designing the panel, we need to be aware that subclasses of Plot will
179      * need to implement subclasses of PlotPropertyEditPanel - so we need to
180      * leave one or two 'slots' where the subclasses can extend the user
181      * interface.
182      *
183      * @param plot the plot, which should be changed.
184      */

185     public PlotPropertyEditPanel(Plot plot) {
186
187         this.plotInsets = plot.getInsets();
188         this.backgroundPaintSample = new PaintSample(plot.getBackgroundPaint());
189         this.outlineStrokeSample = new StrokeSample(plot.getOutlineStroke());
190         this.outlinePaintSample = new PaintSample(plot.getOutlinePaint());
191         if (plot instanceof CategoryPlot) {
192             this.plotOrientation = ((CategoryPlot) plot).getOrientation();
193         }
194         else if (plot instanceof XYPlot) {
195             this.plotOrientation = ((XYPlot) plot).getOrientation();
196         }
197         if (plot instanceof CategoryPlot) {
198             CategoryItemRenderer renderer = ((CategoryPlot) plot).getRenderer();
199             if (renderer instanceof LineAndShapeRenderer) {
200                 LineAndShapeRenderer r = (LineAndShapeRenderer) renderer;
201                 this.drawLines = BooleanUtilities.valueOf(r.isLinesVisible());
202                 this.drawShapes = BooleanUtilities.valueOf(r.isShapesVisible());
203             }
204         }
205         else if (plot instanceof XYPlot) {
206             XYItemRenderer renderer = ((XYPlot) plot).getRenderer();
207             if (renderer instanceof StandardXYItemRenderer) {
208                 StandardXYItemRenderer r = (StandardXYItemRenderer) renderer;
209                 this.drawLines = BooleanUtilities.valueOf(r.getPlotLines());
210                 this.drawShapes = BooleanUtilities.valueOf(r.getPlotShapes());
211             }
212         }
213
214         setLayout(new BorderLayout JavaDoc());
215
216         this.availableStrokeSamples = new StrokeSample[3];
217         this.availableStrokeSamples[0]
218             = new StrokeSample(new BasicStroke JavaDoc(1.0f));
219         this.availableStrokeSamples[1]
220             = new StrokeSample(new BasicStroke JavaDoc(2.0f));
221         this.availableStrokeSamples[2]
222             = new StrokeSample(new BasicStroke JavaDoc(3.0f));
223
224         // create a panel for the settings...
225
JPanel JavaDoc panel = new JPanel JavaDoc(new BorderLayout JavaDoc());
226         panel.setBorder(
227             BorderFactory.createTitledBorder(
228                 BorderFactory.createEtchedBorder(),
229                 plot.getPlotType() + localizationResources.getString(":")
230             )
231         );
232
233         JPanel JavaDoc general = new JPanel JavaDoc(new BorderLayout JavaDoc());
234         general.setBorder(
235             BorderFactory.createTitledBorder(
236                 localizationResources.getString("General")
237             )
238         );
239
240         JPanel JavaDoc interior = new JPanel JavaDoc(new LCBLayout(7));
241         interior.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
242
243 // interior.add(new JLabel(localizationResources.getString("Insets")));
244
// JButton button = new JButton(
245
// localizationResources.getString("Edit...")
246
// );
247
// button.setActionCommand("Insets");
248
// button.addActionListener(this);
249
//
250
// this.insetsTextField = new InsetsTextField(this.plotInsets);
251
// this.insetsTextField.setEnabled(false);
252
// interior.add(this.insetsTextField);
253
// interior.add(button);
254

255         interior.add(
256             new JLabel JavaDoc(localizationResources.getString("Outline_stroke"))
257         );
258         JButton JavaDoc button = new JButton JavaDoc(localizationResources.getString("Select..."));
259         button.setActionCommand("OutlineStroke");
260         button.addActionListener(this);
261         interior.add(this.outlineStrokeSample);
262         interior.add(button);
263
264         interior.add(
265             new JLabel JavaDoc(localizationResources.getString("Outline_Paint"))
266         );
267         button = new JButton JavaDoc(localizationResources.getString("Select..."));
268         button.setActionCommand("OutlinePaint");
269         button.addActionListener(this);
270         interior.add(this.outlinePaintSample);
271         interior.add(button);
272
273         interior.add(
274             new JLabel JavaDoc(localizationResources.getString("Background_paint"))
275         );
276         button = new JButton JavaDoc(localizationResources.getString("Select..."));
277         button.setActionCommand("BackgroundPaint");
278         button.addActionListener(this);
279         interior.add(this.backgroundPaintSample);
280         interior.add(button);
281
282         if (this.plotOrientation != null) {
283             boolean isVertical
284                 = this.plotOrientation.equals(PlotOrientation.VERTICAL);
285             int index
286                 = isVertical ? ORIENTATION_VERTICAL : ORIENTATION_HORIZONTAL;
287             interior.add(
288                 new JLabel JavaDoc(localizationResources.getString("Orientation"))
289             );
290             this.orientationCombo = new JComboBox JavaDoc(orientationNames);
291             this.orientationCombo.setSelectedIndex(index);
292             this.orientationCombo.setActionCommand("Orientation");
293             this.orientationCombo.addActionListener(this);
294             interior.add(new JPanel JavaDoc());
295             interior.add(this.orientationCombo);
296         }
297
298         if (this.drawLines != null) {
299             interior.add(
300                 new JLabel JavaDoc(localizationResources.getString("Draw_lines"))
301             );
302             this.drawLinesCheckBox = new JCheckBox JavaDoc();
303             this.drawLinesCheckBox.setSelected(this.drawLines.booleanValue());
304             this.drawLinesCheckBox.setActionCommand("DrawLines");
305             this.drawLinesCheckBox.addActionListener(this);
306             interior.add(new JPanel JavaDoc());
307             interior.add(this.drawLinesCheckBox);
308         }
309
310         if (this.drawShapes != null) {
311             interior.add(
312                 new JLabel JavaDoc(localizationResources.getString("Draw_shapes"))
313             );
314             this.drawShapesCheckBox = new JCheckBox JavaDoc();
315             this.drawShapesCheckBox.setSelected(this.drawShapes.booleanValue());
316             this.drawShapesCheckBox.setActionCommand("DrawShapes");
317             this.drawShapesCheckBox.addActionListener(this);
318             interior.add(new JPanel JavaDoc());
319             interior.add(this.drawShapesCheckBox);
320         }
321
322         general.add(interior, BorderLayout.NORTH);
323
324         JPanel JavaDoc appearance = new JPanel JavaDoc(new BorderLayout JavaDoc());
325         appearance.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
326         appearance.add(general, BorderLayout.NORTH);
327
328         JTabbedPane JavaDoc tabs = new JTabbedPane JavaDoc();
329         tabs.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
330
331         Axis domainAxis = null;
332         if (plot instanceof CategoryPlot) {
333             domainAxis = ((CategoryPlot) plot).getDomainAxis();
334         }
335         else if (plot instanceof XYPlot) {
336             domainAxis = ((XYPlot) plot).getDomainAxis();
337         }
338         this.domainAxisPropertyPanel
339             = AxisPropertyEditPanel.getInstance(domainAxis);
340         if (this.domainAxisPropertyPanel != null) {
341             this.domainAxisPropertyPanel.setBorder(
342                 BorderFactory.createEmptyBorder(2, 2, 2, 2)
343             );
344             tabs.add(
345                 localizationResources.getString("Domain_Axis"),
346                 this.domainAxisPropertyPanel
347             );
348         }
349
350         Axis rangeAxis = null;
351         if (plot instanceof CategoryPlot) {
352             rangeAxis = ((CategoryPlot) plot).getRangeAxis();
353         }
354         else if (plot instanceof XYPlot) {
355             rangeAxis = ((XYPlot) plot).getRangeAxis();
356         }
357
358         this.rangeAxisPropertyPanel
359             = AxisPropertyEditPanel.getInstance(rangeAxis);
360         if (this.rangeAxisPropertyPanel != null) {
361             this.rangeAxisPropertyPanel.setBorder(
362                 BorderFactory.createEmptyBorder(2, 2, 2, 2)
363             );
364             tabs.add(
365                 localizationResources.getString("Range_Axis"),
366                 this.rangeAxisPropertyPanel
367             );
368         }
369
370 //dmo: added this panel for colorbar control. (start dmo additions)
371
ColorBar colorBar = null;
372         if (plot instanceof ContourPlot) {
373             colorBar = ((ContourPlot) plot).getColorBar();
374         }
375
376         this.colorBarAxisPropertyPanel
377             = ColorBarPropertyEditPanel.getInstance(colorBar);
378         if (this.colorBarAxisPropertyPanel != null) {
379             this.colorBarAxisPropertyPanel.setBorder(
380                 BorderFactory.createEmptyBorder(2, 2, 2, 2)
381             );
382             tabs.add(
383                 localizationResources.getString("Color_Bar"),
384                 this.colorBarAxisPropertyPanel
385             );
386         }
387 //dmo: (end dmo additions)
388

389         tabs.add(localizationResources.getString("Appearance"), appearance);
390         panel.add(tabs);
391
392         add(panel);
393     }
394
395     /**
396      * Returns the current plot insets.
397      *
398      * @return The current plot insets.
399      */

400     public RectangleInsets getPlotInsets() {
401         if (this.plotInsets == null) {
402             this.plotInsets = new RectangleInsets(0.0, 0.0, 0.0, 0.0);
403         }
404         return this.plotInsets;
405     }
406
407     /**
408      * Returns the current background paint.
409      *
410      * @return The current background paint.
411      */

412     public Paint JavaDoc getBackgroundPaint() {
413         return this.backgroundPaintSample.getPaint();
414     }
415
416     /**
417      * Returns the current outline stroke.
418      *
419      * @return The current outline stroke.
420      */

421     public Stroke JavaDoc getOutlineStroke() {
422         return this.outlineStrokeSample.getStroke();
423     }
424
425     /**
426      * Returns the current outline paint.
427      *
428      * @return The current outline paint.
429      */

430     public Paint JavaDoc getOutlinePaint() {
431         return this.outlinePaintSample.getPaint();
432     }
433
434     /**
435      * Returns a reference to the panel for editing the properties of the
436      * domain axis.
437      *
438      * @return A reference to a panel.
439      */

440     public AxisPropertyEditPanel getDomainAxisPropertyEditPanel() {
441         return this.domainAxisPropertyPanel;
442     }
443
444     /**
445      * Returns a reference to the panel for editing the properties of the
446      * range axis.
447      *
448      * @return A reference to a panel.
449      */

450     public AxisPropertyEditPanel getRangeAxisPropertyEditPanel() {
451         return this.rangeAxisPropertyPanel;
452     }
453
454     /**
455      * Handles user actions generated within the panel.
456      * @param event the event
457      */

458     public void actionPerformed(ActionEvent JavaDoc event) {
459         String JavaDoc command = event.getActionCommand();
460         if (command.equals("BackgroundPaint")) {
461             attemptBackgroundPaintSelection();
462         }
463         else if (command.equals("OutlineStroke")) {
464             attemptOutlineStrokeSelection();
465         }
466         else if (command.equals("OutlinePaint")) {
467             attemptOutlinePaintSelection();
468         }
469 // else if (command.equals("Insets")) {
470
// editInsets();
471
// }
472
else if (command.equals("Orientation")) {
473             attemptOrientationSelection();
474         }
475         else if (command.equals("DrawLines")) {
476             attemptDrawLinesSelection();
477         }
478         else if (command.equals("DrawShapes")) {
479             attemptDrawShapesSelection();
480         }
481     }
482
483     /**
484      * Allow the user to change the background paint.
485      */

486     private void attemptBackgroundPaintSelection() {
487         Color JavaDoc c;
488         c = JColorChooser.showDialog(
489             this, localizationResources.getString("Background_Color"),
490             Color.blue
491         );
492         if (c != null) {
493             this.backgroundPaintSample.setPaint(c);
494         }
495     }
496
497     /**
498      * Allow the user to change the outline stroke.
499      */

500     private void attemptOutlineStrokeSelection() {
501         StrokeChooserPanel panel
502             = new StrokeChooserPanel(null, this.availableStrokeSamples);
503         int result = JOptionPane.showConfirmDialog(this, panel,
504             localizationResources.getString("Stroke_Selection"),
505             JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
506
507         if (result == JOptionPane.OK_OPTION) {
508             this.outlineStrokeSample.setStroke(panel.getSelectedStroke());
509         }
510     }
511
512     /**
513      * Allow the user to change the outline paint. We use JColorChooser, so
514      * the user can only choose colors (a subset of all possible paints).
515      */

516     private void attemptOutlinePaintSelection() {
517         Color JavaDoc c;
518         c = JColorChooser.showDialog(
519             this, localizationResources.getString("Outline_Color"), Color.blue
520         );
521         if (c != null) {
522             this.outlinePaintSample.setPaint(c);
523         }
524     }
525
526 // /**
527
// * Allow the user to edit the individual insets' values.
528
// */
529
// private void editInsets() {
530
// InsetsChooserPanel panel = new InsetsChooserPanel(this.plotInsets);
531
// int result = JOptionPane.showConfirmDialog(
532
// this, panel, localizationResources.getString("Edit_Insets"),
533
// JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE
534
// );
535
//
536
// if (result == JOptionPane.OK_OPTION) {
537
// this.plotInsets = panel.getInsets();
538
// this.insetsTextField.setInsets(this.plotInsets);
539
// }
540
//
541
// }
542
//
543
/**
544      * Allow the user to modify the plot orientation if this is an editor for a
545      * <tt>CategoryPlot</tt> or a <tt>XYPlot</tt>.
546      */

547     private void attemptOrientationSelection() {
548
549         int index = this.orientationCombo.getSelectedIndex();
550
551         if (index == ORIENTATION_VERTICAL) {
552             this.plotOrientation = PlotOrientation.VERTICAL;
553         }
554         else {
555             this.plotOrientation = PlotOrientation.HORIZONTAL;
556         }
557     }
558
559     /**
560      * Allow the user to modify whether or not lines are drawn between data
561      * points by <tt>LineAndShapeRenderer</tt>s and
562      * <tt>StandardXYItemRenderer</tt>s.
563      */

564     private void attemptDrawLinesSelection() {
565         this.drawLines = BooleanUtilities.valueOf(
566             this.drawLinesCheckBox.isSelected()
567         );
568     }
569
570     /**
571      * Allow the user to modify whether or not shapes are drawn at data points
572      * by <tt>LineAndShapeRenderer</tt>s and <tt>StandardXYItemRenderer</tt>s.
573      */

574     private void attemptDrawShapesSelection() {
575         this.drawShapes = BooleanUtilities.valueOf(
576             this.drawShapesCheckBox.isSelected()
577         );
578     }
579
580     /**
581      * Updates the plot properties to match the properties defined on the panel.
582      *
583      * @param plot The plot.
584      */

585     public void updatePlotProperties(Plot plot) {
586
587         // set the plot properties...
588
plot.setOutlinePaint(getOutlinePaint());
589         plot.setOutlineStroke(getOutlineStroke());
590         plot.setBackgroundPaint(getBackgroundPaint());
591         plot.setInsets(getPlotInsets());
592
593         // then the axis properties...
594
if (this.domainAxisPropertyPanel != null) {
595             Axis domainAxis = null;
596             if (plot instanceof CategoryPlot) {
597                 CategoryPlot p = (CategoryPlot) plot;
598                 domainAxis = p.getDomainAxis();
599             }
600             else if (plot instanceof XYPlot) {
601                 XYPlot p = (XYPlot) plot;
602                 domainAxis = p.getDomainAxis();
603             }
604             if (domainAxis != null) {
605                 this.domainAxisPropertyPanel.setAxisProperties(domainAxis);
606             }
607         }
608
609         if (this.rangeAxisPropertyPanel != null) {
610             Axis rangeAxis = null;
611             if (plot instanceof CategoryPlot) {
612                 CategoryPlot p = (CategoryPlot) plot;
613                 rangeAxis = p.getRangeAxis();
614             }
615             else if (plot instanceof XYPlot) {
616                 XYPlot p = (XYPlot) plot;
617                 rangeAxis = p.getRangeAxis();
618             }
619             if (rangeAxis != null) {
620                 this.rangeAxisPropertyPanel.setAxisProperties(rangeAxis);
621             }
622         }
623
624         if (this.plotOrientation != null) {
625             if (plot instanceof CategoryPlot) {
626                 CategoryPlot p = (CategoryPlot) plot;
627                 p.setOrientation(this.plotOrientation);
628             }
629             else if (plot instanceof XYPlot) {
630                 XYPlot p = (XYPlot) plot;
631                 p.setOrientation(this.plotOrientation);
632             }
633         }
634
635         if (this.drawLines != null) {
636             if (plot instanceof CategoryPlot) {
637                 CategoryPlot p = (CategoryPlot) plot;
638                 CategoryItemRenderer r = p.getRenderer();
639                 if (r instanceof LineAndShapeRenderer) {
640                     ((LineAndShapeRenderer) r).setLinesVisible(
641                         this.drawLines.booleanValue()
642                     );
643                 }
644             }
645             else if (plot instanceof XYPlot) {
646                 XYPlot p = (XYPlot) plot;
647                 XYItemRenderer r = p.getRenderer();
648                 if (r instanceof StandardXYItemRenderer) {
649                     ((StandardXYItemRenderer) r).setPlotLines(
650                         this.drawLines.booleanValue()
651                     );
652                 }
653             }
654         }
655
656         if (this.drawShapes != null) {
657             if (plot instanceof CategoryPlot) {
658                 CategoryPlot p = (CategoryPlot) plot;
659                 CategoryItemRenderer r = p.getRenderer();
660                 if (r instanceof LineAndShapeRenderer) {
661                     ((LineAndShapeRenderer) r).setShapesVisible(
662                         this.drawShapes.booleanValue()
663                     );
664                 }
665             }
666             else if (plot instanceof XYPlot) {
667                 XYPlot p = (XYPlot) plot;
668                 XYItemRenderer r = p.getRenderer();
669                 if (r instanceof StandardXYItemRenderer) {
670                     ((StandardXYItemRenderer) r).setPlotShapes(
671                         this.drawShapes.booleanValue()
672                     );
673                 }
674             }
675         }
676
677 //dmo: added this panel for colorbar control. (start dmo additions)
678
if (this.colorBarAxisPropertyPanel != null) {
679             ColorBar colorBar = null;
680             if (plot instanceof ContourPlot) {
681                 ContourPlot p = (ContourPlot) plot;
682                 colorBar = p.getColorBar();
683             }
684             if (colorBar != null) {
685                 this.colorBarAxisPropertyPanel.setAxisProperties(colorBar);
686             }
687         }
688 //dmo: (end dmo additions)
689

690     }
691
692 }
693
Popular Tags