Package gov.nih.mipav.view
Class ViewControlsImage
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
gov.nih.mipav.view.ViewControlsImage
- All Implemented Interfaces:
ActionListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,ChangeListener
This class builds the control panel used in ViewJFrameImage frames. Toolbars are created and added to the panel and
the listener for the toolbars is the image frame. If the image frame is to display two images then alpha blending
tools are added and displayed.
- Version:
- 0.1 Dec 15, 1998 update 9 august 2001
- Author:
- Matthew J. McAuliffe, Ph.D.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected JSliderDOCUMENT ME!protected TitledBorderDOCUMENT ME!protected TitledBorderDOCUMENT ME!protected ViewJFrameBaseDOCUMENT ME!protected GridBagConstraintsDOCUMENT ME!protected JPanelDOCUMENT ME!protected ButtonGroupDOCUMENT ME!protected intDOCUMENT ME!protected JToolBarPaint toolbar.protected JPanelDOCUMENT ME!protected JPanelDOCUMENT ME!protected JPanelDOCUMENT ME!protected JPanelDOCUMENT ME!protected JRadioButtonDOCUMENT ME!protected JRadioButtonDOCUMENT ME!protected JToolBarRegistration toolbar.protected JToolBarDOCUMENT ME!private static final longUse serialVersionUID for interoperability.protected ViewJSlidertImageSliderprotected JToolBarMain toolbar .protected ViewToolBarBuilderObject builds and controls the toolbars.protected ViewJSliderDOCUMENT ME!Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactionPerformed(ActionEvent event) Action event handler.voidadd(Component c, GridBagConstraints gbc, int x, int y, int w, int h) Adds a component to the toolbar panel using the given gridbag constraints.voidDisplays the panel which controls which image is the "active image" displayed when imageB is available.voidaddCustomToolBar(Vector<CustomUIBuilder.UIParams> paramVector) protected voidBuilds the slider used to control the alpha blending.voidCreates the main toolbar without any of the pre-made additional bars (no VOI etc) for use with addCustomToolBar() to add custom-built bars to the main barvoidbuildToolbar(boolean showImage, JToolBar voiToolbar, ButtonGroup VOIGroup, JToggleButton VOIPointer, boolean showPaint) DOCUMENT ME!voidbuildToolbar(boolean showImage, JToolBar voiToolbar, ButtonGroup VOIGroup, JToggleButton VOIPointer, boolean showPaint, boolean showScripting) Builds the toolbars.voidfinalize()Clean up memory.intIdentifies which image is active.getFrame()Accessor for the ViewJFrameBase used.getTools()Accessor for the tool bar held by these controls.voidRemoves the controls to the display of which image is "active" in the frame when imageB is not available.voidInvokes the toolbar builder to run the currently selected script.voidsetActiveImage(int image) Sets the active image to either A or B and updates the paint spinner values.voidsetAlphaSlider(int i) voidsetAlphaSliderEnabled(boolean enabled) DOCUMENT ME!voidsetRecording(boolean isRecording) Used to set the state for the script recorder.voidsetTimeSl(int slice) Directs the image to display a particular time slice.voidsetTSlider(int tSlice) Places the pointer on the (time) slider bar to a location corresponding to the given slice value (within the set).voidsetVOIColor(int voiUID) DOCUMENT ME!voidsetVOIColor(Color newColor) DOCUMENT ME!voidsetZSlider(int zSlice) Places the pointer on the (slice) slider bar to a location corresponding to the given slice value (within the set) without notifying the listeners.voidSets values based on knob along slider.voidThis method toggles between the intensities between Image A and Image BvoidupdateFrames(boolean flag, int alphaBlend) Calls ModelImage's updateFrames method.voidupdateScripts(String dir) Invokes the toolbar builder to update the scripts combo box based on the new script directory.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, updateMethods 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, transferFocusDownCycle, validate, validateTreeMethods 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
alphaSlider
DOCUMENT ME! -
borderActiveImage
DOCUMENT ME! -
borderImageSlider
DOCUMENT ME! -
frame
DOCUMENT ME! -
gbc
DOCUMENT ME! -
generalPanel
DOCUMENT ME! -
group1
DOCUMENT ME! -
imageSize
protected int imageSizeDOCUMENT ME! -
paintToolBar
Paint toolbar. -
panelActiveImage
DOCUMENT ME! -
panelImageSlider
DOCUMENT ME! -
panelOptionToolbars
DOCUMENT ME! -
panelToolbars
DOCUMENT ME! -
radioImageA
DOCUMENT ME! -
radioImageB
DOCUMENT ME! -
registrationToolBar
Registration toolbar. -
scriptToolBar
DOCUMENT ME! -
tImageSlider
tImageSlider -
toolBar
Main toolbar . -
toolBarObj
Object builds and controls the toolbars. -
zImageSlider
DOCUMENT ME!
-
-
Constructor Details
-
ViewControlsImage
Constructs new control panel.- Parameters:
_frame- Parent frame.
-
-
Method Details
-
actionPerformed
Action event handler. Switches active image between image A and image B.- Specified by:
actionPerformedin interfaceActionListener- Parameters:
event- Event that triggers function.
-
add
Adds a component to the toolbar panel using the given gridbag constraints.- Parameters:
c- Component to add.gbc- Grid bag constraints for component.x-GridBagConstraints.gridxy-GridBagConstraints.gridyw-GridBagConstraints.gridwidthh-GridBagConstraints.gridheight- See Also:
-
addActiveImageControl
public void addActiveImageControl()Displays the panel which controls which image is the "active image" displayed when imageB is available. -
buildToolbar
public void buildToolbar(boolean showImage, JToolBar voiToolbar, ButtonGroup VOIGroup, JToggleButton VOIPointer, boolean showPaint) DOCUMENT ME!- Parameters:
showImage- Indicates if the image toolbar is shown.showPaint- Indicates if the paint toolbar is shown.showVOI- Indicates if the VOI toolbar is shown.voiIndex- Indicates the index of the currently (or previously) selected VOI
-
buildToolbar
public void buildToolbar(boolean showImage, JToolBar voiToolbar, ButtonGroup VOIGroup, JToggleButton VOIPointer, boolean showPaint, boolean showScripting) Builds the toolbars.- Parameters:
showImage- Indicates if the image toolbar is shown.showPaint- Indicates if the paint toolbar is shown.showScripting- Indicates if the scripting toolbar is shown.showVOI- Indicates if the VOI toolbar is shown.voiIndex- Indicates the index of the currently (or previously) selected VOI
-
addCustomToolBar
-
buildSimpleToolBar
public void buildSimpleToolBar()Creates the main toolbar without any of the pre-made additional bars (no VOI etc) for use with addCustomToolBar() to add custom-built bars to the main bar -
finalize
public void finalize()Clean up memory. -
getActiveImage
public int getActiveImage()Identifies which image is active.- Returns:
- the identifier for the active image
-
getFrame
Accessor for the ViewJFrameBase used.- Returns:
- the frame used
-
getTools
Accessor for the tool bar held by these controls.- Returns:
- The tool bar held by this controls.
-
removeActiveImageControl
public void removeActiveImageControl()Removes the controls to the display of which image is "active" in the frame when imageB is not available. -
runCurrentScript
public void runCurrentScript()Invokes the toolbar builder to run the currently selected script. -
setActiveImage
public void setActiveImage(int image) Sets the active image to either A or B and updates the paint spinner values.- Parameters:
image- Indicates which image is active.
-
setAlphaSliderEnabled
public void setAlphaSliderEnabled(boolean enabled) DOCUMENT ME!- Parameters:
enabled- DOCUMENT ME!
-
setRecording
public void setRecording(boolean isRecording) Used to set the state for the script recorder.- Parameters:
isRecording- boolean
-
setAlphaSlider
public void setAlphaSlider(int i) -
setTimeSl
public void setTimeSl(int slice) Directs the image to display a particular time slice.- Parameters:
slice- The time slice to display.- See Also:
-
setTSlider
public void setTSlider(int tSlice) Places the pointer on the (time) slider bar to a location corresponding to the given slice value (within the set).- Parameters:
tSlice- The slice in the frame that is displayed.- See Also:
-
setVOIColor
public void setVOIColor(int voiUID) DOCUMENT ME!- Parameters:
voiUID- DOCUMENT ME!
-
setVOIColor
DOCUMENT ME!- Parameters:
newColor- DOCUMENT ME!
-
setZSlider
public void setZSlider(int zSlice) Places the pointer on the (slice) slider bar to a location corresponding to the given slice value (within the set) without notifying the listeners.- Parameters:
zSlice- the slice in the frame that is displayed- See Also:
-
stateChanged
Sets values based on knob along slider.- Specified by:
stateChangedin interfaceChangeListener- Parameters:
e- Event that triggered this function.
-
updateFrames
public void updateFrames(boolean flag, int alphaBlend) Calls ModelImage's updateFrames method.- Parameters:
flag- this boolean indicates if the frame that displays the image should re-export the image and apply new LUTalphaBlend- the amount of alpha blending to do- See Also:
-
updateScripts
Invokes the toolbar builder to update the scripts combo box based on the new script directory.- Parameters:
dir- - name of directory for script files.
-
buildAlphaSlider
protected void buildAlphaSlider()Builds the slider used to control the alpha blending. -
getTImageSlider
-
getZImageSlider
-
toggleSlider
public void toggleSlider()This method toggles between the intensities between Image A and Image B
-