`

SWT学习笔记——JFace中TableViewer的使用及注意事项

阅读更多
问题:
1、使用CellEditor时出现org.eclipse.core.runtime.AssertionFailedException: assertion failed:
原因(使用TextCellEditor时CellModifier的getValue函数返回值必须为String类型的)
引用
you have either not set the CellModifier for the TableViewer (using the setCellModifier() function)

or, if you have, then the getValue() function of your ICellModifier descendant returns either null or not a String object.
The return value of getValue() is an object, but if you are using a TextCellEditor, it has to return a String.


引用自:http://stackoverflow.com/questions/1390613/how-to-resolve-assertionfailedexception

教程列表:

使用TableViewer编辑数据貌似有两种方法,此外不用TableViewer时可以添加button等控件:
1、对整个table提供统一的编辑策略
例如(比较详细的教程,含按列排序、filter等功能,分在4篇博客里):
http://www.blogjava.net/dreamstone/archive/2007/08/05/134498.html
2、对每一列单独提供(感觉这种方法更清晰简洁,不需要各种字符串判断了)
http://study-swt.info/viewers/sample_editable_table.html
3、不使用TableViewer,添加button等控件
http://www.blogjava.net/Javawind/articles/131557.html

4、其他教程(详细,含高亮特定字段的功能):
http://www.vogella.de/articles/EclipseJFaceTableAdvanced/article.html

5、在表格中的不同位置弹出不同菜单(杂乱的教程,直接查看类:Snippet311)
http://hi.baidu.com/if1i/blog/item/29f057d1bb9a55dd572c8433.html
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics