Class Loader

java.lang.Object
jwat.trafficAnalysis.utils.Loader

public class Loader extends Object

Title: Model Loader

Description: This class provides unified load/save functionality for every JMT application

Author:
Bertoli Marco Date: 15-feb-2006 Time: 15.36.51
  • Field Details

  • Constructor Details

    • Loader

      public Loader(Loader.JmtFileFilter defaultFilter)
      Initialize a new ModelLoader with specified default file filter (chosen between constrants in this class)
      Parameters:
      defaultFilter - default file filter for current application (used to detect application type)
  • Method Details

    • getFailureMotivation

      public String getFailureMotivation()
      Gets the motivation of last failure
      Returns:
      the motivation of last failure
    • getLastWarnings

      public Vector getLastWarnings()
      Gets a vector containing warnings of last performed operation
      Returns:
      a Vector of String with every found warning
    • loadModel

      public int loadModel(Component parent)
      Shows a Load window and loads chosen model inside specified model data file. The model data file must be compatible with the defaultFilter chosen in the constructor, otherwise a ClassCastException will be thrown.
      Parameters:
      parent - parent component of loading window
      Returns:
      SUCCESS on success, CANCELLED if loading is cancelled, FAILURE if an error occurs and WARNING is one or more warnings are generated due to format conversion
      Throws:
      ClassCastException - if modelData is not of instance of the correct class
      See Also:
    • getSelectedFile

      public File getSelectedFile()
      Returns name of selected file for i/o operations
      Returns:
      name of selected file for open or save
    • addAllFilters

      protected void addAllFilters()
      Adds all filters to current dialog
    • showOpenDialog

      protected int showOpenDialog(Component parent)
      Shows open file dialog
      Parameters:
      parent - parent component for this dialog
      Returns:
      the return state of the file chooser on popdown:
      • JFileChooser.CANCEL_OPTION
      • JFileChooser.APPROVE_OPTION
      • JFileCHooser.ERROR_OPTION if an error occurs or the dialog is dismissed
      Throws:
      HeadlessException - if GraphicsEnvironment.isHeadless() returns true.