可滚动的分页客户端服务器 [英] Scrollable Pagination Client-servers
问题描述
我有一个客户端屏幕,在JTable中显示一个大列表数据.客户端是Swing应用程序.它从远程服务器请求数据.列表数据需要以可滚动的分页模式显示.这意味着仅当用户滚动表时才应请求行(例如Oracle Developer显示查询的数据的方式). 那么有什么好的做法可以遵循吗?我最关心的两个方面是数据请求方法(例如切片查询,id缓存...)和GUI处理.
I have a client screen display a big list data in a JTable. The client is Swing application. It requests the data from a remote server. The list data need to be displayed in scrollable pagination mode. That means the rows should be requested only when user scroll the table (like the way Oracle Developer displays the queried data). So is the any good practice to follow? My 2 main concerning aspects are data requesting method (e.g. slice query, id caching...) and GUI handling.
推荐答案
flyweight模式来渲染单元格,因此即使在成千上万行的情况下,性能也是如此.通常是可以接受的.这是一个示例.
SwingWorker is ideal for this, as it allows the query to continue in the background while the GUI is continually updated. Because JTable
uses the flyweight pattern to render cells, performance—even for thousands of rows—is usually acceptable. Here's an example.
附录:如果发现要增强分页,请考虑使用RowFilter
,如建议的此处.
Addendum: If you find that you want to enhance pagination, consider using RowFilter
, as suggested here, or simple controls, as shown here.
这篇关于可滚动的分页客户端服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!