Class. Diagram Server
sprotty-protocol / DiagramServer
Defined in: diagram-server.ts:31
An instance of this class is responsible for handling a single diagram client. It holds the current state of the diagram and manages communication with the client via actions.
new DiagramServer(
dispatch
,services
):DiagramServer
Defined in: diagram-server.ts:49
<A
>(action
) => Promise
<void
>
DiagramServer
protected
optional
actionHandlerRegistry:ServerActionHandlerRegistry
Defined in: diagram-server.ts:46
protected
readonly
diagramGenerator:IDiagramGenerator
Defined in: diagram-server.ts:44
readonly
dispatch: <A
>(action
) =>Promise
<void
>
Defined in: diagram-server.ts:42
A
extends Action
A
Promise
<void
>
protected
readonly
optional
layoutEngine:IModelLayoutEngine
Defined in: diagram-server.ts:45
protected
readonly
requests:Map
<string
,Deferred
<ResponseAction
>>
Defined in: diagram-server.ts:47
readonly
state:DiagramState
&object
Defined in: diagram-server.ts:33
optional
lastSubmittedModelType:string
get needsClientLayout():
boolean
Defined in: diagram-server.ts:83
Whether the client needs to compute the layout of parts of the model. This affects the behavior
of submitModel
.
This setting is determined by the DiagramOptions
that are received with the RequestModelAction
from the client. If the client does not specify whether it needs client layout, the default value
is true
.
boolean
get needsServerLayout():
boolean
Defined in: diagram-server.ts:98
Whether the server needs to compute the layout of parts of the model. This affects the behavior
of submitModel
.
This setting is determined by the DiagramOptions
that are received with the RequestModelAction
from the client. If the client does not specify whether it needs server layout, the default value
is false
.
boolean
accept(
action
):Promise
<void
>
Defined in: diagram-server.ts:108
Called when an action is received from the client.
Promise
<void
>
protected
handleAction(action
):Promise
<void
>
Defined in: diagram-server.ts:160
Promise
<void
>
protected
handleComputedBounds(action
):Promise
<void
>
Defined in: diagram-server.ts:242
Promise
<void
>
protected
handleLayout(action
):Promise
<void
>
Defined in: diagram-server.ts:250
Promise
<void
>
protected
handleRequestModel(action
):Promise
<void
>
Defined in: diagram-server.ts:182
Promise
<void
>
rejectRemoteRequest(
action
,error
):void
Defined in: diagram-server.ts:149
Send a RejectAction
to the client to notify that a request could not be fulfilled.
undefined
| Action
Error
void
request<
Res
>(action
):Promise
<Res
>
Defined in: diagram-server.ts:132
Send a request action to the client. The resulting promise is resolved when a matching
response is received and rejected when a RejectAction
is received.
Res
extends ResponseAction
RequestAction
<Res
>
Promise
<Res
>
setModel(
newRoot
):Promise
<void
>
Defined in: diagram-server.ts:60
Set the model and submit it to the client.
Promise
<void
>
protected
submitModel(newRoot
,update
,cause?
):Promise
<void
>
Defined in: diagram-server.ts:201
Submit a model to the client after it has been updated in the server state.
boolean
Promise
<void
>
updateModel(
newRoot
):Promise
<void
>
Defined in: diagram-server.ts:69
Update the model to a new state and submit it to the client.
Promise
<void
>