Package eu.bandm.tools.util.files
Class CliOrGui
java.lang.Object
eu.bandm.tools.util.files.CliOrGui
Gets file names from command line or a very primitive interactive GUI
input.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionselectOneInputFile
(String title, boolean lenient, String[] args) Define the path of one input file.selectOneInputFile
(String title, CliOrGui.FileChooser fileChooser, boolean lenient, String[] args) Define the path of one input file.static CliOrGui.FileChooser
wrap
(JFileChooser peer) Factory method to wrap a Java Swing file chooser.
-
Method Details
-
wrap
Factory method to wrap a Java Swing file chooser.- Parameters:
peer
- the Java Swing instance to wrap.- Returns:
- a file chooser
-
selectOneInputFile
Define the path of one input file. When the command line parameters contain strings, then the first is tried as a file name. If not, an interactive swing gui is started. This method uses a default interactive file chooser, as defined by Java Swing.- Parameters:
title
- of the GUI input dialoglenient
- if multiple command line parameters are allowedargs
- the list of strings as found on the command line- Returns:
- the selected file, or null if none is selected or there are unallowed multiple command line parameters
-
selectOneInputFile
@Opt public static @Opt File selectOneInputFile(String title, CliOrGui.FileChooser fileChooser, boolean lenient, String[] args) Define the path of one input file. When the command line parameters contain strings, then the first is tried as a file name. If not, an interactive swing gui is started.- Parameters:
title
- of the GUI input dialogfileChooser
- the interactive file chooser to use, if the command line arguments are missing.lenient
- if multiple command line parameters are allowedargs
- the list of strings as found on the command line- Returns:
- the selected file, or null if none is selected or there are unallowed multiple command line parameters.
-