简体   繁体   English

GEF:如何使用预定义的第三方模型将域信息与表示信息分开?

[英]GEF: How to separate Domain Information from Presentation Information with pre-defined third-party model?

I am in the process of developing a GEF View (which will later be evolving into a GEF Editor ), and I'm doing so with the help of the GEF Book . 我正在开发GEF View (以后将演变为GEF Editor ),并且正在GEF Book的帮助下进行。

In chapter 8.1 ("GEF Models") in the book, a model is constructed which mixes Domain Information and Presentation Information (which is generously admitted): GenealogyElement is the abstract superclass for the rest of the model objects (but one). 在本书的第8.1章(“ GEF模型”)中,构建了一个混合了领域信息表示信息 (被广泛承认)的模型: GenealogyElement是其余模型对象(但是一个)的abstract超类。

GenealogyElement takes care of the location, and location changes of its subclasses ( Person , Marriage ) and the like, which themselves include the actual domain information. GenealogyElement负责位置及其子类( PersonMarriage )等子类的位置及其位置更改,它们本身包括实际的域信息。 Btw, the source code can be found on the books website . 顺便说一句,可以在图书网站上找到源代码。

I wouldn't mind doing so myself (even if this is probably "bad style"), but I'm using a third-party model which I cannot alter , ie, I cannot change the class ThirdPartyNode to extend, say, ExampleElement . 我不介意自己这样做(即使这可能是“不好的风格”),但是我使用的是无法更改的第三方模型 ,即无法更改类ThirdPartyNode来扩展例如ExampleElement

One option would of course be to write my own model against the third-party one, create an abstract class ExampleElement , and let a new class ExampleNode extend both ExampleElement and ThirdPartyNode . 一种选择当然是针对第三方模型编写我自己的模型,创建abstractExampleElement ,并让新类ExampleNode扩展ExampleElementThirdPartyNode I might end up doing so, but really want to include different possibilities first, as creating another model is a lot of typing, and potentially superfluous (isn't it?). 我可能最终会这样做,但实际上我想首先包含其他可能性,因为创建另一个模型需要大量输入,并且可能是多余的(不是吗?)。

What are my options for seperating both information types? 分离两种信息类型有哪些选择?

Thanks in advance! 提前致谢!

I solved a similar problem creating a different model containing the presentation data (ie: the position of the element) and a reference to the actual data model. 我解决了一个类似的问题,创建了一个不同的模型,其中包含演示数据(即元素的位置)和对实际数据模型的引用。 You only shoud consider carefully how the data model notifies its changes to the editor. 您只应仔细考虑数据模型如何将其更改通知编辑器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否可以将演示模型模式用于具有EMF域模型的基于GEF的RCP应用程序? - Is it possible to use the Presentation Model Pattern for a GEF-based RCP app with an EMF domain model? 如何保护来自Postman等第三方工具的Web API请求调用? - How to protect web API request call from third-party tools such as Postman? 如何将信息从一个模型调用到另一个Codeigniter - How to call information from one model to another Codeigniter 如何在MVC中表示跨模型信息? - How to represent cross-model information in MVC? 数据绑定:演示模型和视图,Android中的第三方库 - Data binding: presentation model and view, 3rd party libs in Android 从 model 发送信息到视图,MVC 架构,PyQT5 - Sending information from model to view, MVC architecture, PyQT5 模型视图控制器:将定期显示的信息从控制器发送到视图 - Model view controller: Sending regularly displayed information to the view from controller 大多数Pythonic双调度,用于从模型中提取视图信息 - Most Pythonic double dispatch for extracting View information from Model Controller 未获取从 Ajax 请求发送的信息(针对模型) - Controller not getting information (for the Model) sent from Ajax request 关于如何在用户模型中实现字段元信息,是否存在一种设计模式? - Is there a design pattern on how to implement field meta information in the user model?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM