Skip to main content

ObjectHandler<T>

Defined in: ui.ts:1565

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 ParameterDefault type
Tany

Constructors

Constructor

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

Returns

ObjectHandler<T>

Properties

PropertyTypeDefined in
dartanyui.ts:1566

Accessors

helpUrl

Get Signature

get helpUrl(): string | null

Defined in: ui.ts:1573

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

Returns

string | null


markupRegexp

Get Signature

get markupRegexp(): string | null

Defined in: ui.ts:1670

Creates a regexp for detecting markup descriptions of an object

Returns

string | null


name

Get Signature

get name(): string

Defined in: ui.ts:1577

Returns

string


regexpExample

Get Signature

get regexpExample(): { example: string; nonVariablePart: string; regexpMarkup: string; } | null

Defined in: ui.ts:1586

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

{ example: string; nonVariablePart: string; regexpMarkup: string; } | null


type

Get Signature

get type(): string

Defined in: ui.ts:1568

Type of the object that this meta handles.

Returns

string

Methods

fromMarkup()

fromMarkup(matches): any

Defined in: ui.ts:1665

Extract object from parsed markup description

Parameters

ParameterType
matchesstring[]

Returns

any


getById()

getById(id): Promise<T | null>

Defined in: ui.ts:1590

Parameters

ParameterType
idstring

Returns

Promise<T | null>


getCanvasRenderer()

getCanvasRenderer(): CanvasRenderer | null

Defined in: ui.ts:1613

Returns

CanvasRenderer | null


getCaption()

getCaption(x): string

Defined in: ui.ts:1608

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

Parameters

ParameterTypeDescription
xTitem

Returns

string


getGridCellRenderer()

getGridCellRenderer(): GridCellRenderer<any> | null

Defined in: ui.ts:1618

Returns

GridCellRenderer<any> | null


init()

init(): void

Defined in: ui.ts:1675

Gets called once upon the registration of meta export class.

Returns

void


isApplicable()

isApplicable(x): boolean

Defined in: ui.ts:1601

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

Parameters

ParameterTypeDescription
xanyspecified object.

Returns

boolean


refresh()

refresh(x): Promise<T>

Defined in: ui.ts:1594

Parameters

ParameterType
xT

Returns

Promise<T>


registerParamFunc()

registerParamFunc(name, run): void

Defined in: ui.ts:1723

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


renderCard()

renderCard(x, context?): HTMLElement

Defined in: ui.ts:1638

Renders card div for the item.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLElement


renderIcon()

renderIcon(x, context?): HTMLElement

Defined in: ui.ts:1623

Renders icon for the item.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLElement


renderMarkup()

renderMarkup(x, context?): HTMLElement

Defined in: ui.ts:1628

Renders markup for the item.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLElement


renderPreview()

renderPreview(x, params?, path?): Promise<View>

Defined in: ui.ts:1648

Renders preview list for the item.

Parameters

ParameterType
xT
params?any
path?string

Returns

Promise<View>


renderProperties()

renderProperties(x, context?): HTMLElement

Defined in: ui.ts:1643

Renders properties list for the item.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLElement


renderTooltip()

renderTooltip(x, context?): HTMLElement

Defined in: ui.ts:1633

Renders tooltip for the item.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLElement


renderView()

renderView(x, context?): HTMLElement

Defined in: ui.ts:1655

Renders view for the item.

Parameters

ParameterTypeDefault value
xTundefined
contextanynull

Returns

HTMLElement


toMarkup()

toMarkup(T): string | null

Defined in: ui.ts:1660

Converts object to its markup description

Parameters

ParameterType
Tany

Returns

string | null


toString()

toString(): string

Defined in: ui.ts:1579

Returns

string


forEntity()

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

Defined in: ui.ts:1698

Parameters

ParameterTypeDefault value
objectanyundefined
contextanynull

Returns

ObjectHandler<any> | null


forSemType()

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

Defined in: ui.ts:1709

Parameters

ParameterType
semTypestring

Returns

Promise<ObjectHandler<any>[]>


list()

static list(): ObjectHandler<any>[]

Defined in: ui.ts:1690

All registered handlers

Returns

ObjectHandler<any>[]


onResolve()

static onResolve(observer): Subscription

Defined in: ui.ts:1694

Parameters

ParameterType
observerPartialObserver<ObjectHandlerResolutionArgs>

Returns

Subscription


register()

static register(meta): void

Defined in: ui.ts:1678

Registers entity handler.

Parameters

ParameterType
metaObjectHandler

Returns

void