You might try setting all your data into Labels and keeping the
references to the labels in a vector, arraylist, map, whatever.
Attach the labels to the grid using the setWidget method. Updating the
labels you have stored will update the grid entries.
I've done that with a FlexTable, though without the storage structure
for the labels. Hope this helps:
public class OverviewPanel extends Composite {
private FlexTable table;
private Label valFlow;
private Label valPower;
private Label valSource;
private Label valTarget;
public OverviewPanel(double flow, double power, doube source, double
target) {
overviewPanel = new HorizontalPanel();
overviewPanel.setStyleName("gwt-sb-label-no-bkgd");
overviewPanel.setWidth("600px");
initWidget(overviewPanel);
table = new FlexTable();
table.setCellSpacing(5);
overviewPanel.add(table);
valFlow = addDataSet("Flow:", "gal", flow, 0, 0);
valPower = addDataSet("Power:", "kW", power, 0, 4);
valSource = addDataSet("Source:", "ft", source, 0, 6);
valTarget = addDataSet("Target:", "ft", target, 0, 8);
}
public void updateData(double flow, double power, double source,
double target) {
valPower.setText(power.value);
valFlow.setText(flow.);
valSource.setText(source);
valTarget.setText(target);
}
public void add(Widget widget) {
overviewPanel.add(widget);
}
private Label addDataSet(String name, String units, double value, int
row, int startColumn) {
Label nameLabel = new Label(name);
table.setWidget(row, startColumn, nameLabel);
nameLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
Label value = new Label(Double.toString(value));
value.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
value.setStyleName("gwt-sb-tag-value");
value.setWidth("50px");
table.setWidget(row, startColumn + 1, value);
Label unitsLabel = new Label(units);
table.setWidget(row, startColumn + 2, unitsLabel);
return value;
}
}
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.