如何在服务器上创建GEF图的图像 [英] how to create an image of a GEF diagram on a server

查看:217
本文介绍了如何在服务器上创建GEF图的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在服务器端创建一个Eclipse GEF图的映像,而无需加载整个编辑器环境。

I would like to create an image of an Eclipse GEF diagram on the server side without having to load the entire editor environment.

该图是使用 eclipse bpmn2-modeler ,它基于 eclipse graphiti ,它基于 GEF

The diagram is designed using eclipse bpmn2-modeler which is based on eclipse graphiti which is based on GEF.

想法将是:


  1. 加载BPMN模型

  2. 生成图表信息

  3. 导出图作为图像

此代码段应该执行步骤1,加载BPMN模型:

This snippet should do step 1, load the BPMN model:

    URI modelUri = URI.createFileURI("D:/temp/data.bpmn");
    ResourceSet resourceSet = new Bpmn2ModelerResourceSetImpl();
    resourceSet.setURIConverter(new ProxyURIConverterImplExtension(modelUri));
    Bpmn2ResourceImpl resource = (Bpmn2ResourceImpl) resourceSet.createResource(modelUri, Bpmn2ModelerResourceImpl.BPMN2_CONTENT_TYPE_ID);
    ModelHandler modelHandler = ModelHandlerLocator.createModelHandler(modelUri, resource);




  1. 生成图表信息发现 org.eclipse.bpmn2.modeler.core.di.DIImport

    这里的问题是构造函数需要一个 org.eclipse.graphiti.ui.editor.DiagramEditor 并且在服务器上我没有一个,没有运行的UI环境。

    还有一些其他的util或handler为我生成图表

  1. to generate the diagram information I found org.eclipse.bpmn2.modeler.core.di.DIImport.
    The problem here is that the constructor requires a org.eclipse.graphiti.ui.editor.DiagramEditor and on the server I don't have one, no running UI environment.
    Is there some other util or handler that can generate the diagram for me?

我看了一下 org.eclipse.graphiti.ui.features.DefaultSaveImageFeature org.eclipse.graphiti.ui.internal.util.ui.print.AbstractFigureSelectionDialog(initScaledImage())

但是我需要先通过第2步,然后深入了解。

I took a look at the org.eclipse.graphiti.ui.features.DefaultSaveImageFeature and org.eclipse.graphiti.ui.internal.util.ui.print.AbstractFigureSelectionDialog (initScaledImage()).
But I need to first get passed the step 2 issue, before digging deeper into this.

也许我错了方式有一个更简单的方法?

Maybe I'm on the wrong way and there is a much easier approach?

推荐答案

Graphiti最近收到了一个增强版,它允许您导出与导出编辑器的图。你仍然需要eclipse UI环境。我有一个这里的例子下面列出的帮助方法。

Graphiti recently received an enhancement which allows you to export the diagram w/o bringing up the editor. You'd still need the eclipse UI environment though. I have an example here that uses the helper method listed below.

org.eclipse.graphiti.ui.internal.services.impl.ImageService.convertDiagramToBytes(Diagram, int)

这篇关于如何在服务器上创建GEF图的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆