Examples
define( () => {
"use strict";
class BasicControl
{
draw( oControlHost )
{
oControlHost.container.innerHTML = "Hello world";
}
}
return BasicControl;
} );
define( () => {
"use strict";
class AdvancedControl
{
initialize( oControlHost, fnDoneInitializing )
{
fnDoneInitializing();
}
destroy( oControlHost )
{
}
draw( oControlHost )
{
oControlHost.container.innerHTML = "Hello world";
}
show( oControlHost )
{
}
hide( oControlHost )
{
}
isInValidState( oControlHost )
{
}
getParameters( oControlHost )
{
}
setData( oControlHost, oDataStore )
{
}
}
return AdvancedControl;
} );
Methods
destroy(oControlHost)
The control is being destroyed so do any necessary cleanup. This method is optional.
Name | Type | Description |
---|---|---|
oControlHost | ControlHost | The control host. |
draw(oControlHost)
Draw the control. This method is optional if the control has no UI.
Name | Type | Description |
---|---|---|
oControlHost | ControlHost | The control host. |
draw( oControlHost )
{
oControlHost.container.innerHTML = "Hello world";
}
getParameters(oControlHost) → (nullable) {Array.<Parameter>|Array.<RangeParameter>}
Called by the ControlHost
to get the current values to use for parameters fulfilled by the control. This method is optional.
Name | Type | Description |
---|---|---|
oControlHost | ControlHost | The control host. |
An array of parameters.
- Type:
- Array.<Parameter> |
Array.<RangeParameter>
getParameters( oControlHost )
{
if ( this.m_sel.selectedIndex < 1 )
{
return null;
}
const { value } = this.m_sel.options[this.m_sel.selectedIndex];
return [{
"parameter": "parameter1",
"values": [{ "use" : value }]
}];
}
hide(oControlHost)
Called when the control is being hidden (not displayed). This method is optional.
Name | Type | Description |
---|---|---|
oControlHost | ControlHost | The control host. |
initialize(oControlHost, fnDoneInitializing) → {Promise}
Initialize the control. This method is optional. If this method is implemented, fnDoneInitializing
must be called when done initializing, or a Promise must be returned.
Name | Type | Description |
---|---|---|
oControlHost | ControlHost | The control host. |
fnDoneInitializing | function | The callback function to tell the control host when the initialization has completed. |
An optional promise that will be waited on instead of calling fnDoneInitializing
. Since Version 6
- Type:
- Promise
initialize( oControlHost, fnDoneInitializing )
{
require( ["Module"], this.dependenciesLoaded.bind( this, fnDoneInitializing ) )
}
dependenciesLoaded( fnDoneInitializing, oModule )
{
fnDoneInitializing();
}
isInValidState(oControlHost) → {Boolean}
The valid state of the control. This method is optional. This is used to determine things like enabling "Next" and "Finish" prompt buttons.
Name | Type | Description |
---|---|---|
oControlHost | ControlHost | The control host. |
true if the control is in a valid state and false otherwise.
- Type:
- Boolean
isInValidState( oControlHost )
{
return this.m_sel.selectedIndex > 0;
}
setData(oControlHost, oDataStore)
Called to pass authored data into the control. This method is optional.
Name | Type | Description |
---|---|---|
oControlHost | ControlHost | The control host. |
oDataStore | DataStore | The data as a data store. |
setData( oControlHost, oDataStore )
{
this.m_oDataStore = oDataStore;
}
setData( oControlHost, oDataStore )
{
this.m_aDataStore[oDataStore.index] = oDataStore;
}
setData( oControlHost, oDataStore )
{
this.m_oDataStores[oDataStore.name] = oDataStore;
}
show(oControlHost)
Called when the control is being shown (displayed). This method is optional.
Name | Type | Description |
---|---|---|
oControlHost | ControlHost | The control host. |