Skip to main content

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 parameterValue
Tany

Constructors

new ObjectHandler()

new ObjectHandler<T>(): ObjectHandler<T>

Returns

ObjectHandler<T>

Accessors

helpUrl

get helpUrl(): null | string

URL of help page for the object that this meta handles.

Returns

null | string

Source

ui.ts:1503


markupRegexp

get markupRegexp(): null | string

Creates a regexp for detecting markup descriptions of an object

Returns

null | string

Source

ui.ts:1598


name

get name(): string

Returns

string

Source

ui.ts:1507


regexpExample

get regexpExample(): 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

ui.ts:1516


type

get type(): string

Type of the object that this meta handles.

Returns

string

Source

ui.ts:1498

Methods

fromMarkup()

fromMarkup(matches): any

Extract object from parsed markup description

Parameters

ParameterType
matchesstring[]

Returns

any

Source

ui.ts:1593


getById()

getById(id): Promise<null | T>

Parameters

ParameterType
idstring

Returns

Promise<null | T>

Source

ui.ts:1520


getCanvasRenderer()

getCanvasRenderer(): null | CanvasRenderer

Returns

null | CanvasRenderer

Source

ui.ts:1543


getCaption()

getCaption(x): string

String representation of the [item], by default item.toString().

Parameters

ParameterTypeDescription
xTitem

Returns

string

Source

ui.ts:1538


getGridCellRenderer()

getGridCellRenderer(): null | GridCellRenderer<any>

Returns

null | GridCellRenderer<any>

Source

ui.ts:1548


init()

init(): void

Gets called once upon the registration of meta export class.

Returns

void

Source

ui.ts:1603


isApplicable()

isApplicable(x): boolean

Override this method to check whether this meta class should handle the specified object.

Parameters

ParameterTypeDescription
xanyspecified object.

Returns

boolean

Source

ui.ts:1531


refresh()

refresh(x): Promise<T>

Parameters

ParameterType
xT

Returns

Promise<T>

Source

ui.ts:1524


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

ParameterTypeDescription
namestringfunction name
run(param) => anya function that takes exactly one parameter

Returns

void

Source

ui.ts:1651


renderCard()

renderCard(x, context): HTMLElement

Renders card div for the item.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLElement

Source

ui.ts:1568


renderIcon()

renderIcon(x, context): HTMLElement

Renders icon for the item.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLElement

Source

ui.ts:1553


renderMarkup()

renderMarkup(x, context): HTMLElement

Renders markup for the item.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLElement

Source

ui.ts:1558


renderPreview()

renderPreview(x, context): View

Renders preview list for the item.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

View

Source

ui.ts:1578


renderProperties()

renderProperties(x, context): HTMLElement

Renders properties list for the item.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLElement

Source

ui.ts:1573


renderTooltip()

renderTooltip(x, context): HTMLElement

Renders tooltip for the item.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLElement

Source

ui.ts:1563


renderView()

renderView(x, context): HTMLElement

Renders view for the item.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLElement

Source

ui.ts:1583


toMarkup()

toMarkup(T): null | string

Converts object to its markup description

Parameters

ParameterType
Tany

Returns

null | string

Source

ui.ts:1588


toString()

toString(): string

Returns

string

Source

ui.ts:1509


forEntity()

static forEntity(object, context): null | ObjectHandler<any>

Parameters

ParameterTypeDefault value
objectanyundefined
contextanynull

Returns

null | ObjectHandler<any>

Source

ui.ts:1626


forSemType()

static forSemType(semType): Promise <ObjectHandler<any>[]>

Parameters

ParameterType
semTypestring

Returns

Promise <ObjectHandler<any>[]>

Source

ui.ts:1637


list()

static list(): ObjectHandler<any>[]

All registered handlers

Returns

ObjectHandler<any>[]

Source

ui.ts:1618


onResolve()

static onResolve(observer): Subscription

Parameters

ParameterType
observerPartialObserver <ObjectHandlerResolutionArgs>

Returns

Subscription

Source

ui.ts:1622


register()

static register(meta): void

Registers entity handler.

Parameters

ParameterType
metaObjectHandler<any>

Returns

void

Source

ui.ts:1606