收藏 分享(赏)

TemplateProcessing技术概述PPT课件.ppt

上传人:Facebook 文档编号:3834864 上传时间:2018-11-20 格式:PPT 页数:21 大小:706KB
下载 相关 举报
TemplateProcessing技术概述PPT课件.ppt_第1页
第1页 / 共21页
TemplateProcessing技术概述PPT课件.ppt_第2页
第2页 / 共21页
TemplateProcessing技术概述PPT课件.ppt_第3页
第3页 / 共21页
TemplateProcessing技术概述PPT课件.ppt_第4页
第4页 / 共21页
TemplateProcessing技术概述PPT课件.ppt_第5页
第5页 / 共21页
点击查看更多>>
资源描述

1、Overview,HTML template processing refers to the architecture by which information is accessed on the server and is displayed in HTML on the client. There are essentially two primary parts to this architecture:An HTML template file, which contains HTML text, may contain JavaScript,and may contain wha

2、t is referred to as Windchill scriptA Java class called a template processor,早期的MVC,工作原理图,UI界面的URL,1. A URL arrives at the Windchill server, for example: http:/ The URL contains three pieces of information that are used:The server address, which can be CGI-based or a servlet, for example:http:/ The

3、class and the specific method in the class that is going to be invoked to process the URL, for example: wt.enterprise.URLProcessor/URLTemplateAction?The wt.enterprise.URLProcessor class is a gateway class.URLTemplateAction is a static method in that class which will be invoked. The query string, for

4、 example: action=ObjProps&oid=vr%3awt.doc.WTDocument%3a111235,第一部分,The following are the general steps to build a view page and include it in the HTML client:,小例子,1. 写个类继续 DefaultTemplateProcessorAdd methods to your subclass of the DefaultTemplateProcessor subclass which correspond to script calls y

5、ou may want in your HTML template file. 2. Create the HTML template file to be processed. 3. Add a property so the appropriate action/object pair can be mapped to your subclass of DefaultTemplateProcessor.,1. 写个类继承DefaultTemplateProcessor,package ext.plmm.part.processors;public class PlmmDefaultTemp

6、lateProcessor extends DefaultTemplateProcessor public PlmmDefaultTemplateProcessor() / TODO Auto-generated constructor stub public void initializeTable(Properties properties, Locale locale, OutputStream outputstream)throws WTException PrintWriter printwriter = getPrintWriter(outputstream, locale);/r

7、efresh parent windowprintwriter.println(“This is my first template processor.“);printwriter.flush(); ,方法必须要的参数Properties传页面参数,outputstream字节流用于输出,locale本地语言,2. Create the HTML template file,%wt_home%codebaseextplmmparttemplateformsplmmInformation_zh_CN.htmlprocessSubTemplate action=GetMetaInfo usePr

8、ocessorService service=com.ptc.core.HTMLtemplateutil.server.processors.UtilProcessorService method=getBaseTag useProcessorService service=com.ptc.core.HTMLtemplateutil.server.processors.UtilProcessorService method=getCSSLink my page,页面调用windchill脚本格式,3. Add a property so the appropriate action/objec

9、t pair,创建plmmpart.properties,并加入以下内容 wt.services/rsc/default/wt.templateutil.DefaultHTMLTemplate/LatestPart/java.lang.Object/0=ext.plmm.part.template.forms.AllVersionPartsTableInformation wt.services/svc/default/wt.enterprise.TemplateProcessor/LatestPart/java.lang.Object/0=ext.plmm.part.processors.P

10、lmmDefaultTemplateProcessor/duplicate,3. Add a property so the appropriate action/object pair(续.),在%wt_home%/目标文件site.xconf末尾加入 Windchill shell外壳执行xconfmanager p,此指令的功能是把value的值加入到wt.properties文件中,测试验证,重起MethodServer 在地址栏位输入http:/ Processing and Action Processing ActionDelegate URLActionDelegate For

11、mTaskDelegate,ActionDelegate:检查权限以及状态等信息,判断link是否可见; URLActionDelegate:必须与ActionDelegate配对出现,生成link; FormTaskDelegate:处理表单内容,调用后台程序处理业务请求,实现页面跳转或者弹出提示信息。,小例子(输入部件编号,查询系统是否存在,并显示部件的信息),1. 写个类实现ActionDelegate,如下 public class LatestPartActionDelegate implements ActionDelegate, Externalizable 方法体:检查权限的方

12、法 public Boolean enableable(Object obj)throws WTExceptionreturn new Boolean(true); 2.写个类实现URLActionDelegate,如下 public class LatestPartURLActionDelegate extends LatestPartActionDelegateimplements URLActionDelegate ,Enableable方法用于判断是否有权限,查看true表示有权限,false则无,Enableable方法用于判断是否有权限,查看true表示有权限,false则无,主要

13、方法体为:public String URL(Object obj)throws WTException String s = null;try if(enableable(obj).booleanValue()String s1 = (new ReferenceFactory().getReferenceString(Persistable)obj);wt.httpgw.URLFactory urlfactory = getState().getURLFactory();String s2 = “wt.enterprise.URLProcessor“;String s3 = “generat

14、eForm“;HashMap hashmap = new HashMap();hashmap.put(“action“, “LatestPart“);hashmap.put(“oid“, s1);URL url = GatewayServletHelper.buildAuthenticatedURL(urlfactory, s2, s3, hashmap);s = WindowUtils.getLaunchWindowURLWrapper(url.toExternalForm(), “LatestPart“, 640, 470, “resizable=yes,scrollbars=yes,me

15、nubar=yes,toolbar=yes,location=yes,status=yes“);catch(Exception exception)throw new WTException(“LatestPartURLActionDelegate() - exception“);return s;,构造URL字串,并且传参数,3.写个类继承TaskDelegate ,如下 public class PlmmPartFormTaskDelegate extends FormTaskDelegate ,public void processAction(ContentHTTPStream con

16、tenthttpstream) throws WTExceptionProperties properties = getFormData();String number = properties.getProperty(“number“);WTPart wtpart=null;try wtpart = PlmmPartUtil.getPart(number); catch(WTException wtexception) wtexception.printStackTrace(); if(wtpart = null) HTMLLogManager.addErrorMessage(“error

17、1“, “ext.plmm.part.processorsResource“, “5“, null, null);addToResponseHeaders(new WTException(“搜索异常“);setContextObj(null);setContextAction(“LatestPart“);setStatus(Integer.parseInt(“1“);return;ReferenceFactory rc= new ReferenceFactory();String oid = rc.getReferenceString(wtpart);getFormData().put(“oi

18、d“,oid ); setContextObj(wtpart);setContextAction(“LatestPartResult“);RedirectObject redirectobject = new RedirectObject();redirectobject.setRedirection(getState();,获取表单信息并处理,用于页面跳转,4. Add a property so the appropriate action/object pair,在plmmpart.properties加入以下内容 wt.services/svc/default/wt.enterpris

19、e.ActionDelegate/LATESTPART/java.lang.Object/0=ext.plmm.part.processors.LatestPartActionDelegate/duplicate wt.services/svc/default/wt.enterprise.URLActionDelegate/LATESTPART/java.lang.Object/0=ext.plmm.part.processors.LatestPartURLActionDelegate/duplicate wt.services/svc/default/wt.templateutil.proc

20、essor.FormTaskDelegate/LatestPart/java.lang.Object/0=ext.plmm.part.processors.PlmmPartFormTaskDelegate/duplicate,创建跳转页面,并接受信息,对应template processor如下:,wt.services/rsc/default/wt.templateutil.DefaultHTMLTemplate/LatestPartResult/java.lang.Object/0=ext.plmm.part.template.forms.LatestPartResult wt.services/svc/default/wt.enterprise.TemplateProcessor/LatestPartResult/java.lang.Object/0=ext.plmm.part.processors.PlmmDefaultTemplateProcessor/duplicate,UrlLinkResource_zh_CN,在UrlLinkResource_zh_CN的如下位置加入链接,plmmpart,Plmmpart为action名称,转编码的为中文显示名称,End,Thanks all,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 中等教育 > 小学课件

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报