Revision 9a849658

b/src/gr/grnet/pithos/web/client/FileList.java
258 258
	        public boolean handlesSelection() {
259 259
	            return false;
260 260
	        }
261
		})
262
        {
263
	         @Override
261
		}) {
262
            @Override
264 263
	         public ImageResource getValue(File entity) {
265 264
	             return getFileIcon(entity);
266 265
	         }
......
280 279
			public SafeHtml getValue(File object) {
281 280
				SafeHtmlBuilder sb = new SafeHtmlBuilder();
282 281
				sb.append(Templates.INSTANCE.filenameSpan(object.getName()));
283
				if (object.getContentType() != null && (object.getContentType().endsWith("png") || object.getContentType().endsWith("gif") || object.getContentType().endsWith("jpeg"))) {
284
        			sb.appendHtmlConstant(" ")
285
                      .append(Templates.INSTANCE.viewLink(Pithos.getFileViewURL(object), object.getName()));
286
				}
287
				
282

  
283
                final String contentType = object.getContentType();
284
                if(contentType != null)
285
                if(contentType.endsWith("png") ||
286
                   contentType.endsWith("gif") ||
287
                   contentType.endsWith("jpeg")) {
288

  
289
                    sb.appendHtmlConstant(" ").
290
                       append(Templates.INSTANCE.viewLink(Pithos.getFileViewURL(object), object.getName()));
291
                }
292

  
288 293
				return sb.toSafeHtml();
289 294
			}
290 295
			
......
361 366
	                final int x = event.getNativeEvent().getClientX();
362 367
	                final int y = event.getNativeEvent().getClientY();
363 368
	                final Folder selectedFolder = app.getSelection();
369
                    Pithos.LOG("FileList::ContextMenuHandler::onContextMenu(), selectedFolder=", selectedFolder);
364 370
	                app.scheduleFolderHeadCommand(selectedFolder, new Command() {
365 371
						
366 372
						@Override
367 373
						public void execute() {
368 374
							final List<File> selectedFiles = getSelectedFiles();
369
							Iterator<File> iter = selectedFiles.iterator();
375
                            Pithos.LOG("FileList::ContextMenuHandler::onContextMenu()::scheduledHEAD(), selectedFolder=", selectedFolder);
376
                            Pithos.LOG("FileList::ContextMenuHandler::onContextMenu()::scheduledHEAD(), ", selectedFiles.size(), " selectedFiles");
377
                            for(File selectedFile : selectedFiles) {
378
                                Pithos.LOG("FileList::ContextMenuHandler::onContextMenu()::scheduledHEAD(), selectedFile: ", selectedFile);
379
                            }
380
                            Iterator<File> iter = selectedFiles.iterator();
370 381
							iterateFilesHeadCommand(iter, new Command() {
371 382
								
372 383
								@Override
......
388 399
			
389 400
			@Override
390 401
			public void onSelectionChange(SelectionChangeEvent event) {
402
                Pithos.LOG("FileList::selectionModel::onSelectionChange(", event, ")");
391 403
				app.showRelevantToolbarButtons();
392 404
			}
393 405
		});
b/src/gr/grnet/pithos/web/client/Pithos.java
1447 1447

  
1448 1448
    public void setError(Throwable t) {
1449 1449
        error = t;
1450
        LOG(t);
1450
        LOGError(t);
1451 1451
    }
1452 1452

  
1453 1453
    public void showRelevantToolbarButtons() {
......
1531 1531
                        displayError("System error heading folder: " + t.getMessage());
1532 1532
                    }
1533 1533

  
1534
                    LOG("Error heading folder", t);
1534
                    LOG("Error HEADing folder ", folder);
1535 1535
                    setError(t);
1536 1536
                }
1537 1537

  
......
1545 1545
        }
1546 1546
    }
1547 1547

  
1548
    public void scheduleFileHeadCommand(File f, final Command callback) {
1548
    public void scheduleFileHeadCommand(final File f, final Command callback) {
1549 1549
        HeadRequest<File> headFile = new HeadRequest<File>(File.class, getStorageAPIURL(), f.getOwnerID(), f.getUri(), f) {
1550 1550

  
1551 1551
            @Override
......
1557 1557

  
1558 1558
            @Override
1559 1559
            public void onError(Throwable t) {
1560
                LOG("Error heading file", t);
1560
                LOG("Error HEADing file", f);
1561 1561
                setError(t);
1562 1562
                if(t instanceof RestException) {
1563 1563
                    displayError("Error heading file: " + ((RestException) t).getHttpStatusText());
b/src/gr/grnet/pithos/web/client/PithosSelectionEventManager.java
36 36

  
37 37

  
38 38

  
39
import java.util.ArrayList;
40
import java.util.List;
41

  
42 39
import com.google.gwt.dom.client.Element;
43 40
import com.google.gwt.dom.client.InputElement;
44 41
import com.google.gwt.dom.client.NativeEvent;
45
import com.google.gwt.view.client.CellPreviewEvent;
46
import com.google.gwt.view.client.HasData;
47
import com.google.gwt.view.client.MultiSelectionModel;
48
import com.google.gwt.view.client.Range;
49
import com.google.gwt.view.client.SelectionModel;
42
import com.google.gwt.view.client.*;
43

  
44
import java.util.ArrayList;
45
import java.util.List;
50 46

  
51 47
/**
52 48
 * An implementation of {@link com.google.gwt.view.client.CellPreviewEvent.Handler} that adds selection
......
379 375
   */
380 376
  protected void handleMultiSelectionEvent(CellPreviewEvent<T> event,
381 377
      SelectAction action, MultiSelectionModel<? super T> selectionModel) {
378
    Pithos.LOG("handleMultiSelectionEvent(action=", action, ")");
382 379
    NativeEvent nativeEvent = event.getNativeEvent();
383 380
    String type = nativeEvent.getType();
384 381
    boolean rightclick = "mousedown".equals(type) && nativeEvent.getButton()==NativeEvent.BUTTON_RIGHT;
385 382
    SelectAction action1 = action;
386 383
    if(rightclick){
384
        Pithos.LOG("handleMultiSelectionEvent(action=", action, "), rightclick");
387 385
    	boolean shift = nativeEvent.getShiftKey();
388 386
        boolean ctrlOrMeta = nativeEvent.getCtrlKey() || nativeEvent.getMetaKey();
389 387
        boolean clearOthers = (translator == null) ? !ctrlOrMeta
......
411 409
      if (action == null || action == SelectAction.DEFAULT) {
412 410
        action1 = ctrlOrMeta ? SelectAction.TOGGLE : SelectAction.SELECT;
413 411
      }
412
        Pithos.LOG("handleMultiSelectionEvent(action=", action, "), click, shift=", shift, ", ctrlOrMeta=", ctrlOrMeta, ", clearOthers=", clearOthers, ", action1=", action1);
414 413
      doMultiSelection(selectionModel, event.getDisplay(), event.getIndex(),
415 414
          event.getValue(), action1, shift, clearOthers);
416 415
      if(ctrlOrMeta){
416
          Pithos.LOG("handleMultiSelectionEvent(action=", action, "), click, ctrlOrMeta=true => cancelling event=", event);
417 417
    	  event.setCanceled(true);
418 418
      }
419 419
    } else if ("keyup".equals(type)) {
420 420
      int keyCode = nativeEvent.getKeyCode();
421
        Pithos.LOG("handleMultiSelectionEvent(action=", action, "), keyup, keyCode=", keyCode, ", isSpaceBar=", keyCode == 32);
421 422
      if (keyCode == 32) {
422 423
        /*
423 424
         * Update selection when the space bar is pressed. The spacebar always
b/src/gr/grnet/pithos/web/client/foldertree/File.java
35 35

  
36 36
package gr.grnet.pithos.web.client.foldertree;
37 37

  
38
import java.util.Date;
39
import java.util.HashMap;
40
import java.util.Map;
41

  
42 38
import com.google.gwt.http.client.Header;
43 39
import com.google.gwt.http.client.Response;
44 40
import com.google.gwt.http.client.URL;
45 41
import com.google.gwt.i18n.client.DateTimeFormat;
46
import com.google.gwt.i18n.client.NumberFormat;
47 42
import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
43
import com.google.gwt.i18n.client.NumberFormat;
48 44
import com.google.gwt.json.client.JSONObject;
49 45
import com.google.gwt.json.client.JSONValue;
46
import gr.grnet.pithos.web.client.Pithos;
50 47
import gr.grnet.pithos.web.client.Resource;
51 48

  
49
import java.util.Date;
50
import java.util.HashMap;
51
import java.util.Map;
52

  
52 53
public class File extends Resource {
53 54
    private String name;
54 55

  
......
143 144
    }
144 145

  
145 146
    public void populate(Folder _parent, JSONObject o, String _owner, String _container) {
147
        Pithos.LOG("File::populate(parent=", parent, ", o=", o, ", owner=", _owner, ", container=", _container, ")");
146 148
        this.parent = _parent;
147 149
        path = unmarshallString(o, "name");
148 150
        if (parent != null && parent.getPrefix().length() > 0)
......
223 225
    }
224 226

  
225 227
    private void populate(String _owner, Response response) {
228
        Pithos.LOG("File::populate(owner=", _owner, ", response=", response, ")");
226 229
        this.ownerID = _owner;
227 230
        published = false;
228 231
        publicUri = null;
......
283 286
	public void setName(String _name) {
284 287
		name = _name;
285 288
	}
289

  
290
    @Override
291
    public String toString() {
292
        return "File(container="+container+", name="+name+", parent="+(parent == null ? parent : parent.getName())+", published="+published+")";
293
    }
286 294
}
b/src/gr/grnet/pithos/web/client/foldertree/Folder.java
35 35

  
36 36
package gr.grnet.pithos.web.client.foldertree;
37 37

  
38
import gr.grnet.pithos.web.client.Const;
39

  
40
import java.util.Date;
41
import java.util.HashMap;
42
import java.util.LinkedHashSet;
43
import java.util.Map;
44
import java.util.Set;
45

  
46 38
import com.google.gwt.core.client.GWT;
47 39
import com.google.gwt.http.client.Response;
48 40
import com.google.gwt.http.client.URL;
......
52 44
import com.google.gwt.json.client.JSONObject;
53 45
import com.google.gwt.json.client.JSONParser;
54 46
import com.google.gwt.json.client.JSONValue;
47
import gr.grnet.pithos.web.client.Const;
55 48
import gr.grnet.pithos.web.client.Resource;
56 49

  
50
import java.util.*;
51

  
57 52
public class Folder extends Resource {
58 53
    /*
59 54
     * The name of the folder. If the folder is a container this is its name. If it is a virtual folder this is the
......
325 320

  
326 321
    @Override
327 322
    public String toString() {
328
        return "Folder(container="+container+", name="+name+", prefix="+prefix+")";
323
        return "Folder(container="+container+", name="+name+", parent="+(parent == null ? parent : parent.getName())+", prefix="+prefix+")";
329 324
    }
330 325
}

Also available in: Unified diff