@Test public void testCornerResetButtons() { ActionEvent e = new ActionEvent(testLCM, 0, "test action"); e.setSource(testLCM.topRightCornerResetButton); testLCM.actionPerformed(e); verify(cornerResetButtonManager).informJumpToCurrentTimeSelected(); verify(cornerResetButtonManager, never()).informResetYAxisActionSelected(); verify(cornerResetButtonManager, never()).informResetXAxisActionSelected(); verify(cornerResetButtonManager, never()).informResetXAndYActionSelected(); e.setSource(testLCM.topLeftCornerResetButton); testLCM.actionPerformed(e); verify(cornerResetButtonManager, atMost(1)).informJumpToCurrentTimeSelected(); verify(cornerResetButtonManager).informResetYAxisActionSelected(); verify(cornerResetButtonManager, never()).informResetXAxisActionSelected(); verify(cornerResetButtonManager, never()).informResetXAndYActionSelected(); e.setSource(testLCM.bottomRightCornerResetButton); testLCM.actionPerformed(e); verify(cornerResetButtonManager, atMost(1)).informJumpToCurrentTimeSelected(); verify(cornerResetButtonManager, atMost(1)).informResetYAxisActionSelected(); verify(cornerResetButtonManager).informResetXAxisActionSelected(); verify(cornerResetButtonManager, never()).informResetXAndYActionSelected(); e.setSource(testLCM. bottomLeftCornerResetButton); testLCM.actionPerformed(e); verify(cornerResetButtonManager, atMost(1)).informJumpToCurrentTimeSelected(); verify(cornerResetButtonManager, atMost(1)).informResetYAxisActionSelected(); verify(cornerResetButtonManager, atMost(1)).informResetXAxisActionSelected(); verify(cornerResetButtonManager).informResetXAndYActionSelected(); }
@Override public void actionPerformed(ActionEvent e) { if (pauseButton!=null && e.getSource() == pauseButton) { Axis timeAxis = plot.getPlotAbstraction().getTimeAxis(); Pinnable timePin = plot.getPlotAbstraction().getTimeAxisUserPin(); timePin.setPinned(!timePin.isPinned()); plot.getPlotAbstraction().updateResetButtons(); updatePinButton(); if (!timeAxis.isPinned()) { plot.cornerResetButtonManager.informJumpToCurrentTimeSelected(); } } else if (e.getSource() == yAxisPanUpButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_HIGHER_Y_AXIS); } else if (e.getSource() == yAxisPanDownButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_LOWER_Y_AXIS); } else if (e.getSource() == xAxisPanLeftButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_LOWER_X_AXIS); } else if (e.getSource() == xAxisPanRightButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_HIGHER_X_AXIS); } else if (e.getSource() == xAxisCenterZoomInButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_IN_CENTER_X_AXIS); } else if (e.getSource() == xAxisCenterZoomOutButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_OUT_CENTER_X_AXIS); } else if (e.getSource() == yAxisCenterZoomInButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_IN_CENTER_Y_AXIS); } else if (e.getSource() == yAxisCenterZoomOutButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_OUT_CENTER_Y_AXIS); } else if (e.getSource() == topRightCornerResetButton) { if (!plot.isUserOperationsLocked()) { plot.cornerResetButtonManager.informJumpToCurrentTimeSelected(); } updatePinButton(); } else if (e.getSource() == topLeftCornerResetButton) { plot.cornerResetButtonManager.informResetYAxisActionSelected(); updatePinButton(); } else if (e.getSource() == bottomRightCornerResetButton) { plot.cornerResetButtonManager.informResetXAxisActionSelected(); updatePinButton(); } else if (e.getSource() == bottomLeftCornerResetButton) { plot.cornerResetButtonManager.informResetXAndYActionSelected(); updatePinButton(); } else { assert false: "Unknown button pushed on plot local controls."; } plot.getPlotView().requestFocus(); }
PlotLocalControlsManager implements ActionListener, AbstractPlotLocalControlsManager { @Override public void actionPerformed(ActionEvent e) { if (pauseButton!=null && e.getSource() == pauseButton) { Axis timeAxis = plot.getPlotAbstraction().getTimeAxis(); Pinnable timePin = plot.getPlotAbstraction().getTimeAxisUserPin(); timePin.setPinned(!timePin.isPinned()); plot.getPlotAbstraction().updateResetButtons(); updatePinButton(); if (!timeAxis.isPinned()) { plot.cornerResetButtonManager.informJumpToCurrentTimeSelected(); } } else if (e.getSource() == yAxisPanUpButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_HIGHER_Y_AXIS); } else if (e.getSource() == yAxisPanDownButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_LOWER_Y_AXIS); } else if (e.getSource() == xAxisPanLeftButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_LOWER_X_AXIS); } else if (e.getSource() == xAxisPanRightButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_HIGHER_X_AXIS); } else if (e.getSource() == xAxisCenterZoomInButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_IN_CENTER_X_AXIS); } else if (e.getSource() == xAxisCenterZoomOutButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_OUT_CENTER_X_AXIS); } else if (e.getSource() == yAxisCenterZoomInButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_IN_CENTER_Y_AXIS); } else if (e.getSource() == yAxisCenterZoomOutButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_OUT_CENTER_Y_AXIS); } else if (e.getSource() == topRightCornerResetButton) { if (!plot.isUserOperationsLocked()) { plot.cornerResetButtonManager.informJumpToCurrentTimeSelected(); } updatePinButton(); } else if (e.getSource() == topLeftCornerResetButton) { plot.cornerResetButtonManager.informResetYAxisActionSelected(); updatePinButton(); } else if (e.getSource() == bottomRightCornerResetButton) { plot.cornerResetButtonManager.informResetXAxisActionSelected(); updatePinButton(); } else if (e.getSource() == bottomLeftCornerResetButton) { plot.cornerResetButtonManager.informResetXAndYActionSelected(); updatePinButton(); } else { assert false: "Unknown button pushed on plot local controls."; } plot.getPlotView().requestFocus(); } }
PlotLocalControlsManager implements ActionListener, AbstractPlotLocalControlsManager { @Override public void actionPerformed(ActionEvent e) { if (pauseButton!=null && e.getSource() == pauseButton) { Axis timeAxis = plot.getPlotAbstraction().getTimeAxis(); Pinnable timePin = plot.getPlotAbstraction().getTimeAxisUserPin(); timePin.setPinned(!timePin.isPinned()); plot.getPlotAbstraction().updateResetButtons(); updatePinButton(); if (!timeAxis.isPinned()) { plot.cornerResetButtonManager.informJumpToCurrentTimeSelected(); } } else if (e.getSource() == yAxisPanUpButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_HIGHER_Y_AXIS); } else if (e.getSource() == yAxisPanDownButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_LOWER_Y_AXIS); } else if (e.getSource() == xAxisPanLeftButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_LOWER_X_AXIS); } else if (e.getSource() == xAxisPanRightButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_HIGHER_X_AXIS); } else if (e.getSource() == xAxisCenterZoomInButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_IN_CENTER_X_AXIS); } else if (e.getSource() == xAxisCenterZoomOutButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_OUT_CENTER_X_AXIS); } else if (e.getSource() == yAxisCenterZoomInButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_IN_CENTER_Y_AXIS); } else if (e.getSource() == yAxisCenterZoomOutButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_OUT_CENTER_Y_AXIS); } else if (e.getSource() == topRightCornerResetButton) { if (!plot.isUserOperationsLocked()) { plot.cornerResetButtonManager.informJumpToCurrentTimeSelected(); } updatePinButton(); } else if (e.getSource() == topLeftCornerResetButton) { plot.cornerResetButtonManager.informResetYAxisActionSelected(); updatePinButton(); } else if (e.getSource() == bottomRightCornerResetButton) { plot.cornerResetButtonManager.informResetXAxisActionSelected(); updatePinButton(); } else if (e.getSource() == bottomLeftCornerResetButton) { plot.cornerResetButtonManager.informResetXAndYActionSelected(); updatePinButton(); } else { assert false: "Unknown button pushed on plot local controls."; } plot.getPlotView().requestFocus(); } PlotLocalControlsManager(PlotterPlot thePlot); }
PlotLocalControlsManager implements ActionListener, AbstractPlotLocalControlsManager { @Override public void actionPerformed(ActionEvent e) { if (pauseButton!=null && e.getSource() == pauseButton) { Axis timeAxis = plot.getPlotAbstraction().getTimeAxis(); Pinnable timePin = plot.getPlotAbstraction().getTimeAxisUserPin(); timePin.setPinned(!timePin.isPinned()); plot.getPlotAbstraction().updateResetButtons(); updatePinButton(); if (!timeAxis.isPinned()) { plot.cornerResetButtonManager.informJumpToCurrentTimeSelected(); } } else if (e.getSource() == yAxisPanUpButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_HIGHER_Y_AXIS); } else if (e.getSource() == yAxisPanDownButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_LOWER_Y_AXIS); } else if (e.getSource() == xAxisPanLeftButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_LOWER_X_AXIS); } else if (e.getSource() == xAxisPanRightButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_HIGHER_X_AXIS); } else if (e.getSource() == xAxisCenterZoomInButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_IN_CENTER_X_AXIS); } else if (e.getSource() == xAxisCenterZoomOutButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_OUT_CENTER_X_AXIS); } else if (e.getSource() == yAxisCenterZoomInButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_IN_CENTER_Y_AXIS); } else if (e.getSource() == yAxisCenterZoomOutButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_OUT_CENTER_Y_AXIS); } else if (e.getSource() == topRightCornerResetButton) { if (!plot.isUserOperationsLocked()) { plot.cornerResetButtonManager.informJumpToCurrentTimeSelected(); } updatePinButton(); } else if (e.getSource() == topLeftCornerResetButton) { plot.cornerResetButtonManager.informResetYAxisActionSelected(); updatePinButton(); } else if (e.getSource() == bottomRightCornerResetButton) { plot.cornerResetButtonManager.informResetXAxisActionSelected(); updatePinButton(); } else if (e.getSource() == bottomLeftCornerResetButton) { plot.cornerResetButtonManager.informResetXAndYActionSelected(); updatePinButton(); } else { assert false: "Unknown button pushed on plot local controls."; } plot.getPlotView().requestFocus(); } PlotLocalControlsManager(PlotterPlot thePlot); void setupLocalControlManager(); int getYAxisLocalControlWidth(); int getXAxisLocalControlHeight(); void informShiftKeyState(boolean state); void informAltKeyState(boolean state); void informCtlKeyState(boolean state); @Override void actionPerformed(ActionEvent e); void updatePinButton(); void pinXYAxesAfterZoomedIn(); @Override void informKeyState(int key, boolean pressed); @Override void informMouseHover(boolean inPlotArea); }
PlotLocalControlsManager implements ActionListener, AbstractPlotLocalControlsManager { @Override public void actionPerformed(ActionEvent e) { if (pauseButton!=null && e.getSource() == pauseButton) { Axis timeAxis = plot.getPlotAbstraction().getTimeAxis(); Pinnable timePin = plot.getPlotAbstraction().getTimeAxisUserPin(); timePin.setPinned(!timePin.isPinned()); plot.getPlotAbstraction().updateResetButtons(); updatePinButton(); if (!timeAxis.isPinned()) { plot.cornerResetButtonManager.informJumpToCurrentTimeSelected(); } } else if (e.getSource() == yAxisPanUpButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_HIGHER_Y_AXIS); } else if (e.getSource() == yAxisPanDownButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_LOWER_Y_AXIS); } else if (e.getSource() == xAxisPanLeftButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_LOWER_X_AXIS); } else if (e.getSource() == xAxisPanRightButton) { plot.panAndZoomManager.panAction(PanDirection.PAN_HIGHER_X_AXIS); } else if (e.getSource() == xAxisCenterZoomInButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_IN_CENTER_X_AXIS); } else if (e.getSource() == xAxisCenterZoomOutButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_OUT_CENTER_X_AXIS); } else if (e.getSource() == yAxisCenterZoomInButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_IN_CENTER_Y_AXIS); } else if (e.getSource() == yAxisCenterZoomOutButton) { plot.panAndZoomManager.zoomAction(ZoomDirection.ZOOM_OUT_CENTER_Y_AXIS); } else if (e.getSource() == topRightCornerResetButton) { if (!plot.isUserOperationsLocked()) { plot.cornerResetButtonManager.informJumpToCurrentTimeSelected(); } updatePinButton(); } else if (e.getSource() == topLeftCornerResetButton) { plot.cornerResetButtonManager.informResetYAxisActionSelected(); updatePinButton(); } else if (e.getSource() == bottomRightCornerResetButton) { plot.cornerResetButtonManager.informResetXAxisActionSelected(); updatePinButton(); } else if (e.getSource() == bottomLeftCornerResetButton) { plot.cornerResetButtonManager.informResetXAndYActionSelected(); updatePinButton(); } else { assert false: "Unknown button pushed on plot local controls."; } plot.getPlotView().requestFocus(); } PlotLocalControlsManager(PlotterPlot thePlot); void setupLocalControlManager(); int getYAxisLocalControlWidth(); int getXAxisLocalControlHeight(); void informShiftKeyState(boolean state); void informAltKeyState(boolean state); void informCtlKeyState(boolean state); @Override void actionPerformed(ActionEvent e); void updatePinButton(); void pinXYAxesAfterZoomedIn(); @Override void informKeyState(int key, boolean pressed); @Override void informMouseHover(boolean inPlotArea);  }