Search in sources :

Example 1 with IncrementalLayoutConvertedDiagram

use of org.eclipse.sirius.components.diagrams.layout.incremental.IncrementalLayoutConvertedDiagram in project sirius-components by eclipse-sirius.

the class LayoutService method incrementalLayout.

@Override
public Diagram incrementalLayout(IEditingContext editingContext, Diagram newDiagram, Optional<IDiagramEvent> optionalDiagramElementEvent) {
    IncrementalLayoutConvertedDiagram convertedDiagram = this.incrementalLayoutDiagramConverter.convert(newDiagram);
    DiagramLayoutData diagramLayoutData = convertedDiagram.getDiagramLayoutData();
    var representationDescription = this.representationDescriptionSearchService.findById(editingContext, newDiagram.getDescriptionId());
    ISiriusWebLayoutConfigurator layoutConfigurator;
    if (representationDescription.isPresent() && representationDescription.get() instanceof DiagramDescription) {
        layoutConfigurator = this.layoutConfiguratorRegistry.getLayoutConfigurator(newDiagram, (DiagramDescription) representationDescription.get());
    } else {
        layoutConfigurator = this.layoutConfiguratorRegistry.getDefaultLayoutConfigurator();
    }
    this.incrementalLayoutEngine.layout(optionalDiagramElementEvent, diagramLayoutData, layoutConfigurator);
    Map<String, ILayoutData> id2LayoutData = convertedDiagram.getId2LayoutData();
    return this.incrementalLayoutedDiagramProvider.getLayoutedDiagram(newDiagram, diagramLayoutData, id2LayoutData);
}
Also used : IncrementalLayoutConvertedDiagram(org.eclipse.sirius.components.diagrams.layout.incremental.IncrementalLayoutConvertedDiagram) ILayoutData(org.eclipse.sirius.components.diagrams.layout.incremental.data.ILayoutData) DiagramLayoutData(org.eclipse.sirius.components.diagrams.layout.incremental.data.DiagramLayoutData) DiagramDescription(org.eclipse.sirius.components.diagrams.description.DiagramDescription)

Aggregations

DiagramDescription (org.eclipse.sirius.components.diagrams.description.DiagramDescription)1 IncrementalLayoutConvertedDiagram (org.eclipse.sirius.components.diagrams.layout.incremental.IncrementalLayoutConvertedDiagram)1 DiagramLayoutData (org.eclipse.sirius.components.diagrams.layout.incremental.data.DiagramLayoutData)1 ILayoutData (org.eclipse.sirius.components.diagrams.layout.incremental.data.ILayoutData)1