Microsoft PowerPoint - ch6 [相容模式]

Similar documents
EJB-Programming-4-cn.doc

Chapter 9: Objects and Classes

Fun Time (1) What happens in memory? 1 i n t i ; 2 s h o r t j ; 3 double k ; 4 char c = a ; 5 i = 3; j = 2; 6 k = i j ; H.-T. Lin (NTU CSIE) Referenc

詞 彙 表 編 號 詞 彙 描 述 1 預 約 人 資 料 中 文 姓 名 英 文 姓 名 身 份 證 字 號 預 約 人 電 話 性 別 2 付 款 資 料 信 用 卡 別 信 用 卡 號 信 用 卡 有 效 日 期 3 住 房 條 件 入 住 日 期 退 房 日 期 人 數 房 間 數 量 入

Windows XP

1.ai

前言 C# C# C# C C# C# C# C# C# microservices C# More Effective C# More Effective C# C# C# C# Effective C# 50 C# C# 7 Effective vii

Chapter 9: Objects and Classes

RunPC2_.doc

epub83-1

Chapter 9: Objects and Classes

Important Notice SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information provided by SUNPLUS TECHNOLO

K301Q-D VRT中英文说明书141009

Learning Java

Microsoft Word - template.doc

untitled

EJB-Programming-3.PDF

INTRODUCTION TO COM.DOC

TX-NR3030_BAS_Cs_ indd

Microsoft Word - 第四組心得.doc

Windows RTEMS 1 Danilliu MMI TCP/IP QEMU i386 QEMU ARM POWERPC i386 IPC PC104 uc/os-ii uc/os MMI TCP/IP i386 PORT Linux ecos Linux ecos ecos eco

新・解きながら学ぶJava

Microsoft Word - 01.DOC

Microsoft Word - ch04三校.doc

ch_code_infoaccess

D C 93 2

ebook

mvc

2/80 2

Adobe® Flash® 的 Adobe® ActionScript® 3.0 程式設計

PowerPoint Presentation

untitled

基于ECO的UML模型驱动的数据库应用开发1.doc

Logitech Wireless Combo MK45 English

Lorem ipsum dolor sit amet, consectetuer adipiscing elit

穨control.PDF

Chn 116 Neh.d.01.nis

06 01 action JavaScript action jquery jquery AJAX CSS jquery CSS jquery HTML CSS jquery.css() getter setter.css('backgroundcolor') jquery CSS b

國家圖書館典藏電子全文

<ADB6ADB1C25EA8FAA6DB2D4D56432E706466>

软件测试(TA07)第一学期考试

IoC容器和Dependency Injection模式.doc

附录J:Eclipse教程

Value Chain ~ (E-Business RD / Pre-Sales / Consultant) APS, Advanc

WebSphere Studio Application Developer IBM Portal Toolkit... 2/21 1. WebSphere Portal Portal WebSphere Application Server stopserver.bat -configfile..

Some experiences in working with Madagascar: installa7on & development Tengfei Wang, Peng Zou Tongji university

KillTest 质量更高 服务更好 学习资料 半年免费更新服务

Microsoft Word - 物件導向編程精要.doc

Microsoft Word - CX VMCO 3 easy step v1.doc

Microsoft PowerPoint - Lecture7II.ppt

:5-6

RUN_PC連載_10_.doc

AL-M200 Series

6-1 Table Column Data Type Row Record 1. DBMS 2. DBMS MySQL Microsoft Access SQL Server Oracle 3. ODBC SQL 1. Structured Query Language 2. IBM

Java

<4D F736F F D C4EAC0EDB9A4C0E04142BCB6D4C4B6C1C5D0B6CFC0FDCCE2BEABD1A15F325F2E646F63>

untitled

Knowledge and its Place in Nature by Hilary Kornblith

KillTest 质量更高 服务更好 学习资料 半年免费更新服务

untitled


2015年4月11日雅思阅读预测机经(新东方版)

Edge-Triggered Rising Edge-Triggered ( Falling Edge-Triggered ( Unit 11 Latches and Flip-Flops 3 Timing for D Flip-Flop (Falling-Edge Trigger) Unit 11

9, : Java 19., [4 ]. 3 Apla2Java Apla PAR,Apla2Java Apla Java.,Apla,,, 1. 1 Apla Apla A[J ] Get elem (set A) A J A B Intersection(set A,set B) A B A B

untitled

<4D F736F F F696E74202D20332D322E432B2BC3E6CFF2B6D4CFF3B3CCD0F2C9E8BCC6A1AAD6D8D4D8A1A2BCCCB3D0A1A2B6E0CCACBACDBEDBBACF2E707074>

VASP应用运行优化

新北考區105年國中教育會考簡章

105 年 國 中 教 育 會 考 重 要 日 期 項 目 日 期 及 時 間 報 名 1. 集 體 報 名 :105 年 3 月 10 日 ( 星 期 四 ) 至 3 月 12 日 ( 星 期 六 ) 每 日 8:00~12:00 13:30~17:00 2. 個 別 報 名 : 於 上 網 填

國立桃園高中96學年度新生始業輔導新生手冊目錄

Microsoft Word - SupplyIT manual 3_cn_david.doc

* RRB *

〇〇考區105年國中教育會考簡章

4. 每 组 学 生 将 写 有 习 语 和 含 义 的 两 组 卡 片 分 别 洗 牌, 将 顺 序 打 乱, 然 后 将 两 组 卡 片 反 面 朝 上 置 于 课 桌 上 5. 学 生 依 次 从 两 组 卡 片 中 各 抽 取 一 张, 展 示 给 小 组 成 员, 并 大 声 朗 读 卡

untitled

錄...1 說...2 說 說...5 六 率 POST PAY PREPAY DEPOSIT 更

OOP with Java 通知 Project 4: 4 月 18 日晚 9 点 关于抄袭 没有分数

1505.indd

LH_Series_Rev2014.pdf

致 谢 本 论 文 能 得 以 完 成, 首 先 要 感 谢 我 的 导 师 胡 曙 中 教 授 正 是 他 的 悉 心 指 导 和 关 怀 下, 我 才 能 够 最 终 选 定 了 研 究 方 向, 确 定 了 论 文 题 目, 并 逐 步 深 化 了 对 研 究 课 题 的 认 识, 从 而 一

國立中山大學學位論文典藏.PDF

JBuilder Weblogic

A dissertation for Master s degree Metro Indoor Coverage Systems Analysis And Design Author s Name: Sheng Hailiang speciality: Supervisor:Prof.Li Hui,

【摘要】

BC04 Module_antenna__ doc

Microsoft Word - 十月號.doc

05 01 accordion UI containers 03 Accordion accordion UI accordion 54

國家圖書館典藏電子全文

Improved Preimage Attacks on AES-like Hash Functions: Applications to Whirlpool and Grøstl

<4D F736F F F696E74202D20C8EDBCFEBCDCB9B9CAA6D1D0D0DEBDB2D7F92E707074>

Eclipse C C++, or

K7VT2_QIG_v3

59 1 CSpace 2 CSpace CSpace URL CSpace 1 CSpace URL 2 Lucene 3 ID 4 ID Web 1. 2 CSpace LireSolr 3 LireSolr 3 Web LireSolr ID


Microsoft Word - Final Exam Review Packet.docx

台灣地區同學

從詩歌的鑒賞談生命價值的建構

ENGG1410-F Tutorial 6

Microsoft Word - 11月電子報1130.doc

麻 省 理 工 學 院 是 在 西 元 2013 年 12 月 3 日 推 出 MIT App Inventor 2 網 站, 提 供 免 費 的 雲 端 服 務, 使 用 者 可 以 透 過 瀏 覽 器 來 開 發 Android 裝 置 應 用 程 式, 該 網 站 的 網 址 為 : http

Transcription:

UiBinder wzyang@asia.edu.tw UiBinder Java GWT UiBinder XML UI i18n (widget) 1 2 UiBinder HelloWidget.ui.xml: UI HelloWidgetBinder HelloWidget.java XML UI Owner class ( Composite ) UI XML UiBinder: Owner class ( ) Owner class XML UiBinder Example New a project 3 4

Example Example 5 7 Example Example 6 The XML template and the Java Class need to share the same name!!! And in the same package!!! 8

HelloWidget.xml 9 HelloWidget.xml <ui:style>: CSS.important: HTML.important button ui.xml widget XML namespace prefix widget package. xmlns:g='urn:import:com.google.gwt.user.client.ui.. <g:htmlpanel> <g:button> <g:listbox> <g:label>. 10 HelloWidget.xml Ui.java 11 12

Ui.java Ui.java 13 15 Ui.java Ui.java 14 16

HelloWidget.java HelloWidget.java HelloWidget.ui.xml owner class XML Composite (UIObject ) interface implement HelloWidget.java 17 18 Bind java class to XML template Step 1: Declare an interface (HelloWidgetUiBinder) that extends the UiBinder interface The first type parameter is the root type that we used in the XML template. As you might recall, we used HTMLPanel to wrap all of the HTML code in the template. We could use HTMLPanel as our first type parameter, but because HTMLPanel is a subclass of Widget, we can use that as well. The second type parameter is the class that we want to bind the XML template to. Step 2: create an instance of that interface (HelloWidgetBinder) using GWT.create(). The object returned from GWT.create() is a Java class that s generated by the GWT compiler at compile time. In this case the GWT compiler will generate a class based on the contents of our XML template and the class to which we want to bind it. 19 Bind java class to XML template Step 3: We use the binder object created by GWT.create() to get hold of the root widget that we defined in the XML file so that we can initialize our class. We do this by calling uibinder.createandbindui(this). 20

HelloWidget.java Composite : A type of widget that can wrap another widget, hiding the wrapped widget s methods. When added to a panel, a composite behaves exactly as if the widget it wraps had been added. The composite is useful for creating a single widget out of an aggregate of multiple other widgets contained in a single panel. Composite class inherits from Widget class, which inherits from UIObject class. UIObject class is the superclass for all userinterface objects. Composite Class Example public class CompositeExample implements EntryPoint { /** * A composite of a TextBox and a CheckBox that optionally enables it. */ private static class OptionalTextBox extends Composite implements ClickHandler { private TextBox textbox = new TextBox(); private CheckBox checkbox = new CheckBox(); /** * Constructs an OptionalTextBox with the given caption on the check. * * @param caption the caption to be displayed with the check box */ 21 22 Composite Class Example public OptionalTextBox(String caption) { // Place the check above the text box using a vertical panel. VerticalPanel panel = new VerticalPanel(); panel.add(checkbox); panel.add(textbox); // Set the check box's caption, and check it by default. checkbox.settext(caption); checkbox.setchecked(true); checkbox.addclickhandler(this); // All composites must call initwidget() in their constructors. initwidget(panel); // Give the overall composite a style name. setstylename("example-optionalcheckbox"); } 23 Composite Class Example public void onclick(clickevent event) { if (event.getsource() == checkbox) { // When the check box is clicked, update the text box's enabled state. textbox.setenabled(checkbox.ischecked()); } } /** * Sets the caption associated with the check box. * * @param caption the check box's caption */ public void setcaption(string caption) { // Note how we use the use composition of the contained widgets to provide only the methods that we want to. checkbox.settext(caption); } 24

Composite Class Example /** * Gets the caption associated with the check box. * * @return the check box's caption */ public String getcaption() { return checkbox.gettext(); } } /* end of OptionalTextBox */ public void onmoduleload() { // Create an optional text box and add it to the root panel. OptionalTextBox otb = new OptionalTextBox("Check this to enable me"); RootPanel.get().add(otb); } } 25 HelloWidget.java GWT create method: Composite::initWidget: Sets the widget to be wrapped by the composite. The wrapped widget must be set before calling any Widget methods on this object, or adding it to a panel. This method may only be called once for a given composite U uibinder::createandbindui(o owner): Creates and returns the root object of the UI, and fills any fields of owner tagged with UiField. U - The type of the root object of the generated UI, typically a subclass of Element or UiObject owner: The type of the object that will own the generated UI 26 HelloWidget EntryPoint HelloWidget Ui (Ui.java) Ui.java, designer mode, choose component 27 28

29 31 HelloWidget EntryPoint 30 32

33 35 New a Web Application Project 34 36

New a class from com.ui.client 37 39 38 40

41 43 42 44

UiBinder Deploy a DockLayoutPanel 45 47 UiBinder New a UiBinder UiBinder-image- 46 48

UiBinder-VerticalPanel- UiBinder-Labels 49 51 UiBinder-Labels UiBinder-ContactWidget.java 50 52

UiBinder-ContactWidget.java Source->generate getters and setters UiBinder-ContactWidget.java setcontact contact setcontact, contact 53 54 UiBinder-Ui.java ContactWidget.java UiBinder-Ui.java ContactWidget.java 55 56

UiBinder-Ui.java ContactWidget.java Run 57 59 UiBinder-Ui.java 58