<abstract> new (require("nmodule/webEditors/rc/wb/mgr/Manager"))(params)
API Status: Development
View for managing groups of components, monitoring their current state
and adding/removing components to the group. The concrete manager type
must provide the moduleName
and keyName
parameters if it requires
state to be saved between hyperlinks and page reloads, as these values
will be used when generating the key used to index the cached state data.
Due to the incubating status of the manager framework, it is not
recommended that you extend Manager
directly. Instead, extendDeviceMgr
or PointMgr
: these will provide more robust functionality
for most use cases.
Extends:
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
params |
Object |
Properties
|
- See:
-
- module:nmodule/driver/rc/wb/mgr/DeviceMgr
- module:nmodule/driver/rc/wb/mgr/PointMgr
Methods
-
applyParams( [params])
-
Can re-apply certain params that can also be passed to the constructor.
Parameters:
Name Type Argument Description params
Object <optional>
Properties
Name Type Argument Default Description readonly
Boolean <optional>
enabled
Boolean <optional>
true must explicitly set to false to
disableproperties
module:bajaux/Properties | Object <optional>
- Inherited From:
Returns:
promise to be resolved after any
setEnabled
/setReadonly
work is done. Note that these functions will not
be called if the value ofenabled
/readonly
is not actually changing.- Type
- Promise
-
buildMainTableCell(column, row, dom)
-
Override point, allowing a
Manager
to customize the building of
a cell within its main table. This will default to delegating the
cell building to the column.Parameters:
Name Type Description column
module:nmodule/webEditors/rc/wb/table/model/Column row
module:nmodule/webEditors/rc/wb/table/model/Row dom
jQuery Returns:
- Type
- Promise | *
-
destroy()
-
Overrides the base
destroy
method to give the manager a chance to save its state
before the content (such as the child table widgets) is destroyed. -
destroyMainTableCell(column, row, dom)
-
Override point, allowing a
Manager
to customize the destruction
of a cell that it created in#buildMainTableCell
. The default
behavior is to delegate to the column.Parameters:
Name Type Description column
module:nmodule/webEditors/rc/wb/table/model/Column row
module:nmodule/webEditors/rc/wb/table/model/Row dom
jQuery Returns:
- Type
- Promise | *
-
doDestroy()
-
Destroy child editors, the main table, and its model.
Returns:
- Type
- Promise
-
doInitialize(dom [, params])
-
Set up elements for the main table and command group.
Parameters:
Name Type Argument Description dom
JQuery params
Object <optional>
the initialization parameters
Returns:
- Type
- Promise
-
doLayout()
-
Update the height of the main table element so that the command buttons
are always visible. -
doLoad()
-
Initializes and loads the main table with the
MgrModel
. If overriding,
be sure to call the super method.Returns:
- Type
- Promise
-
finishMainTableRow(row, dom)
-
Override point, allowing a
Manager
to customize the dom for
aRow
after the cells have been built, but before it is inserted
into the main table. This allows sub-classes to perform any CSS
customizations they may require at an individual row level.Parameters:
Name Type Description row
module:nmodule/webEditors/rc/wb/table/model/Row dom
jQuery Returns:
- Type
- Promise
-
generateId()
-
Generate a unique DOM ID. The ID will include the name of this editor's
constructor just for tracing/debugging purposes.- Inherited From:
Returns:
- Type
- String
-
getChildEditors( [params])
-
Same as
getChildWidgets
, but is limited to instances ofBaseEditor
.Parameters:
Name Type Argument Description params
Object <optional>
- Inherited From:
-
getChildWidgets( [params])
-
Returns an array of child widgets living inside this editor's DOM.
This method will specifically not return child widgets of child widgets- for instance, if this widget has one child editor for a
baja.Facets
,
you will only get a single widget back - it won't recurse down and give
you all the tag editors, type editors etc.
This is safer and easier than using
$.find()
, which recurses down,
or carefully managing strings of$.children()
calls.Pass in a
jQuery
instance to limit the child editor search to
a particular set of elements. Otherwise, will search all child elements
of this editor's DOM.If this editor has not initialized yet, you'll just get an empty array
back.The returned array will have some utility functions attached that return
promises. See example for details.Parameters:
Name Type Argument Description params
Object | jQuery <optional>
Properties
Name Type Argument Default Description dom
jQuery <optional>
this.jq().children() the dom element to search
type
function <optional>
the widget type to search for - pass in the
actual constructor, forinstanceof
checks- Inherited From:
Returns:
an array
of child editors- Type
- Array.<module:nmodule/webEditors/rc/fe/BaseWidget>
Examples
var kids = ed.getChildEditors(); kids.setAllEnabled(false).then(function () {}); kids.setAllModified(false).then(function () {}); kids.setAllReadonly(false).then(function () {}); kids.readAll().then(function (valuesArray) {}); kids.validateAll().then(function (valuesArray) {}); kids.saveAll().then(function () {}); kids.destroyAll().then(function () {});
var stringEditors = ed.getChildEditors({ type: StringEditor });
- for instance, if this widget has one child editor for a
-
getMainTable()
-
Get the main Table widget.
- Since:
-
- Niagara 4.6
Returns:
-
getModel()
-
Get the
MgrModel
backing this manager. This will returnundefined
untilload()
is called. It can safely be called from insidedoLoad()
.- Since:
-
- Niagara 4.6
Returns:
-
getOrdBase()
-
If the loaded
MgrModel
is backed by a mounted Component, then use that
Component to resolve ORDs.- Overrides:
- module:nmodule/webEditors/rc/fe/baja/BaseEditor#getOrdBase
Returns:
- Type
- Promise.<(baja.Component|undefined)>
-
initialize(dom)
-
Every
BaseWidget
will add theeditor
class to the element and emit aninitialized
tinyevent when initialized.Parameters:
Name Type Description dom
JQuery - Inherited From:
Returns:
call to module:bajaux/Widget#initialize
- Type
- Promise
-
load(value [, params])
-
Every
BaseEditor
will apply a number of CSS classes to a DOM element
when a value is loaded into it:editor
- If the loaded value is a Baja value, a number of CSS classes
corresponding to the value's Type and all superTypes. Classes will be
determined using typeToClass().
It will also emit a
loaded
tinyevent.Parameters:
Name Type Argument Description value
baja.Value | * params
Object <optional>
- Inherited From:
- Overrides:
Returns:
call to module:bajaux/Widget#load
- Type
- Promise
-
<abstract> makeModel(value)
-
Abstract method to create the
MgrModel
for the main database table. The method
should return aPromise
that will resolve to aMgrModel
instance for theComponentSource
provided in the parameter. This is used to convert the value
being loaded into the widget (e.g. a network) into the model used for the table
widget.Parameters:
Name Type Description value
baja.Component the value being loaded into the
Widget
.Returns:
the model for the main table.
- Type
- Promise.<module:nmodule/webEditors/rc/wb/mgr/model/MgrModel>
-
makeStateHandler()
-
Make a state handler instance for saving and restoring the Manager's
state.Returns:
-
requestFocus()
-
Attempts to place the cursor focus on this editor. For instance, if
showing a simple string editor in a dialog, it should request focus so
that the user can simply begin typing without having to move the mouse
over to it and click.Override this as necessary; by default, will place focus on the first
input
ortextarea
element in this editor's element.- Inherited From:
-
restoreState()
-
Invoke the handler created by
makeStateHandler()
to restore the Manager's
current state when the Manager is loaded.Returns:
- Type
- Promise
-
saveState()
-
Invoke the handler created by
makeStateHandler()
to save the Manager's
current state when the Manager is destroyed. -
setFacets(facets)
-
Convert the given Facets into hidden, transient
bajaux Properties
and
apply them to this editor. In most cases you'll want to useproperties().setValue()
directly, but this method is useful when
applyingComplex
slot facets.Parameters:
Name Type Description facets
baja.Facets | Object (a
baja.Facets
instance or an object
literal to be converted tobaja.Facets
)- Inherited From:
-
shouldValidate( [flag])
-
This provides an extra hook for an editor to declare itself as needing to
be validated before saving or not. The default behavior is to return true
if this editor is modified, or if ashouldValidate
bajaux
Property
is present and truthy. If neither of these conditions is true, it will
check all known child editors, and return true if it has a child editor
that should validate.If
flag
is given, then the check against theshouldValidate
Property
will return true only if the value bitwise matches the
parameter. SeeBaseWidget.SHOULD_VALIDATE_ON_SAVE
, etc.Parameters:
Name Type Argument Description flag
Number <optional>
- Inherited From:
Returns:
- Type
- Boolean