Revision 780606ca
b/gss/src/gr/ebs/gss/client/SearchResults.java | ||
---|---|---|
107 | 107 |
/** |
108 | 108 |
* The table widget with the file list. |
109 | 109 |
*/ |
110 |
private Grid table;// = new Grid(GSS.VISIBLE_FILE_COUNT + 1, 8);
|
|
110 |
private Grid table; |
|
111 | 111 |
|
112 | 112 |
/** |
113 | 113 |
* The navigation bar for paginating the results. |
... | ... | |
117 | 117 |
/** |
118 | 118 |
* The number of files in the search results |
119 | 119 |
*/ |
120 |
int folderFileCount; |
|
120 |
private int folderFileCount;
|
|
121 | 121 |
|
122 | 122 |
/** |
123 | 123 |
* Total search results size |
124 | 124 |
*/ |
125 |
long folderTotalSize; |
|
126 |
|
|
125 |
private long folderTotalSize; |
|
127 | 126 |
|
128 | 127 |
/** |
129 | 128 |
* A cache of the files in the list. |
130 | 129 |
*/ |
131 | 130 |
private List<FileResource> files; |
132 | 131 |
|
133 |
|
|
134 | 132 |
/** |
135 | 133 |
* The widget's image bundle. |
136 | 134 |
*/ |
... | ... | |
165 | 163 |
public SearchResults(final Images _images) { |
166 | 164 |
images = _images; |
167 | 165 |
table = new Grid(GSS.VISIBLE_FILE_COUNT + 1, 8){ |
166 |
|
|
167 |
@Override |
|
168 | 168 |
public void onBrowserEvent(Event event) { |
169 | 169 |
if (files == null || files.size() == 0) |
170 | 170 |
return; |
... | ... | |
216 | 216 |
table.addTableListener(this); |
217 | 217 |
|
218 | 218 |
// Create the 'navigation' bar at the upper-right. |
219 |
final HorizontalPanel innerNavBar = new HorizontalPanel();
|
|
219 |
HorizontalPanel innerNavBar = new HorizontalPanel(); |
|
220 | 220 |
innerNavBar.setStyleName("gss-ListNavBar"); |
221 | 221 |
innerNavBar.setSpacing(8); |
222 | 222 |
innerNavBar.add(prevButton); |
... | ... | |
266 | 266 |
} |
267 | 267 |
} |
268 | 268 |
|
269 |
|
|
270 |
|
|
271 | 269 |
/** |
272 | 270 |
* Retrieve the root folder for the current user. |
273 | 271 |
* |
... | ... | |
281 | 279 |
return DONE; |
282 | 280 |
} |
283 | 281 |
|
284 |
/* |
|
285 |
* (non-Javadoc) |
|
286 |
* |
|
287 |
* @see com.google.gwt.user.client.ui.TableListener#onCellClicked(com.google.gwt.user.client.ui.SourcesTableEvents, |
|
288 |
* int, int) |
|
289 |
*/ |
|
290 |
public void onCellClicked(@SuppressWarnings("unused") SourcesTableEvents sender, int row, @SuppressWarnings("unused") int cell) { |
|
282 |
public void onCellClicked(SourcesTableEvents sender, int row, int cell) { |
|
291 | 283 |
// Select the row that was clicked (-1 to account for header row). |
292 | 284 |
if (row > folderFileCount) |
293 | 285 |
return; |
... | ... | |
429 | 421 |
} |
430 | 422 |
prevButton.setVisible(false); |
431 | 423 |
nextButton.setVisible(false); |
432 |
|
|
433 | 424 |
} |
434 | 425 |
|
435 | 426 |
/** |
... | ... | |
451 | 442 |
} |
452 | 443 |
selectedRows.add(startIndex + row); |
453 | 444 |
styleRow(row, true); |
454 |
|
|
455 | 445 |
} |
456 | 446 |
else { |
457 | 447 |
clearSelectedRows(); |
... | ... | |
464 | 454 |
GSS.get().setCurrentSelection(getSelectedFiles()); |
465 | 455 |
//contextMenu.setFiles(getSelectedFiles()); |
466 | 456 |
table.setWidget(row + 1, 0, contextMenu); |
467 |
|
|
468 | 457 |
} |
469 | 458 |
} |
470 | 459 |
|
... | ... | |
586 | 575 |
|
587 | 576 |
/** |
588 | 577 |
* Update the file cache with data from the server. |
589 |
* |
|
590 |
* @param userId the ID of the current user |
|
591 | 578 |
*/ |
592 |
public void updateFileCache( String query) {
|
|
579 |
public void updateFileCache(String query) { |
|
593 | 580 |
clearSelectedRows(); |
594 | 581 |
sortingProperty = "name"; |
595 | 582 |
clearLabels(); |
... | ... | |
605 | 592 |
} else{ |
606 | 593 |
searchResults.setHTML("Search results for " + query); |
607 | 594 |
|
608 |
ExecuteGet<SearchResource> eg = new ExecuteGet<SearchResource>(SearchResource.class, GSS.GSS_REST_PATH+"search/"+URL.encodeComponent(query)){ |
|
595 |
ExecuteGet<SearchResource> eg = new ExecuteGet<SearchResource>(SearchResource.class, |
|
596 |
GSS.GSS_REST_PATH+"search/"+URL.encodeComponent(query)){ |
|
609 | 597 |
|
610 | 598 |
@Override |
611 | 599 |
public void onComplete() { |
... | ... | |
614 | 602 |
update(); |
615 | 603 |
} |
616 | 604 |
|
605 |
@Override |
|
617 | 606 |
public void onError(Throwable t) { |
618 | 607 |
if(t instanceof RestException) |
619 | 608 |
GSS.get().displayError("Unable to perform search:"+((RestException)t).getHttpStatusText()); |
... | ... | |
633 | 622 |
* @param _files |
634 | 623 |
* @param filePaths the files to set |
635 | 624 |
*/ |
636 |
void setFiles(final List<FileResource> _files) {
|
|
625 |
private void setFiles(List<FileResource> _files) {
|
|
637 | 626 |
files = _files; |
638 | 627 |
Collections.sort(files, new Comparator<FileResource>() { |
639 | 628 |
|
640 | 629 |
public int compare(FileResource arg0, FileResource arg1) { |
641 | 630 |
return arg0.getName().compareTo(arg1.getName()); |
642 |
|
|
643 | 631 |
} |
644 | 632 |
|
645 | 633 |
}); |
... | ... | |
764 | 752 |
$doc.body.onselectstart = null; |
765 | 753 |
}-*/; |
766 | 754 |
|
767 |
/** |
|
768 |
* |
|
769 |
*/ |
|
770 | 755 |
public void selectAllRows() { |
771 | 756 |
clearSelectedRows(); |
772 | 757 |
int count = folderFileCount; |
... | ... | |
788 | 773 |
GSS.get().setCurrentSelection(getSelectedFiles()); |
789 | 774 |
//contextMenu.setFiles(getSelectedFiles()); |
790 | 775 |
table.setWidget(i - 1, 0, contextMenu); |
791 |
|
|
792 | 776 |
} |
793 | 777 |
|
794 | 778 |
} |
Also available in: Unified diff