views/base ================= .. js: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 :param Object args: An Object containing any parameters for the specific View. A subset of it is usually used to initialize the state of the view. :param Object viewArgs: An Object containing parameters of interest (e.g. position) for the view kind (Dialog, Main, SideBar). :param BaseView viewArgs.callee: The view that opened this view. May be *undefined* if not applicable. :param Object baseArgs: An Object containing parameters of interest for this class. :param Workspace baseArgs.workspace: The :js:class:`Workspace` this view is to be linked to. :param String baseArgs.baseContext: See :js:attr:`baseContext`. If not present will be generated automatically. :param String baseArgs.defaultQuery: See :js:attr:`defaultQuery`. If not present it will be generated automatically. :throws Error: If the *baseArgs* is not an object or it is missing critical parameters. :throws Error: If the :js:attr:`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. .. js:attribute:: id read-only :type: String The id of the view. .. js:attribute:: rid read-only :type: Number A running id. .. js:attribute:: baseContext read-only :type: String An identifier string used for :js:attr:`logger`, :js:mixin:`SocketMixin`, and :js:mixin:`ShortcutsMixin`. .. js:function:: 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 :js:func:`init`. .. js:attribute:: 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. .. js:attribute:: messageCount read-only :type: Number The of buffered messages for this view in the *vispa.messenger*. .. js:function:: alert(message[, opts]) See :js:func:`alert` of :js:class:`Dialog` .. js:function:: prompt(message, callback[, opts]) See :js:func:`prompt` of :js:class:`Dialog` .. js:function:: confirm(message, callback[, opts]) See :js:func:`confirm` of :js:class:`Dialog` .. js:function:: dialog(opts) See :js:func:`dialog` of :js:class:`Dialog` .. js:function:: focus(opts) Will focus the view. A :js:class:`ViewManager` may also call :js:func:`show` in the process. :param opts: This may be used to pass further options to the view manager. :emits focus(opts): This event is used by the :js:class:`ViewManager` and can also be used by others. .. js:function:: blur() Will blur (lose focus) the view. :emits blur: This event is used by the :js:class:`ViewManager` and can also be used by others. .. js:function:: show(opts) Will show the view. If it is not :js:attr:`loaded` is will call :js:func:`load` automatically with itself provided as callback. :param opts: This may be used to pass further options to the view manager. :emits show(opts): This event is used by the :js:class:`ViewManager` and can also be used by others. .. js:function:: hide() Will hide the view. A :js:class:`ViewManager` may also call :js:func:`blur` in the process. :emits hide: This event is used by the :js:class:`ViewManager` and can also be used by others. .. js:function:: close(force) Will close the view. A :js:class:`ViewManager` may also call :js:func:`blur` and :js:func:`hide` in the process. Impliest the destruction of the instance - it must not be used thereafter. :param Bool force: If this is *true* :js:func:`onBeforeClose` will not be consulted. :emits close: This event is used by the :js:class:`ViewManager` and can also be used by others. .. js:function:: destroy() Destroys the instance. It must not be used thereafter. .. js:function:: render(node) The function to render/refresh the displayed content. :param JQuery node: The JQUery object containing the one DOM node in which the content is to be renderd. .. note:: Is to be overridden. .. js:attribute:: name read-only :type: String The name of the view. Same as *_class._members.name*. .. js:attribute:: extension read-only :type: Extension The extension of the view. Same as *_class._members.extension*. .. js:function:: spawnInstance(extName, viewName[, args[, viewArgs[, baseArgs]]]) Spawn a new view from the given parameters. :param String extName: The name of the extension that has the view. :param String viewName: The anem of the view to open. :param Object args: The args to be provided to the view. :param Object viewArgs: The viewArgs to be provided to the view. :param Object baseArgs: The baseArgs to be provided to the view. :return: The view that was opened. It is most likely not ready to use yet. :rtype: BaseView :throws Error: If either the extension of the view was not found. .. js:function:: fileURL(path) Retrieves the URL to directly read a file from the workspace. :return: The full URL. :rtype: String :throws Error: if this view is not bound to a workspace .. js:function:: 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. :param Object args: Passed on to :js:class:`baseView` instanciation (if required). :param Object viewArgs: Passed on to :js:class:`baseView` instanciation (if required). :param Object baseArgs: Passed on to :js:class:`baseView` instanciation (if required). :param Object opts: Options passed to the :js:func:`focus` methods. :return: The view spawned (or actived in the case of a existing singleton). :rtype: BaseView .. js:attribute:: name read-only class-member :type: String The name of the view. Must be overridden by extending classes. :throws Error: If it is not overridden. .. js:attribute:: maxInstances read-only class-member :type: Number :value: Infinity The maximum allowed count of concurrent intances. Should be overridden as needed. .. js:attribute:: extension read-only class-member :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. .. js:attribute:: instances read-only class-member :type: Array(BaseView) A list of all current instances of this class. .. js:attribute:: count read-only class-member :type: Number The count of instances of this class currently active. .. js:function:: closeAllInstances() Closes all open instance of this viewClass. .. js:attribute:: workspace class-member :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.