cancel
Showing results for 
Search instead for 
Did you mean: 

how to retrieve the size of diagram?

joewjz85
Champ in-the-making
Champ in-the-making
hi,
do anyone know how to retrieve the height&width of diagram? my web application could not get the process diagram corresponding to the diagram frame size once i click the button to show process diagram, but when i do it again, it could be displayed normally.
just don't want to make every diagram with a fixed size, how to use the API to solve this problem?

some of the APIs related to Diagram:
—————————-
DiagramEdge
DiagramEdgeWaypoint
DiagramElement
DiagramLayout
DiagramNode
2 REPLIES 2

jbarrez
Star Contributor
Star Contributor
It probably depends on your web ui framework, but here is how we do it in Explorer:


     StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder()
        .buildStreamResource(processInstance, repositoryService, runtimeService);

      Embedded embedded = new Embedded(null, diagram);
      embedded.setType(Embedded.TYPE_IMAGE);
      embedded.setSizeUndefined();

      Panel imagePanel = new Panel(); // using panel for scrollbars
      imagePanel.setScrollable(true);
      imagePanel.addStyleName(Reindeer.PANEL_LIGHT);
      imagePanel.setWidth(100, UNITS_PERCENTAGE);
      imagePanel.setHeight(400, UNITS_PIXELS);

As you can see, the height is fixed. Vaadin then resizes the diagram using the available space.

joewjz85
Champ in-the-making
Champ in-the-making
alright, let me have a look first, got so much works,,
thnx