UNPKG

@eclipse-scout/core

Version:
165 lines 9.85 kB
/// <reference types="jquery" /> import { BaseDoEntity, BookmarkDoBuilderModel, BookmarkSupportModel, BookmarkTableRowIdentifierDo, Constructor, Desktop, IBookmarkDo, IBookmarkPageDo, InitModelOf, NodeBookmarkPageDo, ObjectWithType, Outline, OutlineBookmarkDefinitionDo, Page, PageParamDo, PageWithNodes, PageWithTable, Session, TableBookmarkPageDo, TableRow } from '../index'; export declare class BookmarkSupport implements ObjectWithType, BookmarkSupportModel { model: BookmarkSupportModel; protected static _INSTANCES: Map<Session, BookmarkSupport>; static ERROR_ALREADY_LOADING: string; static ERROR_WRONG_DEFINITION_TYPE: string; static ERROR_OUTLINE_NOT_FOUND: string; static ERROR_PAGE_NOT_FOUND: string; static ERROR_PAGE_WRONG_OUTLINE: string; objectType: string; desktop: Desktop; loading: boolean; /** * Returns an instance of {@link BookmarkSupport} for the given {@link Session}. If no instance is registered * for the session yet, a new instance is created. * * @param session Session object providing a desktop. If this is omitted, the first session of the app is used. * If the app does not have any active sessions (e.g. during unit testing), this argument is mandatory. */ static get(session?: Session): BookmarkSupport; constructor(); init(model: InitModelOf<this>): void; get session(): Session; setLoading(loading: boolean): void; resolveOutline(outlineId: string): Outline; /** * Returns `true` if the given page params are equivalent. Unlike {@link BaseDoEntity#equals}, this method * ignores certain data object contributions that are considered to be irrelevant when identifying pages * (e.g. {@link MaxRowCountContributionDo}). */ pageParamsMatch(pageParam1: PageParamDo, pageParam2: PageParamDo): boolean; protected _normalizePageParam(pageParam: PageParamDo): PageParamDo; /** * @returns contributions that may be added to page params but are irrelevant when comparing page params */ protected _getIgnoredContributionClassesForPageParamComparison(): Constructor<BaseDoEntity>[]; /** * 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. */ createTableRowIdentifier(page: PageWithTable, row: TableRow, allowObjectFallback?: boolean): BookmarkTableRowIdentifierDo; /** * Creates a new bookmark for the specified page, or the {@link Outline#activePage active page} of the {@link Desktop#outline current outline} * if no explicit page is specified. By default, {@link CreateBookmarkParam#createTableRowSelections} is set to `false`. * * @param param Optional parameters to {@link BookmarkDoBuilder}, can be used to override the defaults. * @param options Optional settings to change the behavior of this method. */ createBookmark(param?: CreateBookmarkParam, options?: CreateBookmarkOptions): JQuery.Promise<IBookmarkDo>; /** * Creates a bookmark for the given page to be used to refresh an outline. It differs from {@link createBookmark} * in that the resulting bookmark can contain non-bookmarkable pages and non-serializable data. Additionally, * title and description are not returned. */ createBookmarkForRefresh(param?: CreateBookmarkParam, options?: CreateBookmarkOptions): JQuery.Promise<IBookmarkDo>; /** * Returns the implementation-specific identifier for the given bookmark, or `undefined` if the bookmark does not * have a recognizable identifier. */ getBookmarkId(bookmark: IBookmarkDo): string; /** * Navigates to the original location of the given bookmark. * * @param options Optional settings to change the behavior of this method */ activateBookmark(bookmark: IBookmarkDo, options?: ActivateBookmarkOptions): JQuery.Promise<void>; protected _activateBookmarkAsync(bookmark: IBookmarkDo, options?: ActivateBookmarkOptions): Promise<void>; protected _activateOutlineBookmarkDefinition(bookmarkDefinition: OutlineBookmarkDefinitionDo, options: ActivateBookmarkOptions): Promise<void>; /** * Navigates to the page specified by the given page path, starting from the given parent page or outline. Every page on the * way is resolved and populated according to the bookmark page, but only the last page is selected at the end. * * @param param Specifies the starting point and the page path to activate from there * @param options Optional settings to change the behavior of this method */ activateBookmarkPath(param: ActivateBookmarkPathParam, options?: ActivateBookmarkOptions): JQuery.Promise<void>; protected _activateBookmarkPathAsync(param: ActivateBookmarkPathParam, options?: ActivateBookmarkOptions): Promise<void>; protected _activateBookmarkPath(param: ActivateBookmarkPathParam, options?: ActivateBookmarkOptions): Promise<void>; protected _resolvePage(outline: Outline, parentPage: Page, parentBookmarkPage: IBookmarkPageDo, bookmarkPage: IBookmarkPageDo, options?: ActivateBookmarkOptions): Promise<Page>; protected _revealPage(page: Page): void; protected _expandPath(page: Page, expandLeaf: boolean): void; /** * Handles errors that occurred during bookmark creation. */ handleCreateBookmarkError(error: any): JQuery.Promise<any>; /** * Handles errors that occurred during bookmark activation. */ handleActivateBookmarkError(error: any): JQuery.Promise<any>; /** * Adapts the given target page with the information from the given bookmark. * Useful when bookmarked page is opened inline, i.e. in bookmark outline. * * @param saveState Specifies whether the new state of the page (table configuration, search form) should be the * saved state, i.e. resetting to factory settings should revert the page to the state from the bookmark rather * than to the original state. The default value is `true`. */ applyBookmarkToPage(page: Page, bookmark: IBookmarkDo, saveState?: boolean): void; /** * Same as {@link applyBookmarkToPage}, but also reloads the page. The returned promise is not resolved until the * reload is done. */ applyBookmarkToPageAndReload(page: Page, bookmark: IBookmarkDo, saveState?: boolean): JQuery.Promise<void>; protected _applyBookmarkToPageAndReloadAsync(page: Page, bookmark: IBookmarkDo, saveState?: boolean): Promise<void>; protected _applyBookmarkPageAndReload(page: Page, bookmarkPage: IBookmarkPageDo, saveState?: boolean): Promise<void>; protected _applyBookmarkPage(page: Page, bookmarkPage: IBookmarkPageDo, saveState?: boolean): void; protected _applyBookmarkToTablePage(page: PageWithTable, bookmarkPage: TableBookmarkPageDo, saveState?: boolean): void; protected _applyBookmarkToNodePage(page: PageWithNodes, bookmarkPage: NodeBookmarkPageDo): void; protected _prepareTablePage(page: PageWithTable, bookmarkPage: TableBookmarkPageDo, saveState?: boolean): void; protected _prepareTablePreferences(page: PageWithTable, bookmarkPage: TableBookmarkPageDo, saveState: boolean): void; protected _prepareSearchFilter(page: PageWithTable, bookmarkPage: TableBookmarkPageDo, saveState: boolean): void; protected _prepareChartTableControlState(page: PageWithTable, bookmarkPage: TableBookmarkPageDo): void; protected _restoreSelection(page: PageWithTable, selectedRowIdentifiers: BookmarkTableRowIdentifierDo[]): void; } export type CreateBookmarkParam = Omit<BookmarkDoBuilderModel, 'desktop'>; export interface CreateBookmarkOptions { /** * Specifies whether runtime errors should be handled (e.g. by showing a message). The promise will still be rejected. * The default value is `true`. */ handleErrors?: boolean; } export interface ActivateBookmarkPathParam { /** * The outline where to activate the page path. If this is omitted, the desktop's active outline is used instead. */ parentOutline?: Outline; /** * The page where to start activating the page path. If this is omitted, the process starts at the outline root. */ parentPage?: Page; /** * Optional bookmark information for the specified parent page. If set, this information is applied to parent page. */ parentBookmarkPage?: IBookmarkPageDo; /** * The list of path elements to activate, beginning at the specified starting point. The element is processed * from left to right, i.e. the last entry corresponds to the page that will be selected at the end. */ pagePath?: IBookmarkPageDo[]; } export interface ActivateBookmarkOptions { /** * Specifies whether the target outline should be activated. The default value is `true`. */ activateOutline?: boolean; /** * If `true`, the user is warned when the bookmark could not be opened. Useful when a persisted bookmark is activated. * The default value is `true`. */ resetViewAndWarnOnFail?: boolean; /** * Specifies whether runtime errors should be handled (e.g. by showing a message). The promise will still be rejected. * The default value is `true`. */ handleErrors?: boolean; } //# sourceMappingURL=BookmarkSupport.d.ts.map