Updated in order to use setPublic(boolean bool)
Updated icons git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@131399 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
53ea8e8d5f
commit
ccdf36480c
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/workspace-6.13.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/workspace-6.14.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
|
@ -26,5 +26,5 @@
|
|||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
|
||||
<classpathentry kind="output" path="target/workspace-6.13.1-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/workspace-6.14.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -557,7 +557,7 @@ public class AppController implements SubscriberInterface {
|
|||
}
|
||||
|
||||
GWT.log("FILE MODEL DOUBLE CLICK: "+fileModel);
|
||||
FolderModel folder = new FolderModel(fileModel.getIdentifier(), fileModel.getName(), fileModel.getParentFileModel(), true, fileModel.isShared(),fileModel.isVreFolder());
|
||||
FolderModel folder = new FolderModel(fileModel.getIdentifier(), fileModel.getName(), fileModel.getParentFileModel(), true, fileModel.isShared(),fileModel.isVreFolder(), fileModel.isPublic());
|
||||
updateStoreByRpc(folder);
|
||||
wsPortlet.getGridGroupContainer().setCurrentFolderView(folder);
|
||||
loadBreadcrumbByFileModel(fileModel, true);
|
||||
|
@ -867,7 +867,7 @@ public class AppController implements SubscriberInterface {
|
|||
List<FileModel> ingnoreFile = new ArrayList<FileModel>(size);
|
||||
for (FileModel file : targets) {
|
||||
GWT.log("Checking file "+file);
|
||||
if(file.getType()!=null && file.getType().equals(GXTFolderItemTypeEnum.SHARED_FOLDER.toString()) || file.isSpecialFolder()){
|
||||
if(file.getType()!=null && file.getType().equals(GXTFolderItemTypeEnum.FOLDER_SHARED.toString()) || file.isSpecialFolder()){
|
||||
ingnoreFile.add(file);
|
||||
clearTargets.remove(file);
|
||||
}
|
||||
|
@ -1498,7 +1498,7 @@ public class AppController implements SubscriberInterface {
|
|||
return;
|
||||
|
||||
//CREATE FOLDER PARENT FOR RPC
|
||||
final FileModel parent = new FolderModel(folder.getIdentifier(), folder.getName(), folder.getParentFileModel(), true, folder.isShared(), folder.isVreFolder());
|
||||
final FileModel parent = new FolderModel(folder.getIdentifier(), folder.getName(), folder.getParentFileModel(), true, folder.isShared(), folder.isVreFolder(), folder.isPublic());
|
||||
wsPortlet.getGridGroupContainer().mask(ConstantsExplorer.LOADING,ConstantsExplorer.LOADINGSTYLE);
|
||||
|
||||
appContrExplorer.getRpcWorkspaceService().getFolderChildrenForFileGrid(parent, new AsyncCallback<List<FileGridModel>>() {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.gcube.portlets.user.workspace.client.view;
|
||||
|
||||
|
||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
||||
import org.gcube.portlets.user.workspace.client.ConstantsPortlet;
|
||||
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||
|
@ -15,47 +14,47 @@ import com.extjs.gxt.ui.client.util.Format;
|
|||
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
||||
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
||||
import com.extjs.gxt.ui.client.widget.ListView;
|
||||
|
||||
|
||||
/**
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
*/
|
||||
public class GxtListView extends LayoutContainer {
|
||||
|
||||
public class GxtListView extends LayoutContainer {
|
||||
|
||||
private ContentPanel cp = new ContentPanel();
|
||||
// private String headerTitle = ConstantsPortlet.RESULT;
|
||||
private ListStore<FileGridModel> store = ListStoreModel.getInstance().getStore();
|
||||
|
||||
public GxtListView() {
|
||||
|
||||
|
||||
public GxtListView() {
|
||||
|
||||
cp.setBodyBorder(false);
|
||||
cp.setHeading(ConstantsPortlet.RESULT);
|
||||
cp.setHeaderVisible(true);
|
||||
|
||||
ListView<FileGridModel> view = new ListView<FileGridModel>() {
|
||||
@Override
|
||||
protected FileGridModel prepareData(FileGridModel model) {
|
||||
String s = model.get(ConstantsExplorer.NAME);
|
||||
model.set("shortName", Format.ellipse(s, 15));
|
||||
return model;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
view.setStore(store);
|
||||
view.setItemSelector("div.thumb-wrap");
|
||||
view.getSelectionModel().addListener(Events.SelectionChange, new Listener<SelectionChangedEvent<FileModel>>() {
|
||||
|
||||
public void handleEvent(SelectionChangedEvent<FileModel> be) {
|
||||
cp.setHeading("Simple ListView (" + be.getSelection().size()
|
||||
+ " items selected)");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
cp.add(view);
|
||||
|
||||
ListView<FileGridModel> view = new ListView<FileGridModel>() {
|
||||
@Override
|
||||
protected FileGridModel prepareData(FileGridModel model) {
|
||||
String s = model.get(FileModel.NAME);
|
||||
model.set("shortName", Format.ellipse(s, 15));
|
||||
return model;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
view.setStore(store);
|
||||
view.setItemSelector("div.thumb-wrap");
|
||||
view.getSelectionModel().addListener(Events.SelectionChange, new Listener<SelectionChangedEvent<FileModel>>() {
|
||||
|
||||
public void handleEvent(SelectionChangedEvent<FileModel> be) {
|
||||
cp.setHeading("Simple ListView (" + be.getSelection().size()
|
||||
+ " items selected)");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
cp.add(view);
|
||||
add(cp);
|
||||
}
|
||||
}
|
||||
|
||||
private native String getTemplate() /*-{
|
||||
return [ '<tpl for=".">', '<div class="thumb-wrap" id="{Name}">',
|
||||
|
@ -63,5 +62,5 @@ public class GxtListView extends LayoutContainer {
|
|||
'<span class="x-editable">{shortName}</span></div>', '</tpl>',
|
||||
'<div class="x-clear"></div>' ].join("");
|
||||
|
||||
}-*/;
|
||||
}
|
||||
}-*/;
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ public class WorkspaceFeaturesView extends Composite {
|
|||
overFolderlk.setAnimation(false);
|
||||
overFolderlk.setWidget(flk);
|
||||
overFolderlk.setHeading("Workspace Folder Link");
|
||||
String icon = "<span style=\"margin-right:5px\">"+Resources.getIconFolderLink().getSafeHtml().asString()+"</span>";
|
||||
String icon = "<span style=\"margin-right:5px\">"+Resources.getIconFolderPublic().getSafeHtml().asString()+"</span>";
|
||||
overFolderlk.setText(icon+"The owner or administrator can create the Folder Link as public link in order to allow 'guest' users to access to the content of the folder (and its sub-folders). " +
|
||||
"The 'guest' user will access in read-only mode and it will can navigate and download files of the Folder Link (and its subfolders). You can send the Folder Link to anyone by pasting it into Workspace Message, your emails, instant messages, etc.");
|
||||
overFolderlk.setHtml(true);
|
||||
|
|
|
@ -70,7 +70,7 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
private FileGridModel currentItemSelected = null;
|
||||
private FileModel currentFolderView = null;
|
||||
private GroupingView view = new GroupingView();
|
||||
private boolean groupingEnabled = false;
|
||||
private boolean groupingEnabled = false;
|
||||
private NumberFormat number = ConstantsExplorer.numberFormatterKB;
|
||||
private final Grid<FileGridModel> grid;
|
||||
|
||||
|
@ -82,27 +82,27 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
public GxtGridFilterGroupPanel(boolean group) {
|
||||
// setLayout(new FitLayout());
|
||||
setId("GxtGridFilterGroupPanel "+Random.nextInt());
|
||||
ColumnConfig icon = new ColumnConfig(ConstantsExplorer.ICON, "", 25);
|
||||
ColumnConfig icon = new ColumnConfig(FileModel.ICON, "", 25);
|
||||
icon.setSortable(false);
|
||||
ColumnConfig name = new ColumnConfig(ConstantsExplorer.NAME, ConstantsExplorer.NAME, 300);
|
||||
ColumnConfig type = new ColumnConfig(ConstantsExplorer.TYPE, ConstantsExplorer.TYPE, 50);
|
||||
ColumnConfig lastUpdate = new ColumnConfig(ConstantsExplorer.LASTMODIFIED, "Last Update", 100);
|
||||
ColumnConfig name = new ColumnConfig(FileGridModel.NAME, FileGridModel.NAME, 300);
|
||||
ColumnConfig type = new ColumnConfig(FileGridModel.TYPE, FileGridModel.TYPE, 50);
|
||||
ColumnConfig lastUpdate = new ColumnConfig(FileGridModel.LASTMODIFIED, "Last Update", 100);
|
||||
lastUpdate.setDateTimeFormat(DateTimeFormat.getFormat("dd MMM hh:mm aaa yyyy"));
|
||||
ColumnConfig category = new ColumnConfig(ConstantsExplorer.SHORTCUTCATEGORY, ConstantsExplorer.SHORTCUTCATEGORY, 100);
|
||||
ColumnConfig size = new ColumnConfig(ConstantsExplorer.SIZE, ConstantsExplorer.SIZE, 50);
|
||||
ColumnConfig ownerFullName = new ColumnConfig(ConstantsExplorer.OWNERFULLNAME, ConstantsExplorer.OWNER, 100);
|
||||
|
||||
size.setEditor(new CellEditor(new NumberField()));
|
||||
|
||||
ColumnConfig category = new ColumnConfig(FileModel.SHORTCUTCATEGORY, FileModel.SHORTCUTCATEGORY, 100);
|
||||
ColumnConfig size = new ColumnConfig(FileGridModel.SIZE, FileGridModel.SIZE, 50);
|
||||
ColumnConfig ownerFullName = new ColumnConfig(FileGridModel.OWNERFULLNAME, FileGridModel.OWNER, 100);
|
||||
|
||||
size.setEditor(new CellEditor(new NumberField()));
|
||||
|
||||
ColumnModel cm = null;
|
||||
|
||||
if(group)
|
||||
cm = new ColumnModel(Arrays.asList(icon, name, ownerFullName, type, lastUpdate, size, category));
|
||||
else
|
||||
cm = new ColumnModel(Arrays.asList(icon, name, ownerFullName, type, lastUpdate, size));
|
||||
|
||||
|
||||
final ColumnModel columnModel = cm;
|
||||
|
||||
|
||||
cp.setBodyBorder(true);
|
||||
cp.setHeaderVisible(false);
|
||||
cp.setLayout(new FitLayout());
|
||||
|
@ -110,159 +110,159 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
grid = new Grid<FileGridModel>(store, columnModel);
|
||||
grid.getView().setAutoFill(true);
|
||||
|
||||
view.setShowGroupedColumn(false);
|
||||
view.setForceFit(true);
|
||||
view.setShowGroupedColumn(false);
|
||||
view.setForceFit(true);
|
||||
grid.setView(view);
|
||||
view.setEmptyText(ConstantsExplorer.EMPTY);
|
||||
|
||||
view.setEmptyText(FileGridModel.EMPTY);
|
||||
|
||||
if(group){
|
||||
store.groupBy(ConstantsExplorer.SHORTCUTCATEGORY);
|
||||
store.groupBy(FileGridModel.SHORTCUTCATEGORY);
|
||||
groupingEnabled = true;
|
||||
}
|
||||
|
||||
GridCellRenderer<FileGridModel> folderRender = new GridCellRenderer<FileGridModel>() {
|
||||
|
||||
GridCellRenderer<FileGridModel> folderRender = new GridCellRenderer<FileGridModel>() {
|
||||
@Override
|
||||
public String render(FileGridModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<FileGridModel> store, Grid<FileGridModel> grid) {
|
||||
String val = model.get(property);
|
||||
String val = model.get(property);
|
||||
String color = "black";
|
||||
|
||||
|
||||
if(val==null || val.isEmpty())
|
||||
return "";
|
||||
|
||||
|
||||
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' style='color:" + color + "'>" + val + "</span>";
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
GridCellRenderer<FileGridModel> kbRender = new GridCellRenderer<FileGridModel>() {
|
||||
@Override
|
||||
public String render(FileGridModel model, String property, ColumnData config,
|
||||
int rowIndex, int colIndex, ListStore<FileGridModel> store, Grid<FileGridModel> grid) {
|
||||
|
||||
|
||||
long value = (Long) model.get(property);
|
||||
|
||||
|
||||
if(value!=-1){
|
||||
String color = "black";
|
||||
double kb = value/1024;
|
||||
if(kb<1)
|
||||
kb=1;
|
||||
return "<span style='color:"+color+"'>" + number.format(kb) + "</span>";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
size.setRenderer(kbRender);
|
||||
type.setRenderer(folderRender);
|
||||
|
||||
|
||||
//setAlphanumericStoreSorter(grid);
|
||||
|
||||
|
||||
GridFilters filters = new GridFilters();
|
||||
filters.setLocal(true);
|
||||
|
||||
StringFilter nameFilter = new StringFilter(ConstantsExplorer.NAME);
|
||||
StringFilter authorFilter = new StringFilter(ConstantsExplorer.TYPE);
|
||||
DateFilter dateFilter = new DateFilter(ConstantsExplorer.LASTMODIFIED);
|
||||
NumericFilter sizeFilter = new NumericFilter(ConstantsExplorer.SIZE);
|
||||
|
||||
StringFilter nameFilter = new StringFilter(FileGridModel.NAME);
|
||||
StringFilter authorFilter = new StringFilter(FileGridModel.TYPE);
|
||||
DateFilter dateFilter = new DateFilter(FileGridModel.LASTMODIFIED);
|
||||
NumericFilter sizeFilter = new NumericFilter(FileGridModel.SIZE);
|
||||
|
||||
filters.addFilter(nameFilter);
|
||||
filters.addFilter(authorFilter);
|
||||
filters.addFilter(dateFilter);
|
||||
filters.addFilter(sizeFilter);
|
||||
|
||||
|
||||
// grid.setStyleAttribute("borderTop", "none");
|
||||
grid.setAutoExpandColumn(ConstantsExplorer.NAME);
|
||||
grid.setAutoExpandColumn(FileGridModel.NAME);
|
||||
grid.setBorders(false);
|
||||
grid.setStripeRows(true);
|
||||
grid.setColumnLines(true);
|
||||
|
||||
|
||||
grid.getView().setShowDirtyCells(false);
|
||||
grid.addPlugin(filters);
|
||||
grid.getSelectionModel().setSelectionMode(SelectionMode.MULTI);
|
||||
|
||||
|
||||
grid.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener<FileGridModel>() {
|
||||
|
||||
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent<FileGridModel> se) {
|
||||
System.out.println("selection grid change");
|
||||
|
||||
|
||||
ModelData target = se.getSelectedItem();
|
||||
|
||||
|
||||
if(target!=null){
|
||||
currentItemSelected = (FileGridModel) target;
|
||||
|
||||
|
||||
boolean isMultiselection = false;
|
||||
|
||||
|
||||
if(se.getSelection()!=null && se.getSelection().size()>1)
|
||||
isMultiselection = true;
|
||||
|
||||
|
||||
AppController.getEventBus().fireEvent(new GridElementSelectedEvent(target, isMultiselection));
|
||||
}
|
||||
else{
|
||||
currentItemSelected = null;
|
||||
AppController.getEventBus().fireEvent(new GridElementUnSelectedEvent());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
grid.addListener(Events.RowDoubleClick, new Listener<BaseEvent>() {
|
||||
|
||||
|
||||
@Override
|
||||
public void handleEvent(BaseEvent be) {
|
||||
|
||||
|
||||
FileGridModel fileModel = grid.getSelectionModel().getSelectedItem();
|
||||
|
||||
|
||||
if(fileModel!=null)
|
||||
fireEventByFileModelType(fileModel);
|
||||
// if(fileModel.isDirectory())
|
||||
// AppController.getEventBus().fireEvent(new DoubleClickElementSelectedEvent(fileModel));
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
grid.setContextMenu(null); //add context menu null - ignore browse event right click
|
||||
|
||||
|
||||
|
||||
grid.setContextMenu(null); //add context menu null - ignore browse event right click
|
||||
|
||||
grid.addListener(Events.OnContextMenu, new Listener<GridEvent<FileGridModel>>(){
|
||||
@Override
|
||||
public void handleEvent(GridEvent<FileGridModel> be)
|
||||
public void handleEvent(GridEvent<FileGridModel> be)
|
||||
{
|
||||
|
||||
|
||||
if(be.isRightClick())
|
||||
{
|
||||
if(grid.getSelectionModel().getSelectedItem()!=null){
|
||||
|
||||
|
||||
if(grid.getSelectionModel().getSelection().size()>1){
|
||||
new InfoDisplay("Info", "The context menu is not available if multi-select is active");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
FileGridModel fileGridModel = grid.getSelectionModel().getSelectedItem();
|
||||
AppController.getEventBus().fireEvent(new OpenContextMenuTreeEvent(fileGridModel, be.getClientX(), be.getClientY()));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
new GridDragSource(grid);
|
||||
|
||||
|
||||
cp.add(grid);
|
||||
add(cp);
|
||||
|
||||
|
||||
addDataChangedStoreListener();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Disable grouping.
|
||||
*/
|
||||
public void disableGrouping() {
|
||||
GroupingStore<FileGridModel> groupingStore = null;
|
||||
if (this.getStore() instanceof GroupingStore) {
|
||||
groupingStore = (GroupingStore<FileGridModel>) this.getStore();
|
||||
groupingStore = this.getStore();
|
||||
if (groupingStore != null) {
|
||||
groupingStore.clearGrouping();
|
||||
}
|
||||
|
@ -276,60 +276,60 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
public void enableGrouping() {
|
||||
GroupingStore<FileGridModel> groupingStore = null;
|
||||
if (this.getStore() instanceof GroupingStore) {
|
||||
groupingStore = (GroupingStore<FileGridModel>) this.getStore();
|
||||
groupingStore = this.getStore();
|
||||
if (groupingStore != null) {
|
||||
groupingStore.groupBy(ConstantsExplorer.SHORTCUTCATEGORY);
|
||||
groupingStore.groupBy(FileGridModel.SHORTCUTCATEGORY);
|
||||
}
|
||||
this.groupingEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fire event by file model type.
|
||||
*
|
||||
* @param target the target
|
||||
*/
|
||||
private void fireEventByFileModelType(FileModel target){
|
||||
|
||||
|
||||
if(target.isDirectory()){
|
||||
AppController.getEventBus().fireEvent(new DoubleClickElementSelectedEvent(target));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
switch(target.getGXTFolderItemType()){
|
||||
|
||||
case EXTERNAL_IMAGE:
|
||||
case IMAGE_DOCUMENT:
|
||||
|
||||
case EXTERNAL_IMAGE:
|
||||
case IMAGE_DOCUMENT:
|
||||
AppController.getEventBus().fireEvent(new ImagePreviewEvent(target,0, 0));
|
||||
break;
|
||||
case EXTERNAL_FILE:
|
||||
case EXTERNAL_PDF_FILE:
|
||||
case EXTERNAL_FILE:
|
||||
case EXTERNAL_PDF_FILE:
|
||||
case PDF_DOCUMENT:
|
||||
case DOCUMENT:
|
||||
case URL_DOCUMENT:
|
||||
case EXTERNAL_RESOURCE_LINK:
|
||||
case DOCUMENT:
|
||||
case URL_DOCUMENT:
|
||||
case EXTERNAL_RESOURCE_LINK:
|
||||
AppController.getEventBus().fireEvent(new FileDownloadEvent(target.getIdentifier(), target.getName(), DownloadType.SHOW));
|
||||
break;
|
||||
case EXTERNAL_URL:
|
||||
case EXTERNAL_URL:
|
||||
AppController.getEventBus().fireEvent(new OpenUrlEvent(target));
|
||||
break;
|
||||
case REPORT_TEMPLATE:
|
||||
case REPORT:
|
||||
case REPORT_TEMPLATE:
|
||||
case REPORT:
|
||||
AppController.getEventBus().fireEvent(new OpenReportsEvent(target));
|
||||
break;
|
||||
case QUERY:
|
||||
case TIME_SERIES:
|
||||
case METADATA:
|
||||
case WORKFLOW_REPORT:
|
||||
case WORKFLOW_TEMPLATE:
|
||||
case QUERY:
|
||||
case TIME_SERIES:
|
||||
case METADATA:
|
||||
case WORKFLOW_REPORT:
|
||||
case WORKFLOW_TEMPLATE:
|
||||
break;
|
||||
default:
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Reset store.
|
||||
|
@ -337,8 +337,8 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
private void resetStore(){
|
||||
store.removeAll();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Update store.
|
||||
*
|
||||
|
@ -346,7 +346,7 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
* @return true, if successful
|
||||
*/
|
||||
public boolean updateStore(List<FileGridModel> result){
|
||||
|
||||
|
||||
resetStore();
|
||||
if(result!= null && result.size()>0){
|
||||
for(FileGridModel file: result)
|
||||
|
@ -356,8 +356,8 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Adds the to store.
|
||||
*
|
||||
|
@ -365,7 +365,7 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
* @return true, if successful
|
||||
*/
|
||||
public boolean addToStore(FileGridModel result){
|
||||
|
||||
|
||||
if(result!= null){
|
||||
result.setIcon();
|
||||
store.add(result);
|
||||
|
@ -373,47 +373,47 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the selected item.
|
||||
*
|
||||
* @return the selected item
|
||||
*/
|
||||
public FileGridModel getSelectedItem(){
|
||||
|
||||
|
||||
return currentItemSelected;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the selected items.
|
||||
*
|
||||
* @return the selected items
|
||||
*/
|
||||
public List<FileGridModel> getSelectedItems(){
|
||||
|
||||
|
||||
return grid.getSelectionModel().getSelection();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the ids selected items.
|
||||
*
|
||||
* @return the ids selected items
|
||||
*/
|
||||
public List<String> getIdsSelectedItems(){
|
||||
|
||||
|
||||
if(grid.getSelectionModel().getSelection()!=null){
|
||||
|
||||
|
||||
List<String> ids = new ArrayList<String>();
|
||||
for (FileModel file : grid.getSelectionModel().getSelection()) {
|
||||
ids.add(file.getIdentifier());
|
||||
}
|
||||
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete item.
|
||||
*
|
||||
|
@ -421,17 +421,17 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
* @return true, if successful
|
||||
*/
|
||||
public boolean deleteItem(String identifier) {
|
||||
|
||||
|
||||
FileGridModel fileTarget = getFileGridModelByIdentifier(identifier);
|
||||
|
||||
|
||||
if(fileTarget!=null){
|
||||
Record record = store.getRecord(fileTarget);
|
||||
Record record = store.getRecord(fileTarget);
|
||||
store.remove((FileGridModel) record.getModel());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
System.out.println("Delete Error: file target with " + identifier + " identifier not exist in store" );
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -444,15 +444,15 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
* @return true, if successful
|
||||
*/
|
||||
private boolean renameItem(FileGridModel fileTarget, String newName, String extension) {
|
||||
|
||||
|
||||
if(fileTarget!=null){
|
||||
Record record = store.getRecord(fileTarget);
|
||||
Record record = store.getRecord(fileTarget);
|
||||
if(record!=null){
|
||||
if(extension!= null)
|
||||
record.set(ConstantsExplorer.NAME, newName+extension);
|
||||
record.set(FileGridModel.NAME, newName+extension);
|
||||
else
|
||||
record.set(ConstantsExplorer.NAME, newName);
|
||||
|
||||
record.set(FileGridModel.NAME, newName);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -460,7 +460,7 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
}
|
||||
else
|
||||
System.out.println("Rename Error: file target with is null" );
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -501,10 +501,10 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
Record record = store.getRecord(fileTarget);
|
||||
if(record!=null){
|
||||
if(extension!= null)
|
||||
record.set(ConstantsExplorer.NAME, newName+extension);
|
||||
record.set(FileGridModel.NAME, newName+extension);
|
||||
else
|
||||
record.set(ConstantsExplorer.NAME, newName);
|
||||
|
||||
record.set(FileGridModel.NAME, newName);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -513,11 +513,11 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
}
|
||||
else
|
||||
System.out.println("Rename Error: file target is null" );
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the file grid model by identifier.
|
||||
*
|
||||
|
@ -525,9 +525,9 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
* @return the file grid model by identifier
|
||||
*/
|
||||
public FileGridModel getFileGridModelByIdentifier(String id){
|
||||
return (FileGridModel) store.findModel(ConstantsExplorer.IDENTIFIER, id);
|
||||
return store.findModel(FileGridModel.IDENTIFIER, id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Select item by file model id.
|
||||
*
|
||||
|
@ -535,21 +535,21 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
* @return true, if successful
|
||||
*/
|
||||
public boolean selectItemByFileModelId(String id){
|
||||
|
||||
|
||||
if(id!=null && !id.isEmpty()){
|
||||
|
||||
|
||||
FileGridModel fileModel = getFileGridModelByIdentifier(id);
|
||||
|
||||
|
||||
if(fileModel!=null){
|
||||
grid.getSelectionModel().select(fileModel, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the store.
|
||||
*
|
||||
|
@ -558,70 +558,70 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
public GroupingStore<FileGridModel> getStore(){
|
||||
return store;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the border as on search.
|
||||
*
|
||||
* @param bool the new border as on search
|
||||
*/
|
||||
public void setBorderAsOnSearch(boolean bool){
|
||||
|
||||
|
||||
if(this.cp.getElement("body")!=null){
|
||||
|
||||
|
||||
if(bool){
|
||||
this.cp.getElement("body").getStyle().setBorderColor("#32CD32");
|
||||
}
|
||||
else
|
||||
this.cp.getElement("body").getStyle().setBorderColor("#99BBE8");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the data changed store listener.
|
||||
*/
|
||||
private void addDataChangedStoreListener(){
|
||||
|
||||
|
||||
store.addListener(Store.Add, new Listener<StoreEvent<ModelData>>(){
|
||||
|
||||
@Override
|
||||
public void handleEvent(StoreEvent<ModelData> be) {
|
||||
AppController.getEventBus().fireEvent(new StoreGridChangedEvent(storeSize()));
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
store.addListener(Store.Remove, new Listener<StoreEvent<ModelData>>(){
|
||||
|
||||
@Override
|
||||
public void handleEvent(StoreEvent<ModelData> be) {
|
||||
AppController.getEventBus().fireEvent(new StoreGridChangedEvent(storeSize()));
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
store.addListener(Store.Clear, new Listener<StoreEvent<ModelData>>(){
|
||||
|
||||
@Override
|
||||
public void handleEvent(StoreEvent<ModelData> be) {
|
||||
AppController.getEventBus().fireEvent(new StoreGridChangedEvent(storeSize()));
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Store size.
|
||||
*
|
||||
* @return -1 if store is null. The size otherwise
|
||||
*/
|
||||
private int storeSize(){
|
||||
|
||||
|
||||
if(store!=null && store.getModels()!=null){
|
||||
return store.getModels().size();
|
||||
}
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -632,7 +632,7 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
* @param height the height
|
||||
*/
|
||||
public void refreshSize(String width, String height) {
|
||||
|
||||
|
||||
// if(this.isRendered()){
|
||||
// GWT.log("refresh size grid "+height);
|
||||
// this.setHeight(height);
|
||||
|
@ -642,5 +642,5 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
|||
cp.setSize(width, height);
|
||||
// grid.setSize(width, height);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -4,7 +4,6 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.workspace.client.AppController;
|
||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
||||
import org.gcube.portlets.user.workspace.client.ConstantsPortlet;
|
||||
import org.gcube.portlets.user.workspace.client.event.GridElementSelectedEvent;
|
||||
import org.gcube.portlets.user.workspace.client.event.GridElementUnSelectedEvent;
|
||||
|
@ -31,12 +30,13 @@ import com.extjs.gxt.ui.client.widget.grid.filters.GridFilters;
|
|||
import com.extjs.gxt.ui.client.widget.grid.filters.StringFilter;
|
||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||
|
||||
/**
|
||||
* This class is not used
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* The Class GxtGridFilterPanel.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Sep 15, 2016
|
||||
*/
|
||||
public class GxtGridFilterPanel extends LayoutContainer {
|
||||
|
||||
private ContentPanel cp = new ContentPanel();
|
||||
|
@ -44,57 +44,60 @@ public class GxtGridFilterPanel extends LayoutContainer {
|
|||
private FileGridModel currenItemSelected = null;
|
||||
private FileModel currentFolderView = null;
|
||||
|
||||
/**
|
||||
* Instantiates a new gxt grid filter panel.
|
||||
*/
|
||||
public GxtGridFilterPanel() {
|
||||
setLayout(new FitLayout());
|
||||
ColumnConfig name = new ColumnConfig(ConstantsExplorer.NAME, ConstantsExplorer.NAME, 400);
|
||||
ColumnConfig type = new ColumnConfig(ConstantsExplorer.TYPE, ConstantsExplorer.TYPE, 100);
|
||||
ColumnConfig creationDate = new ColumnConfig(ConstantsExplorer.GRIDCOLUMNCREATIONDATE, ConstantsExplorer.GRIDCOLUMNCREATIONDATE, 100);
|
||||
ColumnConfig size = new ColumnConfig(ConstantsExplorer.SIZE, ConstantsExplorer.SIZE, 50);
|
||||
ColumnConfig name = new ColumnConfig(FileGridModel.NAME, FileGridModel.NAME, 400);
|
||||
ColumnConfig type = new ColumnConfig(FileGridModel.TYPE, FileGridModel.TYPE, 100);
|
||||
ColumnConfig creationDate = new ColumnConfig(FileGridModel.GRIDCOLUMNCREATIONDATE, FileGridModel.GRIDCOLUMNCREATIONDATE, 100);
|
||||
ColumnConfig size = new ColumnConfig(FileGridModel.SIZE, FileGridModel.SIZE, 50);
|
||||
|
||||
ColumnModel cm = new ColumnModel(Arrays.asList(name, type, creationDate, size));
|
||||
|
||||
|
||||
cp.setBodyBorder(false);
|
||||
cp.setHeading(ConstantsPortlet.RESULT);
|
||||
cp.setHeaderVisible(true);
|
||||
cp.setLayout(new FitLayout());
|
||||
|
||||
|
||||
GridFilters filters = new GridFilters();
|
||||
filters.setLocal(true);
|
||||
|
||||
StringFilter nameFilter = new StringFilter(ConstantsExplorer.NAME);
|
||||
StringFilter authorFilter = new StringFilter(ConstantsExplorer.TYPE);
|
||||
StringFilter sizeFilter = new StringFilter(ConstantsExplorer.SIZE);
|
||||
StringFilter nameFilter = new StringFilter(FileGridModel.NAME);
|
||||
StringFilter authorFilter = new StringFilter(FileGridModel.TYPE);
|
||||
StringFilter sizeFilter = new StringFilter(FileGridModel.SIZE);
|
||||
|
||||
filters.addFilter(nameFilter);
|
||||
filters.addFilter(authorFilter);
|
||||
filters.addFilter(sizeFilter);
|
||||
|
||||
|
||||
final Grid<FileGridModel> grid = new Grid<FileGridModel>(store, cm);
|
||||
|
||||
|
||||
grid.getView().setAutoFill(true);
|
||||
|
||||
|
||||
setAlphanumericStoreSorter(grid);
|
||||
|
||||
grid.setAutoExpandColumn(ConstantsExplorer.NAME);
|
||||
|
||||
grid.setAutoExpandColumn(FileGridModel.NAME);
|
||||
grid.setBorders(false);
|
||||
grid.setStripeRows(true);
|
||||
grid.setColumnLines(true);
|
||||
grid.addPlugin(filters);
|
||||
|
||||
|
||||
|
||||
|
||||
grid.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener<FileGridModel>() {
|
||||
|
||||
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent<FileGridModel> se) {
|
||||
System.out.println(" SelectionChangedListener selection grid change");
|
||||
|
||||
|
||||
ModelData target = se.getSelectedItem();
|
||||
|
||||
if(target!=null){
|
||||
currenItemSelected = (FileGridModel) target;
|
||||
|
||||
|
||||
boolean isMultiselection = false;
|
||||
|
||||
|
||||
if(se.getSelection()!=null && se.getSelection().size()>1)
|
||||
isMultiselection = true;
|
||||
AppController.getEventBus().fireEvent(new GridElementSelectedEvent(target, isMultiselection));
|
||||
|
@ -105,29 +108,38 @@ public class GxtGridFilterPanel extends LayoutContainer {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
grid.addListener(Events.RowDoubleClick, new Listener<BaseEvent>() {
|
||||
|
||||
@Override
|
||||
public void handleEvent(BaseEvent be) {
|
||||
// FileGridModel fileModel = (FileGridModel) be.getSource();
|
||||
// if(fileModel.isDirectory())
|
||||
// FileGridModel fileModel = (FileGridModel) be.getSource();
|
||||
// if(fileModel.isDirectory())
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
cp.add(grid);
|
||||
add(cp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reset store.
|
||||
*/
|
||||
private void resetStore(){
|
||||
store.removeAll();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Update store.
|
||||
*
|
||||
* @param result the result
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean updateStore(List<FileGridModel> result){
|
||||
|
||||
|
||||
resetStore();
|
||||
if(result!= null){
|
||||
store.add(result);
|
||||
|
@ -135,46 +147,70 @@ public class GxtGridFilterPanel extends LayoutContainer {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public FileGridModel getSelectedItem(){
|
||||
|
||||
return currenItemSelected;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the selected item.
|
||||
*
|
||||
* @return the selected item
|
||||
*/
|
||||
public FileGridModel getSelectedItem(){
|
||||
|
||||
return currenItemSelected;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete item.
|
||||
*
|
||||
* @param identifier (MANDATORY)
|
||||
* @return
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean deleteItem(String identifier) {
|
||||
|
||||
// FileGridModel fileTarget = (FileGridModel) store.findModel("identifier", identifier);
|
||||
|
||||
// FileGridModel fileTarget = (FileGridModel) store.findModel("identifier", identifier);
|
||||
FileGridModel fileTarget = getFileGridModelByIdentifier(identifier);
|
||||
|
||||
|
||||
if(fileTarget!=null){
|
||||
Record record = store.getRecord(fileTarget);
|
||||
Record record = store.getRecord(fileTarget);
|
||||
store.remove((FileGridModel) record.getModel());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
System.out.println("Delete Error: file target with " + identifier + " identifier not exist in store" );
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the current folder view.
|
||||
*
|
||||
* @return the current folder view
|
||||
*/
|
||||
public FileModel getCurrentFolderView() {
|
||||
return currentFolderView;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the current folder view.
|
||||
*
|
||||
* @param currentFolderView the new current folder view
|
||||
*/
|
||||
public void setCurrentFolderView(FileModel currentFolderView) {
|
||||
this.currentFolderView = currentFolderView;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Rename item.
|
||||
*
|
||||
* @param itemIdentifier the item identifier
|
||||
* @param newName the new name
|
||||
* @param extension the extension
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean renameItem(String itemIdentifier, String newName, String extension) {
|
||||
|
||||
if(itemIdentifier!=null){
|
||||
|
@ -184,10 +220,10 @@ public class GxtGridFilterPanel extends LayoutContainer {
|
|||
Record record = store.getRecord(fileTarget);
|
||||
if(record!=null){
|
||||
if(extension!= null)
|
||||
record.set(ConstantsExplorer.NAME, newName+extension);
|
||||
record.set(FileGridModel.NAME, newName+extension);
|
||||
else
|
||||
record.set(ConstantsExplorer.NAME, newName);
|
||||
|
||||
record.set(FileGridModel.NAME, newName);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -196,13 +232,18 @@ public class GxtGridFilterPanel extends LayoutContainer {
|
|||
}
|
||||
else
|
||||
System.out.println("Rename Error: file target with is null" );
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the alphanumeric store sorter.
|
||||
*
|
||||
* @param grid the new alphanumeric store sorter
|
||||
*/
|
||||
private void setAlphanumericStoreSorter(Grid<FileGridModel> grid){
|
||||
|
||||
|
||||
// Sorting files
|
||||
grid.getStore().setStoreSorter(new StoreSorter<FileGridModel>() {
|
||||
|
||||
|
@ -221,11 +262,22 @@ public class GxtGridFilterPanel extends LayoutContainer {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the file grid model by identifier.
|
||||
*
|
||||
* @param id the id
|
||||
* @return the file grid model by identifier
|
||||
*/
|
||||
public FileGridModel getFileGridModelByIdentifier(String id){
|
||||
return (FileGridModel) store.findModel(ConstantsExplorer.IDENTIFIER, id);
|
||||
return store.findModel(FileGridModel.IDENTIFIER, id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the store.
|
||||
*
|
||||
* @return the store
|
||||
*/
|
||||
public ListStore<FileGridModel> getStore(){
|
||||
return store;
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ public class GxtToolBarItemFunctionality {
|
|||
toolBar.add(new SeparatorToolItem());
|
||||
|
||||
|
||||
btnFolderLink = new Button("Folder Link", Resources.getIconFolderLink());
|
||||
btnFolderLink = new Button("Folder Link", Resources.getIconFolderPublic());
|
||||
btnFolderLink.setScale(ButtonScale.SMALL);
|
||||
btnFolderLink.setIconAlign(IconAlign.TOP);
|
||||
btnFolderLink.setArrowAlign(ButtonArrowAlign.BOTTOM);
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.workspace.client.AppController;
|
||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
||||
import org.gcube.portlets.user.workspace.client.event.TrashEvent;
|
||||
import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum;
|
||||
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
||||
|
@ -59,27 +58,27 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
private Button buttonRestore;
|
||||
private Button buttonRestoreAll;
|
||||
private Button buttonEmptyTrash;
|
||||
|
||||
|
||||
public TrashInfoContainer() {
|
||||
initContentPanel();
|
||||
initGrid();
|
||||
createToolBar();
|
||||
// initDropTarget();
|
||||
|
||||
|
||||
activeButtonOnSelection(false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private void initDropTarget() {
|
||||
|
||||
|
||||
this.gridDropTarget = new GridDropTarget(grid){
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.extjs.gxt.ui.client.dnd.GridDropTarget#onDragDrop(com.extjs.gxt.ui.client.event.DNDEvent)
|
||||
*/
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDragDrop(DNDEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
@ -87,67 +86,67 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
List<FileModel> listFileModel = getDragSource(e);
|
||||
|
||||
List<String> ids = new ArrayList<String>();
|
||||
|
||||
|
||||
for (FileModel fileModel : listFileModel) {
|
||||
fileModel.setIcon();
|
||||
ids.add(fileModel.getIdentifier());
|
||||
}
|
||||
|
||||
|
||||
System.out.println("** Trash Event move handleInsertDrop is completed");
|
||||
|
||||
|
||||
super.onDragDrop(e);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private List<FileModel> getDragSource(DNDEvent event){
|
||||
|
||||
|
||||
List<FileModel> listDraggedFile = new ArrayList<FileModel>();
|
||||
|
||||
|
||||
if(event.getData() != null){
|
||||
|
||||
|
||||
List<BaseModelData> listItemsSource = event.getData();
|
||||
|
||||
|
||||
System.out.println("Trash - Number of move " + listItemsSource.size());
|
||||
|
||||
|
||||
// FileModel sourceFileModel = null; //for print
|
||||
|
||||
for(int i=0; i<listItemsSource.size(); i++){
|
||||
|
||||
if(listItemsSource.get(i) instanceof TreeStoreModel){ //DRAG FROM TREE
|
||||
|
||||
|
||||
// System.out.println("qui 1");
|
||||
//
|
||||
//
|
||||
// TreeStoreModel itemSource = (TreeStoreModel) listItemsSource.get(i);
|
||||
//
|
||||
//
|
||||
// listDraggedFile.add((FileModel) itemSource.getModel());
|
||||
|
||||
|
||||
// sourceFileModel = (FileModel) itemSource.getModel();
|
||||
//
|
||||
//
|
||||
// if(sourceFileModel.getParentFileModel()!=null)
|
||||
//
|
||||
//
|
||||
// System.out.println("Trash Source Name " + sourceFileModel.getName() + " id " + sourceFileModel.getIdentifier() + " end drag " + " Parent Name: " + sourceFileModel.getParentFileModel().getName() + "id " + sourceFileModel.getParentFileModel().getIdentifier());
|
||||
// else
|
||||
// System.out.println("Trash Source Name " + sourceFileModel.getName() + " id " + sourceFileModel.getIdentifier() + " end drag ");
|
||||
|
||||
|
||||
|
||||
|
||||
}else if(listItemsSource.get(i) instanceof FileGridModel){ //DRAG FROM GRID
|
||||
|
||||
|
||||
listDraggedFile.add((FileModel) listItemsSource.get(i));
|
||||
// FileGridModel fileGrid = listItemsSource.get(i);
|
||||
// System.out.println("qui 2");
|
||||
// System.out.println("class "+listItemsSource.get(i).getClass());
|
||||
}
|
||||
// System.out.println("Trash Child count: " + itemSource.getChildCount());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return listDraggedFile;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void initContentPanel() {
|
||||
|
@ -163,15 +162,15 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
}
|
||||
|
||||
private boolean checkSelection(){
|
||||
|
||||
|
||||
if(grid.getSelectionModel().getSelectedItems().size()==0){
|
||||
MessageBox.info("Attention", "You must pick at least one item", null);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private void createToolBar() {
|
||||
|
||||
ToolBar bar = new ToolBar();
|
||||
|
@ -180,7 +179,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
buttonRestore.setToolTip(WorkspaceTrashOperation.RESTORE.getOperationDescription());
|
||||
buttonRestore.setScale(ButtonScale.SMALL);
|
||||
buttonRestore.setIconAlign(IconAlign.TOP);
|
||||
|
||||
|
||||
buttonRestore.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
|
||||
@Override
|
||||
|
@ -190,9 +189,9 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
AppController.getEventBus().fireEvent(new TrashEvent(WorkspaceTrashOperation.RESTORE, grid.getSelectionModel().getSelectedItems()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
bar.add(buttonRestore);
|
||||
|
||||
|
||||
|
||||
buttonDelete = new Button(WorkspaceTrashOperation.DELETE_PERMANENTLY.getLabel(),Resources.getIconDeleteItem());
|
||||
buttonDelete.setToolTip(WorkspaceTrashOperation.DELETE_PERMANENTLY.getOperationDescription());
|
||||
|
@ -202,17 +201,17 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
|
||||
|
||||
if(checkSelection())
|
||||
AppController.getEventBus().fireEvent(new TrashEvent(WorkspaceTrashOperation.DELETE_PERMANENTLY, grid.getSelectionModel().getSelectedItems()));
|
||||
}
|
||||
});
|
||||
|
||||
bar.add(buttonDelete);
|
||||
|
||||
|
||||
|
||||
bar.add(new SeparatorMenuItem());
|
||||
|
||||
|
||||
buttonRestoreAll = new Button(WorkspaceTrashOperation.RESTORE_ALL.getLabel(),Resources.getIconRecycle());
|
||||
buttonRestoreAll.setToolTip(WorkspaceTrashOperation.RESTORE_ALL.getOperationDescription());
|
||||
buttonRestoreAll.setScale(ButtonScale.SMALL);
|
||||
|
@ -227,8 +226,8 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
});
|
||||
|
||||
bar.add(buttonRestoreAll);
|
||||
|
||||
|
||||
|
||||
|
||||
buttonEmptyTrash = new Button(WorkspaceTrashOperation.EMPTY_TRASH.getLabel(),Resources.getTrashEmpty());
|
||||
buttonEmptyTrash.setToolTip(WorkspaceTrashOperation.EMPTY_TRASH.getOperationDescription());
|
||||
buttonEmptyTrash.setScale(ButtonScale.SMALL);
|
||||
|
@ -243,10 +242,10 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
});
|
||||
|
||||
bar.add(buttonEmptyTrash);
|
||||
|
||||
|
||||
|
||||
|
||||
bar.add(new FillToolItem());
|
||||
|
||||
|
||||
Button buttonRefresh = new Button(WorkspaceTrashOperation.REFRESH.getLabel(),Resources.getIconRefresh());
|
||||
buttonRefresh.setToolTip(WorkspaceTrashOperation.REFRESH.getOperationDescription());
|
||||
buttonRefresh.setScale(ButtonScale.SMALL);
|
||||
|
@ -261,22 +260,22 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
});
|
||||
|
||||
bar.add(buttonRefresh);
|
||||
|
||||
|
||||
|
||||
|
||||
cp.setTopComponent(bar);
|
||||
|
||||
}
|
||||
|
||||
public void initGrid() {
|
||||
|
||||
ColumnConfig icon = new ColumnConfig(ConstantsExplorer.ICON, "", 25);
|
||||
ColumnConfig name = createSortableColumnConfig(ConstantsExplorer.NAME, ConstantsExplorer.NAME, 200);
|
||||
ColumnConfig type = createSortableColumnConfig(ConstantsExplorer.TYPE, ConstantsExplorer.TYPE, 80);
|
||||
ColumnConfig icon = new ColumnConfig(FileGridModel.ICON, "", 25);
|
||||
ColumnConfig name = createSortableColumnConfig(FileGridModel.NAME, FileGridModel.NAME, 200);
|
||||
ColumnConfig type = createSortableColumnConfig(FileGridModel.TYPE, FileGridModel.TYPE, 80);
|
||||
ColumnConfig originalPath = createSortableColumnConfig(FileTrashedModel.STOREINFO.ORIGINALPATH.toString(), "Original Path", 200);
|
||||
ColumnConfig deleteDate = createSortableColumnConfig(FileTrashedModel.STOREINFO.DELETEDATE.toString(), "Deleted Date", 90);
|
||||
deleteDate.setDateTimeFormat(DateTimeFormat.getFormat("dd MMM hh:mm aaa yyyy"));
|
||||
ColumnConfig deleteUser = createSortableColumnConfig(FileTrashedModel.STOREINFO.DELETEUSER.toString(), "Deleted By", 150);
|
||||
|
||||
|
||||
ColumnModel cm = new ColumnModel(Arrays.asList(icon, name, type, originalPath, deleteDate, deleteUser));
|
||||
|
||||
final ColumnModel columnModel = cm;
|
||||
|
@ -285,17 +284,17 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
|
||||
GroupingView view = new GroupingView();
|
||||
view.setShowGroupedColumn(false);
|
||||
|
||||
|
||||
this.grid.setView(view);
|
||||
this.grid.setContextMenu(null);
|
||||
|
||||
|
||||
GridCellRenderer<FileModel> folderRender = new GridCellRenderer<FileModel>() {
|
||||
GridCellRenderer<FileModel> folderRender = new GridCellRenderer<FileModel>() {
|
||||
@Override
|
||||
public String render(FileModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<FileModel> store, Grid<FileModel> grid) {
|
||||
String val = model.get(property);
|
||||
String val = model.get(property);
|
||||
String color = "black";
|
||||
|
||||
|
||||
if(val != null && val.equals(GXTFolderItemTypeEnum.FOLDER.toString())){
|
||||
// color = "#EEC900";
|
||||
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' style='font-weight: bold;color:" + color + "'>" + val + "</span>";
|
||||
|
@ -304,35 +303,35 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
val = "";
|
||||
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' style='color:" + color + "'>" + val + "</span>";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
type.setRenderer(folderRender);
|
||||
|
||||
GridFilters filters = new GridFilters();
|
||||
filters.setLocal(true);
|
||||
|
||||
|
||||
StringFilter nameFilter = new StringFilter(ConstantsExplorer.NAME);
|
||||
StringFilter typeFilter = new StringFilter(ConstantsExplorer.TYPE);
|
||||
|
||||
StringFilter nameFilter = new StringFilter(FileGridModel.NAME);
|
||||
StringFilter typeFilter = new StringFilter(FileGridModel.TYPE);
|
||||
DateFilter dateFilter = new DateFilter(FileTrashedModel.STOREINFO.DELETEDATE.toString());
|
||||
|
||||
|
||||
filters.addFilter(nameFilter);
|
||||
filters.addFilter(typeFilter);
|
||||
filters.addFilter(dateFilter);
|
||||
|
||||
grid.addPlugin(filters);
|
||||
|
||||
|
||||
grid.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener<FileTrashedModel>() {
|
||||
|
||||
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent<FileTrashedModel> se) {
|
||||
|
||||
|
||||
boolean selection = grid.getSelectionModel().getSelectedItems().size()>0;
|
||||
activeButtonOnSelection(selection);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
grid.getView().setAutoFill(true);
|
||||
grid.setBorders(true);
|
||||
grid.setStripeRows(true);
|
||||
|
@ -341,10 +340,10 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
grid.setColumnReordering(true);
|
||||
grid.setStyleAttribute("borderTop", "none");
|
||||
cp.add(grid);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void setPanelSize(int width, int height) {
|
||||
|
@ -366,16 +365,16 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
|
||||
store.removeAll();
|
||||
typeStoreOperation.removeAll();
|
||||
|
||||
|
||||
for (FileTrashedModel fileTrashedModel : trashFiles) {
|
||||
fileTrashedModel.setIcon();
|
||||
}
|
||||
|
||||
|
||||
store.add(trashFiles);
|
||||
|
||||
|
||||
activeButtonsOnNotEmtpy(store.getModels().size()>0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param b
|
||||
*/
|
||||
|
@ -383,7 +382,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
buttonRestoreAll.setEnabled(isNotEmpty);
|
||||
buttonEmptyTrash.setEnabled(isNotEmpty);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param multi
|
||||
*/
|
||||
|
@ -415,49 +414,49 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param identifier
|
||||
* @return
|
||||
*/
|
||||
public FileTrashedModel getFileModelByIdentifier(String identifier){
|
||||
|
||||
return store.findModel(ConstantsExplorer.IDENTIFIER, identifier);
|
||||
|
||||
|
||||
return store.findModel(FileGridModel.IDENTIFIER, identifier);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param identifier (MANDATORY)
|
||||
* @return
|
||||
*/
|
||||
public boolean deleteItem(String identifier) {
|
||||
|
||||
|
||||
FileTrashedModel fileTarget = getFileModelByIdentifier(identifier);
|
||||
|
||||
|
||||
|
||||
|
||||
if(fileTarget!=null){
|
||||
return deleteItem(fileTarget);
|
||||
}
|
||||
else
|
||||
System.out.println("Delete Error: file target with " + identifier + " identifier not exist in store" );
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param fileTarget (MANDATORY)
|
||||
* @return
|
||||
*/
|
||||
private boolean deleteItem(FileTrashedModel fileTarget) {
|
||||
|
||||
Record record = store.getRecord(fileTarget);
|
||||
|
||||
|
||||
if (record != null) {
|
||||
|
||||
|
||||
FileTrashedModel item = (FileTrashedModel) record.getModel();
|
||||
store.remove(item);
|
||||
|
||||
|
||||
return true;
|
||||
} else
|
||||
System.out.println("Record Error: file target with "
|
||||
|
@ -465,13 +464,13 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
+ " identifier not exist in store");
|
||||
|
||||
activeButtonsOnNotEmtpy(store.getModels().size()>0);
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return the number of items contained into trash
|
||||
*/
|
||||
public int trashSize(){
|
||||
|
|
Loading…
Reference in New Issue