Class AbstractPositionerComposite
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
- Direct Known Subclasses:
EnumPositionerComposite,NudgePositionerComposite,ScannableFieldsComposite
Scannable and a 'stop' button.
Between these, concrete subclasses will createPositionerControl() suitable for a particular scannable.
This base class registers a listener which calls updatePositionerControl(Object, boolean)
while the scannable is moving.
Should subclasses wish to manually trigger the update job, they can call scheduleUpdateReadbackJob().
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final org.eclipse.swt.custom.CLabelprotected Stringprotected booleanFields inherited from class org.eclipse.swt.widgets.Composite
embeddedHandleFields inherited from class org.eclipse.swt.widgets.Widget
handle -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractPositionerComposite(org.eclipse.swt.widgets.Composite parent, int style) protectedAbstractPositionerComposite(org.eclipse.swt.widgets.Composite parent, int style, boolean unitDisplayOutsideTextBox) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanprotected abstract voidCreates the control(s) (drawn between the label and the stop button) to display and/or control the scannable's position.voiddispose()protected Objectprotected Stringprotected Scannableprotected StringvoidHides the stop button.booleanbooleanCheck if the stop button is visibleprotected voidMoves the scannable to a new position.
Checks whether the scannable is busy before movingprotected booleanmoveAllowed(Object newPosition) Subclasses can override to check whether the requested position lies within limits, for instance.protected voidManually schedule the update readback job.voidsetCheckHoldingBaton(boolean checkHoldingBaton) voidsetDisplayName(String displayName) Sets a different name to be used in the GUI instead of the default which is the scannable namevoidsetDisplayNameWidth(int width) voidsetEnabled(boolean enabled) protected voidsetReasonForDisallowingMove(String reason) Specify why the the last call tomoveAllowed(Object)returnedfalse.voidsetScannable(Scannable scannable) This sets the scannable which will be controlled and will automatically configure the control.voidShows the stop button.protected abstract voidupdatePositionerControl(Object newPosition, boolean moving) Updates the control(s) created atcreatePositionerControl()to reflect the given scannable position and whether it is currently moving.Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toStringMethods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBarMethods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isAutoScalable, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, updateMethods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData
-
Field Details
-
displayNameLabel
protected final org.eclipse.swt.custom.CLabel displayNameLabel -
reasonForDisallowingMove
-
unitDisplayOutsideTextBox
protected boolean unitDisplayOutsideTextBox -
checkHoldingBaton
protected boolean checkHoldingBaton
-
-
Constructor Details
-
AbstractPositionerComposite
protected AbstractPositionerComposite(org.eclipse.swt.widgets.Composite parent, int style) - Parameters:
parent- the parent composite on which to draw this onestyle- SWT.HORIZONTAL or SWT.VERTICAL will define a horizontal or vertical (default) layout
-
AbstractPositionerComposite
protected AbstractPositionerComposite(org.eclipse.swt.widgets.Composite parent, int style, boolean unitDisplayOutsideTextBox)
-
-
Method Details
-
dispose
public void dispose()- Overrides:
disposein classorg.eclipse.swt.widgets.Widget
-
createPositionerControl
protected abstract void createPositionerControl()Creates the control(s) (drawn between the label and the stop button) to display and/or control the scannable's position.For consistent results, implementors are advised to create widgets directly on top of
thisComposite. -
updatePositionerControl
Updates the control(s) created atcreatePositionerControl()to reflect the given scannable position and whether it is currently moving.This method is called as soon as the scannable is set, so implementors may use it to initialise their controls.
-
moveAllowed
Subclasses can override to check whether the requested position lies within limits, for instance.If a move is disallowed, it is advised that a reason be set via
setReasonForDisallowingMove(String)so that it can be presented to the user. -
setReasonForDisallowingMove
Specify why the the last call tomoveAllowed(Object)returnedfalse. This will be shown to the user in an error dialog, and then cleared. -
checkBatonHeld
protected boolean checkBatonHeld() -
move
Moves the scannable to a new position.
Checks whether the scannable is busy before moving- Parameters:
position- The demanded position
-
setEnabled
public void setEnabled(boolean enabled) - Overrides:
setEnabledin classorg.eclipse.swt.widgets.Control
-
getCurrentPosition
-
setScannable
This sets the scannable which will be controlled and will automatically configure the control.This can also be called to change the scannable controlled at any time which will reconfigure the control.
- Parameters:
scannable- The scannable to control
-
getScannable
-
setDisplayNameWidth
public void setDisplayNameWidth(int width) -
setDisplayName
Sets a different name to be used in the GUI instead of the default which is the scannable nameAfter calling this method the control will be automatically redrawn.
- Parameters:
displayName- The name to be used in the GUI
-
getDisplayName
-
getScannableOutputFormat
-
scheduleUpdateReadbackJob
protected void scheduleUpdateReadbackJob()Manually schedule the update readback job. -
hideStopButton
public void hideStopButton()Hides the stop button.This is useful for scannables which can't be stopped (move instantly) i.e. setting a voltage.
- See Also:
-
showStopButton
public void showStopButton()Shows the stop button.- See Also:
-
isStopButtonVisible
public boolean isStopButtonVisible()Check if the stop button is visible- Returns:
- true if stop button is visible
- See Also:
-
isCheckHoldingBaton
public boolean isCheckHoldingBaton() -
setCheckHoldingBaton
public void setCheckHoldingBaton(boolean checkHoldingBaton)
-