[英]JTable with jgoodies sorting trouble
I've got a blocking problem with the sorting functionality of a JTable; JTable的排序功能存在阻塞问题; this made stall the development of the spare time open source project for 4 months now.
这使业余时间开源项目的开发停滞了四个月。 Hope to be pointed into the right direction here.
希望在这里指出正确的方向。
Context: I'm working on extending the functionality of the ps3mediaserver to add a media library with pms-mlx . 上下文:我正在扩展ps3mediaserver的功能,以使用pms- mlx添加媒体库。 The UI of the media server has been done using swing.
媒体服务器的UI已使用swing完成。
Problem: When clicking on a column header in the JTable, a seemingly random column gets sorted instead of the one having been clicked. 问题:单击JTable中的列标题时,似乎是随机的列将被排序,而不是被单击的列。
Current implementation: Here's the description of the different components and classes being used for the implementation: 当前实现:这是用于实现的不同组件和类的描述:
Possible solutions: 可能的解决方案:
At some point it will be possible to open an editing dialogue, where the content of the row has to be retrieved, can be edited and when saved the row has to be updated. 在某个时候,可以打开一个编辑对话框,其中必须检索该行的内容,可以对其进行编辑,并且在保存时必须更新该行。
Before reworking the entire thing I'd like to be sure the component will be able to handle all I want to do with it. 在重做整个事情之前,我想确保该组件将能够处理我要使用它进行的所有操作。
I'm more used to create GUIs using .NET in Visual Studio. 我更习惯在Visual Studio中使用.NET创建GUI。 It's quite different and a lot more difficult to do the same with swing.
摇摆是完全不同的,并且要执行相同的操作要困难得多。 Please show me I'm wrong :)
请告诉我我错了:)
[edit] If someone is willing to reproduce the problem, either get the source or the binaries, launch the application, navigate to the media library tab. [edit]如果有人愿意重现该问题,请获取源文件或二进制文件,启动应用程序,导航至“媒体库”选项卡。 In the Genral section import some videos by adding some video files.
在“一般”部分中,通过添加一些视频文件来导入一些视频。 Go to the library section, click on apply to refresh the list and try to sort the table.
转到库部分,单击“应用”以刷新列表并尝试对表进行排序。
It may be useful to know that JTable
columns can be dragged by the user. 知道用户可以拖动
JTable
列可能会很有用。 As a result, the view ( JTable
or a subclass) and model (an implementation of TableModel
) may have different column numbers. 结果,视图(
JTable
或子类)和模型( TableModel
的实现)可能具有不同的列号。 Similarly, a RowSorter
may affect the order or number of rows in the view as compared to the model. 同样,与模型相比,
RowSorter
可能会影响视图中行的顺序或数量。 The related conversion methods are mentioned in How to Use Tables: Sorting and Filtering . 如何使用表:排序和过滤中提到了相关的转换方法。 In particular: "When using a sorter, always remember to translate cell coordinates."
特别是:“使用分类器时,切记转换单元格坐标。”
Addendum: As an alternative, consider org.netbeans.swing.etable.ETable
or it's subclass org.netbeans.swing.outline.Outline
, depicted here . 附录:作为替代方案,考虑
org.netbeans.swing.etable.ETable
或它的子类org.netbeans.swing.outline.Outline
,如此处所述 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.