Example #1
0
  /**
   * Updates the plot properties to match the properties defined on the panel.
   *
   * @param plot The plot.
   */
  public void updatePlotProperties(Plot plot) {
    // set the plot properties...
    plot.setBackgroundPaint(SWTUtils.toAwtColor(getBackgroundPaint()));
    plot.setOutlinePaint(SWTUtils.toAwtColor(getOutlinePaint()));
    plot.setOutlineStroke(getOutlineStroke());

    // set the axis properties
    if (this.domainAxisPropertyPanel != null) {
      Axis domainAxis = null;
      if (plot instanceof CategoryPlot) {
        CategoryPlot p = (CategoryPlot) plot;
        domainAxis = p.getDomainAxis();
      } else if (plot instanceof XYPlot) {
        XYPlot p = (XYPlot) plot;
        domainAxis = p.getDomainAxis();
      }
      if (domainAxis != null) this.domainAxisPropertyPanel.setAxisProperties(domainAxis);
    }
    if (this.rangeAxisPropertyPanel != null) {
      Axis rangeAxis = null;
      if (plot instanceof CategoryPlot) {
        CategoryPlot p = (CategoryPlot) plot;
        rangeAxis = p.getRangeAxis();
      } else if (plot instanceof XYPlot) {
        XYPlot p = (XYPlot) plot;
        rangeAxis = p.getRangeAxis();
      }
      if (rangeAxis != null) this.rangeAxisPropertyPanel.setAxisProperties(rangeAxis);
    }
    if (this.plotAppearance.getPlotOrientation() != null) {
      if (plot instanceof CategoryPlot) {
        CategoryPlot p = (CategoryPlot) plot;
        p.setOrientation(this.plotAppearance.getPlotOrientation());
      } else if (plot instanceof XYPlot) {
        XYPlot p = (XYPlot) plot;
        p.setOrientation(this.plotAppearance.getPlotOrientation());
      }
    }
  }