@Test public void testUpdateButtonsAfterPanZoomAction() { MockitoAnnotations.initMocks(this); GregorianCalendar now = new GregorianCalendar(); GregorianCalendar startTime = new GregorianCalendar(); GregorianCalendar endTime = new GregorianCalendar(); Mockito.when(plotAbstraction.getCurrentMCTTime()).thenReturn(now.getTimeInMillis()); Mockito.when(plot.getCurrentTimeAxisMax()).thenReturn(endTime); Mockito.when(plot.getCurrentTimeAxisMin()).thenReturn(startTime); endTime.add(Calendar.MINUTE, 1); pcm.updateButtons(); verify(plotControlManager, atMost(1)).setJumpToCurrentTimeButtonVisible(true); verify(plotControlManager, never()).setJumpToCurrentTimeButtonVisible(false); now.add(Calendar.MINUTE, -1); endTime.setTimeInMillis(now.getTimeInMillis()); pcm.updateButtons(); verify(plotControlManager, atMost(2)).setJumpToCurrentTimeButtonVisible(true); verify(plotControlManager, atMost(1)).setJumpToCurrentTimeButtonVisible(false); }
public void updateButtons() { Axis timeAxis = plot.getPlotAbstraction().getTimeAxis(); Axis nonTimeAxis = plot.getNonTimeAxis(); Axis xAxis; Axis yAxis; if(plot.getAxisOrientationSetting() == AxisOrientationSetting.X_AXIS_AS_TIME) { xAxis = timeAxis; yAxis = nonTimeAxis; } else { xAxis = nonTimeAxis; yAxis = timeAxis; } List<AbstractPlottingPackage> plots = plot.getPlotAbstraction().getSubPlots(); if(plots.get(0) == plot) { long now = plot.getPlotAbstraction().getCurrentMCTTime(); if(!timeAxis.isPinned()) { plot.localControlsManager.setJumpToCurrentTimeButtonVisible(false); } else if(plot.getMaxTime() < now || plot.getMinTime() > now) { plot.localControlsManager.setJumpToCurrentTimeButtonAlarm(true); } else { plot.localControlsManager.setJumpToCurrentTimeButtonAlarm(false); } } else { plot.localControlsManager.setJumpToCurrentTimeButtonVisible(false); } boolean enableX = true; boolean enableY = true; if(plots.get(plots.size() - 1) != plot) { if(plot.getAxisOrientationSetting() == AxisOrientationSetting.X_AXIS_AS_TIME) { enableX = false; } else { enableY = false; } } plot.localControlsManager.setXAxisCornerResetButtonVisible(enableX && !xAxis.isInDefaultState()); plot.localControlsManager.setYAxisCornerResetButtonVisible(enableY && !yAxis.isInDefaultState()); plot.localControlsManager.setXAndYAxisCornerResetButtonVisible(!xAxis.isInDefaultState() && !yAxis.isInDefaultState()); }
PlotCornerResetButtonManager { public void updateButtons() { Axis timeAxis = plot.getPlotAbstraction().getTimeAxis(); Axis nonTimeAxis = plot.getNonTimeAxis(); Axis xAxis; Axis yAxis; if(plot.getAxisOrientationSetting() == AxisOrientationSetting.X_AXIS_AS_TIME) { xAxis = timeAxis; yAxis = nonTimeAxis; } else { xAxis = nonTimeAxis; yAxis = timeAxis; } List<AbstractPlottingPackage> plots = plot.getPlotAbstraction().getSubPlots(); if(plots.get(0) == plot) { long now = plot.getPlotAbstraction().getCurrentMCTTime(); if(!timeAxis.isPinned()) { plot.localControlsManager.setJumpToCurrentTimeButtonVisible(false); } else if(plot.getMaxTime() < now || plot.getMinTime() > now) { plot.localControlsManager.setJumpToCurrentTimeButtonAlarm(true); } else { plot.localControlsManager.setJumpToCurrentTimeButtonAlarm(false); } } else { plot.localControlsManager.setJumpToCurrentTimeButtonVisible(false); } boolean enableX = true; boolean enableY = true; if(plots.get(plots.size() - 1) != plot) { if(plot.getAxisOrientationSetting() == AxisOrientationSetting.X_AXIS_AS_TIME) { enableX = false; } else { enableY = false; } } plot.localControlsManager.setXAxisCornerResetButtonVisible(enableX && !xAxis.isInDefaultState()); plot.localControlsManager.setYAxisCornerResetButtonVisible(enableY && !yAxis.isInDefaultState()); plot.localControlsManager.setXAndYAxisCornerResetButtonVisible(!xAxis.isInDefaultState() && !yAxis.isInDefaultState()); } }
PlotCornerResetButtonManager { public void updateButtons() { Axis timeAxis = plot.getPlotAbstraction().getTimeAxis(); Axis nonTimeAxis = plot.getNonTimeAxis(); Axis xAxis; Axis yAxis; if(plot.getAxisOrientationSetting() == AxisOrientationSetting.X_AXIS_AS_TIME) { xAxis = timeAxis; yAxis = nonTimeAxis; } else { xAxis = nonTimeAxis; yAxis = timeAxis; } List<AbstractPlottingPackage> plots = plot.getPlotAbstraction().getSubPlots(); if(plots.get(0) == plot) { long now = plot.getPlotAbstraction().getCurrentMCTTime(); if(!timeAxis.isPinned()) { plot.localControlsManager.setJumpToCurrentTimeButtonVisible(false); } else if(plot.getMaxTime() < now || plot.getMinTime() > now) { plot.localControlsManager.setJumpToCurrentTimeButtonAlarm(true); } else { plot.localControlsManager.setJumpToCurrentTimeButtonAlarm(false); } } else { plot.localControlsManager.setJumpToCurrentTimeButtonVisible(false); } boolean enableX = true; boolean enableY = true; if(plots.get(plots.size() - 1) != plot) { if(plot.getAxisOrientationSetting() == AxisOrientationSetting.X_AXIS_AS_TIME) { enableX = false; } else { enableY = false; } } plot.localControlsManager.setXAxisCornerResetButtonVisible(enableX && !xAxis.isInDefaultState()); plot.localControlsManager.setYAxisCornerResetButtonVisible(enableY && !yAxis.isInDefaultState()); plot.localControlsManager.setXAndYAxisCornerResetButtonVisible(!xAxis.isInDefaultState() && !yAxis.isInDefaultState()); } PlotCornerResetButtonManager(PlotterPlot thePlot); }
PlotCornerResetButtonManager { public void updateButtons() { Axis timeAxis = plot.getPlotAbstraction().getTimeAxis(); Axis nonTimeAxis = plot.getNonTimeAxis(); Axis xAxis; Axis yAxis; if(plot.getAxisOrientationSetting() == AxisOrientationSetting.X_AXIS_AS_TIME) { xAxis = timeAxis; yAxis = nonTimeAxis; } else { xAxis = nonTimeAxis; yAxis = timeAxis; } List<AbstractPlottingPackage> plots = plot.getPlotAbstraction().getSubPlots(); if(plots.get(0) == plot) { long now = plot.getPlotAbstraction().getCurrentMCTTime(); if(!timeAxis.isPinned()) { plot.localControlsManager.setJumpToCurrentTimeButtonVisible(false); } else if(plot.getMaxTime() < now || plot.getMinTime() > now) { plot.localControlsManager.setJumpToCurrentTimeButtonAlarm(true); } else { plot.localControlsManager.setJumpToCurrentTimeButtonAlarm(false); } } else { plot.localControlsManager.setJumpToCurrentTimeButtonVisible(false); } boolean enableX = true; boolean enableY = true; if(plots.get(plots.size() - 1) != plot) { if(plot.getAxisOrientationSetting() == AxisOrientationSetting.X_AXIS_AS_TIME) { enableX = false; } else { enableY = false; } } plot.localControlsManager.setXAxisCornerResetButtonVisible(enableX && !xAxis.isInDefaultState()); plot.localControlsManager.setYAxisCornerResetButtonVisible(enableY && !yAxis.isInDefaultState()); plot.localControlsManager.setXAndYAxisCornerResetButtonVisible(!xAxis.isInDefaultState() && !yAxis.isInDefaultState()); } PlotCornerResetButtonManager(PlotterPlot thePlot); void updateButtons(); }
PlotCornerResetButtonManager { public void updateButtons() { Axis timeAxis = plot.getPlotAbstraction().getTimeAxis(); Axis nonTimeAxis = plot.getNonTimeAxis(); Axis xAxis; Axis yAxis; if(plot.getAxisOrientationSetting() == AxisOrientationSetting.X_AXIS_AS_TIME) { xAxis = timeAxis; yAxis = nonTimeAxis; } else { xAxis = nonTimeAxis; yAxis = timeAxis; } List<AbstractPlottingPackage> plots = plot.getPlotAbstraction().getSubPlots(); if(plots.get(0) == plot) { long now = plot.getPlotAbstraction().getCurrentMCTTime(); if(!timeAxis.isPinned()) { plot.localControlsManager.setJumpToCurrentTimeButtonVisible(false); } else if(plot.getMaxTime() < now || plot.getMinTime() > now) { plot.localControlsManager.setJumpToCurrentTimeButtonAlarm(true); } else { plot.localControlsManager.setJumpToCurrentTimeButtonAlarm(false); } } else { plot.localControlsManager.setJumpToCurrentTimeButtonVisible(false); } boolean enableX = true; boolean enableY = true; if(plots.get(plots.size() - 1) != plot) { if(plot.getAxisOrientationSetting() == AxisOrientationSetting.X_AXIS_AS_TIME) { enableX = false; } else { enableY = false; } } plot.localControlsManager.setXAxisCornerResetButtonVisible(enableX && !xAxis.isInDefaultState()); plot.localControlsManager.setYAxisCornerResetButtonVisible(enableY && !yAxis.isInDefaultState()); plot.localControlsManager.setXAndYAxisCornerResetButtonVisible(!xAxis.isInDefaultState() && !yAxis.isInDefaultState()); } PlotCornerResetButtonManager(PlotterPlot thePlot); void updateButtons();  }