原文地址:http://wiki.eclipse.org/GMF_Labels
Labels represent pieces of text possibly associated with icons on diagram surface. Text may be edited using inplace facility. There are many possibilities to construct labels but all of them are grouped in four usecases:
1. "feature based label"
Label is always defined in context of a diagram node or a link. If it's based on EClass from domain model then label may be used to represent attribute(s) of this class. Tooling will generate code that constructs label text and converts user input to the new value for attribute(s).
2. "design label"
It may be desirable to have a label that is not stored in domain model. Tooling may generate code that will use notation style (DescriptionStyle for example) to store label text in notation model.
3. "default label"
This is a read-only label with fixed text.
4. "custom label"
GMF runtime defines IParser interface that is responsible to provide label text and editing support. In this usecase toolsmith is supposed to provide his own IParser implementation.
<script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
Graphical Definition
The only possible label figure is Label. In generated diagram editor the actual figure may be Label from Draw2D or WrapLabel from GMF runtime. Attribute "text" of the figure is a text shown on diagram when parser is not available.
Position of label figure within the model is important; it's used to determine whether label should be inner or external. Link labels are always external but node labels may be located whether inside node figure or "float" near it. If label figure is contained within parent node figure (directly or indirectly) it's inner label.
DiagramLabel element refers to the label figure and is being referenced by LabelMapping from mapping models. If "elementIcon" attribute is set then label uses icon from EMF item providers. The following visual facets are recognized by tooling in DiagramLabel:
-
AlignmentFacet - specifies link label position relative to the link figure; in generator model alignment is copied to "alignment" property of GenLinkLabel
-
LabelOffsetFacet - initial distance between the label and node / link figure; in generator model represented by LabelOffsetAttributes instance in label viewmap
Mapping
LabelMapping and its subclasses define label within the mapping model.
Basic LabelMapping instance supports 3rd and 4th usecases. It has "diagramLabel" reference to graphical definition and "readOnly" flag.
FeatureLabelMapping extends LabelMapping to support 1st usecase by referencing domain attributes and providing format options:
- "features" reference: at least one attribute from domain model; all attributes should be defined within EClass of parent node / link
- "viewPattern": pattern to construct label text from feature value(s)
- "editorPattern": pattern to construct text for inplace editor from feature value(s)
- "editPattern": pattern to parse text entered by user in new feature value(s)
- "viewMethod": method to produce text from feature value(s) by pattern; used with "viewPattern" and "editorPattern"
- "editMethod": method to parse text entered by user in new feature value(s); used with "editPattern"
Currently supported methods are:
- MESSAGE_FORMAT uses java.text.MessageFormat class
- NATIVE only one attribute should be specified; calls EcoreUtil.convertToString(...) / EcoreUtil.createFromString(...) methods
- REGEXP calls String.split(...) method
- PRINTF calls String.format(...) method
DesignLabelMapping is a LabelMapping flavour to handle 2nd usecase. Now it's empty but there should be a way to define view style used to store label text in notation model [1].
Generator Model
Two hierarchies describe labels in generator model: descendants of GenLabel used to express label presentation in context of parent node / link and descendants of LabelModelFacet that denote label semantic. GenLabel references LabelModelFacet by "modelFacet" reference thus linking them together.
GenLabel
Basic GenLabel has "elementIcon" flag copied from graphical definition and "readOnly" flag from the mapping model. GenNodeLabel and GenExternalNodeLabel are concrete classes that should be used to represent inner and external node labels respectively. GenLinkLabel is for the link labels and has "alignment" attribute derived from respective visual facet. GenChildLabelNode provides the same attributes as GenLabel but prefixed with "label" word; this class is used for nodes within list compartments.
LabelModelFacet
Model facet reflects label usecase:
-
"feature label": FeatureLabelModelFacet instance; properties "features", "viewPattern" and "editPattern" are taken from FeatureLabelMapping
-
"design label": DesignLabelModelFacet instance
-
"default label" and "custom label": no model facet (null)
In fact during mapping model to generator model transformation the following rules are obeyed:
-
FeatureLabelMapping -> FeatureLabelModelFacet
-
DesignLabelMapping -> DesignLabelModelFacet
-
LabelMapping -> null
Pending Requests
This is a list of enhancements related to GMF labels; hopefully future versions of GMF will implement them:
分享到:
相关推荐
GMF(Generic Model Framework)是Eclipse平台下的一款强大的图形建模框架,它为开发者提供了构建图形用户界面(GUI)的工具,特别是用于创建复杂的图形编辑器和图表应用程序。GMF 1.7是最新的版本,它在前一版本的...
【GMF Tutorial中文版】是一套面向初学者的Eclipse GMF(Graphical Modeling Framework)入门教程。GMF是Eclipse建模项目的一个子项目,它的主要目标是为Eclipse Modeling Framework (EMF)和Graphical Editing ...
【GMF教程】GMF(Graphics Modeling Framework)是Eclipse平台下的一个图形建模框架,用于构建基于模型的图形编辑工具。本教程是基于英文教程的实践与翻译,旨在帮助读者理解并掌握如何使用GMF创建一个Mindmap编辑器...
GMF(Generic Modeling Framework)是Eclipse平台下的一个开源项目,它为开发可扩展的图形化建模工具提供了基础框架。这个"GMF数据表建模例子"显然是一个利用GMF构建的数据库设计工具,可以帮助用户以图形化的方式...
GMF(Generic Modeling Framework)是Eclipse Modeling Framework (EMF)的一个扩展,它提供了一种通用的方法来构建基于模型的应用程序。GMF旨在简化图形用户界面(GUI)的开发,特别是那些涉及图表编辑和可视化任务...
《深入解析Eclipse GMF RAR技术》 在软件开发领域,Eclipse是一个广泛使用的集成开发环境(IDE),而GMF(Graphical Modeling Framework)则是Eclipse社区提供的一款强大的图形建模框架。本文将深入探讨GMF中的RAR...
Eclipse GMF(Graphics Modeling Framework)是Eclipse平台下的一个开源工具,用于构建图形化建模和编辑环境。本教程将带你快速掌握Eclipse GMF的核心概念和使用方法,让你在15分钟内对GMF有初步的认识。 一、...
【GMF实例解析】 GMF,全称是Graphical Modeling Framework,是Eclipse建模项目中的一个重要组成部分,它建立在GEF(Graphical Editor Framework)和EMF(Eclipse Modeling Framework)之上,为开发基于图形界面的...
### GMF实例解析:Taipan案例深度剖析 #### 前言:GMF与图形化编辑器的革新 在IT领域,特别是软件工程中,图形化编辑器的开发一直是复杂且具有挑战性的任务。传统的图形编辑器开发往往依赖于MVC(Model-View-...
GMF,全称为Generic Mapping Tools,是一个开源的地理信息系统,用于创建、编辑和展示地理数据。这个工具在地学、环境科学以及地球物理学等领域广泛应用,因其强大的地图制作和数据分析功能而受到专业人士的喜爱。本...
### GMF Tourial中文版(一)核心知识点详解 #### 一、引言与背景介绍 **GMF Tourial**是一系列针对Eclipse平台下的**图形化模型框架(Graphical Modeling Framework, GMF)**的教程。该框架作为Eclipse建模项目的一...
Eclipse插件GMF,全称为Graphical Modeling Framework,是Eclipse平台上的一个重要组成部分,主要用于构建可视化的建模工具。这个框架提供了一种强大的方式,让开发者能够创建出具有图形界面的模型编辑器,用于设计...
在Eclipse中,GEF(Graphical Editing Framework)、VE(Visual Editor)和GMF(Graphical Modeling Framework)是三个重要的插件或框架,主要用于图形化界面设计和建模。 1. GEF(Graphical Editing Framework) ...
### 图形建模框架GMF综述 #### 引言 在软件开发过程中,图形建模作为一种有效的沟通手段,帮助工程师们清晰地表达系统结构、流程逻辑和其他关键要素。传统上,开发人员依赖如Rational Rose或Sybase PowerDesigner...
### GMF开发文档知识点概述 #### 一、GMF简介 **GMF (Graphical Modeling Framework)** 是一种基于Eclipse的框架,用于构建图形编辑器。它为开发人员提供了创建和定制图形用户界面(GUI)的功能,使得创建复杂的...
【标题】:“一个简单的GMF实例” 在IT领域,GMF(Graphical Modeling Framework)是Eclipse项目的一部分,主要用于创建图形化编辑器。这个“一个简单的GMF实例”可能是一个教程或者示例项目,旨在帮助开发者理解...
GMF(Graphical Modeling Framework)是Eclipse基金会推出的一个开源项目,主要用于构建图形化建模工具。这个"gmf-runtime-2.1.2.zip"压缩包文件包含了Eclipse图形化开发插件GMF的运行时组件,版本为2.1.2。此插件...