Class Loader
java.lang.Object
jwat.trafficAnalysis.utils.Loader
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classCustom file chooser classprotected static classInner class used to create simple file filters with only extension check -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intprotected Loader.JmtFileFilterprotected Loader.JmtFileChooserprotected static final Stringprotected static final StringFailure motivationsstatic final intprotected Stringstatic final Loader.JmtFileFilterFilters for input filesstatic final intConstants used for outputstatic final intprotected Vector -
Constructor Summary
ConstructorsConstructorDescriptionLoader(Loader.JmtFileFilter defaultFilter) Initialize a new ModelLoader with specified default file filter (chosen between constrants in this class) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdds all filters to current dialogGets the motivation of last failureGets a vector containing warnings of last performed operationReturns name of selected file for i/o operationsintShows a Load window and loads chosen model inside specified model data file.protected intshowOpenDialog(Component parent) Shows open file dialog
-
Field Details
-
LOG
Filters for input files -
SUCCESS
public static final int SUCCESSConstants used for output- See Also:
-
CANCELLED
public static final int CANCELLED- See Also:
-
FAILURE
public static final int FAILURE- See Also:
-
WARNING
public static final int WARNING- See Also:
-
FAIL_UNKNOWN
-
FAIL_CONVERSION
- See Also:
-
dialog
-
defaultFilter
-
failureMotivation
-
warnings
-
-
Constructor Details
-
Loader
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
Gets the motivation of last failure- Returns:
- the motivation of last failure
-
getLastWarnings
Gets a vector containing warnings of last performed operation- Returns:
- a Vector of String with every found warning
-
loadModel
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
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
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.
-