X-Git-Url: https://code.grnet.gr/git/pithos/blobdiff_plain/5b09ea6c7d2b6fcb2cd27c6b8d664f0a962d9b51..bd2b3100be34577bf7bcc8d0d25fc1b14229dff6:/src/gr/ebs/gss/client/FileList.java?ds=sidebyside diff --git a/src/gr/ebs/gss/client/FileList.java b/src/gr/ebs/gss/client/FileList.java index 975ec10..6cf7ab2 100644 --- a/src/gr/ebs/gss/client/FileList.java +++ b/src/gr/ebs/gss/client/FileList.java @@ -18,19 +18,27 @@ */ package gr.ebs.gss.client; - +import static com.google.gwt.query.client.GQuery.$; import gr.ebs.gss.client.rest.GetCommand; -import gr.ebs.gss.client.rest.MultipleHeadCommand; import gr.ebs.gss.client.rest.RestCommand; -import gr.ebs.gss.client.rest.RestException; import gr.ebs.gss.client.rest.resource.FileResource; -import gr.ebs.gss.client.rest.resource.FolderResource; -import gr.ebs.gss.client.rest.resource.OtherUserResource; import gr.ebs.gss.client.rest.resource.RestResource; +import gr.ebs.gss.client.rest.resource.RestResourceWrapper; import gr.ebs.gss.client.rest.resource.SharedResource; import gr.ebs.gss.client.rest.resource.TrashResource; import gr.ebs.gss.client.rest.resource.UserResource; import gr.ebs.gss.client.rest.resource.UserSearchResource; +import gwtquery.plugins.draggable.client.DraggableOptions; +import gwtquery.plugins.draggable.client.StopDragException; +import gwtquery.plugins.draggable.client.DraggableOptions.DragFunction; +import gwtquery.plugins.draggable.client.DraggableOptions.RevertOption; +import gwtquery.plugins.draggable.client.events.DragContext; +import gwtquery.plugins.draggable.client.events.DragStartEvent; +import gwtquery.plugins.draggable.client.events.DragStopEvent; +import gwtquery.plugins.draggable.client.events.DragStartEvent.DragStartEventHandler; +import gwtquery.plugins.draggable.client.events.DragStopEvent.DragStopEventHandler; +import gwtquery.plugins.droppable.client.gwt.DragAndDropCellTable; +import gwtquery.plugins.droppable.client.gwt.DragAndDropColumn; import java.util.ArrayList; import java.util.Collections; @@ -38,17 +46,23 @@ import java.util.Comparator; import java.util.Iterator; import java.util.List; +import com.google.gwt.cell.client.AbstractCell; import com.google.gwt.cell.client.ImageResourceCell; +import com.google.gwt.cell.client.SafeHtmlCell; +import com.google.gwt.cell.client.TextCell; import com.google.gwt.cell.client.ValueUpdater; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.RepeatingCommand; -import com.google.gwt.dom.client.Element; -import com.google.gwt.dom.client.NativeEvent; +import com.google.gwt.dom.client.Style.Cursor; import com.google.gwt.http.client.URL; import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.resources.client.ClientBundle; import com.google.gwt.resources.client.ImageResource; +import com.google.gwt.safehtml.client.SafeHtmlTemplates; +import com.google.gwt.safehtml.shared.SafeHtml; +import com.google.gwt.safehtml.shared.SafeHtmlBuilder; +import com.google.gwt.safehtml.shared.SafeHtmlUtils; import com.google.gwt.user.cellview.client.CellTable; import com.google.gwt.user.cellview.client.Column; import com.google.gwt.user.cellview.client.TextColumn; @@ -59,14 +73,10 @@ import com.google.gwt.user.client.Event; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.AbstractImagePrototype; import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.Grid; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HasHorizontalAlignment; import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwt.user.client.ui.TreeItem; import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; -import com.google.gwt.view.client.DefaultSelectionEventManager; import com.google.gwt.view.client.MultiSelectionModel; import com.google.gwt.view.client.ProvidesKey; import com.google.gwt.view.client.SelectionChangeEvent; @@ -77,11 +87,19 @@ import com.google.gwt.view.client.SelectionChangeEvent.Handler; */ public class FileList extends Composite { - interface TableResources extends CellTable.Resources { + interface TableResources extends DragAndDropCellTable.Resources { @Source({CellTable.Style.DEFAULT_CSS, "GssCellTable.css"}) TableStyle cellTableStyle(); } + static interface Templates extends SafeHtmlTemplates { + Templates INSTANCE = GWT.create(Templates.class); + + @Template("
") + SafeHtml outerHelper(); + } + + /** * The styles applied to the table. */ @@ -181,12 +199,62 @@ public class FileList extends Composite { } + DragStopEventHandler dragStop = new DragStopEventHandler() { + + @Override + public void onDragStop(DragStopEvent event) { + GWT.log("DRAG STOPPED"); + + } + }; + + private static class ContactCell extends AbstractCell"); + sb.appendHtmlConstant(imageHtml); + sb.appendHtmlConstant(" | "); + + // Add the name and address. + DisplayHelper.log("value.getName()"); + sb.appendHtmlConstant(""); + sb.appendEscaped(value.getName()); + sb.appendHtmlConstant(" |
"); + sb.appendEscaped(value.getFileSizeAsString()); + sb.appendHtmlConstant(" |
selected
flag.
- *
- * @param row
- * @param selected
- */
- void styleRow(final int row, final boolean selected) {
-
- }
/**
* Update the display of the file list.
@@ -460,7 +589,9 @@ public class FileList extends Composite {
folderTotalSize = 0;
copyListAndContinue(files);
-
+ for(FileResource f : files){
+ folderTotalSize += f.getContentLength();
+ }
if (folderFileCount == 0) {
showingStats = "no files";
} else if (folderFileCount < GSS.VISIBLE_FILE_COUNT) {
@@ -485,6 +616,8 @@ public class FileList extends Composite {
private ImageResource getFileIcon(FileResource file) {
String mimetype = file.getContentType();
boolean shared = false;
+ //TODO: FETCH USER OF OTHER FOLDER ITEM
+ //if(GSS.get().getTreeView().getSelection()!=null && (GSS.get().getTreeView().getSelection() instanceof OtherUserResource || GSS.get().getTreeView().getSelection() instanceof OthersFolderResource))
/*Folders folders = GSS.get().getFolders();
if(folders.getCurrent() != null && folders.isOthersSharedItem(folders.getCurrent())){
DnDTreeItem otherUser = (DnDTreeItem) folders.getUserOfSharedItem(folders.getCurrent());
@@ -537,26 +670,6 @@ public class FileList extends Composite {
GSS.get().getStatusPanel().updateCurrentlyShowing(showingStats);
}
- /**
- * Adjust the height of the table by adding and removing rows as necessary.
- *
- * @param newHeight the new height to reach
- */
- //void resizeTableHeight(final int newHeight) {
- /*GWT.log("Panel: " + newHeight + ", parent: " + table.getParent().getOffsetHeight(), null);
- // Fill the rest with empty slots.
- if (newHeight > table.getOffsetHeight())
- while (newHeight > table.getOffsetHeight()) {
- table.resizeRows(table.getRowCount() + 1);
- GWT.log("Table: " + table.getOffsetHeight() + ", rows: " + table.getRowCount(), null);
- }
- else
- while (newHeight < table.getOffsetHeight()) {
- table.resizeRows(table.getRowCount() - 1);
- GWT.log("Table: " + table.getOffsetHeight() + ", rows: " + table.getRowCount(), null);
- }*/
- //}
-
public void updateFileCache(boolean updateSelectedFolder, final boolean clearSelection) {
updateFileCache(updateSelectedFolder, clearSelection, null);
}
@@ -565,11 +678,7 @@ public class FileList extends Composite {
if (!updateSelectedFolder && !GSS.get().getTreeView().getSelection().equals(GSS.get().getTreeView().getTrash()))
updateFileCache(clearSelection);
else if (GSS.get().getTreeView().getSelection() != null) {
- final RestResource selectedResource = GSS.get().getTreeView().getSelection();
- if (selectedResource instanceof FolderResource) {
-
- update(true);
- }
+ update(true);
}
updateFileCache(clearSelection);
}
@@ -596,8 +705,8 @@ public class FileList extends Composite {
update(true);
return;
}
- if (folderItem instanceof FolderResource) {
- setFiles(((FolderResource) folderItem).getFiles());
+ if (folderItem instanceof RestResourceWrapper) {
+ setFiles(((RestResourceWrapper) folderItem).getResource().getFiles());
update(true);
}
if (folderItem instanceof SharedResource) {
@@ -614,12 +723,13 @@ public class FileList extends Composite {
* Fill the file cache with data.
*/
public void setFiles(final List