ObjectHandler<T>
Defined in: js-api/ui.ts:1636
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 | Default type |
|---|---|
T | any |
Constructors
Constructor
new ObjectHandler<
T>():ObjectHandler<T>
Returns
ObjectHandler<T>
Properties
| Property | Type | Defined in |
|---|---|---|
dart | any | js-api/ui.ts:1637 |
Accessors
helpUrl
Get Signature
get helpUrl():
string|null
Defined in: js-api/ui.ts:1644
URL of help page for the object that this meta handles.
Returns
string | null
markupRegexp
Get Signature
get markupRegexp():
string|null
Defined in: js-api/ui.ts:1787
Creates a regexp for detecting markup descriptions of an object
Returns
string | null
name
Get Signature
get name():
string
Defined in: js-api/ui.ts:1648
Returns
string
regexpExample
Get Signature
get regexpExample(): {
example:string;nonVariablePart:string;regexpMarkup:string; } |null
Defined in: js-api/ui.ts:1657
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: js-api/ui.ts:1639
Type of the object that this meta handles.
Returns
string
Methods
fromMarkup()
fromMarkup(
matches):any
Defined in: js-api/ui.ts:1782
Extract object from parsed markup description
Parameters
| Parameter | Type |
|---|---|
matches | string[] |
Returns
any
getById()
getById(
id):Promise<T|null>
Defined in: js-api/ui.ts:1661
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
Promise<T | null>
getCanvasRenderer()
getCanvasRenderer():
CanvasRenderer|null
Defined in: js-api/ui.ts:1682
Returns
CanvasRenderer | null
getCaption()
getCaption(
x):string
Defined in: js-api/ui.ts:1677
String representation of the [item]: the value of a semantic value or a grid cell, item.toString() otherwise.
Parameters
| Parameter | Type | Description |
|---|---|---|
x | T | item |
Returns
string
getGridCellRenderer()
getGridCellRenderer():
GridCellRenderer<any> |null
Defined in: js-api/ui.ts:1687
Returns
GridCellRenderer<any> | null
init()
init():
void
Defined in: js-api/ui.ts:1792
Gets called once upon the registration of meta export class.
Returns
void
isApplicable()
isApplicable(
x):boolean
Defined in: js-api/ui.ts:1671
Override this method to check whether this meta class should handle the specified object.
Parameters
| Parameter | Type | Description |
|---|---|---|
x | any | specified object. |
Returns
boolean
refresh()
refresh(
x):Promise<T>
Defined in: js-api/ui.ts:1665
Parameters
| Parameter | Type |
|---|---|
x | T |
Returns
Promise<T>
registerParamFunc()
registerParamFunc(
name,run):void
Defined in: js-api/ui.ts:1839
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
renderCard()
renderCard(
x,context?):HTMLElement
Defined in: js-api/ui.ts:1712
Renders card div for the item.
Parameters
| Parameter | Type | Default value |
|---|---|---|
x | T | undefined |
context | any | null |
Returns
HTMLElement
renderGrid()
renderGrid(
grid,options?):void
Defined in: js-api/ui.ts:1764
Customizes a Grid presenting a collection of this handler's objects
IN PLACE: column order/visibility, captions, cell renderers, interactivity.
options.items is the DataFrame backing the grid when the caller wants the
handler to tag or (re)bind it; when omitted, operate on grid.dataFrame.
Contract: derive presentation from column tags/semTypes only — the frame may
be a pure data frame (e.g. a queryDf result) with NO hidden ~item object
column; never assume one. Interactivity that needs the object goes through
the semType renderer/context machinery.
Dispatch: OVERRIDING this member takes FULL responsibility for grid decoration
of the built-in views (e.g. the Domain View grid). Any handler that does not
override it — including one written against this version of the API — falls
through to the platform meta for type, from EITHER side: the Dart
dispatch skips the sentinel-marked base (see below), and the base itself
delegates, so ObjectHandler.forEntity(x).renderGrid(grid) decorates exactly
like the platform. To opt out of decoration entirely, override it with an
empty body.
Parameters
| Parameter | Type |
|---|---|
grid | Grid |
options? | { items?: DataFrame; } |
options.items? | DataFrame |
Returns
void
renderIcon()
renderIcon(
x,context?):HTMLElement
Defined in: js-api/ui.ts:1692
Renders icon for the item.
Parameters
| Parameter | Type | Default value |
|---|---|---|
x | T | undefined |
context | any | null |
Returns
HTMLElement
renderInput()
renderInput(
x,context?):InputBase<any> |null
Defined in: js-api/ui.ts:1725
Renders an input for the item (e.g. to be used in forms); null when the handler does not define one.
Parameters
| Parameter | Type | Default value |
|---|---|---|
x | T | undefined |
context | any | null |
Returns
InputBase<any> | null
renderListItem()
renderListItem(
x,context?):HTMLDivElement
Defined in: js-api/ui.ts:1719
Renders the item as a list item — used when displaying objects in lists (such as wide html grids, or popups in type-ahead boxes). By default, renders the item's name.
Parameters
| Parameter | Type | Default value |
|---|---|---|
x | T | undefined |
context | any | null |
Returns
HTMLDivElement
renderMarkup()
renderMarkup(
x,context?):HTMLElement
Defined in: js-api/ui.ts:1702
Renders markup for the item. [context] says what the item is being rendered FOR,
so one handler can serve several surfaces. The platform's many-to-many chips pass
{relation, table, input: 'tags'} — the relation's name, the OWNER's
'<schema>.<table>', and the widget kind. A chip's DG.DomainRow is a
{id, displayName} stub with no column values, so read its name through
getCaption(x) / x.displayName — x.values[nameColumn] is undefined there.
Parameters
| Parameter | Type | Default value |
|---|---|---|
x | T | undefined |
context | any | null |
Returns
HTMLElement
renderPreview()
renderPreview(
x,params?,path?):Promise<View>
Defined in: js-api/ui.ts:1735
Renders preview list for the item.
Parameters
| Parameter | Type |
|---|---|
x | T |
params? | any |
path? | string |
Returns
Promise<View>
renderProperties()
renderProperties(
x,context?):HTMLElement
Defined in: js-api/ui.ts:1730
Renders properties list for the item.
Parameters
| Parameter | Type | Default value |
|---|---|---|
x | T | undefined |
context | any | null |
Returns
HTMLElement
renderTooltip()
renderTooltip(
x,context?):HTMLElement
Defined in: js-api/ui.ts:1707
Renders tooltip for the item.
Parameters
| Parameter | Type | Default value |
|---|---|---|
x | T | undefined |
context | any | null |
Returns
HTMLElement
renderView()
renderView(
x,context?):HTMLElement
Defined in: js-api/ui.ts:1742
Renders view for the item.
Parameters
| Parameter | Type | Default value |
|---|---|---|
x | T | undefined |
context | any | null |
Returns
HTMLElement
toMarkup()
toMarkup(
T):string|null
Defined in: js-api/ui.ts:1777
Converts object to its markup description
Parameters
| Parameter | Type |
|---|---|
T | any |
Returns
string | null
toString()
toString():
string
Defined in: js-api/ui.ts:1650
Returns
string
forEntity()
staticforEntity(object,context?):ObjectHandler<any> |null
Defined in: js-api/ui.ts:1815
Parameters
| Parameter | Type | Default value |
|---|---|---|
object | any | undefined |
context | any | null |
Returns
ObjectHandler<any> | null
forSemType()
staticforSemType(semType):Promise<ObjectHandler<any>[]>
Defined in: js-api/ui.ts:1826
Parameters
| Parameter | Type |
|---|---|
semType | string |
Returns
Promise<ObjectHandler<any>[]>
list()
staticlist():ObjectHandler<any>[]
Defined in: js-api/ui.ts:1807
All registered handlers
Returns
ObjectHandler<any>[]
onResolve()
staticonResolve(observer):Subscription
Defined in: js-api/ui.ts:1811
Parameters
| Parameter | Type |
|---|---|
observer | PartialObserver<ObjectHandlerResolutionArgs> |
Returns
Subscription
register()
staticregister(meta):void
Defined in: js-api/ui.ts:1795
Registers entity handler.
Parameters
| Parameter | Type |
|---|---|
meta | ObjectHandler |
Returns
void