Java Reference
In-Depth Information
The onFailure method of your AsyncCallback object references a small helper method to
display any error returned from the server. Add this method to your class along with
some required import statements.
import java.util.Vector;
private void handleError(Throwable error) {
if (error instanceof NotLoggedInException)
Your time-entry UI is almost complete. Users can now add rows to their timecards,
select projects and milestones, and enter their time for the appropriate days. Your
last major task for entering time is writing the entries to the datastore. To perform
this function you'll add the code in Listing 7-12.
The saveEntries method gathers up all of the user-entered timecard data rows
into a Vector of TimeEntryData objects. If there are any timecard entries to submit to
the server, the Vector of objects is passed to the server, the entries are persisted to the
datastore, and the results are sent back and displayed to the user in a standard
JavaScript Alert window.
Listing 7-12. Code for the saveEntries method
private void saveEntries() {
Vector<TimeEntryData> entries = new Vector<TimeEntryData>();
for (int row=1;row<flexEntryTable.getRowCount();row++) {
ListBox projectWidget = (ListBox)
flexEntryTable.getWidget(row, 0);
ListBox milestoneWidget = (ListBox)
flexEntryTable.getWidget(row, 1);
CheckBox billableWidget = (CheckBox)
flexEntryTable.getWidget(row, 2);
Search WWH ::

Custom Search