ikayaki.gui
Class MeasurementControlsPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
ikayaki.gui.ProjectComponent
ikayaki.gui.MeasurementControlsPanel
- All Implemented Interfaces:
- MeasurementListener, ProjectListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
public class MeasurementControlsPanel
- extends ProjectComponent
Has "Measure"/"Pause", "Single step" and "Stop now!" buttons for controlling measurements; "+z/-z" radiobuttons for
changing sample orientation used in calculations, help picture for inserting sample, picture of current magnetometer
status, and, manual controls.
Listens MeasurementEvents and ProjectEvents, and updates buttons and magnetometer status accordingly.
- Author:
- Samuli Kaipiainen
- See Also:
- Serialized Form
Method Summary |
Action |
getAbortAction()
Event C: On stopButton click - call project.doAbort(); show critical error message if false is returned. |
Action |
getAutoStepAction()
Event A: On measureButton click - call project.doAutoStep() or project.doPause(), depending on current button
status. |
Action |
getCalibrateAction()
|
Action |
getPauseAction()
|
Action |
getSingleStepAction()
Event B: On stepButton click - call project.doSingleStep(); show error message if false is returned. |
void |
measurementUpdated(MeasurementEvent event)
Event F: On MeasurementEvent - call magnetometerStatusPanel.measurementUpdated(MeasurementEvent). |
void |
projectUpdated(ProjectEvent event)
Event E: On ProjectEvent - update buttons and manual controls according to project.isXXXEnabled(). |
private void |
setOrientation(Project.Orientation orientation)
Sets zPlus/Minus radiobutton enabled, and the corresponding image as sample inserting help image. |
void |
setProject(Project project)
Call super.setProject(project), update buttons and manual controls according to project.isXXXEnabled(). |
private void |
updateActions()
Checks the current state of the active project and enables/disables the measurement controls accordingly. |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getWidth, getVisibleRect, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
measureButton
private final JButton measureButton
pauseButton
private final JButton pauseButton
stepButton
private final JButton stepButton
abortButton
private final JButton abortButton
measureButtonFlasher
private final ComponentFlasher measureButtonFlasher
pauseButtonFlasher
private final ComponentFlasher pauseButtonFlasher
stepButtonFlasher
private final ComponentFlasher stepButtonFlasher
abortButtonFlasher
private final ComponentFlasher abortButtonFlasher
zButtonGroup
private final ButtonGroup zButtonGroup
- Groups together +z and -z RadioButtons.
zPlusRadioButton
private final JRadioButton zPlusRadioButton
zMinusRadioButton
private final JRadioButton zMinusRadioButton
sampleInsertPanel
private final JPanel sampleInsertPanel
- Draws a help image and text for sample inserting: "Put sample in holder arrow up."
sampleInsertTextLabel
private final JLabel sampleInsertTextLabel
sampleInsertZPlusIcon
private final Icon sampleInsertZPlusIcon
sampleInsertZMinusIcon
private final Icon sampleInsertZMinusIcon
sampleInsertIconLabel
private final JLabel sampleInsertIconLabel
manualControlsPanel
private final MagnetometerStatusPanel.ManualControlsPanel manualControlsPanel
- Magnetometer manual controls.
magnetometerStatusPanel
private final MagnetometerStatusPanel magnetometerStatusPanel
- Magnetometer status panel; also holds move-radiobuttons from ManualControlsPanel.
autoStepAction
private Action autoStepAction
singleStepAction
private Action singleStepAction
calibrateAction
private Action calibrateAction
pauseAction
private Action pauseAction
abortAction
private Action abortAction
MeasurementControlsPanel
public MeasurementControlsPanel()
setProject
public void setProject(Project project)
- Call super.setProject(project), update buttons and manual controls according to project.isXXXEnabled().
- Overrides:
setProject
in class ProjectComponent
- Parameters:
project
- project opened, or null to open no project.
projectUpdated
public void projectUpdated(ProjectEvent event)
- Event E: On ProjectEvent - update buttons and manual controls according to project.isXXXEnabled().
- Specified by:
projectUpdated
in interface ProjectListener
- Overrides:
projectUpdated
in class ProjectComponent
- Parameters:
event
- ProjectEvent received.
measurementUpdated
public void measurementUpdated(MeasurementEvent event)
- Event F: On MeasurementEvent - call magnetometerStatusPanel.measurementUpdated(MeasurementEvent).
- Specified by:
measurementUpdated
in interface MeasurementListener
- Overrides:
measurementUpdated
in class ProjectComponent
- Parameters:
event
- MeasurementEvent received.
setOrientation
private void setOrientation(Project.Orientation orientation)
- Sets zPlus/Minus radiobutton enabled, and the corresponding image as sample inserting help image.
updateActions
private void updateActions()
- Checks the current state of the active project and enables/disables the measurement controls accordingly.
getAutoStepAction
public Action getAutoStepAction()
- Event A: On measureButton click - call project.doAutoStep() or project.doPause(), depending on current button
status. Show error message if false is returned.
getSingleStepAction
public Action getSingleStepAction()
- Event B: On stepButton click - call project.doSingleStep(); show error message if false is returned.
getCalibrateAction
public Action getCalibrateAction()
getPauseAction
public Action getPauseAction()
getAbortAction
public Action getAbortAction()
- Event C: On stopButton click - call project.doAbort(); show critical error message if false is returned.