2 * Copyright (c) 2011 Greek Research and Technology Network
5 package gr.grnet.pithos.web.client;
7 import static com.google.gwt.query.client.GQuery.$;
9 import gr.grnet.pithos.web.client.commands.UploadFileCommand;
10 import gr.grnet.pithos.web.client.foldertree.File;
11 import gr.grnet.pithos.web.client.foldertree.Folder;
12 import gr.grnet.pithos.web.client.foldertree.FolderTreeView;
13 import gr.grnet.pithos.web.client.rest.GetCommand;
14 import gr.grnet.pithos.web.client.rest.RestCommand;
15 import gr.grnet.pithos.web.client.rest.resource.FileResource;
16 import gr.grnet.pithos.web.client.rest.resource.OtherUserResource;
17 import gr.grnet.pithos.web.client.rest.resource.OthersFolderResource;
18 import gr.grnet.pithos.web.client.rest.resource.OthersResource;
19 import gr.grnet.pithos.web.client.rest.resource.RestResource;
20 import gr.grnet.pithos.web.client.rest.resource.RestResourceWrapper;
21 import gr.grnet.pithos.web.client.rest.resource.SharedResource;
22 import gr.grnet.pithos.web.client.rest.resource.TrashFolderResource;
23 import gr.grnet.pithos.web.client.rest.resource.TrashResource;
24 import gr.grnet.pithos.web.client.rest.resource.UserResource;
25 import gwtquery.plugins.draggable.client.DraggableOptions;
26 import gwtquery.plugins.draggable.client.StopDragException;
27 import gwtquery.plugins.draggable.client.DraggableOptions.DragFunction;
28 import gwtquery.plugins.draggable.client.DraggableOptions.RevertOption;
29 import gwtquery.plugins.draggable.client.events.DragContext;
30 import gwtquery.plugins.draggable.client.events.DragStartEvent;
31 import gwtquery.plugins.draggable.client.events.DragStopEvent;
32 import gwtquery.plugins.draggable.client.events.DragStartEvent.DragStartEventHandler;
33 import gwtquery.plugins.draggable.client.events.DragStopEvent.DragStopEventHandler;
34 import gwtquery.plugins.droppable.client.gwt.DragAndDropCellTable;
35 import gwtquery.plugins.droppable.client.gwt.DragAndDropColumn;
37 import java.util.ArrayList;
38 import java.util.Collections;
39 import java.util.Comparator;
40 import java.util.Iterator;
41 import java.util.List;
43 import com.google.gwt.cell.client.AbstractCell;
44 import com.google.gwt.cell.client.ImageResourceCell;
45 import com.google.gwt.cell.client.SafeHtmlCell;
46 import com.google.gwt.cell.client.TextCell;
47 import com.google.gwt.cell.client.ValueUpdater;
48 import com.google.gwt.core.client.GWT;
49 import com.google.gwt.dom.client.Style.Cursor;
50 import com.google.gwt.event.dom.client.ClickEvent;
51 import com.google.gwt.event.dom.client.ClickHandler;
52 import com.google.gwt.i18n.client.DateTimeFormat;
53 import com.google.gwt.resources.client.ClientBundle;
54 import com.google.gwt.resources.client.ImageResource;
55 import com.google.gwt.safehtml.client.SafeHtmlTemplates;
56 import com.google.gwt.safehtml.shared.SafeHtml;
57 import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
58 import com.google.gwt.user.cellview.client.CellTable;
59 import com.google.gwt.user.cellview.client.GssSimplePager;
60 import com.google.gwt.user.client.DOM;
61 import com.google.gwt.user.client.Event;
62 import com.google.gwt.user.client.Window;
63 import com.google.gwt.user.client.ui.AbstractImagePrototype;
64 import com.google.gwt.user.client.ui.Button;
65 import com.google.gwt.user.client.ui.Composite;
66 import com.google.gwt.user.client.ui.HorizontalPanel;
67 import com.google.gwt.user.client.ui.VerticalPanel;
68 import com.google.gwt.view.client.ListDataProvider;
69 import com.google.gwt.view.client.MultiSelectionModel;
70 import com.google.gwt.view.client.ProvidesKey;
71 import com.google.gwt.view.client.SelectionChangeEvent;
72 import com.google.gwt.view.client.SelectionChangeEvent.Handler;
76 * A composite that displays the list of files in a particular folder.
78 public class FileList extends Composite {
80 ListDataProvider<File> provider = new ListDataProvider<File>();
83 * The styles applied to the table.
85 interface TableStyle extends CellTable.Style {
88 interface TableResources extends DragAndDropCellTable.Resources {
89 @Source({CellTable.Style.DEFAULT_CSS, "GssCellTable.css"})
90 TableStyle cellTableStyle();
93 static interface Templates extends SafeHtmlTemplates {
94 Templates INSTANCE = GWT.create(Templates.class);
96 @Template("<div id='dragHelper' style='border:1px solid black; background-color:#ffffff; color:black; width:150px;z-index:100'></div>")
97 SafeHtml outerHelper();
99 @Template("<span id='{0}'>{0}</span>")
100 public SafeHtml filenameSpan(String filename);
102 @Template("<a href='{0}' title='{1}' rel='lytebox[mnf]' onclick='myLytebox.start(this, false, false); return false;'>(view)</a>")
103 public SafeHtml viewLink(String link, String title);
105 @Template("<table><tr><td rowspan='3'>{0}</td><td style='font-size:95%;' id='{1}'>{1}</td></tr><tr><td>{2}</td></tr></table>")
106 public SafeHtml rendelContactCell(String imageHtml, String name, String fileSize);
108 @Template("<span id='{0}' class='{1}'>{2}</span>")
109 public SafeHtml spanWithIdAndClass(String id, String cssClass, String content);
112 private String showingStats = "";
114 private int startIndex = 0;
117 * A constant that denotes the completion of an IncrementalCommand.
119 public static final boolean DONE = false;
121 private final DateTimeFormat formatter = DateTimeFormat.getFormat("d/M/yyyy h:mm a");
124 * Specifies that the images available for this composite will be the ones
125 * available in FileContextMenu.
127 public interface Images extends ClientBundle,FileContextMenu.Images, CellTreeView.Images {
129 @Source("gr/grnet/pithos/resources/blank.gif")
130 ImageResource blank();
132 @Source("gr/grnet/pithos/resources/asc.png")
135 @Source("gr/grnet/pithos/resources/desc.png")
136 ImageResource desc();
138 @Source("gr/grnet/pithos/resources/mimetypes/document_shared.png")
139 ImageResource documentShared();
141 @Source("gr/grnet/pithos/resources/mimetypes/kcmfontinst.png")
142 ImageResource wordprocessor();
144 @Source("gr/grnet/pithos/resources/mimetypes/log.png")
145 ImageResource spreadsheet();
147 @Source("gr/grnet/pithos/resources/mimetypes/kpresenter_kpr.png")
148 ImageResource presentation();
150 @Source("gr/grnet/pithos/resources/mimetypes/acroread.png")
153 @Source("gr/grnet/pithos/resources/mimetypes/image.png")
154 ImageResource image();
156 @Source("gr/grnet/pithos/resources/mimetypes/video2.png")
157 ImageResource video();
159 @Source("gr/grnet/pithos/resources/mimetypes/knotify.png")
160 ImageResource audio();
162 @Source("gr/grnet/pithos/resources/mimetypes/html.png")
163 ImageResource html();
165 @Source("gr/grnet/pithos/resources/mimetypes/txt.png")
168 @Source("gr/grnet/pithos/resources/mimetypes/ark2.png")
171 @Source("gr/grnet/pithos/resources/mimetypes/kcmfontinst_shared.png")
172 ImageResource wordprocessorShared();
174 @Source("gr/grnet/pithos/resources/mimetypes/log_shared.png")
175 ImageResource spreadsheetShared();
177 @Source("gr/grnet/pithos/resources/mimetypes/kpresenter_kpr_shared.png")
178 ImageResource presentationShared();
180 @Source("gr/grnet/pithos/resources/mimetypes/acroread_shared.png")
181 ImageResource pdfShared();
183 @Source("gr/grnet/pithos/resources/mimetypes/image_shared.png")
184 ImageResource imageShared();
186 @Source("gr/grnet/pithos/resources/mimetypes/video2_shared.png")
187 ImageResource videoShared();
189 @Source("gr/grnet/pithos/resources/mimetypes/knotify_shared.png")
190 ImageResource audioShared();
192 @Source("gr/grnet/pithos/resources/mimetypes/html_shared.png")
193 ImageResource htmlShared();
195 @Source("gr/grnet/pithos/resources/mimetypes/txt_shared.png")
196 ImageResource txtShared();
198 @Source("gr/grnet/pithos/resources/mimetypes/ark2_shared.png")
199 ImageResource zipShared();
204 * The number of files in this folder.
211 long folderTotalSize;
214 * A cache of the files in the list.
216 private List<File> files;
219 * The widget's image bundle.
221 private final Images images;
223 private FileContextMenu menuShowing;
225 private DragAndDropCellTable<File> celltable;
227 private final MultiSelectionModel<File> selectionModel;
229 private final List<SortableHeader> allHeaders = new ArrayList<SortableHeader>();
231 SortableHeader nameHeader;
233 GssSimplePager pagerBottom;
235 GssSimplePager pagerTop;
237 Button uploadButtonBottom;
239 Button uploadButtonTop;
241 FolderTreeView treeView;
244 * Construct the file list widget. This entails setting up the widget
245 * layout, fetching the number of files in the current folder from the
246 * server and filling the local file cache of displayed files with data from
247 * the server, as well.
251 public FileList(Images _images, FolderTreeView treeView) {
253 this.treeView = treeView;
255 DragAndDropCellTable.Resources resources = GWT.create(TableResources.class);
257 ProvidesKey<File> keyProvider = new ProvidesKey<File>(){
260 public Object getKey(File item) {
261 return item.getUri();
265 celltable = new DragAndDropCellTable<File>(GSS.VISIBLE_FILE_COUNT, resources, keyProvider);
266 celltable.setWidth("100%");
267 celltable.setStyleName("pithos-List");
269 DragAndDropColumn<File, ImageResource> status = new DragAndDropColumn<File, ImageResource>(new ImageResourceCell() {
271 public boolean handlesSelection() {
277 public ImageResource getValue(File entity) {
278 return getFileIcon(entity);
281 celltable.addColumn(status,"");
282 initDragOperation(status);
284 final DragAndDropColumn<File,SafeHtml> nameColumn = new DragAndDropColumn<File,SafeHtml>(new SafeHtmlCell()) {
287 public SafeHtml getValue(File object) {
288 SafeHtmlBuilder sb = new SafeHtmlBuilder();
289 sb.append(Templates.INSTANCE.filenameSpan(object.getName()));
290 if (object.getContentType().endsWith("png") || object.getContentType().endsWith("gif") || object.getContentType().endsWith("jpeg")) {
291 sb.appendHtmlConstant(" ")
292 .append(Templates.INSTANCE.viewLink(object.getUri(), object.getOwner() + " : " + object.getPath() + object.getName()));
295 return sb.toSafeHtml();
299 initDragOperation(nameColumn);
300 celltable.addColumn(nameColumn, nameHeader = new SortableHeader("Name"));
301 allHeaders.add(nameHeader);
302 nameHeader.setUpdater(new FileValueUpdater(nameHeader, "name"));
304 celltable.redrawHeaders();
306 DragAndDropColumn<File,String> aColumn = new DragAndDropColumn<File, String>(new TextCell()) {
308 public String getValue(File object) {
309 return object.getOwner();
312 SortableHeader aheader = new SortableHeader("Owner");
313 celltable.addColumn(aColumn, aheader);
314 initDragOperation(aColumn);
315 allHeaders.add(aheader);
316 aheader.setUpdater(new FileValueUpdater(aheader, "owner"));
318 aColumn = new DragAndDropColumn<File,String>(new TextCell()) {
320 public String getValue(File object) {
321 return object.getPath();
324 aheader = new SortableHeader("Path");
325 celltable.addColumn(aColumn, aheader);
326 initDragOperation(aColumn);
327 allHeaders.add(aheader);
328 aheader.setUpdater(new FileValueUpdater(aheader, "path"));
330 aColumn = new DragAndDropColumn<File,String>(new TextCell()) {
332 public String getValue(File object) {
333 return String.valueOf(object.getVersion());
336 aheader = new SortableHeader("Version");
337 celltable.addColumn(aColumn, aheader);
338 initDragOperation(aColumn);
339 allHeaders.add(aheader);
340 aheader.setUpdater(new FileValueUpdater(aheader, "version"));
342 aColumn = new DragAndDropColumn<File,String>(new TextCell()) {
344 public String getValue(File object) {
345 // TODO Auto-generated method stub
346 return object.getSizeAsString();
349 aheader = new SortableHeader("Size");
350 celltable.addColumn(aColumn, aheader);
351 initDragOperation(aColumn);
352 allHeaders.add(aheader);
353 aheader.setUpdater(new FileValueUpdater(aheader, "size"));
355 aColumn = new DragAndDropColumn<File,String>(new TextCell()) {
357 public String getValue(File object) {
358 return formatter.format(object.getLastModified());
361 aheader = new SortableHeader("Last Modified");
362 celltable.addColumn(aColumn, aheader);
363 allHeaders.add(aheader);
364 aheader.setUpdater(new FileValueUpdater(aheader, "date"));
366 provider.addDataDisplay(celltable);
368 celltable.addDragStopHandler(new DragStopEventHandler() {
371 public void onDragStop(DragStopEvent event) {
372 GWT.log("DRAG STOPPED");
375 celltable.addDragStartHandler(new DragStartEventHandler() {
377 public void onDragStart(DragStartEvent event) {
378 FileResource value = event.getDraggableData();
380 com.google.gwt.dom.client.Element helper = event.getHelper();
381 SafeHtmlBuilder sb = new SafeHtmlBuilder();
382 sb.appendHtmlConstant("<b>");
383 DisplayHelper.log(value.getName());
384 if(getSelectedFiles().size()==1)
385 sb.appendEscaped(value.getName());
387 sb.appendEscaped(getSelectedFiles().size()+" files");
388 sb.appendHtmlConstant("</b>");
389 helper.setInnerHTML(sb.toSafeHtml().asString());
393 VerticalPanel vp = new VerticalPanel();
396 pagerTop = new GssSimplePager(GssSimplePager.TextLocation.CENTER);
397 pagerTop.setVisible(false);
398 pagerTop.setDisplay(celltable);
399 uploadButtonTop = new Button("<span id='topMenu.file.upload'>" + AbstractImagePrototype.create(images.fileUpdate()).getHTML() + " Upload</span>");
400 uploadButtonTop.addClickHandler(new ClickHandler() {
403 public void onClick(ClickEvent event) {
404 new UploadFileCommand(null).execute();
407 HorizontalPanel topPanel = new HorizontalPanel();
408 topPanel.add(pagerTop);
409 topPanel.add(uploadButtonTop);
414 pagerBottom = new GssSimplePager(GssSimplePager.TextLocation.CENTER);
415 pagerBottom.setVisible(false);
416 pagerBottom.setDisplay(celltable);
417 uploadButtonBottom=new Button("<span id='topMenu.file.upload'>" + AbstractImagePrototype.create(images.fileUpdate()).getHTML() + " Upload</span>");
418 uploadButtonBottom.addClickHandler(new ClickHandler() {
421 public void onClick(ClickEvent event) {
422 new UploadFileCommand(null).execute();
425 HorizontalPanel bottomPanel = new HorizontalPanel();
426 bottomPanel.add(pagerBottom);
427 bottomPanel.add(uploadButtonBottom);
430 vp.setCellWidth(celltable, "100%");
433 selectionModel = new MultiSelectionModel<File>(keyProvider);
435 Handler selectionHandler = new SelectionChangeEvent.Handler() {
437 public void onSelectionChange(SelectionChangeEvent event) {
438 if(getSelectedFiles().size() == 1)
439 GSS.get().setCurrentSelection(getSelectedFiles().get(0));
441 GSS.get().setCurrentSelection(getSelectedFiles());
444 selectionModel.addSelectionChangeHandler(selectionHandler);
446 celltable.setSelectionModel(selectionModel, GSSSelectionEventManager.<File> createDefaultManager());
447 celltable.setPageSize(GSS.VISIBLE_FILE_COUNT);
449 sinkEvents(Event.ONCONTEXTMENU);
450 sinkEvents(Event.ONMOUSEUP);
451 sinkEvents(Event.ONMOUSEDOWN);
452 sinkEvents(Event.ONCLICK);
453 sinkEvents(Event.ONKEYDOWN);
454 sinkEvents(Event.ONDBLCLICK);
455 GSS.preventIESelection();
458 public List<File> getSelectedFiles() {
459 return new ArrayList<File>(selectionModel.getSelectedSet());
462 private void initDragOperation(DragAndDropColumn<?, ?> column) {
463 // retrieve draggableOptions on the column
464 DraggableOptions draggableOptions = column.getDraggableOptions();
465 // use template to construct the helper. The content of the div will be set
467 draggableOptions.setHelper($(Templates.INSTANCE.outerHelper().asString()));
468 //draggableOptions.setZIndex(100);
469 // opacity of the helper
470 draggableOptions.setAppendTo("body");
471 //draggableOptions.setOpacity((float) 0.8);
472 draggableOptions.setContainment("document");
473 // cursor to use during the drag operation
474 draggableOptions.setCursor(Cursor.MOVE);
475 // set the revert option
476 draggableOptions.setRevert(RevertOption.ON_INVALID_DROP);
477 // prevents dragging when user click on the category drop-down list
478 draggableOptions.setCancel("select");
479 draggableOptions.setOnBeforeDragStart(new DragFunction() {
481 public void f(DragContext context) {
482 File value = context.getDraggableData();
483 if (!selectionModel.isSelected(value)) {
484 throw new StopDragException();
490 public void showContextMenu(Event event){
491 menuShowing = new FileContextMenu(images, false, true);
492 menuShowing=menuShowing.onEmptyEvent(event);
495 public void onBrowserEvent(Event event) {
497 if (files == null || files.size() == 0) {
498 if (DOM.eventGetType(event) == Event.ONCONTEXTMENU && getSelectedFiles().size() == 0) {
499 menuShowing = new FileContextMenu(images, false, true);
500 menuShowing=menuShowing.onEmptyEvent(event);
501 event.preventDefault();
502 event.cancelBubble(true);
506 if (DOM.eventGetType(event) == Event.ONCONTEXTMENU && getSelectedFiles().size() != 0) {
507 GWT.log("*****GOING TO SHOW CONTEXT MENU ****", null);
508 menuShowing = new FileContextMenu(images, false, false);
509 menuShowing=menuShowing.onEvent(event);
510 event.cancelBubble(true);
511 event.preventDefault();
512 } else if (DOM.eventGetType(event) == Event.ONCONTEXTMENU && getSelectedFiles().size() == 0) {
513 menuShowing = new FileContextMenu(images, false, true);
514 menuShowing=menuShowing.onEmptyEvent(event);
515 event.cancelBubble(true);
516 event.preventDefault();
517 } else if (DOM.eventGetType(event) == Event.ONDBLCLICK)
518 if (getSelectedFiles().size() == 1) {
520 File file = getSelectedFiles().get(0);
521 Window.open(file.getUri(), "_blank", "");
522 event.preventDefault();
525 super.onBrowserEvent(event);
529 * Update the display of the file list.
531 void update(boolean sort) {
532 int count = folderFileCount;
533 int max = startIndex + GSS.VISIBLE_FILE_COUNT;
539 folderTotalSize += f.getBytes();
541 if (folderFileCount == 0) {
542 showingStats = "no files";
543 } else if (folderFileCount < GSS.VISIBLE_FILE_COUNT) {
544 if (folderFileCount == 1)
545 showingStats = "1 file";
547 showingStats = folderFileCount + " files";
548 showingStats += " (" + FileResource.getFileSizeAsString(folderTotalSize) + ")";
550 showingStats = "" + (startIndex + 1) + " - " + max + " of " + count + " files" + " (" + FileResource.getFileSizeAsString(folderTotalSize) + ")";
553 updateCurrentlyShowingStats();
558 * Return the proper icon based on the MIME type of the file.
563 private ImageResource getFileIcon(File file) {
564 String mimetype = file.getContentType();
565 boolean shared = file.isShared();
566 if (mimetype == null)
567 return shared ? images.documentShared() : images.document();
568 mimetype = mimetype.toLowerCase();
569 if (mimetype.startsWith("application/pdf"))
570 return shared ? images.pdfShared() : images.pdf();
571 else if (mimetype.endsWith("excel"))
572 return shared ? images.spreadsheetShared() : images.spreadsheet();
573 else if (mimetype.endsWith("msword"))
574 return shared ? images.wordprocessorShared() : images.wordprocessor();
575 else if (mimetype.endsWith("powerpoint"))
576 return shared ? images.presentationShared() : images.presentation();
577 else if (mimetype.startsWith("application/zip") ||
578 mimetype.startsWith("application/gzip") ||
579 mimetype.startsWith("application/x-gzip") ||
580 mimetype.startsWith("application/x-tar") ||
581 mimetype.startsWith("application/x-gtar"))
582 return shared ? images.zipShared() : images.zip();
583 else if (mimetype.startsWith("text/html"))
584 return shared ? images.htmlShared() : images.html();
585 else if (mimetype.startsWith("text/plain"))
586 return shared ? images.txtShared() : images.txt();
587 else if (mimetype.startsWith("image/"))
588 return shared ? images.imageShared() : images.image();
589 else if (mimetype.startsWith("video/"))
590 return shared ? images.videoShared() : images.video();
591 else if (mimetype.startsWith("audio/"))
592 return shared ? images.audioShared() : images.audio();
593 return shared ? images.documentShared() : images.document();
597 * Update status panel with currently showing file stats.
599 public void updateCurrentlyShowingStats() {
600 GSS.get().getStatusPanel().updateCurrentlyShowing(showingStats);
604 * Fill the file cache with data.
606 public void setFiles(final List<File> _files) {
607 files = new ArrayList<File>();
608 for (File fres : _files)
609 if (!fres.isInTrash())
611 Collections.sort(files, new Comparator<File>() {
614 public int compare(File arg0, File arg1) {
615 return arg0.getName().compareTo(arg1.getName());
619 folderFileCount = files.size();
621 nameHeader.setSorted(true);
622 nameHeader.toggleReverseSort();
623 for (SortableHeader otherHeader : allHeaders) {
624 if (otherHeader != nameHeader) {
625 otherHeader.setSorted(false);
626 otherHeader.setReverseSort(true);
630 if(files.size() > GSS.VISIBLE_FILE_COUNT){
631 pagerBottom.setVisible(true);
632 pagerTop.setVisible(true);
635 pagerTop.setVisible(false);
636 pagerBottom.setVisible(false);
638 Folder selectedItem = treeView.getSelection();
640 provider.setList(files);
644 * Does the list contains the requested filename
649 public boolean contains(String fileName) {
650 for (int i = 0; i < files.size(); i++)
651 if (files.get(i).getName().equals(fileName))
656 public void clearSelectedRows() {
657 Iterator<File> it = selectionModel.getSelectedSet().iterator();
659 selectionModel.setSelected(it.next(),false);
667 public void selectAllRows() {
668 Iterator<File> it = provider.getList().iterator();
670 selectionModel.setSelected(it.next(),true);
677 private void sortFiles(final String sortingProperty, final boolean sortingType){
678 Collections.sort(files, new Comparator<File>() {
681 public int compare(File arg0, File arg1) {
682 AbstractImagePrototype descPrototype = AbstractImagePrototype.create(images.desc());
683 AbstractImagePrototype ascPrototype = AbstractImagePrototype.create(images.asc());
685 if (sortingProperty.equals("version")) {
686 return arg0.getVersion() - arg1.getVersion();
687 } else if (sortingProperty.equals("owner")) {
688 return arg0.getOwner().compareTo(arg1.getOwner());
689 } else if (sortingProperty.equals("date")) {
690 return arg0.getLastModified().compareTo(arg1.getLastModified());
691 } else if (sortingProperty.equals("size")) {
692 return (int) (arg0.getBytes() - arg1.getBytes());
693 } else if (sortingProperty.equals("name")) {
694 return arg0.getName().compareTo(arg1.getName());
695 } else if (sortingProperty.equals("path")) {
696 return arg0.getUri().compareTo(arg1.getUri());
698 return arg0.getName().compareTo(arg1.getName());
701 else if (sortingProperty.equals("version")) {
703 return arg1.getVersion() - arg0.getVersion();
704 } else if (sortingProperty.equals("owner")) {
706 return arg1.getOwner().compareTo(arg0.getOwner());
707 } else if (sortingProperty.equals("date")) {
709 return arg1.getLastModified().compareTo(arg0.getLastModified());
710 } else if (sortingProperty.equals("size")) {
711 return (int) (arg1.getBytes() - arg0.getBytes());
712 } else if (sortingProperty.equals("name")) {
714 return arg1.getName().compareTo(arg0.getName());
715 } else if (sortingProperty.equals("path")) {
717 return arg1.getUri().compareTo(arg0.getUri());
720 return arg1.getName().compareTo(arg0.getName());
727 final class FileValueUpdater implements ValueUpdater<String>{
728 private String property;
729 private SortableHeader header;
733 public FileValueUpdater(SortableHeader header,String property) {
734 this.property=property;
738 public void update(String value) {
739 header.setSorted(true);
740 header.toggleReverseSort();
742 for (SortableHeader otherHeader : allHeaders) {
743 if (otherHeader != header) {
744 otherHeader.setSorted(false);
745 otherHeader.setReverseSort(true);
748 celltable.redrawHeaders();
749 sortFiles(property, header.getReverseSort());
750 FileList.this.update(true);
756 * Shows the files in the cellTable
758 private void showCellTable(){
759 if(files.size()>GSS.VISIBLE_FILE_COUNT){
760 pagerBottom.setVisible(true);
761 pagerTop.setVisible(true);
764 pagerTop.setVisible(false);
765 pagerBottom.setVisible(false);
767 provider.setList(files);
771 //celltable.redraw();
772 celltable.redrawHeaders();