[英]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
负责位置及其子类( Person
, Marriage
)等子类的位置及其位置更改,它们本身包括实际的域信息。 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
. 一种选择当然是针对第三方模型编写我自己的模型,创建abstract
类ExampleElement
,并让新类ExampleNode
扩展ExampleElement
和ThirdPartyNode
。 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.