merged with branch release 2.13

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@71678 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-03-25 10:19:44 +00:00
parent d4e94f3b64
commit 4f4d7f890d
10 changed files with 311 additions and 43 deletions

View File

@ -14,7 +14,6 @@
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>

View File

@ -1,5 +1,5 @@
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
lastWarOutDir=/home/backup-old-home/francesco-mangiacrapa/workspace/workspace/target/workspace-6.0.0-SNAPSHOT
lastWarOutDir=/home/francesco-mangiacrapa/workspace/workspace/target/workspace-6.0.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -102,7 +102,7 @@
<dependency>
<groupId>org.gcube.contentmanagement</groupId>
<artifactId>storage-resource-link-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -23,6 +23,8 @@ import org.gcube.portlets.user.workspace.client.event.FileDownloadEventHandler;
import org.gcube.portlets.user.workspace.client.event.FileUploadEvent;
import org.gcube.portlets.user.workspace.client.event.FileUploadEventHandler;
import org.gcube.portlets.user.workspace.client.event.FilterScopeEvent;
import org.gcube.portlets.user.workspace.client.event.GetInfoEvent;
import org.gcube.portlets.user.workspace.client.event.GetInfoEventHandler;
import org.gcube.portlets.user.workspace.client.event.GridElementSelectedEvent;
import org.gcube.portlets.user.workspace.client.event.GridElementSelectedEventHandler;
import org.gcube.portlets.user.workspace.client.event.GridElementUnSelectedEvent;
@ -63,6 +65,7 @@ import org.gcube.portlets.user.workspace.client.view.WorskpacePortlet;
import org.gcube.portlets.user.workspace.client.view.panels.GxtBorderLayoutPanel;
import org.gcube.portlets.user.workspace.client.view.panels.GxtItemsPanel;
import org.gcube.portlets.user.workspace.client.view.windows.MessageBoxAlert;
import org.gcube.portlets.user.workspace.client.window.DialogGetInfo;
import org.gcube.portlets.user.wsmail.client.forms.MailForm;
import com.google.gwt.core.client.GWT;
@ -134,7 +137,17 @@ public class AppController implements SubscriberInterface {
}
}
});
eventBus.addHandler(GetInfoEvent.TYPE, new GetInfoEventHandler() {
@Override
public void onGetInfo(GetInfoEvent getInfoEvent) {
new DialogGetInfo(getInfoEvent.getSourceFile());
}
});
//********EVENTS TO NOTIFY SUBSCRIBERS
eventBus.addHandler(OpenReportsEvent.TYPE, new OpenReportsEventHandler() {
@Override
@ -467,7 +480,7 @@ public class AppController implements SubscriberInterface {
if(isSelected){
FileModel lastParent = this.wsPortlet.getToolBarPath().getLastParent();
if(lastParent!=null){
if(lastParent!=null && target.getParentFileModel()!=null){
boolean parentChanged = lastParent.getIdentifier().compareTo(target.getParentFileModel().getIdentifier())==0?false:true;
//RELOAD breadcrumb only if last parent id is changed

View File

@ -8,11 +8,11 @@ package org.gcube.portlets.user.workspace.client;
public class ConstantsPortlet {
// ToolBar button
public static final String ADDFOLDER = "Add Folder";
public static final String REMOVEITEM = "Remove Item";
public static final String RENAMEITEM = "Rename Item";
public static final String UPLOADFILE = "Upload File";
public static final String DOWNLOADITEM = "Download Item";
public static final String ADDFOLDER = "New Folder";
public static final String REMOVEITEM = "Remove";
public static final String RENAMEITEM = "Rename";
public static final String UPLOADFILE = "Upload";
public static final String DOWNLOADITEM = "Download";
public static final String UPLOADARCHIVE = "Upload Archive";
public static final String GET_SEARCH_PARAMETER ="search";
@ -38,11 +38,11 @@ public class ConstantsPortlet {
public static final String CANCEL = "Cancel";
public static final String SEARCHINWORSPACE = "Search in workspace";
public static final String SEARCHINMESSAGE = "Search in messages";
public static final String VIEWSPACE = "Filter by Space";
public static final String VIEWSPACE = "";//"Filter by Space";
public static final String PREVIEW = "Preview";
public static final String OPEN = "Open";
public static final String TITLEACCESSWEBDAV = "Access from Desktop";
public static final String TITLEACCESSWEBDAV = "Desktop Access";
//COOKIE SETTINGS
public static final String GCUBE_COOKIE_WORKSPACE_GRID_VIEW_SETTING = "GCUBE-Cookie-WorkspaceGridViewSetting";

View File

@ -0,0 +1,35 @@
package org.gcube.portlets.user.workspace.client.event;
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
import com.google.gwt.event.shared.GwtEvent;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class GetInfoEvent extends GwtEvent<GetInfoEventHandler> {
public static Type<GetInfoEventHandler> TYPE = new Type<GetInfoEventHandler>();
private FileGridModel targetFile = null;
public GetInfoEvent(FileGridModel target) {
this.targetFile = target;
}
@Override
public Type<GetInfoEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(GetInfoEventHandler handler) {
handler.onGetInfo(this);
}
public FileGridModel getSourceFile() {
return targetFile;
}
}

View File

@ -0,0 +1,12 @@
package org.gcube.portlets.user.workspace.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public interface GetInfoEventHandler extends EventHandler {
void onGetInfo(GetInfoEvent getInfoEvent);
}

View File

@ -32,7 +32,6 @@ import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;
/**
@ -45,7 +44,7 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
private GxtComboBox comboBoxGxt = null;
private ComboBox<ScopeModel> cbViewScope = null;
private HTML txtViewScope = new HTML("<nobr>"+ConstantsPortlet.VIEWSPACE+":</nobr>");
// private HTML txtViewScope = new HTML("<nobr>"+ConstantsPortlet.VIEWSPACE+":</nobr>");
private final TextField<String> textSearch = new TextField<String>();
private Button bSearch = new Button(ConstantsPortlet.SEARCH);
private Button bCancel = new Button(ConstantsPortlet.CANCEL);
@ -65,8 +64,8 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
public GxtSeachAndFilterPanel(HorizontalPanel toolbarContainer) {
txtViewScope.getElement().getStyle().setColor("#15428B");
txtViewScope.getElement().getStyle().setFontSize(12, Unit.PX);
// txtViewScope.getElement().getStyle().setColor("#15428B");
// txtViewScope.getElement().getStyle().setFontSize(12, Unit.PX);
setLayout(new FitLayout());
setBorders(true);
@ -84,8 +83,8 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
hp.setStyleAttribute("padding", "2px");
this.cbViewScope.setStyleAttribute("margin-left", "5px");
this.cbViewScope.setStyleAttribute("margin-right", "70px");
this.cbViewScope.setStyleAttribute("margin-left", "132px");
// this.cbViewScope.setStyleAttribute("margin-right", "70px");
seVisibleButtonsCancelSave(false);
@ -114,7 +113,7 @@ public class GxtSeachAndFilterPanel extends LayoutContainer {
hp2.setHorizontalAlign(HorizontalAlignment.RIGHT);
hp2.setVerticalAlign(VerticalAlignment.MIDDLE);
hp2.add(txtViewScope);
//hp2.add(txtViewScope);
hp2.add(cbViewScope);
cbViewScope.setStyleAttribute("margin-top", "2px");

View File

@ -11,6 +11,7 @@ import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent;
import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent.DownloadType;
import org.gcube.portlets.user.workspace.client.event.FileUploadEvent;
import org.gcube.portlets.user.workspace.client.event.FileUploadEvent.UploadType;
import org.gcube.portlets.user.workspace.client.event.GetInfoEvent;
import org.gcube.portlets.user.workspace.client.event.ImagePreviewEvent;
import org.gcube.portlets.user.workspace.client.event.OpenReportsEvent;
import org.gcube.portlets.user.workspace.client.event.RenameItemEvent;
@ -28,7 +29,6 @@ import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.button.ToggleButton;
import com.extjs.gxt.ui.client.widget.toolbar.FillToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
@ -54,6 +54,7 @@ public class GxtToolBarItem {
private ToolBar toolBar = new ToolBar();
private Button btnPreview;
private ToggleButton btnGridView;
private Button btnGetInfo;
public GxtToolBarItem() {
initToolBar();
@ -82,7 +83,23 @@ public class GxtToolBarItem {
btnAddFolder.setArrowAlign(ButtonArrowAlign.BOTTOM);
toolBar.add(btnAddFolder);
// toolBar.add(new SeparatorToolItem());
btnUploadFile = new Button(ConstantsPortlet.UPLOADFILE,
Resources.getIconFileUpload());
btnUploadFile.setScale(ButtonScale.SMALL);
btnUploadFile.setIconAlign(IconAlign.TOP);
btnUploadFile.setArrowAlign(ButtonArrowAlign.BOTTOM);
toolBar.add(btnUploadFile);
toolBar.add(new SeparatorToolItem());
btnGetInfo = new Button("Info", Resources.getIconInfo());
btnGetInfo.setScale(ButtonScale.SMALL);
btnGetInfo.setIconAlign(IconAlign.TOP);
btnGetInfo.setArrowAlign(ButtonArrowAlign.BOTTOM);
toolBar.add(btnGetInfo);
// toolBar.add(new SeparatorToolItem());
btnRemoveItem = new Button(ConstantsPortlet.REMOVEITEM,
@ -102,18 +119,12 @@ public class GxtToolBarItem {
btnRenameItem.setArrowAlign(ButtonArrowAlign.BOTTOM);
toolBar.add(btnRenameItem);
// toolBar.add(new SeparatorToolItem());
// toolBar.add(new SeparatorToolItem());
btnDownloadFile = new Button(ConstantsPortlet.DOWNLOADITEM,Resources.getIconDownload());
btnDownloadFile.setScale(ButtonScale.SMALL);
btnDownloadFile.setIconAlign(IconAlign.TOP);
btnDownloadFile.setArrowAlign(ButtonArrowAlign.BOTTOM);
toolBar.add(btnDownloadFile);
// toolBar.add(new SeparatorToolItem());
// toolBar.add(new SeparatorToolItem());
btnPreview = new Button(ConstantsPortlet.PREVIEW ,Resources.getIconPreview());
btnPreview.setScale(ButtonScale.SMALL);
@ -121,9 +132,6 @@ public class GxtToolBarItem {
btnPreview.setArrowAlign(ButtonArrowAlign.BOTTOM);
toolBar.add(btnPreview);
// toolBar.add(new SeparatorToolItem());
// toolBar.add(new SeparatorToolItem());
btnOpen = new Button(ConstantsPortlet.OPEN ,Resources.getIconShow());
btnOpen.setScale(ButtonScale.SMALL);
btnOpen.setIconAlign(IconAlign.TOP);
@ -139,21 +147,9 @@ public class GxtToolBarItem {
btnAccessFromDesktop.setIconAlign(IconAlign.TOP);
btnAccessFromDesktop.setArrowAlign(ButtonArrowAlign.BOTTOM);
// btnAccessFromDesktop = new Button(ConstantsPortlet.TITLEACCESSWEBDAV);
// btnAccessFromDesktop.setScale(ButtonScale.SMALL);
// btnAccessFromDesktop.addStyleName("button-hyperlink");
toolBar.add(btnAccessFromDesktop);
toolBar.add(new FillToolItem());
btnUploadFile = new Button(ConstantsPortlet.UPLOADFILE,
Resources.getIconFileUpload());
btnUploadFile.setScale(ButtonScale.SMALL);
btnUploadFile.setIconAlign(IconAlign.TOP);
btnUploadFile.setArrowAlign(ButtonArrowAlign.BOTTOM);
toolBar.add(btnUploadFile);
toolBar.add(new SeparatorToolItem());
// toolBar.add(new SeparatorToolItem());
// toolBar.add(new SeparatorToolItem());
@ -229,6 +225,18 @@ public class GxtToolBarItem {
new DeleteItemEvent(fileGridModel));
}
});
btnGetInfo.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
final FileGridModel fileGridModel = gridGroupViewContainer.getSelectedItem();
AppController.getEventBus().fireEvent(new GetInfoEvent(fileGridModel));
}
});
btnRenameItem.addSelectionListener(new SelectionListener<ButtonEvent>() {
@ -436,11 +444,13 @@ public class GxtToolBarItem {
this.btnRenameItem.disable();
this.btnDownloadFile.disable();
this.btnOpen.disable();
this.btnGetInfo.disable();
} else {
this.btnRemoveItem.enable();
this.btnRenameItem.enable();
this.btnDownloadFile.enable();
this.btnOpen.enable();
this.btnGetInfo.enable();
}
@ -450,6 +460,7 @@ public class GxtToolBarItem {
btnRemoveItem.setEnabled(active);
btnRenameItem.setEnabled(active);
btnGetInfo.setEnabled(active);
btnDownloadFile.setEnabled(active);
btnPreview.setEnabled(active);
btnOpen.setEnabled(active);

View File

@ -0,0 +1,199 @@
package org.gcube.portlets.user.workspace.client.window;
import java.util.List;
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.form.TextArea;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class DialogGetInfo extends Dialog {
private int widthDialog = 450;
private int heightTextArea = 50;
private TextField<String> txtName = new TextField<String>();
private TextField<String> txtType = new TextField<String>();
private TextField<String> txtCategory = new TextField<String>();
private TextField<String> txtOwner = new TextField<String>();
private TextField<String> txtCreated = new TextField<String>();
private TextField<String> txtSize = new TextField<String>();
private TextField<String> txtLocation = new TextField<String>();
private TextField<String> txtShared = new TextField<String>();
private TextArea textAreaSharedWith = new TextArea();
private final NumberFormat number = NumberFormat.getFormat("#,##0 KB;(#,##0 KB)");
public DialogGetInfo(FileGridModel fileModel) {
FormLayout layout = new FormLayout();
layout.setLabelWidth(90);
layout.setDefaultWidth(300);
setLayout(layout);
setIcon(fileModel.getAbstractPrototypeIcon());
setHeading(fileModel.getName() + " Properties");
setButtonAlign(HorizontalAlignment.RIGHT);
setModal(true);
// setBodyBorder(true);
setBodyStyle("padding: 9px; background: none");
setWidth(widthDialog);
setResizable(false);
setButtons(Dialog.OK);
txtName = new TextField<String>();
txtName.setFieldLabel("Name");
txtName.setReadOnly(true);
textFieldSetValue(txtName,fileModel.getName());
add(txtName);
txtType = new TextField<String>();
txtType.setFieldLabel("Type");
txtType.setReadOnly(true);
textFieldSetValue(txtType,fileModel.getType());
add(txtType);
txtCategory = new TextField<String>();
txtCategory.setFieldLabel("Category");
txtCategory.setReadOnly(true);
textFieldSetValue(txtCategory,fileModel.getShortcutCategory());
add(txtCategory);
txtOwner = new TextField<String>();
txtOwner.setFieldLabel("Owner");
txtOwner.setReadOnly(true);
loadOwner(fileModel.getIdentifier());
add(txtOwner);
txtCreated = new TextField<String>();
txtCreated.setFieldLabel("Created");
txtCreated.setReadOnly(true);
textFieldSetValue(txtCreated,fileModel.getCreationDate().toString());
add(txtCreated);
txtSize = new TextField<String>();
txtSize.setFieldLabel("Size");
txtSize.setReadOnly(true);
textFieldSetValue(txtSize,getFormattedSize(fileModel.getSize()));
add(txtSize);
txtShared = new TextField<String>();
txtShared.setFieldLabel("Shared");
txtShared.setReadOnly(true);
textFieldSetValue(txtShared,fileModel.isShared()+"");
add(txtShared);
if(fileModel.isShared()){
textAreaSharedWith.setFieldLabel("Shared with");
textAreaSharedWith.setHeight(heightTextArea);
textAreaSharedWith.setReadOnly(true);
getListSharedContacts(fileModel.getIdentifier());
add(textAreaSharedWith);
}
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
hide();
}
});
this.show();
}
private void textFieldSetValue(TextField<String> field, String value){
if(value==null || value.isEmpty())
field.setValue("unknown");
else
field.setValue(value);
}
private void loadOwner(final String itemId){
txtOwner.mask();
AppControllerExplorer.rpcWorkspaceService.getOwnerByItemId(itemId, new AsyncCallback<InfoContactModel>() {
@Override
public void onFailure(Throwable caught) {
GWT.log("an error occured in get Owner by Id "+itemId + " "+caught.getMessage());
txtOwner.unmask();
}
@Override
public void onSuccess(InfoContactModel result) {
textFieldSetValue(txtOwner,result.getName());
txtOwner.unmask();
}
});
}
private void getListSharedContacts(String sharedId){
textAreaSharedWith.mask();
AppControllerExplorer.rpcWorkspaceService.getListUserSharedBySharedItem(sharedId, new AsyncCallback<List<InfoContactModel>>() {
@Override
public void onFailure(Throwable caught) {
textAreaSharedWith.unmask();
}
@Override
public void onSuccess(List<InfoContactModel> result) {
String users = "";
for (int i = 0; i < result.size()-1; i++) {
users+= result.get(i).getName() + ", ";
}
if(result.size()>1)
users += result.get(result.size()-1).getName();
textAreaSharedWith.setValue(users);
textAreaSharedWith.unmask();
}
});
}
private String getFormattedSize(long value){
if(value>0){
double kb = value/1024;
if(kb<1)
kb=1;
return number.format(kb);
}
return "";
}
}