Java Reference
In-Depth Information
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
addRowButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
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
dateBox.addValueChangeHandler(new ValueChangeHandler<Date>() {
public void onValueChange(ValueChangeEvent<Date> evt) {
startDate = evt.getValue();
// show the main parts of the UI now
Since the code above displays your major UI components when a date is selected
by the date picker, you should add the code to hide the the components when the
application initially loads. Add the following code before setting the Root panel in the
onModuleLoad method.
// hide the main parts of the UI until they choose a date
Search WWH ::

Custom Search