可滚动分页客户端服务器 [英] Scrollable Pagination Client-severs

查看:123
本文介绍了可滚动分页客户端服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个客户端屏幕在JTable中显示大列表数据。客户端是Swing应用程序。它向远程服务器请求数据。列表数据需要以可滚动分页模式显示。这意味着只有当用户滚动表时(像Oracle Developer显示查询的数据的方式),才应请求行。
那么任何良好的做法是遵循吗?我的2个主要方面是数据请求方法(例如片查询,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.

感谢

推荐答案

SwingWorker 是理想的,因为它允许查询在后台继续,同时GUI不断更新。因为 JTable 使用 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 href =http://java-swing-tips.blogspot.com/2008/03/jtable-pagination-example-using.html =nofollow>此处,或简单的控件,如图所示< a href =http://stackoverflow.com/questions/1481138/how-to-make-pagination-in-swing-java/1481468#1481468>此处。

Addendum: If you find that you want to enhance pagination, consider using RowFilter, as suggested here, or simple controls, as shown here.

这篇关于可滚动分页客户端服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆