From 304601f4a3b9794dae88f194301cbb36509c9182 Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Fri, 24 May 2013 16:18:14 +0000 Subject: [PATCH] updated accountings git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@75354 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/AppControllerExplorer.java | 44 +++-- .../client/event/AccountingHistoryEvent.java | 23 ++- .../client/event/AccountingReadersEvent.java | 23 ++- .../client/event/FileDownloadEvent.java | 20 +- .../client/interfaces/EventsTypeEnum.java | 3 +- .../interfaces/SubscriberInterface.java | 4 + .../workspace/client/resources/Icons.java | 3 + .../workspace/client/resources/Resources.java | 5 + .../workspace/client/resources/icons/cut.png | Bin 0 -> 650 bytes .../view/windows/AccoutingInfoContainer.java | 179 +++++++++++++++--- .../client/view/windows/DialogGetInfo.java | 12 +- .../view/windows/WindowAccountingInfo.java | 97 ++++++++-- .../workspace/server/GWTWorkspaceBuilder.java | 8 +- .../user/workspace/server/util/Util.java | 1 + .../accounting/GxtAccountingEntryType.java | 2 +- 15 files changed, 338 insertions(+), 86 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/cut.png diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java index b76895b..51df90b 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java @@ -655,14 +655,21 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt @Override public void onAccountingHistoryShow(AccountingHistoryEvent accountingHistoryEvent) { - String itemIdentifier = accountingHistoryEvent.getItemIdentifier(); + FileModel fileItem = accountingHistoryEvent.getTargetFileModel(); - if(itemIdentifier!=null){ + if(fileItem!=null){ - rpcWorkspaceService.getAccountingHistory(itemIdentifier, new AsyncCallback>() { + String title = "Accounting history of: "+fileItem.getName(); + + final WindowAccountingInfo winInfo = new WindowAccountingInfo(fileItem,title); + winInfo.show(); + winInfo.maskAccountingInfo(true); + + rpcWorkspaceService.getAccountingHistory(fileItem.getIdentifier(), new AsyncCallback>() { @Override public void onFailure(Throwable caught) { + winInfo.maskAccountingInfo(false); new MessageBoxAlert("Error", caught.getMessage(), null); } @@ -670,9 +677,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt @Override public void onSuccess(List result) { - WindowAccountingInfo info = new WindowAccountingInfo(result); - info.setWindowTitle("Test"); - info.show(); + winInfo.updateInfoContainer(result); + winInfo.maskAccountingInfo(false); } }); @@ -687,14 +693,21 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt @Override public void onAccountingReadersShow(AccountingReadersEvent accountingReadersEvent) { - String itemIdentifier = accountingReadersEvent.getItemIdentifier(); + FileModel fileItem = accountingReadersEvent.getTargetFileModel(); - if(itemIdentifier!=null){ + if(fileItem!=null){ - rpcWorkspaceService.getAccountingReaders(itemIdentifier, new AsyncCallback>() { + String title = "Accounting readers of: "+fileItem.getName(); + + final WindowAccountingInfo winInfo = new WindowAccountingInfo(fileItem,title); + winInfo.show(); + winInfo.maskAccountingInfo(true); + + rpcWorkspaceService.getAccountingReaders(fileItem.getIdentifier(), new AsyncCallback>() { @Override public void onFailure(Throwable caught) { + winInfo.maskAccountingInfo(false); new MessageBoxAlert("Error", caught.getMessage(), null); } @@ -702,9 +715,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt @Override public void onSuccess(List result) { - WindowAccountingInfo info = new WindowAccountingInfo(result); - info.setWindowTitle("Test"); - info.show(); + winInfo.updateInfoContainer(result); + winInfo.maskAccountingInfo(false); } }); @@ -725,6 +737,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt } else com.google.gwt.user.client.Window.open(ConstantsExplorer.DOWNLOAD_WORKSPACE_SERVICE+"?id="+fileDownloadEvent.getItemIdentifier(), "_self", ""); + + notifySubscriber(fileDownloadEvent); } } @@ -1515,6 +1529,12 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt + }else if(event instanceof FileDownloadEvent){ + + FileDownloadEvent messageEvent = (FileDownloadEvent) event; + + sub.fileDownloaded(messageEvent.getItemIdentifier()); + } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/AccountingHistoryEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/AccountingHistoryEvent.java index 8049b5d..1d4cfcb 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/event/AccountingHistoryEvent.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/AccountingHistoryEvent.java @@ -1,5 +1,7 @@ package org.gcube.portlets.user.workspace.client.event; +import org.gcube.portlets.user.workspace.client.model.FileModel; + import com.google.gwt.event.shared.GwtEvent; /** @@ -11,10 +13,10 @@ import com.google.gwt.event.shared.GwtEvent; public class AccountingHistoryEvent extends GwtEvent { public static Type TYPE = new Type(); - private String itemIdentifier; + private FileModel targetFileModel; - public AccountingHistoryEvent(String itemIdentifier) { - this.itemIdentifier = itemIdentifier; + public AccountingHistoryEvent(FileModel target) { + this.setTargetFileModel(target); } @Override @@ -27,12 +29,19 @@ public class AccountingHistoryEvent extends handler.onAccountingHistoryShow(this); } - public String getItemIdentifier() { - return itemIdentifier; + /** + * @return the targetFileModel + */ + public FileModel getTargetFileModel() { + return targetFileModel; } - public void setItemIdentifier(String itemIdentifier) { - this.itemIdentifier = itemIdentifier; + /** + * @param targetFileModel the targetFileModel to set + */ + public void setTargetFileModel(FileModel targetFileModel) { + this.targetFileModel = targetFileModel; } + } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/AccountingReadersEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/AccountingReadersEvent.java index 88ee4d1..9cacfa5 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/event/AccountingReadersEvent.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/AccountingReadersEvent.java @@ -1,5 +1,7 @@ package org.gcube.portlets.user.workspace.client.event; +import org.gcube.portlets.user.workspace.client.model.FileModel; + import com.google.gwt.event.shared.GwtEvent; /** @@ -11,10 +13,10 @@ import com.google.gwt.event.shared.GwtEvent; public class AccountingReadersEvent extends GwtEvent { public static Type TYPE = new Type(); - private String itemIdentifier; + private FileModel targetFileModel; - public AccountingReadersEvent(String itemIdentifier) { - this.itemIdentifier = itemIdentifier; + public AccountingReadersEvent(FileModel target) { + this.setTargetFileModel(target); } @Override @@ -27,12 +29,19 @@ public class AccountingReadersEvent extends handler.onAccountingReadersShow(this); } - public String getItemIdentifier() { - return itemIdentifier; + /** + * @return the targetFileModel + */ + public FileModel getTargetFileModel() { + return targetFileModel; } - public void setItemIdentifier(String itemIdentifier) { - this.itemIdentifier = itemIdentifier; + /** + * @param targetFileModel the targetFileModel to set + */ + public void setTargetFileModel(FileModel targetFileModel) { + this.targetFileModel = targetFileModel; } + } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/FileDownloadEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/FileDownloadEvent.java index c3ddce4..94dc237 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/event/FileDownloadEvent.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/FileDownloadEvent.java @@ -1,9 +1,12 @@ package org.gcube.portlets.user.workspace.client.event; +import org.gcube.portlets.user.workspace.client.interfaces.EventsTypeEnum; +import org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface; + import com.google.gwt.event.shared.GwtEvent; -public class FileDownloadEvent extends GwtEvent { +public class FileDownloadEvent extends GwtEvent implements GuiEventInterface { public static Type TYPE = new Type(); public enum DownloadType {SHOW, DOWNLOAD}; private String itemIdentifier = null; @@ -46,13 +49,12 @@ public class FileDownloadEvent extends GwtEvent { return itemName; } -// public FileType getFileType() { -// return fileType; -// } -// -// public String getFileTypeToString() { -// return fileType.toString(); -// } - + /* (non-Javadoc) + * @see org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface#getKey() + */ + @Override + public EventsTypeEnum getKey() { + return EventsTypeEnum.FILE_DOWNLAD_EVENT; + } } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/EventsTypeEnum.java b/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/EventsTypeEnum.java index ef70a79..cf04322 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/EventsTypeEnum.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/EventsTypeEnum.java @@ -25,5 +25,6 @@ public enum EventsTypeEnum REFRESH_FOLDER, SELECTED_MESSAGE, CREATE_NEW_MESSAGE, - REPLY_FORWARD_MESSAGE + REPLY_FORWARD_MESSAGE, + FILE_DOWNLAD_EVENT } \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/SubscriberInterface.java b/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/SubscriberInterface.java index 525a938..e558c02 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/SubscriberInterface.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/SubscriberInterface.java @@ -34,5 +34,9 @@ public interface SubscriberInterface { // void updatePrevieMessage(String fromLogin, String subject, String date, String body, List attachs); void createNewMessage(HashMap hashAttachs); + /** + * @param itemIdentifier + */ + void fileDownloaded(String itemIdentifier); } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java index 15e5470..eb30efe 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java @@ -271,5 +271,8 @@ public interface Icons extends ClientBundle { @Source("icons/history.png") ImageResource history(); + + @Source("icons/cut.png") + ImageResource cut(); } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java index c7091bb..511376e 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java @@ -59,6 +59,11 @@ public class Resources { return AbstractImagePrototype.create(ICONS.users()); } + public static AbstractImagePrototype getIconCut(){ + + return AbstractImagePrototype.create(ICONS.cut()); + } + public static AbstractImagePrototype getIconInfo(){ return AbstractImagePrototype.create(ICONS.info()); diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/cut.png b/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/cut.png new file mode 100644 index 0000000000000000000000000000000000000000..85bb2f0fd74adb2e980e19a1314f1bbe03347346 GIT binary patch literal 650 zcmV;50(Jd~P)VRiSN*cNM8!e}HvIH<9>qC z*u%>#zg$gv<}MShGjnAGJ2PkOK6By0hyU>tw;vUW?dQg807&yrQ=RMQ-E97!vNQg4 z-N*j_tUWjWKLolUYSQlg5=m36r4lDH;xu5ThU}a(Zr1-N2ys|V5M&R&;$i)N&feSq zmz{a{|DKP-|BKF6|7S?@XW}&Au#M51wR+0yLF^T(QZp|FIQ=hOeEQ!tf5-oe6~*Qr zu++b@&qD8hH!l+xRs;50>EAnPZ~Anzf$E{VUiSajXvrViWT0~Tn2ph=HZBI{xzd8= zCmhZH_X%+*U^QU6B!BX8TcaQ6fr?gZ%5MN_lGviFy#9=X>EBjP28k8wGE grid; private ContentPanel cp; private GroupingStore store = new GroupingStore(); + private boolean groupingEnabled; public AccoutingInfoContainer(){ initContentPanel(); initGrid(); + createToolBar(); + } + + private void initContentPanel() { + setLayout(new FitLayout()); + getAriaSupport().setPresentation(true); + cp = new ContentPanel(); + cp.setHeaderVisible(false); + cp.setBodyBorder(true); + cp.setLayout(new FitLayout()); + cp.setButtonAlign(HorizontalAlignment.CENTER); +// cp.getHeader().setIconAltText("Grid Icon"); +// cp.setSize(550, 280); + add(cp); + } + + private void createToolBar(){ + + ToolBar bar = new ToolBar(); + final ToggleButton buttonGrouping = new ToggleButton("", Resources.getIconGridView()); + buttonGrouping.setToolTip("Grouping by operation"); + buttonGrouping.setScale(ButtonScale.SMALL); + buttonGrouping.toggle(true); + + buttonGrouping.addSelectionListener(new SelectionListener() { + + @Override + public void componentSelected(ButtonEvent ce) { + + if(buttonGrouping.isPressed()) + enableGrouping(); + else + disableGrouping(); + } + }); + + bar.add(buttonGrouping); + cp.setTopComponent(bar); + } public void initGrid() { @@ -43,16 +94,55 @@ public class AccoutingInfoContainer extends LayoutContainer { List columns = new ArrayList(); + + ColumnConfig icon = createSortableColumnConfig("Type", "", 20); + columns.add(icon); + + icon.setRenderer(new GridCellRenderer() { + + public Object render(ModelData model, String property, ColumnData config, int rowIndex, int colIndex, + ListStore store, Grid grid) { + + if(model.get(OPERATION).equals(GxtAccountingEntryType.READ)) + return Resources.getIconRead().createImage(); + 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.getIconCancel().createImage(); + else if(model.get(OPERATION).equals(GxtAccountingEntryType.RENAMED)) + return Resources.getIconRenameItem().createImage(); + return null; + } + + }); + + ColumnConfig descr = createSortableColumnConfig(DESCRIPTION, DESCRIPTION, 230); columns.add(descr); + + descr.setRenderer(new GridCellRenderer() { + + public Object render(ModelData model, String property, ColumnData config, int rowIndex, int colIndex, + ListStore store, Grid grid) { + +// if(model.get(OPERATION).equals(GxtAccountingEntryType.READ)) +// return "

" +// + model.get(DESCRIPTION)+ "

"; + + return model.get(DESCRIPTION); + } + + }); ColumnConfig oper = createSortableColumnConfig(OPERATION, OPERATION, 70); columns.add(oper); - ColumnConfig auth = createSortableColumnConfig(OPERATION, AUTHOR, 70); + ColumnConfig auth = createSortableColumnConfig(AUTHOR, AUTHOR, 120); columns.add(auth); - ColumnConfig date = createSortableColumnConfig(DATE, DATE, 70); + ColumnConfig date = createSortableColumnConfig(DATE, DATE, 140); columns.add(date); cm = new ColumnModel(columns); @@ -60,7 +150,7 @@ public class AccoutingInfoContainer extends LayoutContainer { final ColumnModel columnModel = cm; grid = new Grid(this.store, cm); - + GroupingView view = new GroupingView(); view.setShowGroupedColumn(true); this.grid.setView(view); @@ -73,16 +163,34 @@ public class AccoutingInfoContainer extends LayoutContainer { } }); + + GridFilters filters = new GridFilters(); + filters.setLocal(true); + + DateFilter dateFilter = new DateFilter(DATE); + filters.addFilter(dateFilter); + + grid.addPlugin(filters); + + grid.setBorders(true); grid.setStripeRows(true); grid.getView().setAutoFill(true); grid.setColumnLines(true); grid.setColumnReordering(true); grid.setStyleAttribute("borderTop", "none"); - +// grid.setLoadMask(true); cp.add(grid); } + + public void setPanelSize(int width, int height){ + + if(width>0 && height>0 && grid!=null){ + cp.setSize(width, height); +// grid.setSize(width, height); + } + } public AccoutingInfoContainer(List accountings) { @@ -91,8 +199,29 @@ public class AccoutingInfoContainer extends LayoutContainer { updateListAccounting(accountings); } + public void disableGrouping() { + GroupingStore groupingStore = null; + if (store instanceof GroupingStore) { + groupingStore = (GroupingStore) store; + if (groupingStore != null) { + groupingStore.clearGrouping(); + } + this.groupingEnabled = false; + } + } + + public void enableGrouping() { + GroupingStore groupingStore = null; + if (store instanceof GroupingStore) { + groupingStore = (GroupingStore) store; + if (groupingStore != null) { + groupingStore.groupBy(OPERATION); + } + this.groupingEnabled = true; + } + } - private void updateListAccounting(List accountings){ + public void updateListAccounting(List accountings){ List listModelData = new ArrayList(); @@ -103,7 +232,7 @@ public class AccoutingInfoContainer extends LayoutContainer { baseModel.set(DESCRIPTION, gxtAccountingField.getDescription()); baseModel.set(OPERATION, gxtAccountingField.getOperation()); - baseModel.set(AUTHOR, gxtAccountingField.getUser()); + baseModel.set(AUTHOR, gxtAccountingField.getUser().getName()); baseModel.set(DATE, gxtAccountingField.getDate()); listModelData.add(baseModel); @@ -112,31 +241,17 @@ public class AccoutingInfoContainer extends LayoutContainer { store.add(listModelData); } - private void initContentPanel() { - setLayout(new FitLayout()); - getAriaSupport().setPresentation(true); - cp = new ContentPanel(); - cp.setHeaderVisible(false); - cp.setBodyBorder(true); - cp.setLayout(new FitLayout()); - cp.setButtonAlign(HorizontalAlignment.CENTER); - cp.setLayout(new FitLayout()); -// cp.getHeader().setIconAltText("Grid Icon"); - cp.setSize(500, 250); - add(cp); + + @SuppressWarnings("unused") + private void updateStore(ListStore store){ + + resetStore(); + this.grid.getStore().add(store.getModels()); } - public void updateStore(ListStore store){ - + public void resetStore(){ this.grid.getStore().removeAll(); -// for (ModelData modelData : store.getModels()){ -// this.grid.getStore().add(modelData); -// } - - this.grid.getStore().add(store.getModels()); - -// cp.layout(); } public ColumnConfig createSortableColumnConfig(String id, String name, int width) @@ -152,4 +267,14 @@ public class AccoutingInfoContainer extends LayoutContainer { // cp.layout(); } + public boolean isGroupingEnabled() { + return groupingEnabled; + } + + public void setGroupingEnabled(boolean groupingEnabled) { + this.groupingEnabled = groupingEnabled; + } + + + } \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfo.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfo.java index 5ab6fc2..6296c79 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfo.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfo.java @@ -30,6 +30,7 @@ public class DialogGetInfo extends Dialog { private int widthDialog = 450; private int heightTextArea = 50; private TextField txtName = new TextField(); + private TextField txtAreaDescription = new TextArea(); private TextField txtType = new TextField(); private TextField txtCategory = new TextField(); private TextField txtOwner = new TextField(); @@ -77,6 +78,14 @@ public class DialogGetInfo extends Dialog { add(txtLocation); + if(fileModel.isDirectory()){ + txtAreaDescription.setFieldLabel("Description"); + txtAreaDescription.setHeight(30); + txtAreaDescription.setReadOnly(true); + txtAreaDescription.setValue(fileModel.getDescription()); + add(txtAreaDescription); + } + txtType = new TextField(); txtType.setFieldLabel("Type"); txtType.setReadOnly(true); @@ -88,13 +97,14 @@ public class DialogGetInfo extends Dialog { txtCategory.setReadOnly(true); textFieldSetValue(txtCategory,fileModel.getShortcutCategory()); add(txtCategory); + txtOwner = new TextField(); txtOwner.setFieldLabel("Owner"); txtOwner.setReadOnly(true); loadOwner(fileModel.getIdentifier()); add(txtOwner); - + txtCreated = new TextField(); txtCreated.setFieldLabel("Created"); txtCreated.setReadOnly(true); diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/WindowAccountingInfo.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/WindowAccountingInfo.java index fd92ba5..59dc6fd 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/WindowAccountingInfo.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/WindowAccountingInfo.java @@ -1,42 +1,105 @@ package org.gcube.portlets.user.workspace.client.view.windows; - import java.util.List; +import org.gcube.portlets.user.workspace.client.ConstantsExplorer; +import org.gcube.portlets.user.workspace.client.model.FileModel; import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField; +import com.extjs.gxt.ui.client.event.Events; +import com.extjs.gxt.ui.client.event.Listener; +import com.extjs.gxt.ui.client.event.WindowEvent; import com.extjs.gxt.ui.client.widget.Window; +import com.extjs.gxt.ui.client.widget.layout.FitLayout; /** * * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @May 23, 2013 - * + * */ -public class WindowAccountingInfo extends Window{ - - +public class WindowAccountingInfo extends Window { + private List accountingsFields; private AccoutingInfoContainer accountingsContainers; - public WindowAccountingInfo(List accountingsFields) { - setModal(true); - setSize(550, 300); - this.accountingsFields = accountingsFields; - this.accountingsContainers = new AccoutingInfoContainer(accountingsFields); - - add(accountingsContainers); - } - - - public void setWindowTitle(String title) { - this.setHeading(title); + public WindowAccountingInfo() { + initAccounting(); +// addResizeListner(); } + public WindowAccountingInfo(FileModel fileModel, String title) { + initAccounting(); + setIcon(fileModel.getAbstractPrototypeIcon()); + setHeading(title); +// addResizeListner(); + } + + public void addResizeListner(){ + + this.addListener(Events.Resize, new Listener() { + + @Override + public void handleEvent(WindowEvent we ) + { + + if(accountingsContainers!=null){ +// System.out.println("Size in event: " + we.getWidth() + "x" + we.getHeight() ); +// accountingsContainers.setPanelSize(we.getWidth()-14, we.getHeight()-30); + } + } + + }); + } + + public WindowAccountingInfo(List accountingsFields) { + updateInfoContainer(accountingsFields); + } + + private void initAccounting() { + setModal(true); + setLayout(new FitLayout()); + setSize(700, 350); + setResizable(true); + setMaximizable(true); +// setCollapsible(true); + this.accountingsContainers = new AccoutingInfoContainer(); + add(accountingsContainers); + } + + public void setWindowTitle(String title) { + this.setHeading(title); + + } + + + + public void updateInfoContainer(List accountingsFields) { + + this.accountingsContainers.resetStore(); + this.accountingsFields = accountingsFields; + this.accountingsContainers.updateListAccounting(accountingsFields); + } public List getAccountingsFields() { return accountingsFields; } + + public void maskAccountingInfo(boolean bool){ + +// if(accountingsContainers!=null){ +// +// if(bool) +// accountingsContainers.mask(ConstantsExplorer.LOADING, ConstantsExplorer.LOADINGSTYLE); +// else +// accountingsContainers.unmask(); +// } + + if(bool) + this.mask(ConstantsExplorer.LOADING, ConstantsExplorer.LOADINGSTYLE); + else + this.unmask(); + } } diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java index 38aab41..9d6b676 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceBuilder.java @@ -1673,7 +1673,7 @@ public class GWTWorkspaceBuilder { AccountingEntryCut cut = (AccountingEntryCut) accountingEntry; - af.setDescription("cut by "+user.getName() +" from "+cut.getItemName()); + af.setDescription("cut "+cut.getItemName()+" by "+user.getName()); } break; @@ -1699,15 +1699,15 @@ public class GWTWorkspaceBuilder { AccountingEntryRemoval rem = (AccountingEntryRemoval) accountingEntry; - af.setDescription("remove by "+user.getName() +", name: "+rem.getItemName()); + af.setDescription("remove "+rem.getItemName()+" by "+user.getName()); } break; case RENAMING: - if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.RENAMING)){ + if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.RENAMED)){ - af.setOperation(GxtAccountingEntryType.RENAMING); + af.setOperation(GxtAccountingEntryType.RENAMED); AccountingEntryRenaming ren = (AccountingEntryRenaming) accountingEntry; diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/util/Util.java b/src/main/java/org/gcube/portlets/user/workspace/server/util/Util.java index e58db4e..684999c 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/util/Util.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/util/Util.java @@ -53,6 +53,7 @@ public class Util { // public static final String TEST_USER_FULL_NAME = "Francesco Mangiacrapa"; // public static final String TEST_USER = "aureliano.gentile"; public static final String TEST_USER = "test.user"; +// public static final String TEST_USER = "antonio.gioia"; public static final String TEST_USER_FULL_NAME = "Test User"; diff --git a/src/main/java/org/gcube/portlets/user/workspace/shared/accounting/GxtAccountingEntryType.java b/src/main/java/org/gcube/portlets/user/workspace/shared/accounting/GxtAccountingEntryType.java index 498b172..281ef5f 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/shared/accounting/GxtAccountingEntryType.java +++ b/src/main/java/org/gcube/portlets/user/workspace/shared/accounting/GxtAccountingEntryType.java @@ -12,7 +12,7 @@ public enum GxtAccountingEntryType { REMOVED("removed", "removed"), - RENAMING("renamed", "renamed"), + RENAMED("renamed", "renamed"), CREATED("created", "created"),