eclipshine

Eclipse主题站

GEF的Developer Guide的笔记

1. GEFView实际上包含有很多部分,而不仅仅只是figure: 

还包括visual parts, feedback, handles, toolipts等等.

It includes the visual part, which serves as the primary representation for the model object(s).  The most flexible visual parts are Figures from draw2d.  GEF also provides support for SWT TreeItems, but support for other visuals can easily be added.  While "visual part" refers to the object primarily representing a model object, the more encompassing "view" includes feedback, handles, tooltips, and all things visible to the user.  All of these make up the view, and it is the controller's job to construct and manage them.

 2. Graphical editing可以被定义为:

1) 操作模型,这是通过对Request进行响应,生成Command来完成的。

2) 显示Feedback,在复杂的交互中,EditParts需要为用户显示操作的反馈。

3) 上面所提的两个工作,均可以被EditParts代理到其他额外的EditParts上。

 3. EditPolicyRole字符串的作用,是使得EditPolicy能够用过这个Key来进行替换。例如子类可以通过Role这个Key来覆盖其父类所安装的EditPolicy。在GEF中,RoleEditPolicies能够被划分为两类:GraphicalNon-Graphical。非图形的角色能够不需要知道任何View的信息来处理模型对象,也就是说这种角色在不同类型的viewers中是可重用的。

 4. 角色及其定义

Non-Graphical Roles:

1) COMPONENT_ROLE:

一个Component存在于一个parent中,并且可以从parent中删除。更为一般的,它可以使任何只涉及到这个EditPart,而与View无关的东西。(More generally, it is anything that involves only this EditPart.)

2) CONNECTION_ROLE

这是ConnectionEditParts应该有的一个基本角色。ConnectionsComponents有一点不同,删除Connections时通常还需要其从其sourcetarget节点中删除,而不是从其parent中删除。

3) CONTAINER_ROLE

大部分拥有childrenEditParts都应该具有这个角色。一个Container会涉及到adds/orphans以及creates/deletes等操作。

4) NODE_ROLE

如果一个EditParts用户Connection,则其应该具有这个角色,它可以用来创建,删除,重新连接一个Connection

 Graphical Roles:

1) PRIMARY_DRAG_ROLE:

用来允许用户拖动这个EditPart。用户可以通过点击这个EditPart然后拖动,或者点击这个EditPart所创建的一个Handle来进行拖动。

2) LAYOUT_ROLE:

Layout角色用来放在一个ContainerEditPart上,这个EditPart拥有一个graphical layout。如果这个layoutconstraints,则它需要通过计算来得到这个constraints

3) GRAPHICAL_NODE_ROLE:

A node supports connections to terminals.  When creating and manipulating connections, EditPolicies with this role might analyze a Request's data to perform "hit testing" on the graphical view and determine the semantics of the connection.

4) CONNECTION_ENDPOINTS_ROLE:

这个Role允许用户拖动一个ConnectionEditPart的端点。

5) CONNECTION_BENDPOINTS_ROLE:

这个Role允许用户能够在一个Connection中间拖动和创建bendpoints

6) SELECTION_FEEDBACK_ROLE:

这个角色只是用来显示feedback。当鼠标进入或者在一个EditPart上暂停时,Selection Tool会发送两个类型的requestEditPart。安装了这个角色的EditPart能够在此时接受这些请求来改变view的样子,或者弹出tiplabel等。

7) TREE_CONTAINER_ROLE:

SWT TreeLayout Role

posted on 2005-07-27 21:16 Living Not Striving 阅读(1285) 评论(0)  编辑  收藏 所属分类: GEF


只有注册用户登录后才能发表评论。


网站导航: