我有这样的代码,我使用FlexTable在网格布局中呈现产品:
@Override
public void onSuccess(Map<Long, Product> mp) {
int i = 0;
int j = 0;
GWT.log("Success list all products count="+mp.size());
Iterator it = mp.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pairs = (Map.Entry)it.next();
Product product = (Product) pairs.getValue();
ProductWidget pw = productInstance.get();
pw.setTitle(product.getName());
pw.setImageUrl(product.getImageUrl());
pw.setContent(product.getInfo());
flextable.setWidget(i, j, pw);
i = j > 3 ? i : i++;
j++;
it.remove(); // avoids a ConcurrentModificationException
}
}Map mp返回了要呈现为窗口小部件的4产品,但是只有3呈现在Flextable上,这段代码中会有什么错误呢?
发布于 2013-03-10 02:46:57
flextable.setWidget(i, j, pw);
i = j > 2 ? i++:i;
j = j > 2 ? 0 : j++;我想这会成功的。3列和无限行数。
https://stackoverflow.com/questions/15302467
复制相似问题