public void onPlotsChanged(PlotsChangedEvent event)
{
shim_.delayLoadPlotsState = null;
PlotsState plotsState = event.getPlotsState();
// zero or one plot -- next and previous disabled
if (plotsState.getPlotCount() <= 1)
{
commands_.nextPlot().setEnabled(false);
commands_.previousPlot().setEnabled(false);
}
// first plot (only next is enabled)
else if (plotsState.getPlotIndex() == 0)
{
commands_.nextPlot().setEnabled(true);
commands_.previousPlot().setEnabled(false);
}
// last plot (only back is enabled)
else if (plotsState.getPlotIndex() ==
(plotsState.getPlotCount() - 1))
{
commands_.nextPlot().setEnabled(false);
commands_.previousPlot().setEnabled(true);
}
// both enabled
else
{
commands_.nextPlot().setEnabled(true);
commands_.previousPlot().setEnabled(true);
}
// other commands which are only enabled if there is at least
// one plot alive
boolean hasPlots = plotsState.getPlotCount() >= 1;
commands_.savePlotAsImage().setEnabled(hasPlots);
commands_.savePlotAsPdf().setEnabled(hasPlots);
commands_.copyPlotToClipboard().setEnabled(hasPlots);
commands_.publishPlotToRPubs().setEnabled(hasPlots);
commands_.zoomPlot().setEnabled(hasPlots);
commands_.removePlot().setEnabled(hasPlots);
commands_.clearPlots().setEnabled(hasPlots);
commands_.refreshPlot().setEnabled(hasPlots);
commands_.showManipulator().setEnabled(hasPlots);
if (plotsState.getActivatePlots() || shim_.loaded)
{
shim_.onPlotsChanged(event);
}
else
{