GUI for accountings was implemented

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@76290 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-05-27 10:21:16 +00:00
parent 304601f4a3
commit 9b868e3fc6
7 changed files with 81 additions and 17 deletions

View File

@ -138,6 +138,8 @@ import com.google.gwt.user.client.ui.HasWidgets;
*
*/
public class AppControllerExplorer implements EventHandler, TreeAppControllerInterface{
public static final GWTWorkspaceServiceAsync rpcWorkspaceService = (GWTWorkspaceServiceAsync) GWT.create(GWTWorkspaceService.class);
private ExplorerPanel explorerPanel;
private final static HandlerManager eventBus = new HandlerManager(null);
@ -659,7 +661,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
if(fileItem!=null){
String title = "Accounting history of: "+fileItem.getName();
String title = ConstantsExplorer.ACCOUNTING_HISTORY_OF+fileItem.getName();
final WindowAccountingInfo winInfo = new WindowAccountingInfo(fileItem,title);
winInfo.show();
@ -697,7 +699,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
if(fileItem!=null){
String title = "Accounting readers of: "+fileItem.getName();
String title = ConstantsExplorer.ACCOUNTING_READERS_OF+fileItem.getName();
final WindowAccountingInfo winInfo = new WindowAccountingInfo(fileItem,title);
winInfo.show();

View File

@ -51,6 +51,8 @@ public class ConstantsExplorer {
public static final String MESSAGE_SENT_IN_DATE = "Sent in date";
public static final String MESSAGE_ADD_CONTACT = "Add Contact";
public static final String MESSAGE_ADD_SUBJECT = "Add Subject";
public static final String HISTORY = "History";
public static final String ACCREAD = "Read";
public static final String MESSAGE_ERROR_OCCURED = "Sorry an error has occurred while processing your request";
public static final String INFO = "Info";
public static final String MESSAGE_SEND_TO_OK = "Your message has been successfully delivered";
@ -175,10 +177,16 @@ public class ConstantsExplorer {
public static final Object NONE = "None";
//USED IN ACCOUNTINGS
public static final String ACCOUNTING_HISTORY_OF = "Accounting history of: ";
public static final String ACCOUNTING_READERS_OF = "Accounting readers of: ";
public static final NumberFormat numberFormatterKB = NumberFormat.getFormat("#,##0 KB;(#,##0 KB)");
public enum ViewSwitchType {Tree, SmartFolder, Messages};
}

View File

@ -29,7 +29,9 @@ public enum WorkspaceOperation {
PASTE("PSI", "PSI"), // paste
REFRESH_FOLDER("RFH", "RFH"), // Refresh
WEBDAV_URL("WDV", "WDV"), // WebDav
GET_INFO("GTI", "GTI");// GET INFO
GET_INFO("GTI", "GTI"), // GET INFO
HISTORY("HST", "HST"), //HISTORY
ACCREAD("ACR", "ACR"); //ACCOUNTING READ
// //ID CONTEXT MENU

View File

@ -6,6 +6,8 @@ import java.util.List;
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.constant.WorkspaceOperation;
import org.gcube.portlets.user.workspace.client.event.AccountingHistoryEvent;
import org.gcube.portlets.user.workspace.client.event.AccountingReadersEvent;
import org.gcube.portlets.user.workspace.client.event.AddFolderEvent;
import org.gcube.portlets.user.workspace.client.event.CreateSharedFolderEvent;
import org.gcube.portlets.user.workspace.client.event.CreateUrlEvent;
@ -43,6 +45,8 @@ public class ContextMenuTree {
private HandlerManager eventBus = AppControllerExplorer.getEventBus();
private List<FileModel> listSelectedItems = null;
private MenuItem mnRead = new MenuItem();
private boolean hideSharing = false;
public ContextMenuTree() {
@ -164,12 +168,55 @@ public class ContextMenuTree {
contextMenu.add(new SeparatorMenuItem());
MenuItem mnHistory = new MenuItem();
mnHistory.setIcon(Resources.getIconHistory());
mnHistory.setId(WorkspaceOperation.HISTORY.getId());
mnHistory.setText(ConstantsExplorer.HISTORY);
mnHistory.addSelectionListener(new SelectionListener<MenuEvent>() {
@Override
public void componentSelected(MenuEvent ce) {
final FileModel sourceFileModel = listSelectedItems.get(0);
if (sourceFileModel != null) {
eventBus.fireEvent(new AccountingHistoryEvent(sourceFileModel));
}
}
});
contextMenu.add(mnHistory);
//ACCOUNTING READ
mnRead = new MenuItem();
mnRead.setIcon(Resources.getIconRead());
mnRead.setId(WorkspaceOperation.ACCREAD.getId());
mnRead.setText(ConstantsExplorer.ACCREAD);
mnRead.addSelectionListener(new SelectionListener<MenuEvent>() {
@Override
public void componentSelected(MenuEvent ce) {
final FileModel sourceFileModel = listSelectedItems.get(0);
if (sourceFileModel != null) {
eventBus.fireEvent(new AccountingReadersEvent(sourceFileModel));
}
}
});
contextMenu.add(mnRead);
contextMenu.add(new SeparatorMenuItem());
MenuItem insertFolder = new MenuItem();
insertFolder.setId(WorkspaceOperation.INSERT_FOLDER.getId());
insertFolder.setText(ConstantsExplorer.MESSAGE_ADD_FOLDER);
insertFolder.setIcon(Resources.getIconAddFolder());
insertFolder.addSelectionListener(new SelectionListener<MenuEvent>() {
public void componentSelected(MenuEvent ce) {
@ -308,9 +355,6 @@ public class ContextMenuTree {
contextMenu.add(unShare);
MenuItem rename = new MenuItem();
rename.setId(WorkspaceOperation.RENAME.getId());
rename.setText("Rename Item");
@ -557,6 +601,9 @@ public class ContextMenuTree {
contextMenu.getItemByItemId(WorkspaceOperation.REFRESH_FOLDER.getId()).setVisible(false); //set invisible refresh
// contextMenu.getItemByItemId(WorkspaceOperation.SHARE.getId()).setVisible(false); //set invisible share
// contextMenu.getItemByItemId(WorkspaceOperation.UNSHARE.getId()).setVisible(false); //set invisible unshare
contextMenu.showAt(posX, posY);
}
@ -589,6 +636,11 @@ public class ContextMenuTree {
contextMenu.getItemByItemId(WorkspaceOperation.SHARE.getId()).setVisible(false); //SHARE
contextMenu.getItemByItemId(WorkspaceOperation.UNSHARE.getId()).setVisible(false); //UNSHARE
//ACCOUNTINGS
if(selectedItem.isMarkAsRead())
mnRead.setIcon(Resources.getIconRead());
else
mnRead.setIcon(Resources.getIconNotRead());
if(selectedItem.isDirectory()){
contextMenu.getItemByItemId(WorkspaceOperation.SHARE.getId()).setVisible(true); //SHARE

View File

@ -108,10 +108,10 @@ public class AccoutingInfoContainer extends LayoutContainer {
else if(model.get(OPERATION).equals(GxtAccountingEntryType.CUT))
return Resources.getIconCut().createImage();
else if(model.get(OPERATION).equals(GxtAccountingEntryType.PASTE))
return Resources.getIconCopy().createImage();
else if(model.get(OPERATION).equals(GxtAccountingEntryType.REMOVED))
return Resources.getIconPaste().createImage();
else if(model.get(OPERATION).equals(GxtAccountingEntryType.REMOVE))
return Resources.getIconCancel().createImage();
else if(model.get(OPERATION).equals(GxtAccountingEntryType.RENAMED))
else if(model.get(OPERATION).equals(GxtAccountingEntryType.RENAME))
return Resources.getIconRenameItem().createImage();
return null;
}

View File

@ -1693,9 +1693,9 @@ public class GWTWorkspaceBuilder {
case REMOVAL:
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.REMOVED)){
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.REMOVE)){
af.setOperation(GxtAccountingEntryType.REMOVED);
af.setOperation(GxtAccountingEntryType.REMOVE);
AccountingEntryRemoval rem = (AccountingEntryRemoval) accountingEntry;
@ -1705,9 +1705,9 @@ public class GWTWorkspaceBuilder {
case RENAMING:
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.RENAMED)){
if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.RENAME)){
af.setOperation(GxtAccountingEntryType.RENAMED);
af.setOperation(GxtAccountingEntryType.RENAME);
AccountingEntryRenaming ren = (AccountingEntryRenaming) accountingEntry;

View File

@ -10,11 +10,11 @@ package org.gcube.portlets.user.workspace.shared.accounting;
*/
public enum GxtAccountingEntryType {
REMOVED("removed", "removed"),
REMOVE("removed", "removed"),
RENAMED("renamed", "renamed"),
RENAME("renamed", "renamed"),
CREATED("created", "created"),
CREATE("created", "created"),
PASTE("pasted", "pasted"),