??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲理论在线,911亚洲精品,国产欧美日韩http://www.aygfsteel.com/reloadcn/category/2696.html我是一只关在玻璃瓶中的苍蝇Q虽然前途一片光明,可我找不到出?/description>zh-cnThu, 08 Nov 2007 15:53:44 GMTThu, 08 Nov 2007 15:53:44 GMT60- 扩展WTP2.0囑Ş化Web~辑器——{换器http://www.aygfsteel.com/reloadcn/archive/2007/11/08/webeditor1.htmlDartDartThu, 08 Nov 2007 15:35:00 GMThttp://www.aygfsteel.com/reloadcn/archive/2007/11/08/webeditor1.htmlhttp://www.aygfsteel.com/reloadcn/comments/158688.htmlhttp://www.aygfsteel.com/reloadcn/archive/2007/11/08/webeditor1.html#Feedback0http://www.aygfsteel.com/reloadcn/comments/commentRss/158688.htmlhttp://www.aygfsteel.com/reloadcn/services/trackbacks/158688.html阅读全文

]]> - ConnectionQPropertyhttp://www.aygfsteel.com/reloadcn/archive/2006/10/09/gef5.htmlDartDartMon, 09 Oct 2006 11:03:00 GMThttp://www.aygfsteel.com/reloadcn/archive/2006/10/09/gef5.htmlhttp://www.aygfsteel.com/reloadcn/comments/74149.htmlhttp://www.aygfsteel.com/reloadcn/archive/2006/10/09/gef5.html#Feedback1http://www.aygfsteel.com/reloadcn/comments/commentRss/74149.htmlhttp://www.aygfsteel.com/reloadcn/services/trackbacks/74149.html阅读全文

]]> - 数据库字D늚昄以及增加http://www.aygfsteel.com/reloadcn/archive/2006/10/09/gef4.htmlDartDartMon, 09 Oct 2006 11:02:00 GMThttp://www.aygfsteel.com/reloadcn/archive/2006/10/09/gef4.htmlhttp://www.aygfsteel.com/reloadcn/comments/74148.htmlhttp://www.aygfsteel.com/reloadcn/archive/2006/10/09/gef4.html#Feedback5http://www.aygfsteel.com/reloadcn/comments/commentRss/74148.htmlhttp://www.aygfsteel.com/reloadcn/services/trackbacks/74148.html阅读全文

]]> - 能够拖动的矩?/title>http://www.aygfsteel.com/reloadcn/archive/2006/10/09/gef3.htmlDartDartMon, 09 Oct 2006 10:59:00 GMThttp://www.aygfsteel.com/reloadcn/archive/2006/10/09/gef3.htmlhttp://www.aygfsteel.com/reloadcn/comments/74147.htmlhttp://www.aygfsteel.com/reloadcn/archive/2006/10/09/gef3.html#Feedback6http://www.aygfsteel.com/reloadcn/comments/commentRss/74147.htmlhttp://www.aygfsteel.com/reloadcn/services/trackbacks/74147.html阅读全文

]]> - 数据库编辑器雏Şhttp://www.aygfsteel.com/reloadcn/archive/2006/10/09/gef2.htmlDartDartMon, 09 Oct 2006 10:57:00 GMThttp://www.aygfsteel.com/reloadcn/archive/2006/10/09/gef2.htmlhttp://www.aygfsteel.com/reloadcn/comments/74145.htmlhttp://www.aygfsteel.com/reloadcn/archive/2006/10/09/gef2.html#Feedback0http://www.aygfsteel.com/reloadcn/comments/commentRss/74145.htmlhttp://www.aygfsteel.com/reloadcn/services/trackbacks/74145.html
上一?/a>讲了一下GEF的大概,q章我讲通过实现一个数据库~辑器来q一步说一下GEF?a href="/Files/reloadcn/gefexample.zip">实例代码下蝲
1.需求分析以及徏?/strong>
数据库编辑器Q无非就是利用图形化的方式,来实现对数据库表的管理。比如,我从L上托一个表格到~辑器上Q然后给他加上列Q最后通过模型导出对应的SQL语句Q连接数据库生成对应的表。就q么单?/p>
让我们再分析一下。一个徏立一个数据库表需要什么?首先我们要给q个表取个名字,然后l它d上一些列Q而对于列呢,也要有名字,q要有类型,q要说明它是否能为空{等。打住!p样得了,我们q里只研IGEFQ具体的需求还是以后再说吧。下面我们徏立这个模型:
让我们看看这几个c:DBBase为基c,h一个List对象Q这个List是放|其子节点的地方Q因为在数据库中QSchema和表是一对多的关p,可以说是Schema包含了某一个表Q表和列也一P表包含了列,所以我们就先将他们的子对象攄C们的基类中。parent表示该类的父对象?/p>
Schema表示数据库本w;Table表示表;Column表示列,q几个类直接l承DBBaseQ而且没有复写基类的Q何方法?/p>
先就q样吧,q几个类目前来看q少很多的属性和操作Q在以后的开发中我会一一补上?/p>
2.EditPart
在上一章我们以及说q了Q模型是需要通过~辑单元q行l护的,而且~辑单元和模型是一一对应的关pR而这些对应关pd是通过什么来映射的呢Q就是通过一个叫做EditPartFactory的接口类。我们在写GEFE序的时候,q个cL必须的,只有它才能把我们的模型和~辑单元联系h。这个接口只有一个方法:createEditPartQ这个方法需要我们返回一个EditPart,l了我们两个参数Q其中对我们来说最有用的参数就是modelQ因为它是传入的模型,我们需要通过q个模型来生成对应的EditPart
看看q几个EditPartQ?/p>
DBEditPartBase : 其他几个EditPart的基cR虽然没有写什么,但是在以后的后箋开发中v到很大的作用?/p>
SchemaEditPart:Schema模型对应的EditPart
TableEditPart:Table模型对应的EditPart
ColumnEditPart:Column模型对应的EditPart
OK,下面开始让我们的模型实现出?/p>
3.准备工作1——创建我们的Editor
~辑器嘛Q肯定需要扩展editor扩展点咯Q不明白的去看看Eclipse插g开发基。什么?你不知道什么是Eclipse插g开发? ……)Q看看我们扩展点怎么写的Q?br />
<
extension
id
="dbeditor"
point
="org.eclipse.ui.editors"
>
<
editor
class
="gef.example.databasecreator.ui.DbEditor"
icon
="icons/sample.gif"
default
="false"
name
="DBEditor"
id
="gef.example.databasecreator.editor2"
extensions
="dbtest"
/>
</
extension
>
我们的扩展点对应的启动类是gef.example.databasecreator.ui.DbEditorQ这个类是承了 GraphicalEditorWithPaletteQGraphicalEditorWithPalette是一个带有画板的、GEF提供的编辑器。我们生成了我们的编辑器cdQ需要在里面写上一些必要的代码?/font>
首先是在DbEditor的构造函CQ我们需要把EditDomianl它加上Q这是必ȝQ没有EditDomain一些都“空了吹”(家乡话,呵呵Q,我在W一章讲提到qEditDomainQ大家可以看看我以前的文章,里面有对它的短介l。?br />
public
DbEditor()
{
this
.setEditDomain(
new
DefaultEditDomain);
}
然后我们需要在getPaletteRootҎ中给它返回一个PaletteRootQ没有这个东西,我们的编辑器无法启动,因ؓL指针为空Q无法进行构建我们的控gQ我会在后面的文章简要说一下,Palette和Viewer的关p)。我们只要返回一个PaletteRoot够了,不需要往它n上加工具按钮什么的?br />
public
PaletteRoot createPaletteRoot()
{
return
new
PaletteRoot();
}
再看看configureGraphicalViewerҎ。这个方法是复写基类的,在这里面Q我们要Ҏ们的Viewerq行一些设|:指定根编辑单元和讄我们的EditPartFactory。根~辑单元属于一个比较特D的~辑单元Q它不属于我们的模型对应的编辑单元?/font>
特别Q在复写configureGraphicalViewerҎ的时候,需要调用一下父cd来的ҎQ因为在父类Ҏ中,创徏了ViewerQƈq行了一些设|,如果不复写的话,那就要自己动手写了?/font>
我们再把我们的EditPartFactory注册到Viewer中,不然它傻Q找不到对应的EditPart Q)
protected
void
configureGraphicalViewer() {
//
q里需要调用基cȝҎ
super.configureGraphicalViewer();
GraphicalViewer viewer
=
this
.getGraphicalViewer();
//
讄根EditPart
viewer.setRootEditPart(
new
FreeformGraphicalRootEditPart());
//
讄工厂
viewer.setEditPartFactory(
new
DBEditPartFactory());
}
OKQ最后一步:把我们的模型告诉lViewer。在initializeGraphicalViewerҎ中,我们生成了一个Schema对象Qƈ把它通过Viewer的setContentҎ注册q去?/font>
protected
void
initializeGraphicalViewer() {
//
TODO Auto-generated method stub
Schema schema
=
new
Schema();
this
.getGraphicalViewer().setContents(schema);
}
启动一下吧Q什么?无法创徏~辑器…?/font>
4.准备工作2——创Z个Schema对应的Figure
刚才不能创徏~辑器的原因如下Q?/p>
当GEF发现我们讄的内Ҏ一个Schema的时候,它就L到对应的EditPartQ这里是SchemaEditPart,然后调它的createFigureҎQ获得一个图形进行显C。但是我们返回了一个NULLQ所以编辑器׃创徏不v来?/p>
我们l它写一个简单的Figure?/p>
protected
IFigure createFigure() {
return
new
FreeformLayer();
}
q里l了一个FreeformLayerQ这个Figure一般都作ؓ一个根囑Ş存在Q可以根据子Figure的大数量,以及Editor本n的大来调节自n的大?/font>
好了Q让我们再启动一ơ!成功Q看看吧
5.l束?/font>
什么都没有啊,不要着急,下一章我们再让它昄出图形!

]]>- GEF?/title>http://www.aygfsteel.com/reloadcn/archive/2006/10/09/gef1.htmlDartDartMon, 09 Oct 2006 10:55:00 GMThttp://www.aygfsteel.com/reloadcn/archive/2006/10/09/gef1.htmlhttp://www.aygfsteel.com/reloadcn/comments/74144.htmlhttp://www.aygfsteel.com/reloadcn/archive/2006/10/09/gef1.html#Feedback3http://www.aygfsteel.com/reloadcn/comments/commentRss/74144.htmlhttp://www.aygfsteel.com/reloadcn/services/trackbacks/74144.html阅读全文

]]>
վ֩ģ壺
ľ|
|
|
|
ֹ|
|
ƽ|
|
ʡ|
|
ˮ|
|
ͨ|
ֺ|
|
ʯȪ|
³|
䰲|
|
|
ɽ|
|
|
|
|
ƽ|
ƽ|
|
|
ƽ|
|
|
|
|
Խ|
|
|
Ȫ|
|
|
ǹ|