Revision a5f972b3 src/gr/ebs/gss/client/FileList.java

b/src/gr/ebs/gss/client/FileList.java
23 23
import gr.ebs.gss.client.rest.RestCommand;
24 24
import gr.ebs.gss.client.rest.resource.FileResource;
25 25
import gr.ebs.gss.client.rest.resource.FolderResource;
26
import gr.ebs.gss.client.rest.resource.OtherUserResource;
27
import gr.ebs.gss.client.rest.resource.OthersFolderResource;
26 28
import gr.ebs.gss.client.rest.resource.RestResource;
27 29
import gr.ebs.gss.client.rest.resource.RestResourceWrapper;
28 30
import gr.ebs.gss.client.rest.resource.SharedResource;
......
527 529
		return DONE;
528 530
	}
529 531

  
530
	
531

  
532
	
533
	/**
534
	 * Make the specified row look like selected or not, according to the
535
	 * <code>selected</code> flag.
536
	 *
537
	 * @param row
538
	 * @param selected
539
	 */
540
	void styleRow(final int row, final boolean selected) {
541
		
542
	}
543 532

  
544 533
	/**
545 534
	 * Update the display of the file list.
......
552 541
		folderTotalSize = 0;
553 542
		
554 543
		copyListAndContinue(files);
555
		
544
		for(FileResource f : files){
545
			folderTotalSize += f.getContentLength();
546
		}
556 547
		if (folderFileCount == 0) {
557 548
			showingStats = "no files";
558 549
		} else if (folderFileCount < GSS.VISIBLE_FILE_COUNT) {
......
577 568
	private ImageResource getFileIcon(FileResource file) {
578 569
		String mimetype = file.getContentType();
579 570
		boolean shared = false;
571
		//TODO: FETCH USER OF OTHER FOLDER ITEM
572
		//if(GSS.get().getTreeView().getSelection()!=null && (GSS.get().getTreeView().getSelection() instanceof OtherUserResource || GSS.get().getTreeView().getSelection() instanceof OthersFolderResource))
580 573
		/*Folders folders = GSS.get().getFolders();
581 574
		if(folders.getCurrent() != null && folders.isOthersSharedItem(folders.getCurrent())){
582 575
			DnDTreeItem otherUser = (DnDTreeItem) folders.getUserOfSharedItem(folders.getCurrent());
......
629 622
		GSS.get().getStatusPanel().updateCurrentlyShowing(showingStats);
630 623
	}
631 624

  
632
	/**
633
	 * Adjust the height of the table by adding and removing rows as necessary.
634
	 *
635
	 * @param newHeight the new height to reach
636
	 */
637
	//void resizeTableHeight(final int newHeight) {
638
		/*GWT.log("Panel: " + newHeight + ", parent: " + table.getParent().getOffsetHeight(), null);
639
		// Fill the rest with empty slots.
640
		if (newHeight > table.getOffsetHeight())
641
			while (newHeight > table.getOffsetHeight()) {
642
				table.resizeRows(table.getRowCount() + 1);
643
				GWT.log("Table: " + table.getOffsetHeight() + ", rows: " + table.getRowCount(), null);
644
			}
645
		else
646
			while (newHeight < table.getOffsetHeight()) {
647
				table.resizeRows(table.getRowCount() - 1);
648
				GWT.log("Table: " + table.getOffsetHeight() + ", rows: " + table.getRowCount(), null);
649
			}*/
650
	//}
651

  
652 625
	public void updateFileCache(boolean updateSelectedFolder, final boolean clearSelection) {
653 626
		updateFileCache(updateSelectedFolder, clearSelection, null);
654 627
	}
......
688 661
			update(true);
689 662
			return;
690 663
		}
691
		if (folderItem instanceof FolderResource) {
692
			setFiles(((FolderResource) folderItem).getFiles());
664
		if (folderItem instanceof RestResourceWrapper) {
665
			setFiles(((RestResourceWrapper) folderItem).getResource().getFiles());
693 666
			update(true);
694 667
		}
695 668
		if (folderItem instanceof SharedResource) {
......
706 679
	 * Fill the file cache with data.
707 680
	 */
708 681
	public void setFiles(final List<FileResource> _files) {
709
		/*if (_files.size() > 0 && !GSS.get().getFolders().isTrash(GSS.get().getFolders().getCurrent())) {
682
		if (_files.size() > 0 && ! (GSS.get().getTreeView().getSelection() instanceof TrashResource)) {
710 683
			files = new ArrayList<FileResource>();
711 684
			for (FileResource fres : _files)
712 685
				if (!fres.isDeleted())
713 686
					files.add(fres);
714
		} else*/
687
		}
688
		else
715 689
			files = _files;
716 690
		Collections.sort(files, new Comparator<FileResource>() {
717 691

  
......
745 719
		while(it.hasNext()){
746 720
			selectionModel.setSelected(it.next(),false);
747 721
		}
748
		
749
		/*for (int r : selectedRows) {
750
			int row = r - startIndex;
751
			styleRow(row, false);
752
			makeRowNotDraggable(row+1);
753
		}
754
		selectedRows.clear();
755
		Object sel = GSS.get().getCurrentSelection();
756
		if (sel instanceof FileResource || sel instanceof List)
757
			GSS.get().setCurrentSelection(null);
758
		if(menuShowing != null && menuShowing.isShowing()){
759
			menuShowing.hide();
760
			menuShowing=null;
761
		}*/
762 722
	}
763 723

  
764 724
	/**
765 725
	 *
766 726
	 */
767 727
	public void selectAllRows() {
768
		/*clearSelectedRows();
769
		int count = folderFileCount;
770
		if (count == 0)
771
			return;
772
		int max = startIndex + GSS.VISIBLE_FILE_COUNT;
773
		if (max > count)
774
			max = count;
775
		int i = 1;
776
		for (; i < GSS.VISIBLE_FILE_COUNT + 1; ++i) {
777
			// Don't read past the end.
778
			// if (i > folderFileCount)
779
			// break;
780
			if (startIndex + i > folderFileCount)
781
				break;
782
			selectedRows.add(startIndex + i - 1);
783
			styleRow(i - 1, true);
784
			makeRowDraggable(i);
728
		Iterator<FileResource> it = selectionModel.getSelectedSet().iterator();
729
		while(it.hasNext()){
730
			selectionModel.setSelected(it.next(),true);
785 731
		}
786
		GSS.get().setCurrentSelection(getSelectedFiles());
787
		contextMenu.setFiles(getSelectedFiles());*/
788

  
789

  
790
	}
791 732

  
792
	private void makeRowDraggable(int row){
793
	/*	int contextRow = getWidgetRow(contextMenu, table);
794
		if (contextRow != -1)
795
			table.setWidget(contextRow, 0, getFileIcon(files.get(contextRow - 1)).createImage());
796
		contextMenu.setWidget(new HTML(getFileIcon(files.get(row - 1)).getHTML()));
797
		table.setWidget(row, 0, contextMenu);
798
		//for(int i=1;i<table.getCellCount(row);i++)
799
			//GSS.get().getDragController().makeDraggable(table.getWidget(row, i));
800
		table.setWidget(row, 1, new DnDSimpleFocusPanel(table.getWidget(row, 1)));
801
		((DnDSimpleFocusPanel)table.getWidget(row, 1)).setFiles(getSelectedFiles());
802
		GSS.get().getDragController().makeDraggable(table.getWidget(row, 1));*/
803
	}
804
	private void makeRowNotDraggable(int row){
805
		/*if(table.getWidget(row, 1) instanceof DnDSimpleFocusPanel){
806
			((DnDSimpleFocusPanel)table.getWidget(row, 1)).setFiles(null);
807
			GSS.get().getDragController().makeNotDraggable(table.getWidget(row, 1));
808
			table.setWidget(row, 1, new DnDSimpleFocusPanel(((DnDSimpleFocusPanel)table.getWidget(row, 1)).getWidget()));
809 733

  
810
		}
811
		*/
812 734
	}
813 735

  
814
	private int getWidgetRow(Widget widget, Grid grid) {
815
		/*for (int row = 0; row < grid.getRowCount(); row++)
816
			for (int col = 0; col < grid.getCellCount(row); col++) {
817
				Widget w = table.getWidget(row, col);
818
				if (w == widget)
819
					return row;
820
			}*/
821
		return -1;
822
	}
823
	
824 736
	
825 737
	private void sortFiles(final String sortingProperty, final boolean sortingType){
826 738
		Collections.sort(files, new Comparator<FileResource>() {

Also available in: Unified diff