Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow diagram widget to be displayed as a preview widget #37

Open
debovema opened this issue May 9, 2019 · 1 comment
Open

Allow diagram widget to be displayed as a preview widget #37

debovema opened this issue May 9, 2019 · 1 comment

Comments

@debovema
Copy link

debovema commented May 9, 2019

Hi,

I'm trying to display a Diagram in a preview pane as defined in the preview package.

My idea was to generate the Diagram widget using the createWidget method of the DiagramManager class then using the getSvgElement method of the DiagramWidget class in the renderContent method of the PreviewHandler interface.

However, it seems that the widget must be added to the shell and activated to actually generate the SVG content of the diagram, for instance using the doOpen method of the DiagramManager class. And we should avoid that when displaying the diagram in a preview pane.

Is it possible ? Or does it require some change in sprotty-theia library ?

Thanks for your help !

@JanKoehnlein
Copy link
Contributor

Yes, DiagramWidget#onAfterAttach has to be called in order to set up the hierarchy of DOM elements needed for the diagram, the status message and the hidden rendering, as well as for setting up the behavioral part (SVG is just the rendering).

I haven't dug into the details, but it looks like you have to add your own classes for the preview and re-use/copy what's in DiagramWidget#onAfterAttach and in the DiagramManager.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants