45 |
45 |
import java.util.Iterator;
|
46 |
46 |
import java.util.List;
|
47 |
47 |
|
|
48 |
import com.google.gwt.cell.client.Cell.Context;
|
48 |
49 |
import com.google.gwt.cell.client.ImageResourceCell;
|
49 |
50 |
import com.google.gwt.cell.client.SafeHtmlCell;
|
50 |
51 |
import com.google.gwt.cell.client.TextCell;
|
... | ... | |
82 |
83 |
* The styles applied to the table.
|
83 |
84 |
*/
|
84 |
85 |
interface TableStyle extends CellTable.Style {
|
|
86 |
String cellTableFirstColumnShared();
|
85 |
87 |
}
|
86 |
88 |
|
87 |
89 |
interface TableResources extends CellTable.Resources {
|
... | ... | |
236 |
238 |
images = _images;
|
237 |
239 |
this.treeView = _treeView;
|
238 |
240 |
|
239 |
|
CellTable.Resources resources = GWT.create(TableResources.class);
|
|
241 |
final CellTable.Resources resources = GWT.create(TableResources.class);
|
240 |
242 |
|
241 |
243 |
ProvidesKey<File> keyProvider = new ProvidesKey<File>(){
|
242 |
244 |
|
... | ... | |
261 |
263 |
public ImageResource getValue(File entity) {
|
262 |
264 |
return getFileIcon(entity);
|
263 |
265 |
}
|
|
266 |
|
|
267 |
@Override
|
|
268 |
public String getCellStyleNames(Context context, File object) {
|
|
269 |
if (!object.getPermissions().isEmpty() && !object.isPublished())
|
|
270 |
return ((TableStyle) resources.cellTableStyle()).cellTableFirstColumnShared();
|
|
271 |
return super.getCellStyleNames(context, object);
|
|
272 |
}
|
264 |
273 |
};
|
265 |
274 |
celltable.addColumn(status,"");
|
266 |
275 |
|
... | ... | |
421 |
430 |
*/
|
422 |
431 |
protected ImageResource getFileIcon(File file) {
|
423 |
432 |
String mimetype = file.getContentType();
|
424 |
|
boolean shared = file.isShared();
|
|
433 |
boolean published = file.isPublished();
|
425 |
434 |
if (mimetype == null)
|
426 |
|
return shared ? images.documentShared() : images.document();
|
|
435 |
return published ? images.documentShared() : images.document();
|
427 |
436 |
mimetype = mimetype.toLowerCase();
|
428 |
437 |
if (mimetype.startsWith("application/pdf"))
|
429 |
|
return shared ? images.pdfShared() : images.pdf();
|
|
438 |
return published ? images.pdfShared() : images.pdf();
|
430 |
439 |
else if (mimetype.endsWith("excel"))
|
431 |
|
return shared ? images.spreadsheetShared() : images.spreadsheet();
|
|
440 |
return published ? images.spreadsheetShared() : images.spreadsheet();
|
432 |
441 |
else if (mimetype.endsWith("msword"))
|
433 |
|
return shared ? images.wordprocessorShared() : images.wordprocessor();
|
|
442 |
return published ? images.wordprocessorShared() : images.wordprocessor();
|
434 |
443 |
else if (mimetype.endsWith("powerpoint"))
|
435 |
|
return shared ? images.presentationShared() : images.presentation();
|
|
444 |
return published ? images.presentationShared() : images.presentation();
|
436 |
445 |
else if (mimetype.startsWith("application/zip") ||
|
437 |
446 |
mimetype.startsWith("application/gzip") ||
|
438 |
447 |
mimetype.startsWith("application/x-gzip") ||
|
439 |
448 |
mimetype.startsWith("application/x-tar") ||
|
440 |
449 |
mimetype.startsWith("application/x-gtar"))
|
441 |
|
return shared ? images.zipShared() : images.zip();
|
|
450 |
return published ? images.zipShared() : images.zip();
|
442 |
451 |
else if (mimetype.startsWith("text/html"))
|
443 |
|
return shared ? images.htmlShared() : images.html();
|
|
452 |
return published ? images.htmlShared() : images.html();
|
444 |
453 |
else if (mimetype.startsWith("text/plain"))
|
445 |
|
return shared ? images.txtShared() : images.txt();
|
|
454 |
return published ? images.txtShared() : images.txt();
|
446 |
455 |
else if (mimetype.startsWith("image/"))
|
447 |
|
return shared ? images.imageShared() : images.image();
|
|
456 |
return published ? images.imageShared() : images.image();
|
448 |
457 |
else if (mimetype.startsWith("video/"))
|
449 |
|
return shared ? images.videoShared() : images.video();
|
|
458 |
return published ? images.videoShared() : images.video();
|
450 |
459 |
else if (mimetype.startsWith("audio/"))
|
451 |
|
return shared ? images.audioShared() : images.audio();
|
452 |
|
return shared ? images.documentShared() : images.document();
|
|
460 |
return published ? images.audioShared() : images.audio();
|
|
461 |
return published ? images.documentShared() : images.document();
|
453 |
462 |
}
|
454 |
463 |
|
455 |
464 |
/**
|