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 maxInstances is 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-onlyid
Type:String

The id of the view.

read-onlyrid
Type:Number

A running id.

read-onlybaseContext
Type:String

An identifier string used for logger, SocketMixin(), and ShortcutsMixin().

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-onlymessageCount
Type:Number

The of buffered messages for this view in the vispa.messenger.

alert(message[, opts])

See alert() of Dialog()

prompt(message, callback[, opts])

See prompt() of Dialog()

confirm(message, callback[, opts])

See confirm() of Dialog()

dialog(opts)

See dialog() of Dialog()

focus(opts)

Will focus the view. A ViewManager() may also call show() 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 loaded is will call load() 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 call blur() 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 call blur() and hide() in the process. Impliest the destruction of the instance - it must not be used thereafter.

Arguments:
Emits close:

This event is used by the ViewManager() and can also be used by others.

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-onlyname
Type:String

The name of the view. Same as _class._members.name.

read-onlyextension
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

read-only class-membername
Type:String

The name of the view. Must be overridden by extending classes.

Throws Error:If it is not overridden.
read-only class-membermaxInstances
Type:Number
Value:Infinity

The maximum allowed count of concurrent intances. Should be overridden as needed.

read-only class-memberextension
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-memberinstances
Type:Array(BaseView)

A list of all current instances of this class.

read-only class-membercount
Type:Number

The count of instances of this class currently active.

closeAllInstances()

Closes all open instance of this viewClass.

class-memberworkspace
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.