RCP插件开发

来源:互联网 发布:阿里云ecs重装系统 编辑:程序博客网 时间:2024/05/16 07:05

com.teamcenter.rac.aifrcp

teamcenter基础客户化插件,一些主要的借口以及抽象类,入口类等都在改插件中进行了定义
  • AbstractAIFApplication
  • AbstractAIFCommand
  • AbstractAIFDialog
  • AbstractAIFOperation
  • AIFDesktop
  • AIFPortal
  • AbstractAIFAction

com.teamcenter.rac.common

teamcenter的一些动作和菜单都在该插件包中进行了定义,如菜单栏,工具栏,以及右键菜单等。首先要说的是,界面上所有菜单,以及一些公共组件及Form的顶级实现。一般的菜单动作都在rac.common.actions中进行了定义


com.teamcenter.rac.external

Teamcenter中引用的第三方包 用于自己的功能模块的使用


com.teamcenter.rac.kernal

teamcenter核心插件包,下图是会话的获取方式
这里写图片描述

    AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();      TCSession session = (TCSession) app.getSession();   

基本上就是系统中的每一个业务对象都在改插件中有相应的类去实现。比如Folder对象
1、TCComponentFolder该类继承了TCComponent类。扩展定义了Folder的获取以及和属性的修改方法,基本上所有的业务对象都继承于TCComponent类。
2.一个业务类对象对应的组件类相应的也会对应一个业务类型类,如Folder对应的业务类型组件类为TCComponentFolderType。该类继承于TCComponentType类。该类主要扩展定义了相应的业务对象的创建以及另存为等方法。

TCComponentFolderType fodlerType = (TCComponentFolderType)session.getTypeComponent("Folder");TCComponentFolder folder = folderType.create("My Folder Name","My Folder Description","My Folder Type");

com.teamcenter.rac.tcapps

teamcenter中部分应用的基础实现都是在该类中进行了实现,这个主要是遗留问题,虽然现在的应用的大部分都是以相应的插件进行了区别与分类,但是大部分应用的业务逻辑都是在该插件中进行实现的,还有一些公共组件等:

  • com.teamcenter.rac.cme.mpp:对MSE应用进行了实现
  • com.teamcernter.rac.pse:对结构管理器进行了实现
  • com.teamcenter.rac.querybuilder:对查询构建器进行了实现
  • com.teamcenter.rac.explorer:对MyTeamcenter进行了实现

com.teamcenter.rac.util

该插件是Teamcenter对大部分Swing组件进行了继承和重写:如iTextField继承于JTextField
该插件中定义了一些公共工具类,如:TcLogger日志控制类,Registry注册控制类等


Folder的创建:

TCComponentFolderType fodlerType = (TCComponentFolderType)session.getTypeComponent("Folder");TCComponentFolder folder = folderType.create("My Folder Name","My Folder Description","My Folder Type");

Form的创建:

TCComponentFormType tccomponentFormType=(TCComponentFormType)session.getTypeComponent("Form");TCComponentForm tccomponentForm = tccomponentFormType.create("MyForm","MyFromDescription","MyForm");

Item的创建
item的创建相对来说比前两个都复杂点
先根据系统类型从系统中获取编码和版本编码,然后创建
ItemId,ItemRev

//ItemID和ItemRev获取方法TCComponentItemType tccomponentItemType = (TCComponentItemType)session.getTypeComponent("Item");String itemId = tccomponentItemType.getNewID();String itemRev= tccomponentItemType.getNewRev(null);//Item单位获取方法TCComponentType uom = session.getTypeComponent("UnitOfMeasure");TCCompont[] uoms = uom.extent();//Item的创建方法TCComponentItem item = tccomponentItemType.create(itemId,itemRev,"My Item Name","My Item Description",uoms[0]);

DataSet的创建方法
数据集的创建涉及到命名引用,所以创建过程是先创建一个类型的数据集合,然后把命名引用添加上去:

String as1[] = {url};String as2[] = {"Text"};String as3[] = {"Text"};String as4[] = {"Plain"};TCComponentDataSetType dataSetType = (TCComponentDataSetType)session.getTypeComponent("Text");TCComponentDataSet dataSet = dataSetType.create("My DataSet Name","Text","Text");dataSet.setFiles(as1,as2,as3,as4);

查询构建器的调用
Teamcenter中有专门的查询构建器模块,我们可以通过配置查询构建器然后通过代码对系统中的对象进行搜索:

TCTextService tcTextService = session.getTextService();String asKey[] = {tcTextService.getTextValue("item_id")};String asValue[] = {"000001"};InterfaceAIFComponent interfaceAifComponent[] = session.serach("ItemId...",asKey,asValue);

Teamcenter中BOM结构的构建
1.创建BOMWindow对象
2.得到BOMLine对象
3.分别在BOMLine上添加就好了

TCComponentRevisionRuleType revisionRuleType = (TCComponentRevisionRuleType)session.getTypeComponent("RevisionRule");TCComponentRevisionRule revisionRule = revisionRuleType.getDefaultRule();TCComponentBOMWindowType bomWindowType = (TCComponentBOMWindowType)session.getTypeComponent("BOMWindow");TCComponentBOMWindow bomWindow = bomWindowType.create(revisionRule);TCComponentBOMLine bomLine = bomWindow.setWindowTopLine(item,itemRevision,component,XXX);TCComponentBOMLine bomLine = bomWindow.setWindowTopLine(itemRev.getItem(),itemRev,revView,null);
0 0
原创粉丝点击