diff --git a/src/main/java/org/jfree/chart/editor/DefaultAxisEditor.java b/src/main/java/org/jfree/chart/editor/DefaultAxisEditor.java index 011c5f7e4f..9889d038fc 100644 --- a/src/main/java/org/jfree/chart/editor/DefaultAxisEditor.java +++ b/src/main/java/org/jfree/chart/editor/DefaultAxisEditor.java @@ -77,61 +77,61 @@ class DefaultAxisEditor extends JPanel implements ActionListener { /** The axis label. */ - private JTextField label; + protected JTextField label; /** The label font. */ - private Font labelFont; + protected Font labelFont; /** The label paint. */ - private PaintSample labelPaintSample; + protected PaintSample labelPaintSample; /** A field showing a description of the label font. */ - private JTextField labelFontField; + protected JTextField labelFontField; /** The font for displaying tick labels on the axis. */ - private Font tickLabelFont; + protected Font tickLabelFont; /** * A field containing a description of the font for displaying tick labels * on the axis. */ - private JTextField tickLabelFontField; + protected JTextField tickLabelFontField; /** The paint (color) for the tick labels. */ - private PaintSample tickLabelPaintSample; + protected PaintSample tickLabelPaintSample; /** * An empty sub-panel for extending the user interface to handle more * complex axes. */ - private JPanel slot1; + protected JPanel slot1; /** * An empty sub-panel for extending the user interface to handle more * complex axes. */ - private JPanel slot2; + protected JPanel slot2; /** A flag that indicates whether or not the tick labels are visible. */ - private JCheckBox showTickLabelsCheckBox; + protected JCheckBox showTickLabelsCheckBox; /** A flag that indicates whether or not the tick marks are visible. */ - private JCheckBox showTickMarksCheckBox; + protected JCheckBox showTickMarksCheckBox; // /** Insets text field. */ -// private InsetsTextField tickLabelInsetsTextField; +// protected InsetsTextField tickLabelInsetsTextField; // // /** Label insets text field. */ -// private InsetsTextField labelInsetsTextField; +// protected InsetsTextField labelInsetsTextField; /** The tick label insets. */ - private RectangleInsets tickLabelInsets; + protected RectangleInsets tickLabelInsets; /** The label insets. */ - private RectangleInsets labelInsets; + protected RectangleInsets labelInsets; /** A tabbed pane for... */ - private JTabbedPane otherTabs; + protected JTabbedPane otherTabs; /** The resourceBundle for the localization. */ protected static ResourceBundle localizationResources @@ -417,7 +417,7 @@ else if (command.equals("SelectTickLabelFont")) { /** * Presents a font selection dialog to the user. */ - private void attemptLabelFontSelection() { + protected void attemptLabelFontSelection() { FontChooserPanel panel = new FontChooserPanel(this.labelFont); int result = JOptionPane.showConfirmDialog(this, panel, @@ -436,7 +436,7 @@ private void attemptLabelFontSelection() { /** * Allows the user the opportunity to change the outline paint. */ - private void attemptModifyLabelPaint() { + protected void attemptModifyLabelPaint() { Color c; c = JColorChooser.showDialog( this, localizationResources.getString("Label_Color"), Color.BLUE @@ -471,7 +471,7 @@ public void attemptTickLabelFontSelection() { // * individual insets values. Updates the current insets text field if // * edit is accepted. // */ -// private void editTickLabelInsets() { +// protected void editTickLabelInsets() { // InsetsChooserPanel panel = new InsetsChooserPanel( // this.tickLabelInsets); // int result = JOptionPane.showConfirmDialog( @@ -490,7 +490,7 @@ public void attemptTickLabelFontSelection() { // * individual insets values. Updates the current insets text field if edit // * is accepted. // */ -// private void editLabelInsets() { +// protected void editLabelInsets() { // InsetsChooserPanel panel = new InsetsChooserPanel(this.labelInsets); // int result = JOptionPane.showConfirmDialog( // this, panel, localizationResources.getString("Edit_Insets"), diff --git a/src/main/java/org/jfree/chart/editor/DefaultChartEditor.java b/src/main/java/org/jfree/chart/editor/DefaultChartEditor.java index 0115cfa22c..fa7c9fa3ef 100644 --- a/src/main/java/org/jfree/chart/editor/DefaultChartEditor.java +++ b/src/main/java/org/jfree/chart/editor/DefaultChartEditor.java @@ -74,19 +74,19 @@ class DefaultChartEditor extends JPanel implements ActionListener, ChartEditor { /** A panel for displaying/editing the properties of the title. */ - private DefaultTitleEditor titleEditor; + protected DefaultTitleEditor titleEditor; /** A panel for displaying/editing the properties of the plot. */ - private DefaultPlotEditor plotEditor; + protected DefaultPlotEditor plotEditor; /** * A checkbox indicating whether or not the chart is drawn with * anti-aliasing. */ - private JCheckBox antialias; + protected JCheckBox antialias; /** The chart background color. */ - private PaintSample background; + protected PaintSample background; /** The resourceBundle for the localization. */ protected static ResourceBundle localizationResources @@ -179,15 +179,15 @@ public DefaultChartEditor(JFreeChart chart) { JTabbedPane tabs = new JTabbedPane(); - this.titleEditor = new DefaultTitleEditor(title); + this.titleEditor = instantiateTitleEditor(title); this.titleEditor.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); tabs.addTab(localizationResources.getString("Title"), this.titleEditor); if (plot instanceof PolarPlot) { - this.plotEditor = new DefaultPolarPlotEditor((PolarPlot) plot); + this.plotEditor = instantiatePolarPlotEditor((PolarPlot) plot); } else { - this.plotEditor = new DefaultPlotEditor(plot); + this.plotEditor = instantiatePlotEditor(plot); } this.plotEditor.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); tabs.addTab(localizationResources.getString("Plot"), this.plotEditor); @@ -196,6 +196,40 @@ public DefaultChartEditor(JFreeChart chart) { parts.add(tabs, BorderLayout.NORTH); add(parts); } + + /** + * Instantiates the title editor + * - This can be overridden by a subclass to use a different TitleEditor that inherits DeafultTitleEditor + * @param title + * @return + */ + protected DefaultTitleEditor instantiateTitleEditor(Title title) + { + return new DefaultTitleEditor(title); + } + + /** + * Instantiates the DefaultPlotEditor + * - This can be overridden by a subclass to use a different DefaultPlotEditor that inherits DefaultPlotEditor + * @param plot + * @return + */ + protected DefaultPlotEditor instantiatePlotEditor(Plot plot) + { + return new DefaultPlotEditor(plot); + } + + /** + * Instantiates the PolarPlotEditor + * - This can be overridden by a subclass to use a different PolarPlotEditor that inherits PolarPlotEditor + * @param plot + * @return + */ + protected DefaultPolarPlotEditor instantiatePolarPlotEditor(PolarPlot plot) + { + return new DefaultPolarPlotEditor(plot); + } + /** * Returns a reference to the title editor. @@ -251,7 +285,7 @@ public void actionPerformed(ActionEvent event) { * JColorChooser, so we are only allowing a subset of all Paint objects to * be selected (fix later). */ - private void attemptModifyBackgroundPaint() { + protected void attemptModifyBackgroundPaint() { Color c; c = JColorChooser.showDialog(this, localizationResources.getString( "Background_Color"), Color.BLUE); diff --git a/src/main/java/org/jfree/chart/editor/DefaultLogAxisEditor.java b/src/main/java/org/jfree/chart/editor/DefaultLogAxisEditor.java index fcd41ef3a0..0080b455a4 100644 --- a/src/main/java/org/jfree/chart/editor/DefaultLogAxisEditor.java +++ b/src/main/java/org/jfree/chart/editor/DefaultLogAxisEditor.java @@ -56,9 +56,9 @@ */ public class DefaultLogAxisEditor extends DefaultValueAxisEditor { - private double manualTickUnitValue; + protected double manualTickUnitValue; - private JTextField manualTickUnit; + protected JTextField manualTickUnit; /** * Standard constructor: builds a property panel for the specified axis. diff --git a/src/main/java/org/jfree/chart/editor/DefaultNumberAxisEditor.java b/src/main/java/org/jfree/chart/editor/DefaultNumberAxisEditor.java index bea847b5ef..3a35ff6bd8 100644 --- a/src/main/java/org/jfree/chart/editor/DefaultNumberAxisEditor.java +++ b/src/main/java/org/jfree/chart/editor/DefaultNumberAxisEditor.java @@ -64,9 +64,9 @@ class DefaultNumberAxisEditor extends DefaultValueAxisEditor implements FocusListener { - private double manualTickUnitValue; + protected double manualTickUnitValue; - private JTextField manualTickUnit; + protected JTextField manualTickUnit; /** diff --git a/src/main/java/org/jfree/chart/editor/DefaultPlotEditor.java b/src/main/java/org/jfree/chart/editor/DefaultPlotEditor.java index c209855f6e..7d526b9c67 100644 --- a/src/main/java/org/jfree/chart/editor/DefaultPlotEditor.java +++ b/src/main/java/org/jfree/chart/editor/DefaultPlotEditor.java @@ -88,66 +88,66 @@ class DefaultPlotEditor extends JPanel implements ActionListener { /** Orientation constants. */ - private final static String[] orientationNames = {"Vertical", "Horizontal"}; - private final static int ORIENTATION_VERTICAL = 0; - private final static int ORIENTATION_HORIZONTAL = 1; + protected final static String[] orientationNames = {"Vertical", "Horizontal"}; + protected final static int ORIENTATION_VERTICAL = 0; + protected final static int ORIENTATION_HORIZONTAL = 1; /** The paint (color) used to fill the background of the plot. */ - private PaintSample backgroundPaintSample; + protected PaintSample backgroundPaintSample; /** The stroke used to draw the outline of the plot. */ - private StrokeSample outlineStrokeSample; + protected StrokeSample outlineStrokeSample; /** The paint (color) used to draw the outline of the plot. */ - private PaintSample outlinePaintSample; + protected PaintSample outlinePaintSample; /** * A panel used to display/edit the properties of the domain axis (if any). */ - private DefaultAxisEditor domainAxisPropertyPanel; + protected DefaultAxisEditor domainAxisPropertyPanel; /** * A panel used to display/edit the properties of the range axis (if any). */ - private DefaultAxisEditor rangeAxisPropertyPanel; + protected DefaultAxisEditor rangeAxisPropertyPanel; /** An array of stroke samples to choose from. */ - private StrokeSample[] availableStrokeSamples; + protected StrokeSample[] availableStrokeSamples; /** The insets for the plot. */ - private RectangleInsets plotInsets; + protected RectangleInsets plotInsets; /** * The orientation for the plot (for CategoryPlots and * XYPlots). */ - private PlotOrientation plotOrientation; + protected PlotOrientation plotOrientation; /** * The orientation combo box (for CategoryPlots and * XYPlots). */ - private JComboBox orientationCombo; + protected JComboBox orientationCombo; /** Whether or not to draw lines between each data point (for * LineAndShapeRenderers and StandardXYItemRenderers). */ - private Boolean drawLines; + protected Boolean drawLines; /** * The checkbox for whether or not to draw lines between each data point. */ - private JCheckBox drawLinesCheckBox; + protected JCheckBox drawLinesCheckBox; /** Whether or not to draw shapes at each data point (for * LineAndShapeRenderers and StandardXYItemRenderers). */ - private Boolean drawShapes; + protected Boolean drawShapes; /** * The checkbox for whether or not to draw shapes at each data point. */ - private JCheckBox drawShapesCheckBox; + protected JCheckBox drawShapesCheckBox; /** The resourceBundle for the localization. */ protected static ResourceBundle localizationResources @@ -321,7 +321,7 @@ protected JTabbedPane createPlotTabs(Plot plot) else if (plot instanceof XYPlot) { domainAxis = ((XYPlot) plot).getDomainAxis(); } - this.domainAxisPropertyPanel = DefaultAxisEditor.getInstance( + this.domainAxisPropertyPanel = instantiateAxisPropertyPanel( domainAxis); if (this.domainAxisPropertyPanel != null) { this.domainAxisPropertyPanel.setBorder( @@ -341,7 +341,7 @@ else if (plot instanceof PolarPlot) { rangeAxis = ((PolarPlot) plot).getAxis(); } - this.rangeAxisPropertyPanel = DefaultAxisEditor.getInstance(rangeAxis); + this.rangeAxisPropertyPanel = instantiateAxisPropertyPanel(rangeAxis); if (this.rangeAxisPropertyPanel != null) { this.rangeAxisPropertyPanel.setBorder( BorderFactory.createEmptyBorder(2, 2, 2, 2)); @@ -351,6 +351,17 @@ else if (plot instanceof PolarPlot) { return tabs; } + + /** + * Instantiates the Axis Editor + * - This can be overridden by a subclass to use a different DefaultAxisEditor that inherits DefaultAxisEditor + * @param axis + * @return + */ + protected DefaultAxisEditor instantiateAxisPropertyPanel(Axis axis) + { + return DefaultAxisEditor.getInstance(axis); + } /** * Returns the current plot insets. @@ -444,7 +455,7 @@ else if (command.equals("DrawShapes")) { /** * Allow the user to change the background paint. */ - private void attemptBackgroundPaintSelection() { + protected void attemptBackgroundPaintSelection() { Color c; c = JColorChooser.showDialog(this, localizationResources.getString( "Background_Color"), Color.BLUE); @@ -456,7 +467,7 @@ private void attemptBackgroundPaintSelection() { /** * Allow the user to change the outline stroke. */ - private void attemptOutlineStrokeSelection() { + protected void attemptOutlineStrokeSelection() { StrokeChooserPanel panel = new StrokeChooserPanel( this.outlineStrokeSample, this.availableStrokeSamples); int result = JOptionPane.showConfirmDialog(this, panel, @@ -472,7 +483,7 @@ private void attemptOutlineStrokeSelection() { * Allow the user to change the outline paint. We use JColorChooser, so * the user can only choose colors (a subset of all possible paints). */ - private void attemptOutlinePaintSelection() { + protected void attemptOutlinePaintSelection() { Color c; c = JColorChooser.showDialog(this, localizationResources.getString( "Outline_Color"), Color.BLUE); @@ -484,7 +495,7 @@ private void attemptOutlinePaintSelection() { // /** // * Allow the user to edit the individual insets' values. // */ -// private void editInsets() { +// protected void editInsets() { // InsetsChooserPanel panel = new InsetsChooserPanel(this.plotInsets); // int result = JOptionPane.showConfirmDialog( // this, panel, localizationResources.getString("Edit_Insets"), @@ -502,7 +513,7 @@ private void attemptOutlinePaintSelection() { * Allow the user to modify the plot orientation if this is an editor for a * CategoryPlot or a XYPlot. */ - private void attemptOrientationSelection() { + protected void attemptOrientationSelection() { int index = this.orientationCombo.getSelectedIndex(); @@ -519,7 +530,7 @@ private void attemptOrientationSelection() { * points by LineAndShapeRenderers and * StandardXYItemRenderers. */ - private void attemptDrawLinesSelection() { + protected void attemptDrawLinesSelection() { this.drawLines = Boolean.valueOf(this.drawLinesCheckBox.isSelected()); } @@ -527,7 +538,7 @@ private void attemptDrawLinesSelection() { * Allow the user to modify whether or not shapes are drawn at data points * by LineAndShapeRenderers and StandardXYItemRenderers. */ - private void attemptDrawShapesSelection() { + protected void attemptDrawShapesSelection() { this.drawShapes = Boolean.valueOf(this.drawShapesCheckBox.isSelected()); } diff --git a/src/main/java/org/jfree/chart/editor/DefaultPolarPlotEditor.java b/src/main/java/org/jfree/chart/editor/DefaultPolarPlotEditor.java index 3a0f478544..68c24886b5 100644 --- a/src/main/java/org/jfree/chart/editor/DefaultPolarPlotEditor.java +++ b/src/main/java/org/jfree/chart/editor/DefaultPolarPlotEditor.java @@ -63,16 +63,16 @@ public class DefaultPolarPlotEditor extends DefaultPlotEditor implements FocusListener { /** A text field to enter a manual TickUnit. */ - private JTextField manualTickUnit; + protected JTextField manualTickUnit; /** A text field to enter the angleOffset. */ - private JTextField angleOffset; + protected JTextField angleOffset; /** The size for the manual TickUnit. */ - private double manualTickUnitValue; + protected double manualTickUnitValue; /** The value for the plot's angle offset. */ - private double angleOffsetValue; + protected double angleOffsetValue; /** @@ -106,7 +106,7 @@ protected JTabbedPane createPlotTabs(Plot plot) { return tabs; } - private JPanel createPlotPanel() { + protected JPanel createPlotPanel() { JPanel plotPanel = new JPanel(new LCBLayout(3)); plotPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); diff --git a/src/main/java/org/jfree/chart/editor/DefaultTitleEditor.java b/src/main/java/org/jfree/chart/editor/DefaultTitleEditor.java index f2660bc005..5f2033d958 100644 --- a/src/main/java/org/jfree/chart/editor/DefaultTitleEditor.java +++ b/src/main/java/org/jfree/chart/editor/DefaultTitleEditor.java @@ -75,28 +75,28 @@ class DefaultTitleEditor extends JPanel implements ActionListener { /** Whether or not to display the title on the chart. */ - private boolean showTitle; + protected boolean showTitle; /** The checkbox to indicate whether or not to display the title. */ - private JCheckBox showTitleCheckBox; + protected JCheckBox showTitleCheckBox; /** A field for displaying/editing the title text. */ - private JTextField titleField; + protected JTextField titleField; /** The font used to draw the title. */ - private Font titleFont; + protected Font titleFont; /** A field for displaying a description of the title font. */ - private JTextField fontfield; + protected JTextField fontfield; /** The button to use to select a new title font. */ - private JButton selectFontButton; + protected JButton selectFontButton; /** The paint (color) used to draw the title. */ - private PaintSample titlePaint; + protected PaintSample titlePaint; /** The button to use to select a new paint (color) to draw the title. */ - private JButton selectPaintButton; + protected JButton selectPaintButton; /** The resourceBundle for the localization. */ protected static ResourceBundle localizationResources @@ -263,7 +263,7 @@ public void attemptPaintSelection() { * Allow the user the opportunity to change whether the title is * displayed on the chart or not. */ - private void attemptModifyShowTitle() { + protected void attemptModifyShowTitle() { this.showTitle = this.showTitleCheckBox.isSelected(); this.enableOrDisableControls(); } @@ -272,7 +272,7 @@ private void attemptModifyShowTitle() { * If we are supposed to show the title, the controls are enabled. * If we are not supposed to show the title, the controls are disabled. */ - private void enableOrDisableControls() { + protected void enableOrDisableControls() { boolean enabled = (this.showTitle == true); this.titleField.setEnabled(enabled); this.selectFontButton.setEnabled(enabled); diff --git a/src/main/java/org/jfree/chart/editor/DefaultValueAxisEditor.java b/src/main/java/org/jfree/chart/editor/DefaultValueAxisEditor.java index 62fe12d1e7..9ced59c56b 100644 --- a/src/main/java/org/jfree/chart/editor/DefaultValueAxisEditor.java +++ b/src/main/java/org/jfree/chart/editor/DefaultValueAxisEditor.java @@ -74,41 +74,41 @@ class DefaultValueAxisEditor extends DefaultAxisEditor /** A flag that indicates whether or not the axis range is determined * automatically. */ - private boolean autoRange; + protected boolean autoRange; /** Flag if auto-tickunit-selection is enabled. */ - private boolean autoTickUnitSelection; + protected boolean autoTickUnitSelection; /** The lowest value in the axis range. */ - private double minimumValue; + protected double minimumValue; /** The highest value in the axis range. */ - private double maximumValue; + protected double maximumValue; /** A checkbox that indicates whether or not the axis range is determined * automatically. */ - private JCheckBox autoRangeCheckBox; + protected JCheckBox autoRangeCheckBox; /** A check-box enabling/disabling auto-tickunit-selection. */ - private JCheckBox autoTickUnitSelectionCheckBox; + protected JCheckBox autoTickUnitSelectionCheckBox; /** A text field for entering the minimum value in the axis range. */ - private JTextField minimumRangeValue; + protected JTextField minimumRangeValue; /** A text field for entering the maximum value in the axis range. */ - private JTextField maximumRangeValue; + protected JTextField maximumRangeValue; /** The paint selected for drawing the gridlines. */ - private PaintSample gridPaintSample; + protected PaintSample gridPaintSample; /** The stroke selected for drawing the gridlines. */ - private StrokeSample gridStrokeSample; + protected StrokeSample gridStrokeSample; /** An array of stroke samples to choose from (since I haven't written a * decent StrokeChooser component yet). */ - private StrokeSample[] availableStrokeSamples; + protected StrokeSample[] availableStrokeSamples; /** The resourceBundle for the localization. */ protected static ResourceBundle localizationResources