首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Flextable上设置小部件

在Flextable上设置小部件
EN

Stack Overflow用户
提问于 2013-03-09 04:11:47
回答 1查看 65关注 0票数 0

我有这样的代码,我使用FlexTable在网格布局中呈现产品:

代码语言:javascript
复制
        @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上,这段代码中会有什么错误呢?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-03-10 02:46:57

代码语言:javascript
复制
flextable.setWidget(i, j, pw);
i = j > 2 ? i++:i;
j = j > 2 ? 0 : j++;

我想这会成功的。3列和无限行数。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15302467

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档