mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
fix paging issue
This commit is contained in:
+12
-4
@@ -163,14 +163,21 @@ public class ResultsScrollPanel extends JScrollPane {
|
|||||||
addProjectToDisplay(project);
|
addProjectToDisplay(project);
|
||||||
this.currentLocation++;
|
this.currentLocation++;
|
||||||
}
|
}
|
||||||
armed = true;
|
getResultsPanel().invalidate();
|
||||||
|
getResultsPanel().revalidate();
|
||||||
|
|
||||||
|
// Reset scrollbar position, for some reason it jumps to the last added element
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
old.translate(0, -16);
|
||||||
getViewport().setViewPosition(old);
|
getViewport().setViewPosition(old);
|
||||||
|
LOG.info("Paging mechanism is armed");
|
||||||
|
armed = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (searchSession != null && searchSession.hasMoreData()) {
|
if (searchSession != null && searchSession.hasMoreData()) {
|
||||||
getLoadMoreLabel().setText("Querying the cloud for more results...");
|
getLoadMoreLabel().setText("Querying the cloud for more results...");
|
||||||
getLoadMoreLabel().setIcon(spinnerIcon);
|
getLoadMoreLabel().setIcon(spinnerIcon);
|
||||||
@@ -403,9 +410,9 @@ public class ResultsScrollPanel extends JScrollPane {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProjectEntity doInBackground() throws Exception {
|
public ProjectEntity doInBackground() throws Exception {
|
||||||
CloudPresenter.Instance.uploadProject(dialog.getName(), dialog.getCategory(), dialog.getDescription(),
|
CloudPresenter.Instance.uploadProject(dialog.getName(), dialog.getCategory(), dialog
|
||||||
dialog.getKeywords(), plugInPort.getCurrentVersionNumber().toString(), thumbnailFile,
|
.getDescription(), dialog.getKeywords(), plugInPort.getCurrentVersionNumber().toString(),
|
||||||
file, project.getId());
|
thumbnailFile, file, project.getId());
|
||||||
return CloudPresenter.Instance.fetchUserUploads(project.getId()).get(0);
|
return CloudPresenter.Instance.fetchUserUploads(project.getId()).get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,6 +607,7 @@ public class ResultsScrollPanel extends JScrollPane {
|
|||||||
super.paint(g);
|
super.paint(g);
|
||||||
if (armed && searchSession != null && searchSession.hasMoreData()) {
|
if (armed && searchSession != null && searchSession.hasMoreData()) {
|
||||||
// disarm immediately so we don't trigger successive requests to the provider
|
// disarm immediately so we don't trigger successive requests to the provider
|
||||||
|
LOG.info("Paging mechanism is disarmed");
|
||||||
armed = false;
|
armed = false;
|
||||||
SwingWorker<List<ProjectEntity>, Void> worker = new SwingWorker<List<ProjectEntity>, Void>() {
|
SwingWorker<List<ProjectEntity>, Void> worker = new SwingWorker<List<ProjectEntity>, Void>() {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user