Java Reference
In-Depth Information
public void onClick(ClickEvent event) {
saveEntries();
removeAllRows();
}
});
After you save the entries to the server, your code needs to remove all of the current
timecard entries and present the user with a FlexTable that contains only one blank
row for new data entry. Add the following method to the TimeEntry class.
private void removeAllRows() {
// remove all of the rows from the flex table
for (int row=flexEntryTable.getRowCount()-1;row>0;row--)
flexEntryTable.removeRow(row);
// rest the total
totalLabel.setText("0.00");
// add a new blank row to the flex table
addRow();
}
Displaying Timecard Entries
Now your timecard entry UI is complete! However, one of your functional
requirements was to display the user's current timecard entries. You'll add another
tab to your UI and display a simple FlexTable with all of the user's current entries.
Remember, you already implemented the server-side code earlier in this chapter.
Start by adding a new FlexTable to hold all of the existing timecard entries. Add
the following private class member.
private FlexTable flexCurrentTable = new FlexTable();
Now simply add another tab titled “Current Entries” to the DecoratedTabPanel with
your newly created FlexTable .
tabPanel.add(flexCurrentTable,"Current Entries");
There's only one function of your new FlexTable : display entries for the current user.
To populate the FlexTable with data from the server, you need to implement the
following getCurrentEntries method in Listing 7-13 that makes an RPC call to the
server and fetches the user's current entries. The method doesn't need to pass any
 
Search WWH ::




Custom Search