ObjectHandler<T>
Override the corresponding methods, and register an instance to let Datagrok know how to handle objects of the specified type.
isApplicable is used to associate an object with the handler. When handling an object x, the platform uses the first registered handler that claims that it is applicable to that object.
TODO: search, destructuring to properties
Example: https://public.datagrok.ai/js/samples/ui/handlers/handlers
Extended by
Type parameters
| Type parameter | Value |
|---|---|
T | any |
Constructors
new ObjectHandler()
new ObjectHandler<
T>():ObjectHandler<T>
Returns
Accessors
helpUrl
gethelpUrl():null|string
URL of help page for the object that this meta handles.
Returns
null | string
Source
markupRegexp
getmarkupRegexp():null|string
Creates a regexp for detecting markup descriptions of an object
Returns
null | string
Source
name
getname():string
Returns
string
Source
regexpExample
getregexpExample():null|object
Will be used by search providers to get suggestions (like chembl which has regexp matcher) For something like CHEMBL object handler, it should return: regexpMarkup: 'CHEMBL[0-9]+', example: 'CHEMBL1234', nonVariablePart: 'CHEMBL'
Returns
null | object
Source
type
gettype():string
Type of the object that this meta handles.
Returns
string
Source
Methods
fromMarkup()
fromMarkup(
matches):any
Extract object from parsed markup description
Parameters
| Parameter | Type |
|---|---|
matches | string[] |
Returns
any
Source
getById()
getById(
id):Promise<null|T>
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
Promise<null | T>
Source
getCanvasRenderer()
getCanvasRenderer():
null|CanvasRenderer
Returns
null | CanvasRenderer
Source
getCaption()
getCaption(
x):string
String representation of the [item], by default item.toString().
Parameters
| Parameter | Type | Description |
|---|---|---|
x | T | item |
Returns
string
Source
getGridCellRenderer()
getGridCellRenderer():
null|GridCellRenderer<any>
Returns
null | GridCellRenderer<any>
Source
init()
init():
void
Gets called once upon the registration of meta export class.
Returns
void
Source
isApplicable()
isApplicable(
x):boolean
Override this method to check whether this meta class should handle the specified object.
Parameters
| Parameter | Type | Description |
|---|---|---|
x | any | specified object. |
Returns
boolean
Source
refresh()
refresh(
x):Promise<T>
Parameters
| Parameter | Type |
|---|---|
x | T |
Returns
Promise<T>
Source
registerParamFunc()
registerParamFunc(
name,run):void
Registers a function that takes applicable objects as the only argument. It will be suggested to run in the context menu for that object, and also in the "Actions" pane on the context panel.
Example: https://public.datagrok.ai/js/samples/ui/docking/docking
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | function name |
run | (param) => any | a function that takes exactly one parameter |
Returns
void
Source
renderCard()
renderCard(
x,context):HTMLElement
Renders card div for the item.
Parameters
| Parameter | Type | Default value |
|---|---|---|
x | T | undefined |
context | any | null |
Returns
HTMLElement
Source
renderIcon()
renderIcon(
x,context):HTMLElement
Renders icon for the item.
Parameters
| Parameter | Type | Default value |
|---|---|---|
x | T | undefined |
context | any | null |
Returns
HTMLElement
Source
renderMarkup()
renderMarkup(
x,context):HTMLElement
Renders markup for the item.
Parameters
| Parameter | Type | Default value |
|---|---|---|
x | T | undefined |
context | any | null |
Returns
HTMLElement
Source
renderPreview()
renderPreview(
x,context):View
Renders preview list for the item.
Parameters
| Parameter | Type | Default value |
|---|---|---|
x | T | undefined |
context | any | null |
Returns
Source
renderProperties()
renderProperties(
x,context):HTMLElement
Renders properties list for the item.
Parameters
| Parameter | Type | Default value |
|---|---|---|
x | T | undefined |
context | any | null |
Returns
HTMLElement
Source
renderTooltip()
renderTooltip(
x,context):HTMLElement
Renders tooltip for the item.
Parameters
| Parameter | Type | Default value |
|---|---|---|
x | T | undefined |
context | any | null |
Returns
HTMLElement
Source
renderView()
renderView(
x,context):HTMLElement
Renders view for the item.
Parameters
| Parameter | Type | Default value |
|---|---|---|
x | T | undefined |
context | any | null |
Returns
HTMLElement
Source
toMarkup()
toMarkup(
T):null|string
Converts object to its markup description
Parameters
| Parameter | Type |
|---|---|
T | any |
Returns
null | string
Source
toString()
toString():
string
Returns
string
Source
forEntity()
staticforEntity(object,context):null|ObjectHandler<any>
Parameters
| Parameter | Type | Default value |
|---|---|---|
object | any | undefined |
context | any | null |
Returns
null | ObjectHandler<any>
Source
forSemType()
staticforSemType(semType):Promise<ObjectHandler<any>[]>
Parameters
| Parameter | Type |
|---|---|
semType | string |
Returns
Promise <ObjectHandler<any>[]>
Source
list()
staticlist():ObjectHandler<any>[]
All registered handlers
Returns
ObjectHandler<any>[]
Source
onResolve()
staticonResolve(observer):Subscription
Parameters
| Parameter | Type |
|---|---|
observer | PartialObserver <ObjectHandlerResolutionArgs> |
Returns
Subscription
Source
register()
staticregister(meta):void
Registers entity handler.
Parameters
| Parameter | Type |
|---|---|
meta | ObjectHandler<any> |
Returns
void