Class ViewMenuBar


  • public class ViewMenuBar
    extends java.lang.Object
    Build the menus for an image loaded into MIPAV.
    Version:
    1.0 July 12, 2004
    Author:
    Evan McCreedy
    See Also:
    ViewJFrameImage, ViewMenuBuilder
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected javax.swing.JMenu imageMenu
      The menu listing image and overlay commands
      protected ViewMenuBuilder menuBuilder
      Menu and menu item generator.
      protected javax.swing.JMenu plugInMenu
      The menu listing installed plugins in the user's home directory.
      protected static javax.swing.JSeparator separator
      Separator that can be added in between menu items.
      protected ViewUserInterface userInterface
      The user interface for MIPAV.
      protected javax.swing.JMenu voiMenu
      The menu listing voi commands.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void enableAllMenuItems()
      Enable all items in a menubar.
      protected void finalize()
      Clean up memory used by this class.
      javax.swing.JMenu getImageMenu()
      Returns the menu that contains all image and overlay commands
      javax.swing.JMenuBar getMenuBar​(java.awt.event.ActionListener listener, int numberOfDimensions, int type, boolean isDicomImage)
      Creates general menus based on dimensionality and data type (byte, short, argb, etc) of image and attaches them to a menu bar.
      javax.swing.JMenu getPlugInMenu()
      Return the menu containing the list of installed plugins.
      javax.swing.JMenu getVOIMenu()
      Return the menu containing the list VOI commands.
      static boolean isMenuCommand​(java.awt.Component[] menuComponents, java.lang.String command)
      determines if there is a matching action command
      static boolean isMenuCommand​(javax.swing.JMenu menu, java.lang.String command)
      determines if there is a matching action command
      javax.swing.JMenu makeAlgorithmsMenu()
      Construct the algorithms menu.
      javax.swing.JMenu makeCaptureMenu​(boolean isAnImageOpen)
      Create the image capture/print File submenu.
      javax.swing.JMenu makeCustomMenu​(java.lang.String customMenuName, java.util.Vector<CustomUIBuilder.UIParams> paramVector)
      Creates a custom menu with a given Vector of UIParams
      javax.swing.JMenu makeDicomMenu()
      Create the Dicom File submenu.
      javax.swing.JMenu makeDiffusionTensorMenu()
      Create the Diffusion Tensor File submenu.
      javax.swing.JMenu makeFileMenu​(boolean isAnImageOpen)
      Construct the file menu.
      javax.swing.JMenu makeHelpMenu()
      Construct the help menu.
      javax.swing.JMenu makeImageMenu​(boolean isDicomImage)
      Construct the image menu.
      javax.swing.JMenu makeLoadBMenu​(boolean isAnImageOpen)
      Create the Load image B File submenu.
      javax.swing.JMenu makeLUTMenu()
      Construct the LUT menu.
      javax.swing.JMenu makeScriptingMenu()
      Create the Scripting menu.
      javax.swing.JMenu makeSystemsAnalysisMenu()  
      javax.swing.JMenu makeToolbarsMenu()
      Construct the toolbar menu.
      javax.swing.JMenu makeUtilitiesMenu()
      Construct the utilities menu.
      javax.swing.JMenu makeVOIMenu()
      Construct the VOI menu.
      void setEnabledMenuItems​(int numberOfDimensions, int type)
      Enable or disable items in a menubar based on the image dimensionality and storage type.
      void setPlugInMenu​(javax.swing.JMenu menu)
      Sets the menu containing the list of installed plugins.
      • Methods inherited from class java.lang.Object

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

      • separator

        protected static final javax.swing.JSeparator separator
        Separator that can be added in between menu items.
      • menuBuilder

        protected ViewMenuBuilder menuBuilder
        Menu and menu item generator.
      • plugInMenu

        protected javax.swing.JMenu plugInMenu
        The menu listing installed plugins in the user's home directory.
      • voiMenu

        protected javax.swing.JMenu voiMenu
        The menu listing voi commands.
      • imageMenu

        protected javax.swing.JMenu imageMenu
        The menu listing image and overlay commands
      • userInterface

        protected ViewUserInterface userInterface
        The user interface for MIPAV.
    • Constructor Detail

      • ViewMenuBar

        public ViewMenuBar​(ViewMenuBuilder menuObj)
        Set up the menu bar builder.
        Parameters:
        menuObj - the helper class used to make the menus and menu items
    • Method Detail

      • finalize

        protected void finalize()
        Clean up memory used by this class.
        Overrides:
        finalize in class java.lang.Object
      • getMenuBar

        public javax.swing.JMenuBar getMenuBar​(java.awt.event.ActionListener listener,
                                               int numberOfDimensions,
                                               int type,
                                               boolean isDicomImage)
        Creates general menus based on dimensionality and data type (byte, short, argb, etc) of image and attaches them to a menu bar.
        Parameters:
        listener - The class that wants to listen to plugin menu actions.
        numberOfDimensions - Dimensionality of image (2D, 3D, 4D...)
        type - Data type from ModelStorageBase, byte, short, argb, etc.
        isDicomImage - Whether the image this menu bar is for is a dicom image.
        Returns:
        Menu bar with the menus attached.
      • getPlugInMenu

        public javax.swing.JMenu getPlugInMenu()
        Return the menu containing the list of installed plugins.
        Returns:
        the plugin menu
      • getImageMenu

        public javax.swing.JMenu getImageMenu()
        Returns the menu that contains all image and overlay commands
      • getVOIMenu

        public javax.swing.JMenu getVOIMenu()
        Return the menu containing the list VOI commands.
        Returns:
        the VOI menu
      • setPlugInMenu

        public void setPlugInMenu​(javax.swing.JMenu menu)
        Sets the menu containing the list of installed plugins.
        Parameters:
        menu - the new plugin menu
      • makeAlgorithmsMenu

        public javax.swing.JMenu makeAlgorithmsMenu()
        Construct the algorithms menu.
        Returns:
        the algorithms menu
      • makeCaptureMenu

        public javax.swing.JMenu makeCaptureMenu​(boolean isAnImageOpen)
        Create the image capture/print File submenu.
        Parameters:
        isAnImageOpen - Whether MIPAV has an image open (determines whether the menu is enabled).
        Returns:
        The new submenu
        See Also:
        makeFileMenu(boolean)
      • makeCustomMenu

        public javax.swing.JMenu makeCustomMenu​(java.lang.String customMenuName,
                                                java.util.Vector<CustomUIBuilder.UIParams> paramVector)
        Creates a custom menu with a given Vector of UIParams
        Parameters:
        customMenuName - the name of the menu
        paramVector - a vector of UIParams objects (can be lifted from CustomUIBuilder
        Returns:
        the custom menu
      • makeDicomMenu

        public javax.swing.JMenu makeDicomMenu()
        Create the Dicom File submenu.
        Returns:
        The new submenu
        See Also:
        makeFileMenu(boolean)
      • makeDiffusionTensorMenu

        public javax.swing.JMenu makeDiffusionTensorMenu()
        Create the Diffusion Tensor File submenu.
        Returns:
        The new submenu
        See Also:
        makeFileMenu(boolean)
      • makeFileMenu

        public javax.swing.JMenu makeFileMenu​(boolean isAnImageOpen)
        Construct the file menu.
        Parameters:
        isAnImageOpen - indicates whether an image has been opened in MIPAV yet (false if calling from ViewUserInterface, true otherwise)
        Returns:
        the file menu
      • makeHelpMenu

        public javax.swing.JMenu makeHelpMenu()
        Construct the help menu.
        Returns:
        the help menu
      • makeSystemsAnalysisMenu

        public javax.swing.JMenu makeSystemsAnalysisMenu()
      • makeImageMenu

        public javax.swing.JMenu makeImageMenu​(boolean isDicomImage)
        Construct the image menu.
        Parameters:
        isDicomImage - Whether the image this menu is attached to is a dicom image.
        Returns:
        the image menu
      • makeLoadBMenu

        public javax.swing.JMenu makeLoadBMenu​(boolean isAnImageOpen)
        Create the Load image B File submenu.
        Parameters:
        isAnImageOpen - Whether MIPAV has an image open (determines whether the menu is enabled).
        Returns:
        The new submenu
        See Also:
        makeFileMenu(boolean)
      • makeLUTMenu

        public javax.swing.JMenu makeLUTMenu()
        Construct the LUT menu.
        Returns:
        the LUT menu
      • makeScriptingMenu

        public javax.swing.JMenu makeScriptingMenu()
        Create the Scripting menu.
        Returns:
        The new scripting menu
      • makeToolbarsMenu

        public javax.swing.JMenu makeToolbarsMenu()
        Construct the toolbar menu.
        Returns:
        the toolbar menu
      • makeUtilitiesMenu

        public javax.swing.JMenu makeUtilitiesMenu()
        Construct the utilities menu.
        Returns:
        the utilities menu
      • makeVOIMenu

        public javax.swing.JMenu makeVOIMenu()
        Construct the VOI menu.
        Returns:
        the VOI menu
      • isMenuCommand

        public static boolean isMenuCommand​(javax.swing.JMenu menu,
                                            java.lang.String command)
        determines if there is a matching action command
        Parameters:
        menu -
        command -
        Returns:
      • isMenuCommand

        public static boolean isMenuCommand​(java.awt.Component[] menuComponents,
                                            java.lang.String command)
        determines if there is a matching action command
        Parameters:
        menuComponents -
        command -
        Returns:
      • setEnabledMenuItems

        public void setEnabledMenuItems​(int numberOfDimensions,
                                        int type)
        Enable or disable items in a menubar based on the image dimensionality and storage type.
        Parameters:
        numberOfDimensions - Dimensionality of image (2D, 3D, 4D...)
        type - Data type from ModelStorageBase, byte, short, argb, etc.
      • enableAllMenuItems

        protected void enableAllMenuItems()
        Enable all items in a menubar.