第三十二讲:tapestry javaScript动画

本文介绍了一个基于Tapestry5框架的应用案例,该应用通过Maven构建,并集成了Scriptaculous JavaScript库来实现页面元素的动态效果。具体展示了如何在Tapestry5中使用Scriptaculous的Grow效果。

动画效果使用了script.aculo.us的JS库,源码如下:

Scriptaculous.java

/**
* 项目名称:TapestryStart
* 开发模式:Maven+Tapestry5.x+Tapestry-hibernate+Mysql
* 版本:1.0
* 编写:飞风
* 时间:2012-02-29
*/
package com.tapestry.app.pages;
 
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.javascript.InitializationPriority;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
 
public class Scriptaculous {
@Property
@SuppressWarnings("unused")
private String firstName;
 
@Property
@SuppressWarnings("unused")
private String lastName;
 
@Inject
private JavaScriptSupport javaScriptSupport;
 
public void setupRender() {
 
javaScriptSupport.addScript(InitializationPriority.LATE, String.format("Effect.Grow('%s');", "expando"));
}
 
}
 

Scriptaculous.tml

<html t:type="layout" title="tapestryStart Index"  t:sidebarTitle="Framework Version" 
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" xmlns:p="tapestry:parameter">
<div id="expando" style="padding: 10px; background-color: #eeeeee;">
 
<form t:type="form" t:autofocus="false">
<input t:type="TextField" t:id="firstName" t:mixins="TextboxHint" t:hintText="Enter First Name" t:hintColor="#808080"/>
<input t:type="TextField" t:id="lastName" t:mixins="TextboxHint" t:hintText="Enter Last Name" t:hintColor="#808080"/><br/>
</form>
</div>
</html>

转载于:https://my.oschina.net/shootercn/blog/55019

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值