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
This commit is contained in:
parent
93c1e4fbda
commit
304601f4a3
|
@ -655,14 +655,21 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
@Override
|
@Override
|
||||||
public void onAccountingHistoryShow(AccountingHistoryEvent accountingHistoryEvent) {
|
public void onAccountingHistoryShow(AccountingHistoryEvent accountingHistoryEvent) {
|
||||||
|
|
||||||
String itemIdentifier = accountingHistoryEvent.getItemIdentifier();
|
FileModel fileItem = accountingHistoryEvent.getTargetFileModel();
|
||||||
|
|
||||||
if(itemIdentifier!=null){
|
if(fileItem!=null){
|
||||||
|
|
||||||
rpcWorkspaceService.getAccountingHistory(itemIdentifier, new AsyncCallback<List<GxtAccountingField>>() {
|
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<List<GxtAccountingField>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
winInfo.maskAccountingInfo(false);
|
||||||
new MessageBoxAlert("Error", caught.getMessage(), null);
|
new MessageBoxAlert("Error", caught.getMessage(), null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -670,9 +677,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<GxtAccountingField> result) {
|
public void onSuccess(List<GxtAccountingField> result) {
|
||||||
|
|
||||||
WindowAccountingInfo info = new WindowAccountingInfo(result);
|
winInfo.updateInfoContainer(result);
|
||||||
info.setWindowTitle("Test");
|
winInfo.maskAccountingInfo(false);
|
||||||
info.show();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -687,14 +693,21 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
@Override
|
@Override
|
||||||
public void onAccountingReadersShow(AccountingReadersEvent accountingReadersEvent) {
|
public void onAccountingReadersShow(AccountingReadersEvent accountingReadersEvent) {
|
||||||
|
|
||||||
String itemIdentifier = accountingReadersEvent.getItemIdentifier();
|
FileModel fileItem = accountingReadersEvent.getTargetFileModel();
|
||||||
|
|
||||||
if(itemIdentifier!=null){
|
if(fileItem!=null){
|
||||||
|
|
||||||
rpcWorkspaceService.getAccountingReaders(itemIdentifier, new AsyncCallback<List<GxtAccountingField>>() {
|
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<List<GxtAccountingField>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
winInfo.maskAccountingInfo(false);
|
||||||
new MessageBoxAlert("Error", caught.getMessage(), null);
|
new MessageBoxAlert("Error", caught.getMessage(), null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -702,9 +715,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<GxtAccountingField> result) {
|
public void onSuccess(List<GxtAccountingField> result) {
|
||||||
|
|
||||||
WindowAccountingInfo info = new WindowAccountingInfo(result);
|
winInfo.updateInfoContainer(result);
|
||||||
info.setWindowTitle("Test");
|
winInfo.maskAccountingInfo(false);
|
||||||
info.show();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -725,6 +737,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
com.google.gwt.user.client.Window.open(ConstantsExplorer.DOWNLOAD_WORKSPACE_SERVICE+"?id="+fileDownloadEvent.getItemIdentifier(), "_self", "");
|
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());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.gcube.portlets.user.workspace.client.event;
|
package org.gcube.portlets.user.workspace.client.event;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,10 +13,10 @@ import com.google.gwt.event.shared.GwtEvent;
|
||||||
public class AccountingHistoryEvent extends
|
public class AccountingHistoryEvent extends
|
||||||
GwtEvent<AccountingHistoryEventHandler> {
|
GwtEvent<AccountingHistoryEventHandler> {
|
||||||
public static Type<AccountingHistoryEventHandler> TYPE = new Type<AccountingHistoryEventHandler>();
|
public static Type<AccountingHistoryEventHandler> TYPE = new Type<AccountingHistoryEventHandler>();
|
||||||
private String itemIdentifier;
|
private FileModel targetFileModel;
|
||||||
|
|
||||||
public AccountingHistoryEvent(String itemIdentifier) {
|
public AccountingHistoryEvent(FileModel target) {
|
||||||
this.itemIdentifier = itemIdentifier;
|
this.setTargetFileModel(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,12 +29,19 @@ public class AccountingHistoryEvent extends
|
||||||
handler.onAccountingHistoryShow(this);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.gcube.portlets.user.workspace.client.event;
|
package org.gcube.portlets.user.workspace.client.event;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,10 +13,10 @@ import com.google.gwt.event.shared.GwtEvent;
|
||||||
public class AccountingReadersEvent extends
|
public class AccountingReadersEvent extends
|
||||||
GwtEvent<AccountingReadersEventHandler> {
|
GwtEvent<AccountingReadersEventHandler> {
|
||||||
public static Type<AccountingReadersEventHandler> TYPE = new Type<AccountingReadersEventHandler>();
|
public static Type<AccountingReadersEventHandler> TYPE = new Type<AccountingReadersEventHandler>();
|
||||||
private String itemIdentifier;
|
private FileModel targetFileModel;
|
||||||
|
|
||||||
public AccountingReadersEvent(String itemIdentifier) {
|
public AccountingReadersEvent(FileModel target) {
|
||||||
this.itemIdentifier = itemIdentifier;
|
this.setTargetFileModel(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,12 +29,19 @@ public class AccountingReadersEvent extends
|
||||||
handler.onAccountingReadersShow(this);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package org.gcube.portlets.user.workspace.client.event;
|
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;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
public class FileDownloadEvent extends GwtEvent<FileDownloadEventHandler> {
|
public class FileDownloadEvent extends GwtEvent<FileDownloadEventHandler> implements GuiEventInterface {
|
||||||
public static Type<FileDownloadEventHandler> TYPE = new Type<FileDownloadEventHandler>();
|
public static Type<FileDownloadEventHandler> TYPE = new Type<FileDownloadEventHandler>();
|
||||||
public enum DownloadType {SHOW, DOWNLOAD};
|
public enum DownloadType {SHOW, DOWNLOAD};
|
||||||
private String itemIdentifier = null;
|
private String itemIdentifier = null;
|
||||||
|
@ -46,13 +49,12 @@ public class FileDownloadEvent extends GwtEvent<FileDownloadEventHandler> {
|
||||||
return itemName;
|
return itemName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public FileType getFileType() {
|
/* (non-Javadoc)
|
||||||
// return fileType;
|
* @see org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface#getKey()
|
||||||
// }
|
*/
|
||||||
//
|
@Override
|
||||||
// public String getFileTypeToString() {
|
public EventsTypeEnum getKey() {
|
||||||
// return fileType.toString();
|
return EventsTypeEnum.FILE_DOWNLAD_EVENT;
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,5 +25,6 @@ public enum EventsTypeEnum
|
||||||
REFRESH_FOLDER,
|
REFRESH_FOLDER,
|
||||||
SELECTED_MESSAGE,
|
SELECTED_MESSAGE,
|
||||||
CREATE_NEW_MESSAGE,
|
CREATE_NEW_MESSAGE,
|
||||||
REPLY_FORWARD_MESSAGE
|
REPLY_FORWARD_MESSAGE,
|
||||||
|
FILE_DOWNLAD_EVENT
|
||||||
}
|
}
|
|
@ -34,5 +34,9 @@ public interface SubscriberInterface {
|
||||||
// void updatePrevieMessage(String fromLogin, String subject, String date, String body, List<FileModel> attachs);
|
// void updatePrevieMessage(String fromLogin, String subject, String date, String body, List<FileModel> attachs);
|
||||||
|
|
||||||
void createNewMessage(HashMap<String, String> hashAttachs);
|
void createNewMessage(HashMap<String, String> hashAttachs);
|
||||||
|
/**
|
||||||
|
* @param itemIdentifier
|
||||||
|
*/
|
||||||
|
void fileDownloaded(String itemIdentifier);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,5 +271,8 @@ public interface Icons extends ClientBundle {
|
||||||
|
|
||||||
@Source("icons/history.png")
|
@Source("icons/history.png")
|
||||||
ImageResource history();
|
ImageResource history();
|
||||||
|
|
||||||
|
@Source("icons/cut.png")
|
||||||
|
ImageResource cut();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,11 @@ public class Resources {
|
||||||
return AbstractImagePrototype.create(ICONS.users());
|
return AbstractImagePrototype.create(ICONS.users());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static AbstractImagePrototype getIconCut(){
|
||||||
|
|
||||||
|
return AbstractImagePrototype.create(ICONS.cut());
|
||||||
|
}
|
||||||
|
|
||||||
public static AbstractImagePrototype getIconInfo(){
|
public static AbstractImagePrototype getIconInfo(){
|
||||||
|
|
||||||
return AbstractImagePrototype.create(ICONS.info());
|
return AbstractImagePrototype.create(ICONS.info());
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 650 B |
|
@ -3,22 +3,33 @@ package org.gcube.portlets.user.workspace.client.view.windows;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.workspace.client.resources.Resources;
|
||||||
|
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType;
|
||||||
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
||||||
|
|
||||||
|
import com.extjs.gxt.ui.client.Style.ButtonScale;
|
||||||
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
||||||
import com.extjs.gxt.ui.client.data.BaseModelData;
|
import com.extjs.gxt.ui.client.data.BaseModelData;
|
||||||
import com.extjs.gxt.ui.client.data.ModelData;
|
import com.extjs.gxt.ui.client.data.ModelData;
|
||||||
|
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
||||||
|
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||||
import com.extjs.gxt.ui.client.store.GroupingStore;
|
import com.extjs.gxt.ui.client.store.GroupingStore;
|
||||||
import com.extjs.gxt.ui.client.store.ListStore;
|
import com.extjs.gxt.ui.client.store.ListStore;
|
||||||
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
||||||
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
||||||
|
import com.extjs.gxt.ui.client.widget.button.ToggleButton;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
||||||
|
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
||||||
|
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.GridGroupRenderer;
|
import com.extjs.gxt.ui.client.widget.grid.GridGroupRenderer;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.GroupColumnData;
|
import com.extjs.gxt.ui.client.widget.grid.GroupColumnData;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.GroupingView;
|
import com.extjs.gxt.ui.client.widget.grid.GroupingView;
|
||||||
|
import com.extjs.gxt.ui.client.widget.grid.filters.DateFilter;
|
||||||
|
import com.extjs.gxt.ui.client.widget.grid.filters.GridFilters;
|
||||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||||
|
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
||||||
|
|
||||||
public class AccoutingInfoContainer extends LayoutContainer {
|
public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
|
|
||||||
|
@ -31,10 +42,50 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
private Grid<ModelData> grid;
|
private Grid<ModelData> grid;
|
||||||
private ContentPanel cp;
|
private ContentPanel cp;
|
||||||
private GroupingStore<ModelData> store = new GroupingStore<ModelData>();
|
private GroupingStore<ModelData> store = new GroupingStore<ModelData>();
|
||||||
|
private boolean groupingEnabled;
|
||||||
|
|
||||||
public AccoutingInfoContainer(){
|
public AccoutingInfoContainer(){
|
||||||
initContentPanel();
|
initContentPanel();
|
||||||
initGrid();
|
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<ButtonEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
|
if(buttonGrouping.isPressed())
|
||||||
|
enableGrouping();
|
||||||
|
else
|
||||||
|
disableGrouping();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
bar.add(buttonGrouping);
|
||||||
|
cp.setTopComponent(bar);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initGrid() {
|
public void initGrid() {
|
||||||
|
@ -43,16 +94,55 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
|
|
||||||
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
|
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
|
||||||
|
|
||||||
|
|
||||||
|
ColumnConfig icon = createSortableColumnConfig("Type", "", 20);
|
||||||
|
columns.add(icon);
|
||||||
|
|
||||||
|
icon.setRenderer(new GridCellRenderer<ModelData>() {
|
||||||
|
|
||||||
|
public Object render(ModelData model, String property, ColumnData config, int rowIndex, int colIndex,
|
||||||
|
ListStore<ModelData> store, Grid<ModelData> 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);
|
ColumnConfig descr = createSortableColumnConfig(DESCRIPTION, DESCRIPTION, 230);
|
||||||
columns.add(descr);
|
columns.add(descr);
|
||||||
|
|
||||||
|
descr.setRenderer(new GridCellRenderer<ModelData>() {
|
||||||
|
|
||||||
|
public Object render(ModelData model, String property, ColumnData config, int rowIndex, int colIndex,
|
||||||
|
ListStore<ModelData> store, Grid<ModelData> grid) {
|
||||||
|
|
||||||
|
// if(model.get(OPERATION).equals(GxtAccountingEntryType.READ))
|
||||||
|
// return "<b><p style=\"color: red;\">"
|
||||||
|
// + model.get(DESCRIPTION)+ "</p></b>";
|
||||||
|
|
||||||
|
return model.get(DESCRIPTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
ColumnConfig oper = createSortableColumnConfig(OPERATION, OPERATION, 70);
|
ColumnConfig oper = createSortableColumnConfig(OPERATION, OPERATION, 70);
|
||||||
columns.add(oper);
|
columns.add(oper);
|
||||||
|
|
||||||
ColumnConfig auth = createSortableColumnConfig(OPERATION, AUTHOR, 70);
|
ColumnConfig auth = createSortableColumnConfig(AUTHOR, AUTHOR, 120);
|
||||||
columns.add(auth);
|
columns.add(auth);
|
||||||
|
|
||||||
ColumnConfig date = createSortableColumnConfig(DATE, DATE, 70);
|
ColumnConfig date = createSortableColumnConfig(DATE, DATE, 140);
|
||||||
columns.add(date);
|
columns.add(date);
|
||||||
|
|
||||||
cm = new ColumnModel(columns);
|
cm = new ColumnModel(columns);
|
||||||
|
@ -60,7 +150,7 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
final ColumnModel columnModel = cm;
|
final ColumnModel columnModel = cm;
|
||||||
|
|
||||||
grid = new Grid<ModelData>(this.store, cm);
|
grid = new Grid<ModelData>(this.store, cm);
|
||||||
|
|
||||||
GroupingView view = new GroupingView();
|
GroupingView view = new GroupingView();
|
||||||
view.setShowGroupedColumn(true);
|
view.setShowGroupedColumn(true);
|
||||||
this.grid.setView(view);
|
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.setBorders(true);
|
||||||
grid.setStripeRows(true);
|
grid.setStripeRows(true);
|
||||||
grid.getView().setAutoFill(true);
|
grid.getView().setAutoFill(true);
|
||||||
grid.setColumnLines(true);
|
grid.setColumnLines(true);
|
||||||
grid.setColumnReordering(true);
|
grid.setColumnReordering(true);
|
||||||
grid.setStyleAttribute("borderTop", "none");
|
grid.setStyleAttribute("borderTop", "none");
|
||||||
|
// grid.setLoadMask(true);
|
||||||
cp.add(grid);
|
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<GxtAccountingField> accountings) {
|
public AccoutingInfoContainer(List<GxtAccountingField> accountings) {
|
||||||
|
|
||||||
|
@ -91,8 +199,29 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
updateListAccounting(accountings);
|
updateListAccounting(accountings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void disableGrouping() {
|
||||||
|
GroupingStore<ModelData> groupingStore = null;
|
||||||
|
if (store instanceof GroupingStore) {
|
||||||
|
groupingStore = (GroupingStore<ModelData>) store;
|
||||||
|
if (groupingStore != null) {
|
||||||
|
groupingStore.clearGrouping();
|
||||||
|
}
|
||||||
|
this.groupingEnabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enableGrouping() {
|
||||||
|
GroupingStore<ModelData> groupingStore = null;
|
||||||
|
if (store instanceof GroupingStore) {
|
||||||
|
groupingStore = (GroupingStore<ModelData>) store;
|
||||||
|
if (groupingStore != null) {
|
||||||
|
groupingStore.groupBy(OPERATION);
|
||||||
|
}
|
||||||
|
this.groupingEnabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateListAccounting(List<GxtAccountingField> accountings){
|
public void updateListAccounting(List<GxtAccountingField> accountings){
|
||||||
|
|
||||||
List<BaseModelData> listModelData = new ArrayList<BaseModelData>();
|
List<BaseModelData> listModelData = new ArrayList<BaseModelData>();
|
||||||
|
|
||||||
|
@ -103,7 +232,7 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
|
|
||||||
baseModel.set(DESCRIPTION, gxtAccountingField.getDescription());
|
baseModel.set(DESCRIPTION, gxtAccountingField.getDescription());
|
||||||
baseModel.set(OPERATION, gxtAccountingField.getOperation());
|
baseModel.set(OPERATION, gxtAccountingField.getOperation());
|
||||||
baseModel.set(AUTHOR, gxtAccountingField.getUser());
|
baseModel.set(AUTHOR, gxtAccountingField.getUser().getName());
|
||||||
baseModel.set(DATE, gxtAccountingField.getDate());
|
baseModel.set(DATE, gxtAccountingField.getDate());
|
||||||
|
|
||||||
listModelData.add(baseModel);
|
listModelData.add(baseModel);
|
||||||
|
@ -112,31 +241,17 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
store.add(listModelData);
|
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<ModelData> store){
|
||||||
|
|
||||||
|
resetStore();
|
||||||
|
this.grid.getStore().add(store.getModels());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateStore(ListStore<ModelData> store){
|
public void resetStore(){
|
||||||
|
|
||||||
this.grid.getStore().removeAll();
|
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)
|
public ColumnConfig createSortableColumnConfig(String id, String name, int width)
|
||||||
|
@ -152,4 +267,14 @@ public class AccoutingInfoContainer extends LayoutContainer {
|
||||||
// cp.layout();
|
// cp.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isGroupingEnabled() {
|
||||||
|
return groupingEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupingEnabled(boolean groupingEnabled) {
|
||||||
|
this.groupingEnabled = groupingEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -30,6 +30,7 @@ public class DialogGetInfo extends Dialog {
|
||||||
private int widthDialog = 450;
|
private int widthDialog = 450;
|
||||||
private int heightTextArea = 50;
|
private int heightTextArea = 50;
|
||||||
private TextField<String> txtName = new TextField<String>();
|
private TextField<String> txtName = new TextField<String>();
|
||||||
|
private TextField<String> txtAreaDescription = new TextArea();
|
||||||
private TextField<String> txtType = new TextField<String>();
|
private TextField<String> txtType = new TextField<String>();
|
||||||
private TextField<String> txtCategory = new TextField<String>();
|
private TextField<String> txtCategory = new TextField<String>();
|
||||||
private TextField<String> txtOwner = new TextField<String>();
|
private TextField<String> txtOwner = new TextField<String>();
|
||||||
|
@ -77,6 +78,14 @@ public class DialogGetInfo extends Dialog {
|
||||||
|
|
||||||
add(txtLocation);
|
add(txtLocation);
|
||||||
|
|
||||||
|
if(fileModel.isDirectory()){
|
||||||
|
txtAreaDescription.setFieldLabel("Description");
|
||||||
|
txtAreaDescription.setHeight(30);
|
||||||
|
txtAreaDescription.setReadOnly(true);
|
||||||
|
txtAreaDescription.setValue(fileModel.getDescription());
|
||||||
|
add(txtAreaDescription);
|
||||||
|
}
|
||||||
|
|
||||||
txtType = new TextField<String>();
|
txtType = new TextField<String>();
|
||||||
txtType.setFieldLabel("Type");
|
txtType.setFieldLabel("Type");
|
||||||
txtType.setReadOnly(true);
|
txtType.setReadOnly(true);
|
||||||
|
@ -88,13 +97,14 @@ public class DialogGetInfo extends Dialog {
|
||||||
txtCategory.setReadOnly(true);
|
txtCategory.setReadOnly(true);
|
||||||
textFieldSetValue(txtCategory,fileModel.getShortcutCategory());
|
textFieldSetValue(txtCategory,fileModel.getShortcutCategory());
|
||||||
add(txtCategory);
|
add(txtCategory);
|
||||||
|
|
||||||
|
|
||||||
txtOwner = new TextField<String>();
|
txtOwner = new TextField<String>();
|
||||||
txtOwner.setFieldLabel("Owner");
|
txtOwner.setFieldLabel("Owner");
|
||||||
txtOwner.setReadOnly(true);
|
txtOwner.setReadOnly(true);
|
||||||
loadOwner(fileModel.getIdentifier());
|
loadOwner(fileModel.getIdentifier());
|
||||||
add(txtOwner);
|
add(txtOwner);
|
||||||
|
|
||||||
txtCreated = new TextField<String>();
|
txtCreated = new TextField<String>();
|
||||||
txtCreated.setFieldLabel("Created");
|
txtCreated.setFieldLabel("Created");
|
||||||
txtCreated.setReadOnly(true);
|
txtCreated.setReadOnly(true);
|
||||||
|
|
|
@ -1,42 +1,105 @@
|
||||||
package org.gcube.portlets.user.workspace.client.view.windows;
|
package org.gcube.portlets.user.workspace.client.view.windows;
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
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 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.Window;
|
||||||
|
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
* @May 23, 2013
|
* @May 23, 2013
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class WindowAccountingInfo extends Window{
|
public class WindowAccountingInfo extends Window {
|
||||||
|
|
||||||
|
|
||||||
private List<GxtAccountingField> accountingsFields;
|
private List<GxtAccountingField> accountingsFields;
|
||||||
private AccoutingInfoContainer accountingsContainers;
|
private AccoutingInfoContainer accountingsContainers;
|
||||||
|
|
||||||
public WindowAccountingInfo(List<GxtAccountingField> accountingsFields) {
|
public WindowAccountingInfo() {
|
||||||
setModal(true);
|
initAccounting();
|
||||||
setSize(550, 300);
|
// addResizeListner();
|
||||||
this.accountingsFields = accountingsFields;
|
|
||||||
this.accountingsContainers = new AccoutingInfoContainer(accountingsFields);
|
|
||||||
|
|
||||||
add(accountingsContainers);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setWindowTitle(String title) {
|
|
||||||
this.setHeading(title);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WindowAccountingInfo(FileModel fileModel, String title) {
|
||||||
|
initAccounting();
|
||||||
|
setIcon(fileModel.getAbstractPrototypeIcon());
|
||||||
|
setHeading(title);
|
||||||
|
// addResizeListner();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addResizeListner(){
|
||||||
|
|
||||||
|
this.addListener(Events.Resize, new Listener<WindowEvent>() {
|
||||||
|
|
||||||
|
@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<GxtAccountingField> 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<GxtAccountingField> accountingsFields) {
|
||||||
|
|
||||||
|
this.accountingsContainers.resetStore();
|
||||||
|
this.accountingsFields = accountingsFields;
|
||||||
|
this.accountingsContainers.updateListAccounting(accountingsFields);
|
||||||
|
}
|
||||||
|
|
||||||
public List<GxtAccountingField> getAccountingsFields() {
|
public List<GxtAccountingField> getAccountingsFields() {
|
||||||
return accountingsFields;
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1673,7 +1673,7 @@ public class GWTWorkspaceBuilder {
|
||||||
|
|
||||||
AccountingEntryCut cut = (AccountingEntryCut) accountingEntry;
|
AccountingEntryCut cut = (AccountingEntryCut) accountingEntry;
|
||||||
|
|
||||||
af.setDescription("cut by "+user.getName() +" from "+cut.getItemName());
|
af.setDescription("cut "+cut.getItemName()+" by "+user.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -1699,15 +1699,15 @@ public class GWTWorkspaceBuilder {
|
||||||
|
|
||||||
AccountingEntryRemoval rem = (AccountingEntryRemoval) accountingEntry;
|
AccountingEntryRemoval rem = (AccountingEntryRemoval) accountingEntry;
|
||||||
|
|
||||||
af.setDescription("remove by "+user.getName() +", name: "+rem.getItemName());
|
af.setDescription("remove "+rem.getItemName()+" by "+user.getName());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RENAMING:
|
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;
|
AccountingEntryRenaming ren = (AccountingEntryRenaming) accountingEntry;
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ public class Util {
|
||||||
// public static final String TEST_USER_FULL_NAME = "Francesco Mangiacrapa";
|
// public static final String TEST_USER_FULL_NAME = "Francesco Mangiacrapa";
|
||||||
// public static final String TEST_USER = "aureliano.gentile";
|
// public static final String TEST_USER = "aureliano.gentile";
|
||||||
public static final String TEST_USER = "test.user";
|
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";
|
public static final String TEST_USER_FULL_NAME = "Test User";
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ public enum GxtAccountingEntryType {
|
||||||
|
|
||||||
REMOVED("removed", "removed"),
|
REMOVED("removed", "removed"),
|
||||||
|
|
||||||
RENAMING("renamed", "renamed"),
|
RENAMED("renamed", "renamed"),
|
||||||
|
|
||||||
CREATED("created", "created"),
|
CREATED("created", "created"),
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue