第三十二講:tapestry javaScript動畫

動畫效果使用了script.aculo.us的JS庫,源碼以下:javascript

Scriptaculous.javahtml

/**
* 項目名稱: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.tmljava

<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>
相關文章
相關標籤/搜索