views/base¶
-
class
BaseView(args, viewArgs, baseArgs)¶ The base class for all views. The decendants are expected to implement the details of the visual representation.
Extends: UINodeCollection
Mixins: AjaxMixin
Mixins: LinkMixin
Mixins: LoadMixin
Mixins: LoggerMixin
Mixins: PreferencesMixin
Mixins: ShortcutsMixin
Mixins: SocketMixin
Mixins: StateMixin
Arguments: - args (Object) – An Object containing any parameters for the specific View. A subset of it is usually used to initialize the state of the view.
- viewArgs (Object) – An Object containing parameters of interest (e.g. position) for the view kind (Dialog, Main, SideBar).
- viewArgs.callee (BaseView) – The view that opened this view. May be undefined if not applicable.
- baseArgs (Object) – An Object containing parameters of interest for this class.
- baseArgs.workspace (Workspace) – The
Workspace()this view is to be linked to. - baseArgs.baseContext (String) – See
baseContext. If not present will be generated automatically. - baseArgs.defaultQuery (String) – See
defaultQuery. If not present it will be generated automatically.
Throws: - Error – If the baseArgs is not an object or it is missing critical parameters.
- Error – If the
maxInstancesis reached.
Note
All classes extending this one can simply call the the init super by using:
init._super.apply(this, arguments);
Note
The shortcuts are disabled by default.
-
read-only
id¶ Type: String The id of the view.
-
read-only
rid¶ Type: Number A running id.
-
read-only
baseContext¶ Type: String An identifier string used for
logger,SocketMixin(), andShortcutsMixin().
-
processArgs(args, viewArgs, baseArgs)¶ For singletons, this function will be called automatically when instanciation of it was reuested again by spawn, in order to be able to provess the arguments anyway. Will be called before foucs.
Note
This function should be overridden if needed.
Note
For information on the arguments, see
init().
-
messageContainer¶ Type: JQuery The JQuery object (containing exactly one DOM node) to contain the messages/dialogs.
Throws Error: If attempting to set it to an invalid value.
-
read-only
messageCount¶ Type: Number The of buffered messages for this view in the vispa.messenger.
-
focus(opts)¶ Will focus the view. A
ViewManager()may also callshow()in the process.Arguments: - opts – This may be used to pass further options to the view manager.
Emits focus(opts): This event is used by the
ViewManager()and can also be used by others.
-
blur()¶ Will blur (lose focus) the view.
Emits blur: This event is used by the ViewManager()and can also be used by others.
-
show(opts)¶ Will show the view. If it is not
loadedis will callload()automatically with itself provided as callback.Arguments: - opts – This may be used to pass further options to the view manager.
Emits show(opts): This event is used by the
ViewManager()and can also be used by others.
-
hide()¶ Will hide the view. A
ViewManager()may also callblur()in the process.Emits hide: This event is used by the ViewManager()and can also be used by others.
-
close(force)¶ Will close the view. A
ViewManager()may also callblur()andhide()in the process. Impliest the destruction of the instance - it must not be used thereafter.Arguments: - force (Bool) – If this is true
onBeforeClose()will not be consulted.
Emits close: This event is used by the
ViewManager()and can also be used by others.- force (Bool) – If this is true
-
destroy()¶ Destroys the instance. It must not be used thereafter.
-
render(node)¶ The function to render/refresh the displayed content.
Arguments: - node (JQuery) – The JQUery object containing the one DOM node in which the content is to be renderd.
Note
Is to be overridden.
-
read-only
name¶ Type: String The name of the view. Same as _class._members.name.
-
read-only
extension¶ Type: Extension The extension of the view. Same as _class._members.extension.
-
spawnInstance(extName, viewName[, args[, viewArgs[, baseArgs]]])¶ Spawn a new view from the given parameters.
Arguments: - extName (String) – The name of the extension that has the view.
- viewName (String) – The anem of the view to open.
- args (Object) – The args to be provided to the view.
- viewArgs (Object) – The viewArgs to be provided to the view.
- baseArgs (Object) – The baseArgs to be provided to the view.
Returns: The view that was opened. It is most likely not ready to use yet.
Return type: BaseView
Throws: Error – If either the extension of the view was not found.
-
fileURL(path)¶ Retrieves the URL to directly read a file from the workspace.
Returns: The full URL. Return type: String Throws: Error – if this view is not bound to a workspace
-
spawn(args, viewArgs, baseArgs[, opts])¶ A singleton safe spawing method for a new view. For an excistant singleton only the focus method will be called.
Arguments: - args (Object) – Passed on to
baseView()instanciation (if required). - viewArgs (Object) – Passed on to
baseView()instanciation (if required). - baseArgs (Object) – Passed on to
baseView()instanciation (if required). - opts (Object) – Options passed to the
focus()methods.
Returns: The view spawned (or actived in the case of a existing singleton).
Return type: BaseView
- args (Object) – Passed on to
-
read-only class-member
name Type: String The name of the view. Must be overridden by extending classes.
Throws Error: If it is not overridden.
-
read-only class-member
maxInstances¶ Type: Number Value: Infinity The maximum allowed count of concurrent intances. Should be overridden as needed.
-
read-only class-member
extension Type: Extension|null Value: null The extension this view is linked to by default. Will be updated automatically when registering the view to an extension.
-
read-only class-member
instances¶ Type: Array(BaseView) A list of all current instances of this class.
-
read-only class-member
count¶ Type: Number The count of instances of this class currently active.
-
closeAllInstances()¶ Closes all open instance of this viewClass.
-
class-member
workspace¶ Type: The default workspace binding type for this view. If it is null this view will only be global (no workspace binding). If it is a number, it will always be bound to a workspace. In any other case, it can be both.