Tapestry - Page Enhance

1.      Tapestry提供的页面加强

a)        说明:TapestryPage Enhancement的配置是在tapestry.enhance.xml内部。

b)        配置文件:

<contribution configuration-id="EnhancementWorkers">   

    <!-- These can actually run in any order, as long as abstract-property runs later. -->

 

    <command id="inject-messages" object="service:InjectMessagesWorker" before="abstract-property"/>   

<command id="inject-specification" object="service:InjectSpecificationWorker"

before="abstract-property"/>

    <command id="specified-property" object="service:SpecifiedPropertyWorker" before="abstract-property"/>

    <command id="parameter" object="service:ParameterPropertyWorker" before="abstract-property"/>

    <command id="dispatch-inject" object="service:DispatchToInjectWorker" before="abstract-property"/>

    <command id="inject-component" object="service:InjectComponentWorker" before="abstract-property"/>

    <command id="inject-bean" object="service:InjectBeanWorker" before="abstract-property"/>

    <command id="inject-asset" object="service:InjectAssetWorker" before="abstract-property"/>

   

    <!-- After all the previous workers have had their chance, we "fill in" any unclaimed properties

         as transient page properties. -->

        

    <command id="abstract-property" object="service:AbstractPropertyWorker"/>

 

    <!-- These need to come last,  since the previous commands (including abstract-property)

         may have added interfaces to the class. -->

   

<command id="page-detach-listener" object="service:InjectPageDetachListenerWorker"

after="abstract-property"/>

<command id="page-attach-listener" object="service:InjectPageAttachListenerWorker"

after="abstract-property"/>

<command id="page-validate-listener" object="service:InjectPageValidateListenerWorker"

after="abstract-property"/>

<command id="page-begin-render-listener" object="service:InjectPageBeginRenderListenerWorker"

after="abstract-property"/>

<command id="page-end-render-listener" object="service:InjectPageEndRenderListenerWorker"

after="abstract-property"/>

</contribution>

 

这里的定义包含了三部分。第一部分,主要是定义了用于处理注入的Worker。被注入的属性可能是文本,对象,

或者其他用户自定义的内容。他们当中的一部分可能会需要在类当中添加一些新的属性。如果这些属性只是一些普通的

get/set方法,那么他们只需在类声明中增加一个抽象属性的定义,而具体的方法注入,则可以交给后续的

AbstractPropertyWorker来完成。

第二部分,就是AbstractPropertyWorker属性定义,也就是类似于插入一些<property>的声明。

最后一部分就是为页面类增加事件处理部分。这些事件处理很大一部分是用于初始化,或者回滚某些属性值的。

 

2.      Tapestry Annotation提供的页面加强

a)        说明:通过Hivemindcontribute功能,Tapestry Annotation,扩展了Tapestry的页面加强功能。

b)        配置文件:

<contribution configuration-id="tapestry.enhance.EnhancementWorkers" if="class

java.lang.annotation.Annotation">

<command id="annotation-worker" object="service:AnnotationEnhancementWorker" before="*" />

<command id="component-housekeeping-worker" object="service:ComponentHousekeepingWorker"

after="annotation-worker" />

<command id="component-propertyproxy-worker" object="service:ComponentPropertyProxyWorker"

before="tapestry.enhance.specified-property" />

<command id="inject-asset-annotation" object="service:InjectAssetAnnotationWorker"

after="tapestry.enhance.inject-asset" />

</contribution>

 

这里把annotatioin-worker,加入到了Tapestry Page Enhance的链当中。

 

<service-point id="AnnotationEnhancementWorker" interface="org.apache.tapestry.enhance.EnhancementWorker">

<invoke-factory>

<construct class="AnnotationEnhancementWorker">

<set-configuration property="methodWorkers" configuration-id="MethodWorkers" />

<set-configuration property="classWorkers" configuration-id="ClassWorkers" />

<set-configuration property="secondaryAnnotationWorkers"

configuration-id="SecondaryAnnotationWorkers" />

</construct>

</invoke-factory>

</service-point>

 

         AnnotationEnhancementWorkerTapestry Annotation Enhancement的入口,她支持在类上或者方法上通过

Annotation进行的加强。

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值