UNPKG

sprotty-theia

Version:

Glue code for Sprotty diagrams in a Theia IDE

83 lines 3.91 kB
/******************************************************************************** * Copyright (c) 2017-2018 TypeFox and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * This Source Code may also be made available under the following Secondary * Licenses when the conditions for such availability set forth in the Eclipse * Public License v. 2.0 are satisfied: GNU General Public License, version 2 * with the GNU Classpath Exception which is available at * https://www.gnu.org/software/classpath/license.html. * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ import { ServerStatusAction, IActionDispatcher, ModelSource, ViewerOptions } from 'sprotty'; import { Widget } from "@phosphor/widgets"; import { Message } from "@phosphor/messaging/lib"; import { BaseWidget } from '@theia/core/lib/browser/widgets/widget'; import { StatefulWidget, Navigatable } from '@theia/core/lib/browser'; import URI from '@theia/core/lib/common/uri'; import { TheiaSprottyConnector } from '../sprotty/theia-sprotty-connector'; import { Container } from 'inversify'; export interface DiagramWidgetOptions { uri: string; diagramType: string; label: string; iconClass: string; } export declare type DiagramWidgetFactory = (options: DiagramWidgetOptions, widgetId: string, diContainer: Container, connector?: TheiaSprottyConnector) => DiagramWidget; export declare const DiagramWidgetFactory: unique symbol; export declare namespace DiagramWidgetOptions { function is(options: any): options is DiagramWidgetOptions; } /** * The DiagramWidget is the container for Sprotty diagrams. */ export declare class DiagramWidget extends BaseWidget implements StatefulWidget, Navigatable { protected options: DiagramWidgetOptions; readonly widgetId: string; readonly diContainer: Container; readonly connector?: TheiaSprottyConnector | undefined; private diagramContainer?; private statusIconDiv?; private statusMessageDiv?; protected _actionDispatcher: IActionDispatcher; protected _modelSource: ModelSource; get uri(): URI; get actionDispatcher(): IActionDispatcher; get viewerOptions(): ViewerOptions; get modelSource(): ModelSource; get clientId(): string; get id(): string; constructor(options: DiagramWidgetOptions, widgetId: string, diContainer: Container, connector?: TheiaSprottyConnector | undefined); protected onAfterAttach(msg: Message): void; protected createContainer(): void; protected initializeSprotty(): void; protected requestModel(): Promise<void>; protected initializeView(): Promise<void>; protected getBoundsInPage(element: Element): { x: number; y: number; width: number; height: number; }; protected onResize(msg: Widget.ResizeMessage): void; protected onActivateRequest(msg: Message): void; /** * We cannot activate the widget before the SVG element is there, as it takes the focus. * This should happen within two animation frames, as the action dispatcher issues * a SetModelCommand in the constructor. OTOH, shell.activateWidget() is synchronous. So * after creating the widget and before activating it, we use this method to wait for the * SVG to be appended to the DOM. */ getSvgElement(): Promise<HTMLElement | undefined>; setStatus(status: ServerStatusAction): void; protected removeClasses(element: Element, keep: number): void; storeState(): object; restoreState(oldState: object): void; getResourceUri(): URI | undefined; createMoveToUri(resourceUri: URI): URI | undefined; } //# sourceMappingURL=diagram-widget.d.ts.map