sprotty
Version:
A next-gen framework for graphical views
75 lines • 3.42 kB
TypeScript
/********************************************************************************
* Copyright (c) 2017-2021 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 { Action, ActionMessage, ComputedBoundsAction, RequestModelAction, ExportSvgAction } from 'sprotty-protocol/lib/actions';
import { SModelRoot } from 'sprotty-protocol/lib/model';
import { ActionHandlerRegistry } from '../base/actions/action-handler';
import { ICommand } from '../base/commands/command';
import { ILogger } from '../utils/logging';
import { ComputedBoundsApplicator, ModelSource } from './model-source';
/**
* Sent by the external server when to signal a state change.
*/
export declare class ServerStatusAction {
static KIND: string;
kind: string;
severity: string;
message: string;
}
/**
* A ModelSource that communicates with an external model provider, e.g.
* a model editor.
*
* This class defines which actions are sent to and received from the
* external model source.
*/
export declare abstract class DiagramServerProxy extends ModelSource {
protected logger: ILogger;
protected readonly computedBoundsApplicator: ComputedBoundsApplicator;
clientId: string;
protected currentRoot: SModelRoot;
protected lastSubmittedModelType: string;
get model(): SModelRoot;
initialize(registry: ActionHandlerRegistry): void;
handle(action: Action): void | ICommand | Action;
protected forwardToServer(action: Action): void;
/**
* Send a message to the remote diagram server.
*/
protected abstract sendMessage(message: ActionMessage): void;
/**
* Called when a message is received from the remote diagram server.
*/
protected messageReceived(data: any): void;
/**
* Check whether the given action should be handled locally. Returns true if the action should
* still be sent to the server, and false if it's only handled locally.
*/
protected handleLocally(action: Action): boolean;
/**
* Put the new model contained in the given action into the model storage, if there is any.
*/
protected storeNewModel(action: Action): void;
protected handleRequestModel(action: RequestModelAction): boolean;
/**
* If the server requires to compute a layout, the computed bounds are forwarded. Otherwise they
* are applied to the current model locally and a model update is triggered.
*/
protected handleComputedBounds(action: ComputedBoundsAction): boolean;
protected handleExportSvgAction(action: ExportSvgAction): boolean;
protected handleServerStateAction(action: ServerStatusAction): boolean;
commitModel(newRoot: SModelRoot): Promise<SModelRoot> | SModelRoot;
}
//# sourceMappingURL=diagram-server.d.ts.map