DocumentModule

The entry point of the documents module.

Constructor

new DocumentModule(requestService, config)

Creates a new documents module.

Parameters:
NameTypeDescription
requestServiceRequestService

The request service.

configobject

The configuration of UD-Viz.

Properties
NameTypeDescription
serverobject

The server configuration.

Properties
NameTypeDescription
urlstring

The server url.

documentstring

The base route for documents.

filestring

The route for document files.

Classes

DocumentModule

Members

provider :DocumentProvider

The document provider filters the list of documents.

service :DocumentService

The document service holds the list of documents fetched from the server.

view :DocumentView

The document view represents the user interface for the documents.

Methods

addEventListener(event, action)

Adds an event listener to the document provider. There are two types of events :

  • DocumentModule.EVENT_FILTERED_DOCUMENTS_UPDATED fires when the list of filtered documents changes
  • DocumentModule.EVENT_DISPLAYED_DOC_CHANGED fires when the displayed document changes.
Parameters:
NameTypeDescription
eventstring

The event to register. Can only be DocumentModule.EVENT_FILTERED_DOCS_UPDATED or DocumentModule.EVENT_DISPLAYED_DOC_CHANGED

actioncbAction

The listener.

addFilter(filter)

Adds a filter to the filtering pipeline.

Parameters:
NameTypeDescription
filterDocumentFilter

The new filter to add.

changeDocumentSource(newSource, authenticateopt) → {DocumentSource}

Changes the document source (the object representing the server URLs to fetch the documents).

Parameters:
NameTypeAttributesDescription
newSourceDocumentSource

The new document source.

authenticateboolean<optional>

Specifies wether authentication should be used for the document fetch requests.

Returns:

The previous document source.

Type: 
DocumentSource

(async) refreshDocumentList()

Updates the filtered documents list by fetching them from the DocumentService and applying the successive filters. Triggers the DOCUMENT_LIST_UPDATED and then the DISPLAYED_DOCUMENT_CHANGED events.

removeEventListener(action)

Removes an event listener from the document provider.

Parameters:
NameTypeDescription
actioncbAction

The listener to remove.