@eclipse-scout/core
Version:
Eclipse Scout runtime
263 lines • 12.3 kB
TypeScript
import { BaseDoEntity, BookmarkTableRowIdentifierDo, ButtonTile, ChildModelOf, Column, Constructor, DoTypeResolver, EnumObject, Event, EventHandler, EventListener, EventMapOf, EventModel, EventSupport, Form, HtmlComponent, InitModelOf, Menu, MenuOwner, ObjectOrType, ObjectWithUuid, Outline, PageDetailMenuContributor, PageEventMap, PageModel, PropertyChangeEvent, RequiredUnlessNotSubclass, SomeRequired, Table, TableRow, TableRowClickEvent, TreeNode, UuidPathOptions } from '../../../index';
/**
* This class is used differently in online and JS-only case. In the online case we only have instances
* of Page in an outline. The server sets the property <code>nodeType</code> which is used to distinct
* between pages with tables and pages with nodes in some cases. In the JS only case, Page is an abstract
* class and is never instantiated directly, instead we always use subclasses of PageWithTable or PageWithNodes.
* Implementations of these classes contain code which loads table data or child nodes.
*/
export declare class Page extends TreeNode implements PageModel, ObjectWithUuid {
initModel: SomeRequired<this['model'], 'parent'> & PageParamRequiredIfDeclared<this>;
model: PageModel;
eventMap: PageEventMap;
self: Page;
parent: Outline;
childNodes: Page[];
parentNode: Page;
uuid: string;
pageParam: PageParamDo;
/**
* This property is set by the server, see: JsonOutline#putNodeType.
*/
nodeType: NodeType;
compactRoot: boolean;
detailTable: Table;
detailTableVisible: boolean;
detailForm: Form;
detailFormVisible: boolean;
detailFormVisibleByUi: boolean;
navigateButtonsVisible: boolean;
tableStatusVisible: boolean;
htmlComp: HtmlComponent;
/**
* True to select the page linked with the selected row when the row was selected. May be useful on touch devices.
*/
drillDownOnRowClick: boolean;
/**
* The icon id which is used for icons in the tile outline overview.
*/
overviewIconId: string;
showTileOverview: boolean;
inheritMenusFromParentTablePage: boolean;
detailMenuContributors: PageDetailMenuContributor[];
row: TableRow;
tile: ButtonTile;
events: EventSupport;
pageChanging: number;
userPreferenceContext: string;
modelClass: string;
classId: string;
protected _tableFilterHandler: EventHandler<Event<Table>>;
protected _tableRowClickHandler: EventHandler<TableRowClickEvent>;
protected _detailTableModel: ChildModelOf<Table>;
/** @internal */
_detailFormModel: ChildModelOf<Form>;
protected _detailMenusChangeHandler: (event: Event<MenuOwner>) => void;
constructor();
/**
* This enum defines a node-type. This is basically used for the Scout Classic case where we only have instances
* of Page, but never instances of PageWithTable or PageWithNodes. The server simply sets a nodeType instead.
*/
static NodeType: {
readonly NODES: "nodes";
readonly TABLE: "table";
};
protected _init(model: InitModelOf<this>): void;
/**
* Writes the static model to the page instance and initializes the {@link pageParam}.
* This allows the {@link PageResolver} to find the correct page without having to initialize it completely.
*
* **Important:** Always use {@link scout.create} to create and initialize page instances. This method is *only* intended to be used for page resolving!
*/
minimalInit(): void;
buildUuid(useFallback?: boolean): string;
buildUuidPath(options?: UuidPathOptions): string;
setUuid(uuid: string): void;
protected static _removePropertyIfLazyLoading(object: PageModel, name: string): any;
protected _destroy(): void;
setOverviewIconId(overviewIconId: string): void;
protected _createDetailMenuContributors(): ObjectOrType<PageDetailMenuContributor>[];
protected _setDetailMenuContributors(contributors: ObjectOrType<PageDetailMenuContributor>[]): void;
protected _internalInitTable(): void;
protected _internalInitDetailForm(): void;
ensureDetailTable(): void;
/**
* Creates the detail table
* @returns the created table or null
*/
createDetailTable(): Table;
/**
* Override this function to create the internal table. Default impl. returns null.
*/
protected _createDetailTable(): Table;
ensureDetailForm(): void;
/**
* Creates the detail form
* @returns the created form or null
*/
createDetailForm(): Form;
/**
* Override this function to return a detail form which is displayed in the outline when this page is selected.
* The default implementation returns null.
*/
protected _createDetailForm(): Form;
/**
* Override this function to initialize the internal detail form.
* @param form the form to initialize.
*/
protected _initDetailForm(form: Form): void;
protected _updateDetailMenus(): void;
protected _updateDetailFormMenus(): void;
protected _updateDetailTableMenus(): void;
protected _updateDetailMenusForMenuOwner(menuOwner: MenuOwner): void;
protected _onMenuOwnerMenusChange(event: Event<MenuOwner>): void;
isMenuInheritedFromParentTablePage(menu: Menu): boolean;
/**
* Override this function to destroy the internal (detail) form.
* @param form the form to destroy.
*/
protected _destroyDetailForm(form: Form): void;
/**
* Override this function to initialize the internal (detail) table.
* Default impl. delegates filter events to the outline mediator.
* @param table The table to initialize.
*/
protected _initDetailTable(table: Table): void;
/**
* Override this function to destroy the internal (detail) table.
* @param table the table to destroy.
*/
protected _destroyDetailTable(table: Table): void;
/** @internal */
_decorate(): void;
activate(): void;
deactivate(): void;
/**
* @deprecated use {@link outline} instead
*/
getOutline(): Outline;
/**
* @returns the tree / outline / parent instance. it's all the same,
* but it's more intuitive to work with the 'outline' when we deal with pages.
*/
get outline(): Outline;
/**
* Returns an array of pages linked with the given rows. The order of the returned pages corresponds to the
* order of the rows. Rows that are not linked to a page are ignored.
*/
pagesForTableRows(rows: TableRow[]): Page[];
/**
* @param form The new form
*/
setDetailForm(form: Form): void;
protected _setDetailForm(form: Form): void;
/**
* @param table The new table
*/
setDetailTable(table: Table): void;
protected _setDetailTable(table: Table): void;
/**
* Updates relevant properties from the pages linked with the given rows using the method updatePageFromTableRow and
* returns the pages. Rows that are not linked to a page are ignored.
*
* @returns pages linked with the given rows.
*/
updatePagesFromTableRows(rows: TableRow[]): Page[];
/**
* Updates relevant properties (text, enabled, htmlEnabled) from the page linked with the given row.
* Only call this method if {@link TableRow#page} is set!
*
* @returns page linked with the given row.
*/
updatePageFromTableRow(row: TableRow): Page;
/**
* This function creates the text property of this page. The default implementation returns {@link Column#cellText} of all summary columns.
*/
computeTextForRow(row: TableRow, summaryColumns?: Column[]): string;
/**
* Computes the summary columns of the given {@link TableRow}. The summary columns are
* <ol>
* <li> the {@link Table#compactColumn} if it exists and the {@link Outline} is compact
* <li> the {@link Table#summaryColumns}
* <li> the first visible column
* </ol>
*/
protected _computeSummaryColumns(row: TableRow): Column<any>[];
/**
* Returns the `text` property of this page as plain text.
*/
getDisplayText(): string;
/**
* @returns a page parameter object used to pass to newly created child pages. Sets the parent
* to our outline instance and adds optional other properties. Typically, you'll pass an
* object (entity-key or arbitrary data) to a child page.
* @deprecated either add the parent by yourself or return a page model instead of a page when creating child pages
*/
protected _pageParam<T extends object>(paramProperties?: T): T & {
parent: Outline;
};
reloadPage(): void;
linkWithRow(row: TableRow): void;
unlinkWithRow(row: TableRow): void;
protected _onTableFilter(event: Event<Table>): void;
protected _onTableRowClick(event: TableRowClickEvent): void;
matchesPageParam(pageParam: PageParamDo): boolean;
protected _setPageParam(pageParam: PageParamDo): void;
protected _computeDummyPageParam(): PageParamDo;
/**
* Returns an identifier for the given row that can be stored in a bookmark or used to find the same row again when the
* bookmark is activated. Usually, it consists of all primary key values.
*
* By default, all components of a row identifier have to be persistable. If one of the primary keys is of an unsupported
* type, an error is thrown. To return a (non-persistable) {@link BookmarkTableRowIdentifierObjectComponentDo} instead,
* set the optional argument `allowObjectFallback` to `true`.
*
* This method can also return `null`. In that case, the child page is identified by its page param.
*/
getTableRowIdentifier(row: TableRow, allowObjectFallback?: boolean): BookmarkTableRowIdentifierDo;
setPageChanging(changing: boolean): void;
/**
* Triggers a property change for a single property.
*/
triggerPropertyChange<T>(propertyName: string, oldValue: T, newValue: T): PropertyChangeEvent<T, this>;
trigger<K extends string & keyof EventMapOf<Page>>(type: K, eventOrModel?: Event<Page> | EventModel<EventMapOf<Page>[K]>): EventMapOf<Page>[K];
one<K extends string & keyof EventMapOf<this>>(type: K, handler: EventHandler<EventMapOf<this>[K] & Event<this>>): void;
on<K extends string & keyof EventMapOf<this>>(type: K, handler: EventHandler<(EventMapOf<this>)[K] & Event<this>>): EventListener;
off<K extends string & keyof EventMapOf<this>>(type: K, handler?: EventHandler<EventMapOf<this>[K]>): void;
}
export type NodeType = EnumObject<typeof Page.NodeType>;
/**
* A page param contains all parameters that are required to create a {@link Page}.
* Being able to create a page in a generic way is essential when bookmarks are used.
*
* If the application uses bookmarks then each page needs to provide its own page param that inherits from this base class.
* If the page does not have any parameters, the page param can be omitted.
*
* If the application does not use bookmarks, page params are not required.
*
* @see BookmarkSupport
*/
export declare class PageParamDo extends BaseDoEntity {
}
/**
* Default page param that is used by bookmarks to identify pages that do not provide a {@link PageParamDo}.
* It stores the page's ID so it can be found again when activating the bookmark.
*/
export declare class PageIdDummyPageParamDo extends PageParamDo {
pageId: string;
}
/**
* If a specific {@link PageParamDo} exists on server side but there is no equivalent on JS side, a {@link BaseDoEntity} would be created.
* This resolver ensures a real {@link PageParamDo} instance will be created instead of a {@link BaseDoEntity}
* whenever a data object is deserialized whose type ends with 'PageParam', if there is no explicit page param found.
*
* This guarantees all page params are actual instances of {@link PageParamDo}.
*/
export declare class PageParamDoTypeResolver implements DoTypeResolver {
resolve(rawObj: Record<string, any>): Constructor<BaseDoEntity>;
}
/**
* Makes the pageParam of the given page required if the page declares a concrete page param (= a subclass of {@link PageParamDo}).
*/
export type PageParamRequiredIfDeclared<TPage extends Page> = RequiredUnlessNotSubclass<TPage, 'pageParam', PageParamDo>;
//# sourceMappingURL=Page.d.ts.map