import gr.ebs.gss.client.rest.GetCommand;
import gr.ebs.gss.client.rest.RestCommand;
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.OthersFolderResource;
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.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 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.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;
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.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.view.client.MultiSelectionModel;
import com.google.gwt.view.client.ProvidesKey;
import com.google.gwt.view.client.SelectionChangeEvent;
ImageResource zipShared();
}
+
+ DragStopEventHandler dragStop = new DragStopEventHandler() {
+
+ @Override
+ public void onDragStop(DragStopEvent event) {
+ GWT.log("DRAG STOPPED");
+
+ }
+ };
+
private static class ContactCell extends AbstractCell<gr.ebs.gss.client.rest.resource.FileResource> {
/**
}
};
- final DragAndDropColumn<FileResource,String> nameColumn = new DragAndDropColumn<FileResource,String>(new TextCell()) {
+ final DragAndDropColumn<FileResource,SafeHtml> nameColumn = new DragAndDropColumn<FileResource,SafeHtml>(new SafeHtmlCell()) {
+
@Override
- public String getValue(FileResource object) {
- // TODO Auto-generated method stub
- return object.getName();
+ public SafeHtml getValue(FileResource object) {
+ SafeHtmlBuilder sb = new SafeHtmlBuilder();
+ if (object.getContentType().endsWith("png") || object.getContentType().endsWith("gif") || object.getContentType().endsWith("jpeg") ){
+
+ sb.appendEscaped(object.getName());
+ sb.appendHtmlConstant(" <a href='" +
+ GSS.get().getTopPanel().getFileMenu().getDownloadURL(object) +
+ "' title='" + object.getOwner() + " : " + object.getPath() + object.getName() +
+ "' rel='lytebox[mnf]' " +
+ "onclick='myLytebox.start(this, false, false); return false;'>" +
+ "(view)" + "</a>");
+
+
+ }
+ else
+ sb.appendEscaped(object.getName());
+ return sb.toSafeHtml();
}
super.onBrowserEvent2(event);
}
};
+
+ celltable.addDragStopHandler(dragStop);
celltable.addDragStartHandler(new DragStartEventHandler() {
public void onDragStart(DragStartEvent event) {
FileResource value = event.getDraggableData();
- if(!selectionModel.isSelected(value)){
- event.getHelper().removeFromParent();
- return;
- }
-
com.google.gwt.dom.client.Element helper = event.getHelper();
-
SafeHtmlBuilder sb = new SafeHtmlBuilder();
- // reuse the contact cell to render the inner html of the drag helper.
- ///new CotactCell(images.blank()).render(new Context(0,0, value), value, sb);
sb.appendHtmlConstant("<b>");
sb.appendEscaped(value.getName());
sb.appendHtmlConstant("</b>");
draggableOptions.setRevert(RevertOption.ON_INVALID_DROP);
// prevents dragging when user click on the category drop-down list
draggableOptions.setCancel("select");
+
+ draggableOptions.setOnBeforeDragStart(new DragFunction() {
+
+ @Override
+ public void f(DragContext context) {
+ FileResource value = context.getDraggableData();
+ if(!selectionModel.isSelected(value)){
+ throw new StopDragException();
+ }
+
+ }
+ });
}