Class JDialogBase

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected class  JDialogBase.CancelAction
      Handler for keys which should invoke the Cancel button (such as ESC).
      protected class  JDialogBase.HelpAction
      Handler for keys which should invoke the Help button (such as F1).
      protected class  JDialogBase.OKAction
      Handler for keys which should invoke the OK button (such as ENTER).
      • Nested classes/interfaces inherited from class javax.swing.JDialog

        javax.swing.JDialog.AccessibleJDialog
      • Nested classes/interfaces inherited from class java.awt.Dialog

        java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
      • Nested classes/interfaces inherited from class java.awt.Window

        java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String ABOUT_MIPAV
      Access about mipav panel
      protected javax.swing.JButton applyButton
      Apply button is used to apply the setting of the dialog.
      protected javax.swing.JMenuBar bar
      JMenuBar for loading/saving defaults
      protected javax.swing.JButton cancelButton
      Cancel button is used on most dialogs.
      boolean cancelFlag
      Flag indicating if the dialog had been cancelled or not.
      protected javax.swing.JButton closeButton
      Close button is used to close the dialog.
      protected static java.lang.String HELP
      Displays help this dialog
      protected javax.swing.JButton helpButton
      Help button is used on most dialogs.
      private static java.lang.String LOAD_DEFAULT
      Loads default for this dialog
      private static java.lang.String LOAD_PROFILE
      Loads profile for this dialog
      protected javax.swing.JPanel mainDialogPanel
      The main panel of the dialog.
      protected static int NEW
      NEW indicates a new image is created after the algorithm is run.
      protected javax.swing.JButton OKButton
      OK button is used on most dialogs.
      protected java.awt.Frame parentFrame
      Parent frame of this dialog, usually of type ViewJFrameImage.
      private java.util.ArrayList<java.lang.String> profiles
      List of existing default profiles for this dialog
      protected ViewJProgressBar progressBar
      Progress bar that will listen to a dialog's algorithm (and reflect current progress)
      protected static int REPLACE
      REPLACE indicates the current image is replaced after algorithm is run.
      protected boolean runInSeparateThread
      Flag indicating if the algorithm should run in a separate thread.
      protected boolean runningScriptFlag
      Whether we are using this dialog as part of a script.
      protected boolean runQuiet
      Whether algorithm is running in quiet mode (such as part of a script, in headless environment, within other algorithm )
      private static java.lang.String SAVE_DEFAULT
      Saves default for this dialog
      private static java.lang.String SAVE_PROFILE
      Saves profile for this dialog
      private static long serialVersionUID
      Use serialVersionUID for interoperability.
      protected java.awt.Font serif12
      Fonts, same as MipavUtil.font12 and MipavUtil.font12B.
      protected java.awt.Font serif12B
      Fonts, same as MipavUtil.font12 and MipavUtil.font12B.
      protected VOIManagerInterface voiManager  
      • Fields inherited from class javax.swing.JDialog

        accessibleContext, rootPane, rootPaneCheckingEnabled
      • Fields inherited from class java.awt.Dialog

        DEFAULT_MODALITY_TYPE
      • Fields inherited from class java.awt.Component

        BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • Fields inherited from interface javax.swing.WindowConstants

        DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
    • Constructor Summary

      Constructors 
      Constructor Description
      JDialogBase()
      Constructor that sets the dialog to not modal.
      JDialogBase​(boolean modal)
      Constructor that only sets the dialog to modal or not modal.
      JDialogBase​(java.awt.Dialog parent, boolean modal)
      Constructor that forwards the parent dialog whether or not the dialog is modal.
      JDialogBase​(java.awt.Dialog parent, boolean modal, boolean displayMenu)
      Constructor that forwards the parent dialog whether or not the dialog is modal.
      JDialogBase​(java.awt.Frame parent, boolean modal)
      Constructor that sets the parent frame of the dialog and whether or not the dialog is modal.
      JDialogBase​(java.awt.Frame parent, boolean modal, boolean displayMenu)
      Constructor that sets the parent frame of the dialog and whether or not the dialog is modal.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent e)  
      protected javax.swing.JButton buildApplyButton()
      Builds the cancel button.
      protected javax.swing.JPanel buildButtons()
      Builds button panel consisting of OK, Cancel and Help buttons.
      protected javax.swing.JButton buildCancelButton()
      Builds the cancel button.
      static javax.swing.JButton buildCancelButton​(java.lang.String actionCommand, java.awt.event.ActionListener parent)  
      protected javax.swing.JButton buildCloseButton()
      Builds the close button.
      protected javax.swing.JButton buildHelpButton()
      Builds the help button.
      protected javax.swing.JComboBox buildImageComboBox​(ModelImage image)
      Builds a list of images.
      protected javax.swing.JButton buildOKButton()
      Builds the OK button.
      static javax.swing.JButton buildOKButton​(java.lang.String actionCommand, java.awt.event.ActionListener parent)
      Builds the OK button.
      protected javax.swing.JPanel buildOKCancelButtons()
      Builds button panel consisting of OK, Cancel and Help buttons.
      static javax.swing.border.TitledBorder buildTitledBorder​(java.lang.String title)
      Builds a titled border with the given title, an etched border, and the proper font and color.
      static javax.swing.border.TitledBorder buildTitledBorder​(java.lang.String title, java.awt.Color color)
      Builds a titled border with the given title, an etched border, and the proper font and color.
      protected javax.swing.JLabel createLabel​(java.lang.String title)
      Helper method to create a label with the proper font and font color.
      private void createMenu()  
      protected void createProgressBar​(java.lang.String title, AlgorithmBase pListener)
      Creates the progress bar that will listen to an algorithm's progress changes
      protected void createProgressBar​(java.lang.String title, java.lang.String msg, AlgorithmBase pListener)
      Creates the progress bar (should be created within JDialog's callAlgorithm method
      protected javax.swing.JTextField createTextField​(java.lang.String title)
      Helper method to create a text field with the proper font and font color.
      void focusGained​(java.awt.event.FocusEvent event)
      Unchanged.
      void focusLost​(java.awt.event.FocusEvent event)
      Unchanged.
      private java.lang.String getComponentName​(java.awt.Component comp, java.lang.String longName, java.lang.String profile)  
      private static java.lang.String getComponentName​(java.lang.Object parentClassObject, java.awt.Component comp, java.lang.String longName, java.lang.String profile)  
      protected java.lang.String getDialogName()
      Returns the name of the dialog (e.g.
      boolean isCancelled()
      Accessor that returns whether or not the dialog has been cancelled.
      boolean isQuietRunning()  
      boolean isRunInSeparateThread()
      Returns whether this dialog's algorithm should be run in a new thread.
      boolean isScriptRunning()
      Returns whether the current dialog is being run from within a script.
      void itemStateChanged​(java.awt.event.ItemEvent event)
      Unchanged.
      private boolean loadComponents​(java.awt.Component comp, java.lang.String name, java.lang.String profile)  
      void loadDefaults()
      Loads the defaults of profile 0.
      boolean loadDefaults​(java.lang.String profileStr)
      Loads default values for gui components in the dialog.
      private java.util.ArrayList<java.lang.String> loadProfiles()
      Loads profile names that are available for the dialog
      static java.lang.String makeImageName​(java.lang.String image_name, java.lang.String ext)
      Helper method for making the result image's name.
      java.lang.String makeString​(float number, int decPts)
      Makes a string of a floating point number with a specific number of decimal points.
      protected ViewJFrameImage openNewFrame​(ModelImage image)
      JDialogs that create result image's in new frame should call this method instead of creating a new ViewJFrameImage
      private void saveComponents​(java.awt.Component comp, java.lang.String name, java.lang.String profile)  
      void saveDefaults()
      Saves the defaults of profile 0.
      void saveDefaults​(java.lang.String profile)
      Saves the defaults of the dialog base to the mipav preferences file, assigning it to the given profile name.
      void setLeftHandSystem​(boolean leftHandSys)
      Sets the left-hand coordinate flag.
      void setQuietRunning​(boolean runQuiet)  
      void setScriptRunning​(boolean flag)
      Sets whether the dialog is being run by a script.
      void setSeparateThread​(boolean flag)
      Accessor that sets the separate thread flag.
      void setVisible()
      Makes the dialog visible in center of screen.
      void setVisible​(boolean status)
      Makes the dialog visible in center of screen.
      void setVisibleMenuBar​(boolean visible)  
      void setVisibleStandard​(boolean status)
      Makes the dialog visible by calling super method.
      void setVOIManager​(VOIManagerInterface voiManager)
      Sets the VOIManagerInterface
      void setWCSystem​(boolean wcSys)
      Sets the world coordinate flag.
      static boolean testParameter​(java.lang.String str, double minValue, double maxValue)
      Tests that the entered parameter is in range from [minValue, maxValue].
      static boolean testParameterMin​(java.lang.String str, double minValue)
      Tests that the entered parameter is larger than the specified value.
      static void updateFFTFileInfo​(ModelImage image, ModelImage resultImage, int type)
      Copy important file information to resultant image structure.
      static void updateFileInfo​(ModelImage image, ModelImage resultImage)
      Copy important file information to resultant image structure.
      static void updateFileInfoOtherModality​(ModelImage image, ModelImage resultImage)
      Copy important file information to resultant image structure.
      static void updateFileInfoStatic​(FileInfoBase info, ModelImage resultImage)
      Copy important file information between ModelImage structures, assuming all slices have same properties (uses only the first slice from the source).
      static void updateFileInfoStatic​(ModelImage image, ModelImage resultImage)
      Copy important file information to resultant image structure.
      static void updateFileTypeInfo​(ModelImage image, int type)
      Copy important file information to resultant image structure, including data type.
      static void updateFileTypeInfo​(ModelImage image, ModelImage resultImage, int type)
      Copy important file information to resultant image structure, including data type.
      void windowActivated​(java.awt.event.WindowEvent event)
      Unchanged.
      void windowClosed​(java.awt.event.WindowEvent event)
      Unchanged.
      void windowClosing​(java.awt.event.WindowEvent event)
      Disposes of error dialog, then frame.
      void windowDeactivated​(java.awt.event.WindowEvent event)
      Unchanged.
      void windowDeiconified​(java.awt.event.WindowEvent event)
      Unchanged.
      void windowIconified​(java.awt.event.WindowEvent event)
      Unchanged.
      void windowOpened​(java.awt.event.WindowEvent event)
      Unchanged.
      • Methods inherited from class javax.swing.JDialog

        addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
      • Methods inherited from class java.awt.Dialog

        addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, show, toBack
      • Methods inherited from class java.awt.Window

        addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Use serialVersionUID for interoperability.
        See Also:
        Constant Field Values
      • REPLACE

        protected static final int REPLACE
        REPLACE indicates the current image is replaced after algorithm is run.
        See Also:
        Constant Field Values
      • NEW

        protected static final int NEW
        NEW indicates a new image is created after the algorithm is run.
        See Also:
        Constant Field Values
      • LOAD_DEFAULT

        private static final java.lang.String LOAD_DEFAULT
        Loads default for this dialog
        See Also:
        Constant Field Values
      • LOAD_PROFILE

        private static final java.lang.String LOAD_PROFILE
        Loads profile for this dialog
        See Also:
        Constant Field Values
      • SAVE_DEFAULT

        private static final java.lang.String SAVE_DEFAULT
        Saves default for this dialog
        See Also:
        Constant Field Values
      • SAVE_PROFILE

        private static final java.lang.String SAVE_PROFILE
        Saves profile for this dialog
        See Also:
        Constant Field Values
      • HELP

        protected static final java.lang.String HELP
        Displays help this dialog
        See Also:
        Constant Field Values
      • ABOUT_MIPAV

        private static final java.lang.String ABOUT_MIPAV
        Access about mipav panel
        See Also:
        Constant Field Values
      • cancelFlag

        public boolean cancelFlag
        Flag indicating if the dialog had been cancelled or not.
      • applyButton

        protected javax.swing.JButton applyButton
        Apply button is used to apply the setting of the dialog.
      • cancelButton

        protected javax.swing.JButton cancelButton
        Cancel button is used on most dialogs. Defining it in the base allows default actions if the user presses return and the button is in focus.
      • closeButton

        protected javax.swing.JButton closeButton
        Close button is used to close the dialog.
      • helpButton

        protected javax.swing.JButton helpButton
        Help button is used on most dialogs. Defining it in the base allows default actions if the user presses return and the button is in focus.
      • mainDialogPanel

        protected javax.swing.JPanel mainDialogPanel
        The main panel of the dialog. To be filled by inheriting classes. Defaults to BorderLayout since that's what the contentPane defaults to (makes it easier to change over to using mainDialogPanel without messing up the layout).
      • OKButton

        protected javax.swing.JButton OKButton
        OK button is used on most dialogs. Defining it in the base allows default actions if the user presses return and the button is in focus.
      • parentFrame

        protected java.awt.Frame parentFrame
        Parent frame of this dialog, usually of type ViewJFrameImage.
      • runInSeparateThread

        protected boolean runInSeparateThread
        Flag indicating if the algorithm should run in a separate thread. Default is true.
      • runningScriptFlag

        protected boolean runningScriptFlag
        Whether we are using this dialog as part of a script.
      • runQuiet

        protected boolean runQuiet
        Whether algorithm is running in quiet mode (such as part of a script, in headless environment, within other algorithm )
      • serif12

        protected java.awt.Font serif12
        Fonts, same as MipavUtil.font12 and MipavUtil.font12B.
      • serif12B

        protected java.awt.Font serif12B
        Fonts, same as MipavUtil.font12 and MipavUtil.font12B.
      • progressBar

        protected ViewJProgressBar progressBar
        Progress bar that will listen to a dialog's algorithm (and reflect current progress)
      • bar

        protected javax.swing.JMenuBar bar
        JMenuBar for loading/saving defaults
      • profiles

        private java.util.ArrayList<java.lang.String> profiles
        List of existing default profiles for this dialog
    • Constructor Detail

      • JDialogBase

        public JDialogBase()
        Constructor that sets the dialog to not modal. There is no parent frame. No visible dialogs should use this constructor - only for scripting, where the dialogs are hidden and simply store information.
      • JDialogBase

        public JDialogBase​(boolean modal)
        Constructor that only sets the dialog to modal or not modal. In this case the parent frame is null. Also adds this as a window listener.
        Parameters:
        modal - true indicates modal dialog, false otherwise.
      • JDialogBase

        public JDialogBase​(java.awt.Frame parent,
                           boolean modal)
        Constructor that sets the parent frame of the dialog and whether or not the dialog is modal. Also adds this as a window listener to all dialogs.
        Parameters:
        parent - Parent frame.
        modal - Modality of the dialog; true means the user can't do anything until this dialog is diposed of.
      • JDialogBase

        public JDialogBase​(java.awt.Frame parent,
                           boolean modal,
                           boolean displayMenu)
        Constructor that sets the parent frame of the dialog and whether or not the dialog is modal. Also adds this as a window listener to all dialogs.
        Parameters:
        parent - Parent frame.
        modal - Modality of the dialog; true means the user can't do anything until this dialog is diposed of.
        displayMenu - Whether menu should be displayed to user for loading/saving defaults
      • JDialogBase

        public JDialogBase​(java.awt.Dialog parent,
                           boolean modal)
        Constructor that forwards the parent dialog whether or not the dialog is modal. Also adds this as a window listener to all dialogs.
        Parameters:
        parent - Parent Dialog. Unlike the JDialog(Frame, boolean) constructor, this method merely forwards the parent/owner to the super-class, and not store a reference locally. a higher level, but does not store the
        modal - Modality of the dialog; true means the user can't do anything until this dialog is diposed of.
      • JDialogBase

        public JDialogBase​(java.awt.Dialog parent,
                           boolean modal,
                           boolean displayMenu)
        Constructor that forwards the parent dialog whether or not the dialog is modal. Also adds this as a window listener to all dialogs.
        Parameters:
        parent - Parent Dialog. Unlike the JDialog(Frame, boolean) constructor, this method merely forwards the parent/owner to the super-class, and not store a reference locally. a higher level, but does not store the
        modal - Modality of the dialog; true means the user can't do anything until this dialog is diposed of.
        displayMenu - Whether menu should be displayed to user for loading/saving defaults
    • Method Detail

      • createMenu

        private void createMenu()
      • makeImageName

        public static java.lang.String makeImageName​(java.lang.String image_name,
                                                     java.lang.String ext)
        Helper method for making the result image's name. Strips the current extension from the original name, adds the given extension, and returns the new name.
        Parameters:
        image_name - the original image's name
        ext - Extension to add which gives information about what algorithm was performed on the image.
        Returns:
        The new image name.
      • updateFileInfoStatic

        public static void updateFileInfoStatic​(ModelImage image,
                                                ModelImage resultImage)
        Copy important file information to resultant image structure.
        Parameters:
        image - Source image.
        resultImage - Resultant image.
      • updateFileInfoStatic

        public static final void updateFileInfoStatic​(FileInfoBase info,
                                                      ModelImage resultImage)
        Copy important file information between ModelImage structures, assuming all slices have same properties (uses only the first slice from the source).
        Parameters:
        image - Source image.
        resultImage - Resultant image.
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
      • focusGained

        public void focusGained​(java.awt.event.FocusEvent event)
        Unchanged.
        Specified by:
        focusGained in interface java.awt.event.FocusListener
        Parameters:
        event - FocusEvent
      • focusLost

        public void focusLost​(java.awt.event.FocusEvent event)
        Unchanged.
        Specified by:
        focusLost in interface java.awt.event.FocusListener
        Parameters:
        event - FocusEvent
      • getComponentName

        private java.lang.String getComponentName​(java.awt.Component comp,
                                                  java.lang.String longName,
                                                  java.lang.String profile)
      • getComponentName

        private static java.lang.String getComponentName​(java.lang.Object parentClassObject,
                                                         java.awt.Component comp,
                                                         java.lang.String longName,
                                                         java.lang.String profile)
      • isCancelled

        public boolean isCancelled()
        Accessor that returns whether or not the dialog has been cancelled.
        Returns:
        true indicates cancelled, false indicates not cancelled.
      • isRunInSeparateThread

        public boolean isRunInSeparateThread()
        Returns whether this dialog's algorithm should be run in a new thread.
        Returns:
        True if this dialog's algorithm should be run in a new thread.
      • itemStateChanged

        public void itemStateChanged​(java.awt.event.ItemEvent event)
        Unchanged.
        Specified by:
        itemStateChanged in interface java.awt.event.ItemListener
        Parameters:
        event - ItemEvent
      • loadComponents

        private boolean loadComponents​(java.awt.Component comp,
                                       java.lang.String name,
                                       java.lang.String profile)
      • loadDefaults

        public boolean loadDefaults​(java.lang.String profileStr)
        Loads default values for gui components in the dialog.
      • loadProfiles

        private java.util.ArrayList<java.lang.String> loadProfiles()
        Loads profile names that are available for the dialog
        Returns:
      • makeString

        public java.lang.String makeString​(float number,
                                           int decPts)
        Makes a string of a floating point number with a specific number of decimal points.
        Parameters:
        number - Number to be converted to a string.
        decPts - The number of decimal points.
        Returns:
        String representation of the number.
      • saveComponents

        private void saveComponents​(java.awt.Component comp,
                                    java.lang.String name,
                                    java.lang.String profile)
      • saveDefaults

        public void saveDefaults​(java.lang.String profile)
        Saves the defaults of the dialog base to the mipav preferences file, assigning it to the given profile name.
      • setLeftHandSystem

        public void setLeftHandSystem​(boolean leftHandSys)
        Sets the left-hand coordinate flag. If true, change matrix to the left-hand coordinate system.
        Parameters:
        leftHandSys - flag for left hand coordinate system
      • setSeparateThread

        public void setSeparateThread​(boolean flag)
        Accessor that sets the separate thread flag.
        Parameters:
        flag - true indicates run in separate thread, false otherwise.
      • setVisibleMenuBar

        public void setVisibleMenuBar​(boolean visible)
        Parameters:
        bar - whether the menu bar is visible
      • setVisible

        public void setVisible()
        Makes the dialog visible in center of screen.
      • setVisible

        public void setVisible​(boolean status)
        Makes the dialog visible in center of screen.
        Overrides:
        setVisible in class java.awt.Dialog
        Parameters:
        status - Flag indicating if the dialog should be visible.
      • setVisibleStandard

        public void setVisibleStandard​(boolean status)
        Makes the dialog visible by calling super method. No location set.
        Parameters:
        status - Flag indicating if the dialog should be visible.
      • setWCSystem

        public void setWCSystem​(boolean wcSys)
        Sets the world coordinate flag. If true, change matrix to the world coordinate system.
        Parameters:
        wcSys - flag for world coordinate
      • updateFFTFileInfo

        public static final void updateFFTFileInfo​(ModelImage image,
                                                   ModelImage resultImage,
                                                   int type)
        Copy important file information to resultant image structure. In doing a Forward FFT the result image is the same size or bigger than the original image because of zero padding. Set file info for the amount of slices in the FFT image so the original info will be available for all the slices after the inverse FFT is performed and so the MIPAV FileInfo operations will work properly on the FFT image.

        Because zero stripping is performed at the end of the inverse FFT process, the image formed after the inverse FFT will be the same size as the original image before the forward FFT. Also used for wavlet images since the wavelet tranform is always larger than the original source image

        Parameters:
        image - Source image.
        resultImage - Resultant image.
        type - Data type to set in file info.
      • updateFileInfo

        public static final void updateFileInfo​(ModelImage image,
                                                ModelImage resultImage)
        Copy important file information to resultant image structure.
        Parameters:
        image - Source image.
        resultImage - Resultant image.
      • updateFileInfoOtherModality

        public static final void updateFileInfoOtherModality​(ModelImage image,
                                                             ModelImage resultImage)
        Copy important file information to resultant image structure.
        Parameters:
        image - Source image.
        resultImage - Resultant image.
      • updateFileTypeInfo

        public static final void updateFileTypeInfo​(ModelImage image,
                                                    int type)
        Copy important file information to resultant image structure, including data type.
        Parameters:
        image - Source image.
        type - Data type to set in file info.
      • updateFileTypeInfo

        public static final void updateFileTypeInfo​(ModelImage image,
                                                    ModelImage resultImage,
                                                    int type)
        Copy important file information to resultant image structure, including data type.
        Parameters:
        image - Source image.
        resultImage - Resultant image.
        type - Data type to set in file info for the resultImage.
      • windowActivated

        public void windowActivated​(java.awt.event.WindowEvent event)
        Unchanged.
        Specified by:
        windowActivated in interface java.awt.event.WindowListener
        Parameters:
        event - WindowEvent
      • windowClosed

        public void windowClosed​(java.awt.event.WindowEvent event)
        Unchanged.
        Specified by:
        windowClosed in interface java.awt.event.WindowListener
        Parameters:
        event - WindowEvent
      • windowClosing

        public void windowClosing​(java.awt.event.WindowEvent event)
        Disposes of error dialog, then frame. Sets cancelled to true.
        Specified by:
        windowClosing in interface java.awt.event.WindowListener
        Parameters:
        event - WindowEvent
      • windowDeactivated

        public void windowDeactivated​(java.awt.event.WindowEvent event)
        Unchanged.
        Specified by:
        windowDeactivated in interface java.awt.event.WindowListener
        Parameters:
        event - WindowEvent
      • windowDeiconified

        public void windowDeiconified​(java.awt.event.WindowEvent event)
        Unchanged.
        Specified by:
        windowDeiconified in interface java.awt.event.WindowListener
        Parameters:
        event - WindowEvent
      • windowIconified

        public void windowIconified​(java.awt.event.WindowEvent event)
        Unchanged.
        Specified by:
        windowIconified in interface java.awt.event.WindowListener
        Parameters:
        event - WindowEvent
      • windowOpened

        public void windowOpened​(java.awt.event.WindowEvent event)
        Unchanged.
        Specified by:
        windowOpened in interface java.awt.event.WindowListener
        Parameters:
        event - WindowEvent
      • buildApplyButton

        protected javax.swing.JButton buildApplyButton()
        Builds the cancel button. Sets it internally as well return the just-built button.
        Returns:
        JButton apply button
      • buildButtons

        protected javax.swing.JPanel buildButtons()
        Builds button panel consisting of OK, Cancel and Help buttons.
        Returns:
        JPanel that has ok, cancel, and help buttons
      • buildOKCancelButtons

        protected javax.swing.JPanel buildOKCancelButtons()
        Builds button panel consisting of OK, Cancel and Help buttons.
        Returns:
        JPanel that has ok, cancel, and help buttons
      • buildCancelButton

        protected javax.swing.JButton buildCancelButton()
        Builds the cancel button. Sets it internally as well return the just-built button.
        Returns:
        JButton cancel button
      • buildCancelButton

        public static javax.swing.JButton buildCancelButton​(java.lang.String actionCommand,
                                                            java.awt.event.ActionListener parent)
      • buildCloseButton

        protected javax.swing.JButton buildCloseButton()
        Builds the close button. Sets it internally as well return the just-built button.
        Returns:
        JButton close button
      • buildHelpButton

        protected javax.swing.JButton buildHelpButton()
        Builds the help button. Sets it internally as well return the just-built button.
        Returns:
        JButton help button
      • buildImageComboBox

        protected javax.swing.JComboBox buildImageComboBox​(ModelImage image)
        Builds a list of images. Returns combobox.
        Parameters:
        image - ModelImage to exclude from the box
        Returns:
        Newly created combo box.
      • buildOKButton

        public static javax.swing.JButton buildOKButton​(java.lang.String actionCommand,
                                                        java.awt.event.ActionListener parent)
        Builds the OK button. Sets it internally as well return the just-built button.
        Returns:
        JButton ok button
      • buildOKButton

        protected javax.swing.JButton buildOKButton()
        Builds the OK button. Sets it internally as well return the just-built button.
        Returns:
        JButton ok button
      • buildTitledBorder

        public static javax.swing.border.TitledBorder buildTitledBorder​(java.lang.String title)
        Builds a titled border with the given title, an etched border, and the proper font and color.
        Parameters:
        title - Title of the border
        Returns:
        The titled border.
      • buildTitledBorder

        public static javax.swing.border.TitledBorder buildTitledBorder​(java.lang.String title,
                                                                        java.awt.Color color)
        Builds a titled border with the given title, an etched border, and the proper font and color.
        Parameters:
        title - Title of the border
        color - Color of the border
        Returns:
        The titled border.
      • createLabel

        protected javax.swing.JLabel createLabel​(java.lang.String title)
        Helper method to create a label with the proper font and font color.
        Parameters:
        title - Text of the label.
        Returns:
        New label.
      • createTextField

        protected javax.swing.JTextField createTextField​(java.lang.String title)
        Helper method to create a text field with the proper font and font color.
        Parameters:
        title - Text int the field.
        Returns:
        New text field.
      • createProgressBar

        protected void createProgressBar​(java.lang.String title,
                                         AlgorithmBase pListener)
        Creates the progress bar that will listen to an algorithm's progress changes
        Parameters:
        title - progress bar's title
        pListener - algorithmbase that will notify progress updates to the pBar
      • createProgressBar

        protected void createProgressBar​(java.lang.String title,
                                         java.lang.String msg,
                                         AlgorithmBase pListener)
        Creates the progress bar (should be created within JDialog's callAlgorithm method
        Parameters:
        title - progress bar's title
        msg - the message to display on the progress bar (initial setting)
        pListener - the algorithm that will register the progress bar as a listener
      • getDialogName

        protected java.lang.String getDialogName()
        Returns the name of the dialog (e.g. JDialogBase -> Base)
        Returns:
        String dialog name
      • openNewFrame

        protected ViewJFrameImage openNewFrame​(ModelImage image)
        JDialogs that create result image's in new frame should call this method instead of creating a new ViewJFrameImage
        Parameters:
        image - the result image to be opened in a new frame that extends ViewJFrameImage
        Returns:
        the new frame
      • isScriptRunning

        public boolean isScriptRunning()
        Returns whether the current dialog is being run from within a script.
        Returns:
        whether a script is running
      • setScriptRunning

        public void setScriptRunning​(boolean flag)
        Sets whether the dialog is being run by a script.
        Parameters:
        flag - whether a script is being executed
      • isQuietRunning

        public boolean isQuietRunning()
      • setQuietRunning

        public void setQuietRunning​(boolean runQuiet)
      • setVOIManager

        public void setVOIManager​(VOIManagerInterface voiManager)
        Sets the VOIManagerInterface
        Parameters:
        voiManager -
      • testParameter

        public static boolean testParameter​(java.lang.String str,
                                            double minValue,
                                            double maxValue)
        Tests that the entered parameter is in range from [minValue, maxValue].
        Parameters:
        str - The value entered by the user.
        minValue - The minimum value this variable may be set to.
        maxValue - The maximum value this variable may be set to.
        Returns:
        true if parameters passed range test, false if failed.
      • testParameterMin

        public static boolean testParameterMin​(java.lang.String str,
                                               double minValue)
        Tests that the entered parameter is larger than the specified value.
        Parameters:
        str - The value entered by the user.
        minValue - The minimum value this variable may be set to.
        Returns:
        true if parameters passed range test, false if failed.