public class FileDialog
extends java.lang.Object
Each public method emulates an option of the statement. They do a quick validation. If successful, they return a reference to this object to allow other method to be chained.
The execute() method does the final checks, send the request with gathered options
to client, awaits the user to interact and finally sets up the response and confirmation
variable update.
| Modifier and Type | Field and Description |
|---|---|
private boolean |
askOverwrite
If
true, a dialog is displayed to prompt for confirmation if the user selects the
a file that already exists. |
private boolean |
atWebBrowser
AT-WEB-BROWSER option value
|
private boolean |
createTestFile
The dialog will attempt to create a temporary file with selected name and location before it
completes in order to verify whether the user has write access to respective directory.
|
private java.lang.String |
defaultExtension
The default extension to be appended to the user's selection if it does not have one.
|
private java.lang.String[] |
events
An array of legacy events registered for direct upload
|
private java.lang.String[] |
filters
Defines one or more filters for the filename dialog.
|
private boolean |
findDirectories
Flag to mark a dialog for selecting a directory.
|
private java.lang.String |
initialDir
The initial directory where dialog opens for the first time.
|
private int |
initialFilter
If
filters are specified, then the default one is designed by this value. |
private handle |
inWindow
Specifies the parent window for the dialog box to be displayed.
|
private boolean |
multiple
MULTIPLE option value
|
private boolean |
mustExist
Enforces that the user must select and existing file.
|
private character |
path
As input parameter, when
useFilename == true this is the default filename presented
to user. |
private boolean |
returnToStartDir
By default, the last directory where the user has selected a file remains will be used as
the default initial directory for subsequent invocations of this method.
|
private boolean |
saveAs
Converts the dialog to a "Save As..." dialog box.
|
private java.lang.String |
title
The title of the dialog.
|
private logical |
toUpdate
A logical variable used as output parameter that will contain the status of the user's
dialog interaction: if the user validates it by selecting the
OK button, the
value of the variable is set to TRUE on return. |
private boolean |
upload
UPLOAD option value
|
private java.lang.String |
uploadDir
Upload directory.
|
private boolean |
useFilename
Specifies the contents of
path as the default filename entry for the dialog. |
private CommonWidget |
widget
A reference of a widget registered for direct upload
|
| Modifier | Constructor and Description |
|---|---|
private |
FileDialog(character path,
boolean findDirs)
The constructor.
|
private |
FileDialog(CommonWidget widget,
java.lang.String[] events)
Creates a new FileDialog instance.
|
| Modifier and Type | Method and Description |
|---|---|
FileDialog |
askOverwrite()
Configures the file selection dialog to warn the user that the selected file already exists
and prompt for overwrite it.
|
FileDialog |
atWebBrowser()
Sets the AT-WEB-BROWSER option.
|
static FileDialog |
createDirSearchDialog(character dirPath)
Creates a configurable
FileDialog object that will prompt the user to select a
directory when executed. |
static FileDialog |
createFileSearchDialog(character filePath)
Creates a configurable
FileDialog object that will prompt the user to select a file
when executed. |
FileDialog |
createTestFile()
Configures the file selection dialog to check write access.
|
void |
deregister()
Deregisters a widget from direct upload.
|
static FileDialog |
directUpload(CommonWidget widget,
java.lang.String... events)
Initializes the object with widget and an array of events for the direct upload use case.
|
static FileDialog |
directUpload(handle widget,
java.lang.String... events)
Initializes the object with widget and an array of events for the direct upload use case.
|
void |
execute()
Displays the file selection dialog that was already configured.
|
FileDialog |
multiple()
Sets the MULTIPLE option.
|
FileDialog |
mustExist()
Configures the file selection dialog not to select new files.
|
void |
register()
Registers a widget with the associated set of events and other optional parameters for direct upload.
|
FileDialog |
returnToStartDir()
Configures the file selection dialog to discard any used navigation and not to save the
destination directory as default location for subsequent dialogs.
|
FileDialog |
saveAs()
Configures the file selection dialog as a Save-as dialog.
|
FileDialog |
setDefaultExtension(character defaultExtension)
Configures the default extension of the file selection dialog.
|
FileDialog |
setDefaultExtension(java.lang.String defaultExtension)
Configures the default extension of the file selection dialog.
|
FileDialog |
setFilters(java.lang.Object... filters)
Configures the filters of the file selection dialog.
|
FileDialog |
setInitialDir(BaseDataType initialDir)
Configures the initial directory where the file selection dialog is open.
|
FileDialog |
setInitialDir(character initialDir)
Configures the initial directory where the file selection dialog is open.
|
FileDialog |
setInitialDir(java.lang.String initialDir)
Configures the initial directory where the file selection dialog is open.
|
FileDialog |
setInitialFilter(long initialFilter)
Configures the initial filter of the file selection dialog.
|
FileDialog |
setInitialFilter(NumberType initialFilter)
Configures the initial filter of the file selection dialog.
|
FileDialog |
setTitle(character title)
Configures the title of the file selection dialog.
|
FileDialog |
setTitle(java.lang.String title)
Configures the title of the file selection dialog.
|
FileDialog |
setWindow(handle window)
Configures the file dialog to be created as child of a certain windows.
|
FileDialog |
update(logical update)
Configures the variable to be set when the file selection dialog is closed.
|
FileDialog |
upload()
Sets the UPLOAD flag.
|
FileDialog |
upload(character dir)
Sets the UPLOAD flag and assigns the upload directory.
|
FileDialog |
upload(java.lang.String dir)
Sets the UPLOAD flag and assigns the upload directory.
|
FileDialog |
useFilename()
Configures the file selection dialog to use the current value of the
path as default
filename and location. |
private static void |
validateParam(BaseDataType param)
Validates a parameter.
|
private boolean findDirectories
true the user can select only
directories. If false the user can select only files.private character path
useFilename == true this is the default filename presented
to user. When the dialog finished with success it contains the filename the user has
selected - as OUTPUT parameter. When multiple is set, the variable will be set to comma separated
list of files/paths.private logical toUpdate
OK button, the
value of the variable is set to TRUE on return. If the user rejects the dialog by
pressing the Cancel button, the variable's value on return will be FALSE.private handle inWindow
private java.lang.String title
Open
and Save As dialogs will be used.private boolean askOverwrite
true, a dialog is displayed to prompt for confirmation if the user selects the
a file that already exists. This option is used only if SAVE-AS option is
also active.private boolean createTestFile
Note: this option is not supported yet.
private java.lang.String defaultExtension
private java.lang.String initialDir
private boolean mustExist
Cancel button to reject
the dialog.private boolean returnToStartDir
private boolean saveAs
private boolean useFilename
path as the default filename entry for the dialog. The
user is free to change it if needed.private int initialFilter
filters are specified, then the default one is designed by this value.private java.lang.String[] filters
private boolean atWebBrowser
private boolean upload
private boolean multiple
private java.lang.String uploadDir
private CommonWidget widget
private java.lang.String[] events
private FileDialog(character path, boolean findDirs)
execute. Depending on the findDirs flag,
some of the options to be set may not be valid (FILTERS, INITIAL-FILTER, DEFAULT-EXTENSION,
MUST-EXIST, CREATE-TEST-FILE, SAVE-AS, ASK-OVERWRITE, USE-FILENAME and UPDATE are not valid
when findDirs == false).path - A reference to a character variable to be updated if the dialog is
accepted.findDirs - Sets the type of file dialog. If true this will select folders only (behave
like the SYSTEM-DIALOG-GET-DIR), otherwise, only files are allowed to be returned
(behave like the SYSTEM-DIALOG-GET-FILE).private FileDialog(CommonWidget widget, java.lang.String[] events)
widget - the widget object to associate the FileDialog withevents - the array of events to associate the FileDialog withpublic static FileDialog createFileSearchDialog(character filePath)
FileDialog object that will prompt the user to select a file
when executed.filePath - The output parameter that will contain result (full absolute path).FileDialog that can be configured with various options using chained
methods before calling execute() to be displayed.public static FileDialog createDirSearchDialog(character dirPath)
FileDialog object that will prompt the user to select a
directory when executed.dirPath - The output parameter that will contain result (full absolute path).FileDialog that can be configured with various options using chained
methods before calling execute() to be displayed.public static FileDialog directUpload(CommonWidget widget, java.lang.String... events)
widget - the CommonWidget to associate the file dialog withevents - the array of events to associate the FileDialog withpublic static FileDialog directUpload(handle widget, java.lang.String... events)
widget - a handle of a CommonWidget to associate the file dialog withevents - the array of events to associate the FileDialog withpublic FileDialog setWindow(handle window)
window - A handle to a window that will be the parent of the dialog. The handle must
refer a window or an error condition will be issued.FileDialog. Used for chaining.inWindowpublic FileDialog setTitle(character title)
title - The title of the file selection dialog.FileDialog. Used for chaining.titlepublic FileDialog setTitle(java.lang.String title)
title - The title of the file selection dialog.FileDialog. Used for chaining.titlepublic FileDialog askOverwrite()
FileDialog. Used for chaining.askOverwritepublic FileDialog createTestFile()
FileDialog. Used for chaining.createTestFilepublic FileDialog setDefaultExtension(character defaultExtension)
defaultExtension - The default extension for selected file.FileDialog. Used for chaining.defaultExtensionpublic FileDialog setDefaultExtension(java.lang.String defaultExtension)
defaultExtension - The default extension for selected file.FileDialog. Used for chaining.defaultExtensionpublic FileDialog setInitialDir(BaseDataType initialDir)
initialDir - the initial directory where the file selection dialog is open.FileDialog. Used for chaining.initialDirpublic FileDialog setInitialDir(character initialDir)
initialDir - the initial directory where the file selection dialog is open.FileDialog. Used for chaining.initialDirpublic FileDialog setInitialDir(java.lang.String initialDir)
initialDir - the initial directory where the file selection dialog is open.FileDialog. Used for chaining.initialDirpublic FileDialog mustExist()
FileDialog. Used for chaining.mustExistpublic FileDialog returnToStartDir()
FileDialog. Used for chaining.returnToStartDirpublic FileDialog saveAs()
FileDialog. Used for chaining.saveAspublic FileDialog useFilename()
path as default
filename and location.FileDialog. Used for chaining.useFilenamepublic FileDialog update(logical update)
update - A variable that will hold the return status of the dialog. That is true
if the dialog was accepted and false otherwise.FileDialog. Used for chaining.toUpdatepublic FileDialog setInitialFilter(long initialFilter)
initialFilter - The index of the initial filter.FileDialog. Used for chaining.initialFilterpublic FileDialog setInitialFilter(NumberType initialFilter)
initialFilter - The index of the initially active filter.FileDialog. Used for chaining.initialFilterpublic FileDialog setFilters(java.lang.Object... filters)
filters - The list of filters for the file selection dialog.FileDialog. Used for chaining.filterspublic FileDialog multiple()
FileDialog. Used for chaining.public FileDialog atWebBrowser()
FileDialog. Used for chaining.public FileDialog upload()
FileDialog. Used for chaining.public FileDialog upload(character dir)
dir - The upload directory.FileDialog. Used for chaining.public FileDialog upload(java.lang.String dir)
dir - The upload directory.FileDialog. Used for chaining.public void execute()
public void register()
public void deregister()
private static void validateParam(BaseDataType param)
null or
unknown.param - The parameter to check.ErrorConditionException - if the parameter does not meet the requirements.