Class StartupManager

java.lang.Object
edu.wisc.ssec.mcidasv.startupmanager.StartupManager
All Implemented Interfaces:
Constants, IdvConstants

public class StartupManager extends Object implements Constants
Manages the McIDAS-V startup options in a context that is completely free from the traditional IDV/McIDAS-V overhead.
  • Field Details

  • Constructor Details

  • Method Details

    • getInstance

      public static StartupManager getInstance()
    • getRenderingHints

      Creates and returns the rendering hints for the GUI. Built from RENDER_HINTS
      Returns:
      Hints to use when displaying the GUI.
    • determinePlatform

      Figures out the type of platform. Queries the "os.name" system property to determine the platform type.
      Returns:
      Platform.UNIXLIKE, Platform.WINDOWS, or Platform.MAC.
    • getPlatform

      Returns:
      The platform as determined by determinePlatform().
    • handleApply

      public void handleApply()
      Saves the changes to the preferences and quits. Unlike the other button handling methods, this one is public. This was done so that the advanced preferences (within McIDAS-V) can force an update to the startup prefs.
    • handleOk

      protected void handleOk()
      Saves the preference changes.
    • handleHelp

      protected void handleHelp()
      Shows the startup preferences help page.
    • handleCancel

      protected void handleCancel()
      Simply quits the program.
    • getSelectedPanel

      Returns the preferences panel that corresponds with the user's JList selection.

      In the context of the startup manager, this means that any JList selection other than "Advanced" will return the results of getUnavailablePanel(). Otherwise the results of getAdvancedPanel(boolean) will be returned.

      Returns:
      Either the advanced preferences panel or an "unavailable", depending upon the user's selection.
    • buildUnavailablePanel

      Creates and returns a dummy panel.
      Returns:
      Panel containing only a note about "options unavailable."
    • buildAdvancedPanel

      Creates and returns the advanced preferences panel.
      Returns:
      Panel with all the various startup options.
    • buildCommandRow

      Builds and returns a JPanel containing the various buttons that control the startup manager. These buttons offer identical functionality to those built by the IDV's preference manager code.
      Returns:
      A JPanel containing the following types of buttons: StartupManager.ApplyButton, StartupManager.OkButton, StartupManager.HelpButton, and StartupManager.CancelButton.
      See Also:
    • getAdvancedPanel

      public JPanel getAdvancedPanel(boolean forceBuild)
      Returns the advanced preferences panel. Differs from the buildAdvancedPanel() in that a panel isn't created, unless forceBuild is true.
      Parameters:
      forceBuild - Always rebuilds the advanced panel if true.
      Returns:
      Panel containing the startup options.
    • getUnavailablePanel

    • getCommandRow

      Returns a panel containing the Apply/Ok/Help/Cancel buttons.
      Returns:
      Panel containing the command row.
    • createDisplay

      protected void createDisplay()
      Build and display the startup manager window.
    • copy

      public void copy(File src, File dst) throws IOException
      Copies a file.
      Parameters:
      src - The file to copy.
      dst - The path to the copy of src.
      Throws:
      IOException - If there was a problem while attempting to copy.
    • getDefaultProperties

    • getArgs

      public static Properties getArgs(boolean ignoreUnknown, boolean fromStartupManager, String[] args, Properties defaults)
      Extract any command-line properties and their corresponding values.

      May print out usage information if a badly formatted "property=value" pair is encountered, or when an unknown argument is found (depending on value of the ignoreUnknown parameter).

      NOTE: null is not a permitted value for any parameter.

      Parameters:
      ignoreUnknown - Whether or not to handle unknown arguments.
      fromStartupManager - Whether or not this call originated from startupmanager.jar.
      args - Array containing command-line arguments.
      defaults - Default parameter values.
      Returns:
      Command-line arguments as a collection of property identifiers and values.
    • getMaximumHeapSize

      public static int getMaximumHeapSize()
    • usage

      private static void usage(String err)
      Print out the command line usage message and exit. Taken entirely from ArgsManager.
      Parameters:
      err - The usage message
    • getUsageMessage

      protected static String getUsageMessage()
      Return the command line usage message.
      Returns:
      The usage message
    • applyArgs

      public static void applyArgs(boolean ignoreUnknown, boolean fromStartupManager, String[] args) throws IllegalArgumentException
      Applies the command line arguments to the startup preferences. This method is mostly useful because it allows us to supply an arbitrary args array, link in McIDASV.main(String[]).
      Parameters:
      ignoreUnknown - If true ignore any parameters that do not apply to the startup manager. If false, the non-applicable parameters should signify an error.
      fromStartupManager - Whether or not this call originated from the startup manager (rather than preferences).
      args - Incoming command line arguments. Cannot be null.
      Throws:
      NullPointerException - if args is null.
      IllegalArgumentException
      See Also:
    • getStartupPrefs

      public static Map<String,String> getStartupPrefs()
      Extracts all startup preferences and returns them in a convenient Map.
      Returns:
      Either a HashMap mapping "preference ID" to its corresponding value, or an empty map.
    • main

      public static void main(String[] args)