Java Reference
In-Depth Information
of course) and sums the values in the row's total column. The grand total for the
timecard is then displayed at the lower-right corner of the UI.
private void totalGrid() {
double grandTotal = 0.00;
for (int row=1;row<flexEntryTable.getRowCount();row++) {
Label rowTotalWidget = (Label) flexEntryTable.getWidget(row,
10);
double rowTotal =
Double.parseDouble(rowTotalWidget.getText());
grandTotal = grandTotal + rowTotal;
}
;
totalLabel.setText(NumberFormat.getFormat(".00").format(grandTotal));
}
At this point your application's basic functionality is in place. The next couple of
chapters will deal with authentication and persistence, so this is a good time to take a
look at the entire code in the TimeEntry.java file (Listing 5-1).
Listing 5-1. The code for TimeEntry.java
package com.appirio.timeentry.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.datepicker.client.DateBox;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.DecoratedTabPanel;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.CheckBox;
113
 
Search WWH ::




Custom Search