|
|
|
@ -53,7 +53,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
|
|
|
|
private ContentPanel cp;
|
|
|
|
|
private GroupingStore<FileTrashedModel> store = new GroupingStore<FileTrashedModel>();
|
|
|
|
|
private ListStore<FileTrashedModel> typeStoreOperation = new ListStore<FileTrashedModel>();
|
|
|
|
|
private GridDropTarget gridDropTarget;
|
|
|
|
|
private GridDropTarget gridDropTarget;
|
|
|
|
|
private Button buttonDelete;
|
|
|
|
|
private Button buttonRestore;
|
|
|
|
|
private Button buttonRestoreAll;
|
|
|
|
@ -63,7 +63,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
|
|
|
|
initContentPanel();
|
|
|
|
|
initGrid();
|
|
|
|
|
createToolBar();
|
|
|
|
|
// initDropTarget();
|
|
|
|
|
// initDropTarget();
|
|
|
|
|
activeButtonOnSelection(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -72,19 +72,23 @@ public class TrashInfoContainer extends LayoutContainer {
|
|
|
|
|
*/
|
|
|
|
|
private void initDropTarget() {
|
|
|
|
|
|
|
|
|
|
this.gridDropTarget = new GridDropTarget(grid){
|
|
|
|
|
this.gridDropTarget = new GridDropTarget(grid) {
|
|
|
|
|
|
|
|
|
|
/* (non-Javadoc)
|
|
|
|
|
* @see com.extjs.gxt.ui.client.dnd.GridDropTarget#onDragDrop(com.extjs.gxt.ui.client.event.DNDEvent)
|
|
|
|
|
/*
|
|
|
|
|
* (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
|
|
|
|
|
|
|
|
|
|
List<FileModel> listFileModel = getDragSource(e);
|
|
|
|
|
List<FileModel> listFileModel = getDragSource(e);
|
|
|
|
|
|
|
|
|
|
List<String> ids = new ArrayList<String>();
|
|
|
|
|
List<String> ids = new ArrayList<String>();
|
|
|
|
|
|
|
|
|
|
for (FileModel fileModel : listFileModel) {
|
|
|
|
|
fileModel.setIcon();
|
|
|
|
@ -95,55 +99,70 @@ public class TrashInfoContainer extends LayoutContainer {
|
|
|
|
|
|
|
|
|
|
super.onDragDrop(e);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<FileModel> getDragSource(DNDEvent event){
|
|
|
|
|
private List<FileModel> getDragSource(DNDEvent event) {
|
|
|
|
|
|
|
|
|
|
List<FileModel> listDraggedFile = new ArrayList<FileModel>();
|
|
|
|
|
List<FileModel> listDraggedFile = new ArrayList<FileModel>();
|
|
|
|
|
|
|
|
|
|
if(event.getData() != null){
|
|
|
|
|
if (event.getData() != null) {
|
|
|
|
|
|
|
|
|
|
List<BaseModelData> listItemsSource = event.getData();
|
|
|
|
|
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
|
|
|
|
|
// 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());
|
|
|
|
|
// 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());
|
|
|
|
|
// System.out.println("Trash Child count: " +
|
|
|
|
|
// itemSource.getChildCount());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return listDraggedFile;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initContentPanel() {
|
|
|
|
@ -158,9 +177,9 @@ public class TrashInfoContainer extends LayoutContainer {
|
|
|
|
|
add(cp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean checkSelection(){
|
|
|
|
|
private boolean checkSelection() {
|
|
|
|
|
|
|
|
|
|
if(grid.getSelectionModel().getSelectedItems().size()==0){
|
|
|
|
|
if (grid.getSelectionModel().getSelectedItems().size() == 0) {
|
|
|
|
|
MessageBox.info("Attention", "You must pick at least one item", null);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
@ -172,7 +191,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
|
|
|
|
|
|
|
|
|
ToolBar bar = new ToolBar();
|
|
|
|
|
|
|
|
|
|
buttonRestore = new Button(WorkspaceTrashOperation.RESTORE.getLabel(),Resources.getIconUndo());
|
|
|
|
|
buttonRestore = new Button(WorkspaceTrashOperation.RESTORE.getLabel(), Resources.getIconUndo());
|
|
|
|
|
buttonRestore.setToolTip(WorkspaceTrashOperation.RESTORE.getOperationDescription());
|
|
|
|
|
buttonRestore.setScale(ButtonScale.SMALL);
|
|
|
|
|
buttonRestore.setIconAlign(IconAlign.TOP);
|
|
|
|
@ -182,15 +201,15 @@ public class TrashInfoContainer extends LayoutContainer {
|
|
|
|
|
@Override
|
|
|
|
|
public void componentSelected(ButtonEvent ce) {
|
|
|
|
|
|
|
|
|
|
if(checkSelection())
|
|
|
|
|
AppController.getEventBus().fireEvent(new TrashEvent(WorkspaceTrashOperation.RESTORE, grid.getSelectionModel().getSelectedItems()));
|
|
|
|
|
if (checkSelection())
|
|
|
|
|
AppController.getEventBus().fireEvent(new TrashEvent(WorkspaceTrashOperation.RESTORE,
|
|
|
|
|
grid.getSelectionModel().getSelectedItems()));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
bar.add(buttonRestore);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
buttonDelete = new Button(WorkspaceTrashOperation.DELETE_PERMANENTLY.getLabel(),Resources.getIconDeleteItem());
|
|
|
|
|
buttonDelete = new Button(WorkspaceTrashOperation.DELETE_PERMANENTLY.getLabel(), Resources.getIconDeleteItem());
|
|
|
|
|
buttonDelete.setToolTip(WorkspaceTrashOperation.DELETE_PERMANENTLY.getOperationDescription());
|
|
|
|
|
buttonDelete.setScale(ButtonScale.SMALL);
|
|
|
|
|
buttonDelete.setIconAlign(IconAlign.TOP);
|
|
|
|
@ -199,17 +218,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()));
|
|
|
|
|
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 = new Button(WorkspaceTrashOperation.RESTORE_ALL.getLabel(), Resources.getIconRecycle());
|
|
|
|
|
buttonRestoreAll.setToolTip(WorkspaceTrashOperation.RESTORE_ALL.getOperationDescription());
|
|
|
|
|
buttonRestoreAll.setScale(ButtonScale.SMALL);
|
|
|
|
|
buttonRestoreAll.setIconAlign(IconAlign.TOP);
|
|
|
|
@ -222,9 +241,9 @@ public class TrashInfoContainer extends LayoutContainer {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//bar.add(buttonRestoreAll);
|
|
|
|
|
// bar.add(buttonRestoreAll);
|
|
|
|
|
|
|
|
|
|
buttonEmptyTrash = new Button(WorkspaceTrashOperation.EMPTY_TRASH.getLabel(),Resources.getTrashEmpty());
|
|
|
|
|
buttonEmptyTrash = new Button(WorkspaceTrashOperation.EMPTY_TRASH.getLabel(), Resources.getTrashEmpty());
|
|
|
|
|
buttonEmptyTrash.setToolTip(WorkspaceTrashOperation.EMPTY_TRASH.getOperationDescription());
|
|
|
|
|
buttonEmptyTrash.setScale(ButtonScale.SMALL);
|
|
|
|
|
buttonEmptyTrash.setIconAlign(IconAlign.TOP);
|
|
|
|
@ -239,10 +258,9 @@ public class TrashInfoContainer extends LayoutContainer {
|
|
|
|
|
|
|
|
|
|
bar.add(buttonEmptyTrash);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bar.add(new FillToolItem());
|
|
|
|
|
|
|
|
|
|
Button buttonRefresh = new Button(WorkspaceTrashOperation.REFRESH.getLabel(),Resources.getIconRefresh());
|
|
|
|
|
Button buttonRefresh = new Button(WorkspaceTrashOperation.REFRESH.getLabel(), Resources.getIconRefresh());
|
|
|
|
|
buttonRefresh.setToolTip(WorkspaceTrashOperation.REFRESH.getOperationDescription());
|
|
|
|
|
buttonRefresh.setScale(ButtonScale.SMALL);
|
|
|
|
|
buttonRefresh.setIconAlign(IconAlign.TOP);
|
|
|
|
@ -264,12 +282,15 @@ public class TrashInfoContainer extends LayoutContainer {
|
|
|
|
|
ColumnConfig icon = new ColumnConfig(FileGridModel.ICON, "", 40);
|
|
|
|
|
ColumnConfig name = createSortableColumnConfig(FileGridModel.NAME, FileGridModel.NAME, 190);
|
|
|
|
|
ColumnConfig type = createSortableColumnConfig(FileGridModel.TYPE, FileGridModel.TYPE, 80);
|
|
|
|
|
ColumnConfig originalPath = createSortableColumnConfig(FileTrashedModel.STOREINFO.ORIGINALPATH.toString(), "Original Path", 190);
|
|
|
|
|
ColumnConfig deleteDate = createSortableColumnConfig(FileTrashedModel.STOREINFO.DELETEDATE.toString(), "Deleted Date", 90);
|
|
|
|
|
ColumnConfig originalPath = createSortableColumnConfig(FileTrashedModel.STOREINFO.ORIGINALPATH.toString(),
|
|
|
|
|
"Original Path", 190);
|
|
|
|
|
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);
|
|
|
|
|
ColumnConfig deleteUser = createSortableColumnConfig(FileTrashedModel.STOREINFO.DELETEUSER.toString(),
|
|
|
|
|
"Deleted By", 150);
|
|
|
|
|
|
|
|
|
|
ColumnModel cm = new ColumnModel(Arrays.asList(icon, name, type, originalPath, deleteDate, deleteUser));
|
|
|
|
|
ColumnModel cm = new ColumnModel(Arrays.asList(icon, name, type, originalPath, deleteDate, deleteUser));
|
|
|
|
|
|
|
|
|
|
final ColumnModel columnModel = cm;
|
|
|
|
|
|
|
|
|
@ -281,30 +302,31 @@ public class TrashInfoContainer extends LayoutContainer {
|
|
|
|
|
this.grid.setView(view);
|
|
|
|
|
this.grid.setContextMenu(null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 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>";
|
|
|
|
|
}else{
|
|
|
|
|
if(val==null)
|
|
|
|
|
val = "";
|
|
|
|
|
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' style='color:" + color + "'>" + val + "</span>";
|
|
|
|
|
}
|
|
|
|
|
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 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>";
|
|
|
|
|
} else {
|
|
|
|
|
if (val == null)
|
|
|
|
|
val = "";
|
|
|
|
|
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val
|
|
|
|
|
+ "' style='color:" + color + "'>" + val + "</span>";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
type.setRenderer(folderRender);
|
|
|
|
|
type.setRenderer(folderRender);
|
|
|
|
|
|
|
|
|
|
GridFilters filters = new GridFilters();
|
|
|
|
|
filters.setLocal(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StringFilter nameFilter = new StringFilter(FileGridModel.NAME);
|
|
|
|
|
StringFilter typeFilter = new StringFilter(FileGridModel.TYPE);
|
|
|
|
|
DateFilter dateFilter = new DateFilter(FileTrashedModel.STOREINFO.DELETEDATE.toString());
|
|
|
|
@ -320,7 +342,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
|
|
|
|
@Override
|
|
|
|
|
public void selectionChanged(SelectionChangedEvent<FileTrashedModel> se) {
|
|
|
|
|
|
|
|
|
|
boolean selection = grid.getSelectionModel().getSelectedItems().size()>0;
|
|
|
|
|
boolean selection = grid.getSelectionModel().getSelectedItems().size() > 0;
|
|
|
|
|
activeButtonOnSelection(selection);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -334,11 +356,8 @@ public class TrashInfoContainer extends LayoutContainer {
|
|
|
|
|
grid.setStyleAttribute("borderTop", "none");
|
|
|
|
|
cp.add(grid);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setPanelSize(int width, int height) {
|
|
|
|
|
|
|
|
|
|
if (width > 0 && height > 0 && grid != null) {
|
|
|
|
@ -361,31 +380,27 @@ public class TrashInfoContainer extends LayoutContainer {
|
|
|
|
|
|
|
|
|
|
for (FileTrashedModel fileTrashedModel : trashFiles) {
|
|
|
|
|
fileTrashedModel.setIcon();
|
|
|
|
|
// GWT.log("TrashFile: "+fileTrashedModel);
|
|
|
|
|
// //Workaround remove this
|
|
|
|
|
// if(fileTrashedModel.isDirectory())
|
|
|
|
|
// fileTrashedModel.setFolderItemType(GXTFolderItemTypeEnum.FOLDER);
|
|
|
|
|
// GWT.log("TrashFile: "+fileTrashedModel);
|
|
|
|
|
// //Workaround remove this
|
|
|
|
|
// if(fileTrashedModel.isDirectory())
|
|
|
|
|
// fileTrashedModel.setFolderItemType(GXTFolderItemTypeEnum.FOLDER);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
store.add(trashFiles);
|
|
|
|
|
activeButtonsOnNotEmtpy(store.getModels().size()>0);
|
|
|
|
|
activeButtonsOnNotEmtpy(store.getModels().size() > 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param b
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
private void activeButtonsOnNotEmtpy(boolean isNotEmpty) {
|
|
|
|
|
buttonRestoreAll.setEnabled(isNotEmpty);
|
|
|
|
|
buttonEmptyTrash.setEnabled(isNotEmpty);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param multi
|
|
|
|
|
*/
|
|
|
|
|
protected void activeButtonOnSelection(boolean bool) {
|
|
|
|
|
buttonDelete.setEnabled(bool);
|
|
|
|
|
buttonRestore.setEnabled(bool);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateStore(ListStore<FileTrashedModel> store) {
|
|
|
|
|
|
|
|
|
|
resetStore();
|
|
|
|
@ -396,8 +411,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
|
|
|
|
this.grid.getStore().removeAll();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ColumnConfig createSortableColumnConfig(String id, String name,
|
|
|
|
|
int width) {
|
|
|
|
|
public ColumnConfig createSortableColumnConfig(String id, String name, int width) {
|
|
|
|
|
ColumnConfig columnConfig = new ColumnConfig(id, name, width);
|
|
|
|
|
columnConfig.setSortable(true);
|
|
|
|
|
|
|
|
|
@ -409,40 +423,35 @@ public class TrashInfoContainer extends LayoutContainer {
|
|
|
|
|
// cp.layout();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param identifier
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public FileTrashedModel getFileModelByIdentifier(String identifier){
|
|
|
|
|
public FileTrashedModel getFileModelByIdentifier(String identifier) {
|
|
|
|
|
|
|
|
|
|
return store.findModel(FileGridModel.IDENTIFIER, identifier);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param identifier (MANDATORY)
|
|
|
|
|
* @return
|
|
|
|
|
*
|
|
|
|
|
* @param identifier
|
|
|
|
|
* mandatory
|
|
|
|
|
* @return operation result
|
|
|
|
|
*/
|
|
|
|
|
public boolean deleteItem(String identifier) {
|
|
|
|
|
|
|
|
|
|
FileTrashedModel fileTarget = getFileModelByIdentifier(identifier);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(fileTarget!=null){
|
|
|
|
|
if (fileTarget != null) {
|
|
|
|
|
return deleteItem(fileTarget);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
System.out.println("Delete Error: file target with " + identifier + " identifier not exist in store" );
|
|
|
|
|
} else
|
|
|
|
|
System.out.println("Delete Error: file target with " + identifier + " identifier not exist in store");
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param fileTarget (MANDATORY)
|
|
|
|
|
* @return
|
|
|
|
|
* @param fileTarget
|
|
|
|
|
* (MANDATORY)
|
|
|
|
|
* @return operation result
|
|
|
|
|
*/
|
|
|
|
|
private boolean deleteItem(FileTrashedModel fileTarget) {
|
|
|
|
|
|
|
|
|
@ -455,11 +464,10 @@ public class TrashInfoContainer extends LayoutContainer {
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
} else
|
|
|
|
|
System.out.println("Record Error: file target with "
|
|
|
|
|
+ fileTarget.getIdentifier()
|
|
|
|
|
+ " identifier not exist in store");
|
|
|
|
|
System.out.println(
|
|
|
|
|
"Record Error: file target with " + fileTarget.getIdentifier() + " identifier not exist in store");
|
|
|
|
|
|
|
|
|
|
activeButtonsOnNotEmtpy(store.getModels().size()>0);
|
|
|
|
|
activeButtonsOnNotEmtpy(store.getModels().size() > 0);
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
@ -469,7 +477,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
|
|
|
|
*
|
|
|
|
|
* @return the number of items contained into trash
|
|
|
|
|
*/
|
|
|
|
|
public int trashSize(){
|
|
|
|
|
public int trashSize() {
|
|
|
|
|
return store.getCount();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|