TAILIEUCHUNG - Apress bắt đầu ứng dụng với java google - p 14

Xử lý Client-Side Sự kiện Giống như hầu hết các ứng dụng dựa trên web, code của bạn thực hiện dựa trên sự tương tác của người dùng. Người sử dụng gây ra một số loại sự kiện, như một nút nhấn hoặc nhấn một phím, và ứng dụng của bạn phản ứng phù hợp bằng cách thực hiện một số hành động | CHAPTER 5 DEVELOPING YOUR APPLICATION table Running Your Application Click the Run button again to launch your application in hosted mode. It should look like Figure 5-5. Figure 5-5. Your newly designed application Handling Client-Side Events Like most web-based applications your code executes based on user interaction. The user triggers some kind of event such as a button click or a key press and your application responds accordingly by performing some action. It shouldn t be a surprise to discover that GWT handles events with the same event-handler interface model that you find in other user-interface frameworks. A widget announces or publishes an event for example clicking a button and other widgets subscribe to the event by receiving a particular event-handler interface and performing some action for example displaying a pop-up message . 108 CHAPTER 5 DEVELOPING YOUR APPLICATION Start by adding a click handler and an event listener for your Add Row button. You ll handle the Add Row button s click event by passing it an object that implements the ClickHandler interface. In the code below you ll see that we use an anonymous inner class to implement ClickHandler. The interface has one method onClick which fires when the user clicks the button and adds a new row to the FlexTable for a new time entry. listen for mouse events on the add new row button new ClickHandler public void onClick ClickEvent event addRow One of your functional requirements is to allow users to record the amount of time they worked based on a user-defined start date. With your date picker you ll listen for changes to the selected date based on the interface s onValueChanged method. When the widget detects a change to its date it sets the class variable to the widget s selected date renames the columns of the FlexTable based on the start date and displays the major visible components of the application. listen for the changes in the value of the date .

TÀI LIỆU MỚI ĐĂNG
170    252    4    28-03-2024
9    210    0    28-03-2024
34    198    1    28-03-2024
44    181    0    28-03-2024
14    159    0    28-03-2024
37    128    0    28-03-2024
10    112    0    28-03-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.