Java Code Examples for org.jfree.chart.plot.Zoomable#isDomainZoomable()

The following examples show how to use org.jfree.chart.plot.Zoomable#isDomainZoomable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChartPanel.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the flag that controls whether or not zooming is enabled for the
 * domain axis.  A check is made to ensure that the current plot supports
 * zooming for the domain values.
 *
 * @param flag  <code>true</code> enables zooming if possible.
 */
public void setDomainZoomable(boolean flag) {
    if (flag) {
        Plot plot = this.chart.getPlot();
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = flag && (z.isDomainZoomable());
        }
    }
    else {
        this.domainZoomable = false;
    }
}
 
Example 2
Source File: AbstractChartPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Sets the flag that controls whether or not zooming is enable for the domain axis. A check is
 * made to ensure that the current plot supports zooming for the domain values.
 * 
 * @param flag
 *            <code>true</code> enables zooming if possible.
 */

@Override
public void setDomainZoomable(boolean flag) {
	if (flag) {
		Plot plot = this.chart.getPlot();
		if (plot instanceof Zoomable) {
			Zoomable z = (Zoomable) plot;
			this.domainZoomable = flag && z.isDomainZoomable();
		}
	} else {
		this.domainZoomable = false;
	}
}
 
Example 3
Source File: AbstractChartPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Sets the chart that is displayed in the panel.
 * 
 * @param chart
 *            the chart (<code>null</code> permitted).
 */

@Override
public void setChart(JFreeChart chart) {

	// stop listening for changes to the existing chart
	if (this.chart != null) {
		this.chart.removeChangeListener(this);
		this.chart.removeProgressListener(this);
	}

	// add the new chart
	this.chart = chart;
	if (chart != null) {
		this.chart.addChangeListener(this);
		this.chart.addProgressListener(this);
		Plot plot = chart.getPlot();
		this.domainZoomable = false;
		this.rangeZoomable = false;
		if (plot instanceof Zoomable) {
			Zoomable z = (Zoomable) plot;
			this.domainZoomable = z.isDomainZoomable();
			this.rangeZoomable = z.isRangeZoomable();
			this.orientation = z.getOrientation();
		}
	} else {
		this.domainZoomable = false;
		this.rangeZoomable = false;
	}

	repaint();

}
 
Example 4
Source File: ChartPanel.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the flag that controls whether or not zooming is enabled for the
 * domain axis.  A check is made to ensure that the current plot supports
 * zooming for the domain values.
 *
 * @param flag  <code>true</code> enables zooming if possible.
 */
public void setDomainZoomable(boolean flag) {
    if (flag) {
        Plot plot = this.chart.getPlot();
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = flag && (z.isDomainZoomable());
        }
    }
    else {
        this.domainZoomable = false;
    }
}
 
Example 5
Source File: ChartPanel.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the chart that is displayed in the panel.
 *
 * @param chart  the chart (<code>null</code> permitted).
 */
public void setChart(JFreeChart chart) {

    // stop listening for changes to the existing chart
    if (this.chart != null) {
        this.chart.removeChangeListener(this);
        this.chart.removeProgressListener(this);
    }

    // add the new chart
    this.chart = chart;
    if (chart != null) {
        this.chart.addChangeListener(this);
        this.chart.addProgressListener(this);
        Plot plot = chart.getPlot();
        this.domainZoomable = false;
        this.rangeZoomable = false;
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = z.isDomainZoomable();
            this.rangeZoomable = z.isRangeZoomable();
            this.orientation = z.getOrientation();
        }
    }
    else {
        this.domainZoomable = false;
        this.rangeZoomable = false;
    }
    if (this.useBuffer) {
        this.refreshBuffer = true;
    }
    repaint();

}
 
Example 6
Source File: ChartComposite.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the flag that controls whether or not zooming is enable for the
 * domain axis.  A check is made to ensure that the current plot supports
 * zooming for the domain values.
 *
 * @param flag  <code>true</code> enables zooming if possible.
 */
public void setDomainZoomable(boolean flag) {
    if (flag) {
        Plot plot = this.chart.getPlot();
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = flag && (z.isDomainZoomable());
        }
    }
    else {
        this.domainZoomable = false;
    }
}
 
Example 7
Source File: ChartComposite.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the chart that is displayed in the panel.
 *
 * @param chart  the chart (<code>null</code> permitted).
 */
public void setChart(JFreeChart chart) {
    // stop listening for changes to the existing chart
    if (this.chart != null) {
        this.chart.removeChangeListener(this);
        this.chart.removeProgressListener(this);
    }

    // add the new chart
    this.chart = chart;
    if (chart != null) {
        this.chart.addChangeListener(this);
        this.chart.addProgressListener(this);
        Plot plot = chart.getPlot();
        this.domainZoomable = false;
        this.rangeZoomable = false;
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = z.isDomainZoomable();
            this.rangeZoomable = z.isRangeZoomable();
            this.orientation = z.getOrientation();
        }
    }
    else {
        this.domainZoomable = false;
        this.rangeZoomable = false;
    }
    if (this.useBuffer) {
        this.refreshBuffer = true;
    }
}
 
Example 8
Source File: ChartComposite.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the chart that is displayed in the panel.
 *
 * @param chart  the chart (<code>null</code> permitted).
 */
public void setChart(JFreeChart chart) {
    // stop listening for changes to the existing chart
    if (this.chart != null) {
        this.chart.removeChangeListener(this);
        this.chart.removeProgressListener(this);
    }

    // add the new chart
    this.chart = chart;
    if (chart != null) {
        this.chart.addChangeListener(this);
        this.chart.addProgressListener(this);
        Plot plot = chart.getPlot();
        this.domainZoomable = false;
        this.rangeZoomable = false;
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = z.isDomainZoomable();
            this.rangeZoomable = z.isRangeZoomable();
            this.orientation = z.getOrientation();
        }
    }
    else {
        this.domainZoomable = false;
        this.rangeZoomable = false;
    }
    if (this.useBuffer) {
        this.refreshBuffer = true;
    }
}
 
Example 9
Source File: ChartPanel.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the chart that is displayed in the panel.
 *
 * @param chart  the chart (<code>null</code> permitted).
 */
public void setChart(JFreeChart chart) {

    // stop listening for changes to the existing chart
    if (this.chart != null) {
        this.chart.removeChangeListener(this);
        this.chart.removeProgressListener(this);
    }

    // add the new chart
    this.chart = chart;
    if (chart != null) {
        this.chart.addChangeListener(this);
        this.chart.addProgressListener(this);
        Plot plot = chart.getPlot();
        this.domainZoomable = false;
        this.rangeZoomable = false;
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = z.isDomainZoomable();
            this.rangeZoomable = z.isRangeZoomable();
            this.orientation = z.getOrientation();
        }
    }
    else {
        this.domainZoomable = false;
        this.rangeZoomable = false;
    }
    if (this.useBuffer) {
        this.refreshBuffer = true;
    }
    repaint();

}
 
Example 10
Source File: ChartComposite.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the chart that is displayed in the panel.
 *
 * @param chart  the chart (<code>null</code> permitted).
 */
public void setChart(JFreeChart chart) {
    // stop listening for changes to the existing chart
    if (this.chart != null) {
        this.chart.removeChangeListener(this);
        this.chart.removeProgressListener(this);
    }

    // add the new chart
    this.chart = chart;
    if (chart != null) {
        this.chart.addChangeListener(this);
        this.chart.addProgressListener(this);
        Plot plot = chart.getPlot();
        this.domainZoomable = false;
        this.rangeZoomable = false;
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = z.isDomainZoomable();
            this.rangeZoomable = z.isRangeZoomable();
            this.orientation = z.getOrientation();
        }
    }
    else {
        this.domainZoomable = false;
        this.rangeZoomable = false;
    }
    if (this.useBuffer) {
        this.refreshBuffer = true;
    }
}
 
Example 11
Source File: ChartPanel.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the flag that controls whether or not zooming is enabled for the
 * domain axis.  A check is made to ensure that the current plot supports
 * zooming for the domain values.
 *
 * @param flag  <code>true</code> enables zooming if possible.
 */
public void setDomainZoomable(boolean flag) {
    if (flag) {
        Plot plot = this.chart.getPlot();
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = flag && (z.isDomainZoomable());
        }
    }
    else {
        this.domainZoomable = false;
    }
}
 
Example 12
Source File: ChartPanel.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the chart that is displayed in the panel.
 *
 * @param chart  the chart (<code>null</code> permitted).
 */
public void setChart(JFreeChart chart) {

    // stop listening for changes to the existing chart
    if (this.chart != null) {
        this.chart.removeChangeListener(this);
        this.chart.removeProgressListener(this);
    }

    // add the new chart
    this.chart = chart;
    if (chart != null) {
        this.chart.addChangeListener(this);
        this.chart.addProgressListener(this);
        Plot plot = chart.getPlot();
        this.domainZoomable = false;
        this.rangeZoomable = false;
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = z.isDomainZoomable();
            this.rangeZoomable = z.isRangeZoomable();
            this.orientation = z.getOrientation();
        }
    }
    else {
        this.domainZoomable = false;
        this.rangeZoomable = false;
    }
    if (this.useBuffer) {
        this.refreshBuffer = true;
    }
    repaint();

}
 
Example 13
Source File: ChartComposite.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the flag that controls whether or not zooming is enable for the
 * domain axis.  A check is made to ensure that the current plot supports
 * zooming for the domain values.
 *
 * @param flag  <code>true</code> enables zooming if possible.
 */
public void setDomainZoomable(boolean flag) {
    if (flag) {
        Plot plot = this.chart.getPlot();
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            this.domainZoomable = flag && (z.isDomainZoomable());
        }
    }
    else {
        this.domainZoomable = false;
    }
}
 
Example 14
Source File: ChartComposite.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * The idea is to modify the zooming options depending on the type of chart
 * being displayed by the panel.
 *
 * @param x  horizontal position of the popup.
 * @param y  vertical position of the popup.
 */
protected void displayPopupMenu(int x, int y) {
    if (this.popup != null) {
        // go through each zoom menu item and decide whether or not to
        // enable it...
        Plot plot = this.chart.getPlot();
        boolean isDomainZoomable = false;
        boolean isRangeZoomable = false;
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            isDomainZoomable = z.isDomainZoomable();
            isRangeZoomable = z.isRangeZoomable();
        }
        if (this.zoomInDomainMenuItem != null) {
            this.zoomInDomainMenuItem.setEnabled(isDomainZoomable);
        }
        if (this.zoomOutDomainMenuItem != null) {
            this.zoomOutDomainMenuItem.setEnabled(isDomainZoomable);
        }
        if (this.zoomResetDomainMenuItem != null) {
            this.zoomResetDomainMenuItem.setEnabled(isDomainZoomable);
        }

        if (this.zoomInRangeMenuItem != null) {
            this.zoomInRangeMenuItem.setEnabled(isRangeZoomable);
        }
        if (this.zoomOutRangeMenuItem != null) {
            this.zoomOutRangeMenuItem.setEnabled(isRangeZoomable);
        }

        if (this.zoomResetRangeMenuItem != null) {
            this.zoomResetRangeMenuItem.setEnabled(isRangeZoomable);
        }

        if (this.zoomInBothMenuItem != null) {
            this.zoomInBothMenuItem.setEnabled(isDomainZoomable
                    & isRangeZoomable);
        }
        if (this.zoomOutBothMenuItem != null) {
            this.zoomOutBothMenuItem.setEnabled(isDomainZoomable
                    & isRangeZoomable);
        }
        if (this.zoomResetBothMenuItem != null) {
            this.zoomResetBothMenuItem.setEnabled(isDomainZoomable
                    & isRangeZoomable);
        }

        this.popup.setLocation(x, y);
        this.popup.setVisible(true);
    }

}
 
Example 15
Source File: AbstractChartPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * The idea is to modify the zooming options depending on the type of chart being displayed by
 * the panel.
 * 
 * @param x
 *            horizontal position of the popup.
 * @param y
 *            vertical position of the popup.
 */

@Override
protected void displayPopupMenu(int x, int y) {

	if (this.popup == null) {
		return;
	}

	// go through each zoom menu item and decide whether or not to
	// enable it...
	boolean isDomainZoomable = false;
	boolean isRangeZoomable = false;
	Plot plot = this.chart != null ? this.chart.getPlot() : null;
	if (plot instanceof Zoomable) {
		Zoomable z = (Zoomable) plot;
		isDomainZoomable = z.isDomainZoomable();
		isRangeZoomable = z.isRangeZoomable();
	}

	if (this.zoomInDomainMenuItem != null) {
		this.zoomInDomainMenuItem.setEnabled(isDomainZoomable);
	}
	if (this.zoomOutDomainMenuItem != null) {
		this.zoomOutDomainMenuItem.setEnabled(isDomainZoomable);
	}
	if (this.zoomResetDomainMenuItem != null) {
		this.zoomResetDomainMenuItem.setEnabled(isDomainZoomable);
	}

	if (this.zoomInRangeMenuItem != null) {
		this.zoomInRangeMenuItem.setEnabled(isRangeZoomable);
	}
	if (this.zoomOutRangeMenuItem != null) {
		this.zoomOutRangeMenuItem.setEnabled(isRangeZoomable);
	}

	if (this.zoomResetRangeMenuItem != null) {
		this.zoomResetRangeMenuItem.setEnabled(isRangeZoomable);
	}

	if (this.zoomInBothMenuItem != null) {
		this.zoomInBothMenuItem.setEnabled(isDomainZoomable && isRangeZoomable);
	}
	if (this.zoomOutBothMenuItem != null) {
		this.zoomOutBothMenuItem.setEnabled(isDomainZoomable && isRangeZoomable);
	}
	if (this.zoomResetBothMenuItem != null) {
		this.zoomResetBothMenuItem.setEnabled(isDomainZoomable && isRangeZoomable);
	}

	coordinateTransformation.showPopupMenu(new Point(x, y), this, popup);
}
 
Example 16
Source File: ChartPanel.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * The idea is to modify the zooming options depending on the type of chart
 * being displayed by the panel.
 *
 * @param x  horizontal position of the popup.
 * @param y  vertical position of the popup.
 */
protected void displayPopupMenu(int x, int y) {

    if (this.popup == null) {
        return;
    }

    // go through each zoom menu item and decide whether or not to
    // enable it...
    boolean isDomainZoomable = false;
    boolean isRangeZoomable = false;
    Plot plot = (this.chart != null ? this.chart.getPlot() : null);
    if (plot instanceof Zoomable) {
        Zoomable z = (Zoomable) plot;
        isDomainZoomable = z.isDomainZoomable();
        isRangeZoomable = z.isRangeZoomable();
    }

    if (this.zoomInDomainMenuItem != null) {
        this.zoomInDomainMenuItem.setEnabled(isDomainZoomable);
    }
    if (this.zoomOutDomainMenuItem != null) {
        this.zoomOutDomainMenuItem.setEnabled(isDomainZoomable);
    }
    if (this.zoomResetDomainMenuItem != null) {
        this.zoomResetDomainMenuItem.setEnabled(isDomainZoomable);
    }

    if (this.zoomInRangeMenuItem != null) {
        this.zoomInRangeMenuItem.setEnabled(isRangeZoomable);
    }
    if (this.zoomOutRangeMenuItem != null) {
        this.zoomOutRangeMenuItem.setEnabled(isRangeZoomable);
    }

    if (this.zoomResetRangeMenuItem != null) {
        this.zoomResetRangeMenuItem.setEnabled(isRangeZoomable);
    }

    if (this.zoomInBothMenuItem != null) {
        this.zoomInBothMenuItem.setEnabled(isDomainZoomable
                && isRangeZoomable);
    }
    if (this.zoomOutBothMenuItem != null) {
        this.zoomOutBothMenuItem.setEnabled(isDomainZoomable
                && isRangeZoomable);
    }
    if (this.zoomResetBothMenuItem != null) {
        this.zoomResetBothMenuItem.setEnabled(isDomainZoomable
                && isRangeZoomable);
    }

    this.popup.show(this, x, y);

}
 
Example 17
Source File: ChartPanel.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * The idea is to modify the zooming options depending on the type of chart
 * being displayed by the panel.
 *
 * @param x  horizontal position of the popup.
 * @param y  vertical position of the popup.
 */
protected void displayPopupMenu(int x, int y) {

    if (this.popup == null) {
        return;
    }

    // go through each zoom menu item and decide whether or not to
    // enable it...
    boolean isDomainZoomable = false;
    boolean isRangeZoomable = false;
    Plot plot = (this.chart != null ? this.chart.getPlot() : null);
    if (plot instanceof Zoomable) {
        Zoomable z = (Zoomable) plot;
        isDomainZoomable = z.isDomainZoomable();
        isRangeZoomable = z.isRangeZoomable();
    }

    if (this.zoomInDomainMenuItem != null) {
        this.zoomInDomainMenuItem.setEnabled(isDomainZoomable);
    }
    if (this.zoomOutDomainMenuItem != null) {
        this.zoomOutDomainMenuItem.setEnabled(isDomainZoomable);
    }
    if (this.zoomResetDomainMenuItem != null) {
        this.zoomResetDomainMenuItem.setEnabled(isDomainZoomable);
    }

    if (this.zoomInRangeMenuItem != null) {
        this.zoomInRangeMenuItem.setEnabled(isRangeZoomable);
    }
    if (this.zoomOutRangeMenuItem != null) {
        this.zoomOutRangeMenuItem.setEnabled(isRangeZoomable);
    }

    if (this.zoomResetRangeMenuItem != null) {
        this.zoomResetRangeMenuItem.setEnabled(isRangeZoomable);
    }

    if (this.zoomInBothMenuItem != null) {
        this.zoomInBothMenuItem.setEnabled(isDomainZoomable
                && isRangeZoomable);
    }
    if (this.zoomOutBothMenuItem != null) {
        this.zoomOutBothMenuItem.setEnabled(isDomainZoomable
                && isRangeZoomable);
    }
    if (this.zoomResetBothMenuItem != null) {
        this.zoomResetBothMenuItem.setEnabled(isDomainZoomable
                && isRangeZoomable);
    }

    this.popup.show(this, x, y);

}
 
Example 18
Source File: ChartComposite.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * The idea is to modify the zooming options depending on the type of chart
 * being displayed by the panel.
 *
 * @param x  horizontal position of the popup.
 * @param y  vertical position of the popup.
 */
protected void displayPopupMenu(int x, int y) {
    if (this.popup != null) {
        // go through each zoom menu item and decide whether or not to
        // enable it...
        Plot plot = this.chart.getPlot();
        boolean isDomainZoomable = false;
        boolean isRangeZoomable = false;
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            isDomainZoomable = z.isDomainZoomable();
            isRangeZoomable = z.isRangeZoomable();
        }
        if (this.zoomInDomainMenuItem != null) {
            this.zoomInDomainMenuItem.setEnabled(isDomainZoomable);
        }
        if (this.zoomOutDomainMenuItem != null) {
            this.zoomOutDomainMenuItem.setEnabled(isDomainZoomable);
        }
        if (this.zoomResetDomainMenuItem != null) {
            this.zoomResetDomainMenuItem.setEnabled(isDomainZoomable);
        }

        if (this.zoomInRangeMenuItem != null) {
            this.zoomInRangeMenuItem.setEnabled(isRangeZoomable);
        }
        if (this.zoomOutRangeMenuItem != null) {
            this.zoomOutRangeMenuItem.setEnabled(isRangeZoomable);
        }

        if (this.zoomResetRangeMenuItem != null) {
            this.zoomResetRangeMenuItem.setEnabled(isRangeZoomable);
        }

        if (this.zoomInBothMenuItem != null) {
            this.zoomInBothMenuItem.setEnabled(isDomainZoomable
                    & isRangeZoomable);
        }
        if (this.zoomOutBothMenuItem != null) {
            this.zoomOutBothMenuItem.setEnabled(isDomainZoomable
                    & isRangeZoomable);
        }
        if (this.zoomResetBothMenuItem != null) {
            this.zoomResetBothMenuItem.setEnabled(isDomainZoomable
                    & isRangeZoomable);
        }

        this.popup.setLocation(x, y);
        this.popup.setVisible(true);
    }

}
 
Example 19
Source File: ChartPanel.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * The idea is to modify the zooming options depending on the type of chart
 * being displayed by the panel.
 *
 * @param x  horizontal position of the popup.
 * @param y  vertical position of the popup.
 */
protected void displayPopupMenu(int x, int y) {

    if (this.popup == null) {
        return;
    }

    // go through each zoom menu item and decide whether or not to
    // enable it...
    boolean isDomainZoomable = false;
    boolean isRangeZoomable = false;
    Plot plot = (this.chart != null ? this.chart.getPlot() : null);
    if (plot instanceof Zoomable) {
        Zoomable z = (Zoomable) plot;
        isDomainZoomable = z.isDomainZoomable();
        isRangeZoomable = z.isRangeZoomable();
    }

    if (this.zoomInDomainMenuItem != null) {
        this.zoomInDomainMenuItem.setEnabled(isDomainZoomable);
    }
    if (this.zoomOutDomainMenuItem != null) {
        this.zoomOutDomainMenuItem.setEnabled(isDomainZoomable);
    }
    if (this.zoomResetDomainMenuItem != null) {
        this.zoomResetDomainMenuItem.setEnabled(isDomainZoomable);
    }

    if (this.zoomInRangeMenuItem != null) {
        this.zoomInRangeMenuItem.setEnabled(isRangeZoomable);
    }
    if (this.zoomOutRangeMenuItem != null) {
        this.zoomOutRangeMenuItem.setEnabled(isRangeZoomable);
    }

    if (this.zoomResetRangeMenuItem != null) {
        this.zoomResetRangeMenuItem.setEnabled(isRangeZoomable);
    }

    if (this.zoomInBothMenuItem != null) {
        this.zoomInBothMenuItem.setEnabled(isDomainZoomable
                && isRangeZoomable);
    }
    if (this.zoomOutBothMenuItem != null) {
        this.zoomOutBothMenuItem.setEnabled(isDomainZoomable
                && isRangeZoomable);
    }
    if (this.zoomResetBothMenuItem != null) {
        this.zoomResetBothMenuItem.setEnabled(isDomainZoomable
                && isRangeZoomable);
    }

    this.popup.show(this, x, y);

}
 
Example 20
Source File: ChartComposite.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * The idea is to modify the zooming options depending on the type of chart
 * being displayed by the panel.
 *
 * @param x  horizontal position of the popup.
 * @param y  vertical position of the popup.
 */
protected void displayPopupMenu(int x, int y) {
    if (this.popup != null) {
        // go through each zoom menu item and decide whether or not to
        // enable it...
        Plot plot = this.chart.getPlot();
        boolean isDomainZoomable = false;
        boolean isRangeZoomable = false;
        if (plot instanceof Zoomable) {
            Zoomable z = (Zoomable) plot;
            isDomainZoomable = z.isDomainZoomable();
            isRangeZoomable = z.isRangeZoomable();
        }
        if (this.zoomInDomainMenuItem != null) {
            this.zoomInDomainMenuItem.setEnabled(isDomainZoomable);
        }
        if (this.zoomOutDomainMenuItem != null) {
            this.zoomOutDomainMenuItem.setEnabled(isDomainZoomable);
        }
        if (this.zoomResetDomainMenuItem != null) {
            this.zoomResetDomainMenuItem.setEnabled(isDomainZoomable);
        }

        if (this.zoomInRangeMenuItem != null) {
            this.zoomInRangeMenuItem.setEnabled(isRangeZoomable);
        }
        if (this.zoomOutRangeMenuItem != null) {
            this.zoomOutRangeMenuItem.setEnabled(isRangeZoomable);
        }

        if (this.zoomResetRangeMenuItem != null) {
            this.zoomResetRangeMenuItem.setEnabled(isRangeZoomable);
        }

        if (this.zoomInBothMenuItem != null) {
            this.zoomInBothMenuItem.setEnabled(isDomainZoomable
                    & isRangeZoomable);
        }
        if (this.zoomOutBothMenuItem != null) {
            this.zoomOutBothMenuItem.setEnabled(isDomainZoomable
                    & isRangeZoomable);
        }
        if (this.zoomResetBothMenuItem != null) {
            this.zoomResetBothMenuItem.setEnabled(isDomainZoomable
                    & isRangeZoomable);
        }

        this.popup.setLocation(x, y);
        this.popup.setVisible(true);
    }

}