Class: FileBrowsingDialog

sync.api.FileBrowsingDialog

new FileBrowsingDialog(optionsopt)

Browsing dialog for files in a remote file repository. The file repositories suitable to be browsed using this dialog contain files that can be identified by URLs. The URLs should be composed of two parts:
  • The file repository URL. E.g. the URL of a branch of a GitHub project, or an WebDAV server. When editing a file, browsing for external references link: images, content references, DITA Maps happens in the repository of the edited file. However, when trying to open or create a new file, the users should be allowed to change the file repository that they are using.
  • The path to the file. In order to change the file path, users can navigate the hierarchical of the repository.
Parameters:
Name Type Attributes Description
options sync.api.FileBrowsingDialog.Options <optional>
The options used to configure the File Browsing Dialog.
Source:

Extends

Classes

FolderEntryDescriptor
UserActionRequiredEvent

Members

(static) DEFAULT_HEIGHT :number

The default height for the filebrowser. (WA-312)
Type:
  • number
Source:

(static) EventTypes :string

Event types generated by the File Browser.
Type:
  • string
Properties:
Name Type Description
USER_ACTION_REQUIRED string The Event dispatched when some user action is required in order to be able to list the content of a folder.
See sync.api.FileBrowsingDialog.UserActionRequiredEvent for more details.
Source:

handleOpenRepo

Called when the repository configuration should be opened.
Source:

renderRepoEditing

Render the repo editing UI.
Source:

renderRepoPreview

Render the repo preview UI.
Source:

Methods

checkIfFileExists(encodedName) → {boolean}

Check if a specific file exists in the files list.
Parameters:
Name Type Description
encodedName string The name of the file to search for.
Source:
Returns:
three-state flag. null if we do not know already if the file exists.
Type
boolean

chooseUrl(context, chosen, purpose)

Invokes the URL chooser.
Parameters:
Name Type Description
context sync.api.UrlChooser.Context The context in which the chooser is invoked - it contains information like the type of the resource that we want the user to choose: image, external xml file, etc.
chosen sync.api.UrlChooser~urlChosen The function to be called with the result of the choice.
purpose sync.api.UrlChooser.Purpose The purpose the chooser is invoked with.
Overrides:
Source:

customizeDialog_(purpose)

Customize the dialog according to the purpose.
Parameters:
Name Type Description
purpose sync.api.UrlChooser.Purpose The purpose of the dialog.
Source:

getCurrentFolderUrl() → {string}

Source:
Returns:
the URL of the current folder.
Type
string

getEventTarget() → {goog.events.EventTarget}

Getter for the url chooser's event target.
Source:
Returns:
target the object on which to listen for url chooser specific events.
Type
goog.events.EventTarget

getFileName() → {string}

Source:
Returns:
The name of the selected file.
Type
string

openUrl(url, isFile, eopt)

Opens the following URL. If the URL denotes a File, the file is chosen. If the URL denotes a Folder, the dialog switches to that folder.
Parameters:
Name Type Attributes Description
url string The URL to open.
isFile boolean true if the url points to a file rather than to a folder.
e goog.events.Event <optional>
The event that made you want to open the URL. If the call is made outside an event handler, pass null.
Source:

refresh()

Refresh the url chooser. Refresh the url chooser in case the chooser does not reflect the actual resource state.
Source:

saveFile(fileURL, suggestedFileName, callback)

Saves the file given file. IMPORTANT: Please consider overriding sync.api.UrlChooser#chooseUrl instead of this one. The default implementation for this method uses sync.api.UrlChooser#chooseUrl to determine the save location. An use-case for this method is to re-use a 'saver' widget which already takes care of the saving itself.
Parameters:
Name Type Description
fileURL string the URL of the file to be saved.
suggestedFileName string the proposed name for the new file.
callback sync.api.UrlChooser~fileSaved the callback to be called with the saved file url.
Inherited From:
Source:

setRootUrl(opt_rootopt)

Sets the root URL, above which navigation is prohibited.
Parameters:
Name Type Attributes Description
opt_root string <optional>
the root url of the server.
Source:

showErrorMessage(message, errorTypeopt)

Shows an error message inline.
Parameters:
Name Type Attributes Description
message string The error message.
errorType sync.view.InplaceNotificationReporter.types <optional>
The type of the error message, error by default.
Source:

supports(type) → {boolean}

Checks whether the URL chooser supports choosing a given type of resource sync.api.UrlChooser.Type. If not supported, the default UI (which is usually a text-field) will be presented to the user.
Parameters:
Name Type Description
type sync.api.UrlChooser.Type The type of the URL to be chosen.
Overrides:
Source:
Returns:
true if the chooser supports the given type.
Type
boolean

supportsOperation(purpose) → {boolean}

Needs to be implemented to reflect whether the chooser suports the given operation: save or choose.
Parameters:
Name Type Description
purpose sync.api.UrlChooser.Purpose The operation.
Overrides:
Source:
Returns:
true if the given operation is supported.
Type
boolean

switchToFileBrowsing()

Switches the dialog into file browsing mode.
Source:

switchToRepoConfig()

Switches the dialog into repository configuration editing mode.
Source:

updatePath()

Update the path bar with the path relative to the root path.
Source:

Type Definitions

Options

options The options used to configure the file browsing dialog.
Type:
  • Object
Properties:
Name Type Attributes Description
options.root string <optional>
The root url of the file repository on which the browsing will be performed.
options.initialUrl string <optional>
The URL of the folder where the dialog points to initially.
options.listFolder sync.api.FileBrowsingDialog~listFolderFunction <optional>
The function to call to retrieve files - by default the server-side ro.sync.net.protocol.FileBrowsingConnection.listFiles() method is called.
Source:

listFolderFunction(folderUrl, successCalback, failureCallback)

Callback that returns the contents of the given folder.
Parameters:
Name Type Description
folderUrl string The URL of the folder to list.
successCalback sync.api.FileBrowsingDialog~listFolderSuccessCallback The function to call when the folder listing is available.
failureCallback function The function to call when there was a failure retrieving folder content, passing in the exception.
Source:

listFolderSuccessCallback(folderEntries)

Callback that receives the folder entries.
Parameters:
Name Type Description
folderEntries Array.<sync.api.FileBrowsingDialog.FolderEntryDescriptor> The list of the URLs of the folder entries.
Source: