Skip to content

Commit

Permalink
Add ExportSvgAction to protocol (#144)
Browse files Browse the repository at this point in the history
* Add ExportSvgAction to protocol

Part of eclipse-glsp/glps/issues/117
  • Loading branch information
tortmayr authored Nov 11, 2020
1 parent 3d500d7 commit 569dcae
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
22 changes: 22 additions & 0 deletions PROTOCOL.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- [2.6. Model Saving](#26-model-saving)
- [2.6.1. SaveModelAction](#261-savemodelaction)
- [2.6.2. SetDirtyStateAction](#262-setdirtystateaction)
- [2.6.2. ExportSvgAction](#263-exportsvgaction)
- [2.7. Model Layout](#27-model-layout)
- [2.7.1. RequestBoundsAction](#271-requestboundsaction)
- [2.7.2. ComputedBoundsAction](#272-computedboundsaction)
Expand Down Expand Up @@ -965,6 +966,27 @@ class SetDirtyStateAction implements Action {
```
</details>

### 2.6.3. ExportSvgAction

The client (or the server) sends an `ExportSvgAction` to indicate that the diagram, which represents the current model state, should be exported in SVG format. The action only provides the diagram SVG as plain string. The expected result of executing an `ExportSvgAction` is a new file in SVG-format on the underlying filesystem. However, other details like the target destination, concrete file name, file extension etc. are not specified in the protocol. So it is the responsibility of the action handler to process this information accordingly and export the result to the underlying filesystem.

<details open><summary>Code</summary>

```typescript
/**
* Sprotty's ExportSvgAction.
* Note that sprotty also provides a `RequestExportSvgAction` which is currently not supported in GLSP.
*/
class ExportSvgAction implements ResponseAction {
/**
* The diagram SModel as serializable SVG.
*/
public readonly svg:string;
}

```
</details>

## 2.7. Model Layout

In GLSP the server usually controls the model's layout by applying bounds to all elements and sending an updated model to the client ([SetModelAction](#252-setmodelaction), [UpdateModelAction](#253-updatemodelaction)). However, calculating the correct bounds of each element may not be straight-forward as it may depend on certain client-side rendering properties, such as label size.
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ Below is a list of features that are supported by the different base technologie
|------------------------------------------------------------------- |:--------------: |:-----------------: |:-------------------: |:-------------------: |
| Model Saving | ||| |
| Model Dirty State | ||| |
| Model SVG Export | || | |
| Model Layout |||||
| Model Edit Modes<br>- Edit<br>- Read-only | <br>✓<br>&nbsp; | <br>✓<br>✓ | <br>✓<br>&nbsp; | <br>✓<br>&nbsp; |
| Model Edit Modes<br>- Edit<br>- Read-only | <br>✓<br>&nbsp; | <br>✓<br>✓ | <br>✓<br>&nbsp; | <br>✓<br>&nbsp; |
| Client View Port<br>- Center<br>- Fit to Screen | <br>✓<br>✓ | <br>✓<br>✓ | <br>✓<br>✓ | <br>✓<br>✓ |
| Client Status Notification |||||
| Client Message Notification ||| | |
Expand Down

0 comments on commit 569dcae

Please sign in to comment.