Class: IMatchFileWindow

IMatchFileWindow

This class implements the base class for IMatch File Window Apps. Derive from this class when you create your own File Window Apps.
 

Importing

import IMatchFileWindow from '/system/imatch/imatch-filewindow.js';

Requirements

/system/imatch/imatchlib.js


new IMatchFileWindow(instanceId)

Constructs a file window instance and associates it with the specified File Window app instance.
Each File Window App in IMatch has a unique instance id. This id changes when the user swiches between regular File Window Layouts and App Layouts.

Tip: Use the IMatchFileWindow.enumerateRunningApps method of this classs to get a list of all runnnig File Window Apps, their type and instance id.

Parameters:
Name Type Description
instanceId String

The instance id of the associated File Window.

Members


FileStates :Number

The possible states of a file. A file can use any combination of states (bitmask).

Type:
  • Number
Properties:
Name Type Default Description
none Number 0

No specific state.

selected Number 1

The file is selected.

focused Number 2

The file is focused.

esHiddenSearch Number 4096

The file is hidden by the currenly active search. The File Window App should suppress the display of this file or indicate this state by some other means.

esHiddenFilter Number 8192

The file is hidden by the currenly active filter. The File Window App should suppress the display of this file or indicate this state by some other means.

esHiddenStack Number 16384

The file is part of a stack and hidden.

Methods


onScopeChanged(cause)

This method is called when IMatch informs the File Window App about the change in the scope (model).
Such changes can be caused by many things, e.g. the user clicking on another folder, the user using the search bar or filter panel, changing the sort order etc.

Parameters:
Name Type Description
cause String

The reason for the scope change.


onSortOrderChanged(reverse)

This methid is caled when the sort order changes between asc and desc. The user triggers this via the File Window toolbar.

Parameters:
Name Type Description
reverse Boolean

The current state of the Asc/Desc sort order option. True when the sort order is reversed (Z..A).


onSortProfileChanged(profile)

The user selected a different sort profile in the File Window toolbar.
This also causes an IMatchFileWindow.onScopeChanged event.

Parameters:
Name Type Description
profile String

The name of the currently selected sort profile.


onZoomChanged(zoom)

The user changed the zoom level of the File Window.

Parameters:
Name Type Description
zoom Number

The new zoom level. The range for this number is by default 0-20, but it can be changed via the app.json of your File Window App.


onPauseThresholdChanged(threshold)

The user picked a new auto-pause theshold.

Parameters:
Name Type Description
threshold *

The new threshold.


onActiveStateChanged(active)

The file window was actived or deactivated. When the user switches to another View or opens a result window, the current file window is deactivated.

Parameters:
Name Type Description
active Boolean

onMoveFocus(next, selectAndFocus, keepSelection, ensureVisible)

IMatch has requested that the file window moves the focus to the previous or next file.
This is mostly used by the Quick Preview Panel, when the user navigates using the flaps.

Parameters:
Name Type Description
next *

True to move to the next file, false to move to the previous file.

selectAndFocus *

The new file should be focused and selected

keepSelection *

False if the change should remove the current selection

ensureVisible *

The newly selected file should be made visible.


onSearchRunning()

The user started a search via the File Window Search Bar.


onSearchCompleted(success)

The search has completed or was aborted by some reason.
IMatch applies the search result to the file window and causes the scope to change. Files no longer visible get the flag FileStates.esHiddenSearch.
This also causes an IMatchFileWindow.onScopeChanged event.

Parameters:
Name Type Description
success *

True if the search has been successful.


onFilterRunning()

The Filter Panel is performing a query.


onFilterCanceled()

The current Filter Panel query was canceled.
This may cause an IMatchFileWindow.onScopeChanged event.


onFilterCompleted()

The Filter Panel has complete its query.
This may causes an IMatchFileWindow.onScopeChanged event.


<static> enumerateRunningApps() → {Promise}

Lists all currently running File Window Apps.
This can be used to find out the instance id of a specific app, e.g., to connect to it from an external web browser.

Returns:
Type
Promise

getState() → {Promise}

Queries the current state of the File Window associated with this instance.

Returns:
Type
Promise

loadModel(params) → {Promise}

Loads the model of the File Window associated with this instance.
The model contains 1 to n groups, each group containing the file ids in that group plus other information.
Groups may be nested to any depth. The hierarhcy mode of the file window controls how the model is created from the current scope.

Parameters:
Name Type Description
params Object

An object with additional parameters. You can specify the same parameters that can be used with the /files endpoint.

Returns:
Type
Promise
Example
let fw = new IMatchFileWindow(instance);
fw.loadModel({
  fields: 'id,namene,format,datetime,rating,label,labelcolor',
 tagdesc: 'description',
 tagtitle: 'title',
 tagkeywords: 'hierarchicalkeywords'
}).then(response => {
 // ...
});

setSelection(params)

This method changes the selection of the model maintained by the File Window.

Parameters:
Name Type Description
params Object
parameters.op String

How to apply the selection. Supported are 'set' to replace the selection and 'add' to add to the selection.

parameters.id String

List of file ids. Standard IMWS syntax.


setFocus(id)

This selection changes the focused file in the model maintained by the File Window.

Parameters:
Name Type Description
id Number

The id of the file to focus, or null to remove the focus


getImageUrl(id, size [, useDefault])

Parameters:
Name Type Argument Default Description
id Number

The id of the file

size String

The size of the image. See /files endpoint for details.

useDefault Boolean <optional>
true

If this is true and there is no image available for the file, a default image/icon is returned.