add copy link, completed

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@76869 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-06-07 12:47:10 +00:00
parent 9410639f50
commit 6bd8c1e211
5 changed files with 113 additions and 15 deletions

View File

@ -190,7 +190,13 @@ public class AppController implements SubscriberInterface {
@Override
public void onGetInfo(GetInfoEvent getInfoEvent) {
new DialogGetInfo(getInfoEvent.getSourceFile());
FileModel file = getInfoEvent.getSourceFile();
if(file==null)
file = getGridSelectedItem();
if(file!=null)
new DialogGetInfo(file);
}
});

View File

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

View File

@ -0,0 +1,15 @@
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 GetSharedLinkEventHandler extends EventHandler {
/**
* @param getLinkEvent
*/
void onGetLink(GetShareLinkEvent getLinkEvent);
}

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.workspace.client.view.toolbars;
import org.gcube.portlets.user.workspace.client.AppController;
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.GetInfoEvent;
import org.gcube.portlets.user.workspace.client.resources.Resources;
import com.extjs.gxt.ui.client.event.ButtonEvent;
@ -19,6 +20,10 @@ import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
*/
public class GxtToolBarItemAccounting extends ToolBar{
/**
*
*/
protected static final String INFO = "Info";
/**
*
*/
@ -32,6 +37,7 @@ public class GxtToolBarItemAccounting extends ToolBar{
private Text txtCreationTime = new Text("Empty");
private Text txtDimension = new Text("Empty");
private Button btnGetInfo;
private Button bHistory;
private Button bRead;
@ -67,7 +73,21 @@ public class GxtToolBarItemAccounting extends ToolBar{
}
});
btnGetInfo = new Button(INFO, Resources.getIconInfo());
btnGetInfo.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
AppController.getEventBus().fireEvent(new GetInfoEvent(null));
}
});
add(btnGetInfo);
add(new SeparatorToolItem());
add(bHistory);
add(new SeparatorToolItem());
add(bRead);
@ -86,6 +106,7 @@ public class GxtToolBarItemAccounting extends ToolBar{
public void enableButtons(boolean enable){
bHistory.setEnabled(enable);
bRead.setEnabled(enable);
btnGetInfo.setEnabled(enable);
}
public void setDetails(String itemName, String description, String dimension, String creationTime, String owner){

View File

@ -12,6 +12,7 @@ import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent.Download
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.GetShareLinkEvent;
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;
@ -54,7 +55,8 @@ public class GxtToolBarItemFunctionality {
private ToolBar toolBar = new ToolBar();
private Button btnPreview;
private ToggleButton btnGridView;
private Button btnGetInfo;
// private Button btnGetInfo;
private Button btnGetSharedLink;
public GxtToolBarItemFunctionality() {
initToolBar();
@ -93,13 +95,12 @@ public class GxtToolBarItemFunctionality {
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);
// 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,
@ -142,6 +143,14 @@ public class GxtToolBarItemFunctionality {
// toolBar.add(new SeparatorToolItem());
toolBar.add(new SeparatorToolItem());
toolBar.add(new SeparatorToolItem());
btnGetSharedLink = new Button("Share Link", Resources.getIconShareLink());
btnGetSharedLink.setScale(ButtonScale.SMALL);
btnGetSharedLink.setIconAlign(IconAlign.TOP);
btnGetSharedLink.setArrowAlign(ButtonArrowAlign.BOTTOM);
toolBar.add(btnGetSharedLink);
btnAccessFromDesktop = new Button(ConstantsPortlet.TITLEACCESSWEBDAV, Resources.getIconWebDav());
btnAccessFromDesktop.setScale(ButtonScale.SMALL);
btnAccessFromDesktop.setIconAlign(IconAlign.TOP);
@ -224,17 +233,30 @@ public class GxtToolBarItemFunctionality {
}
});
btnGetInfo.addSelectionListener(new SelectionListener<ButtonEvent>() {
btnGetSharedLink.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
final FileGridModel fileGridModel = gridGroupViewContainer.getSelectedItem();
AppController.getEventBus().fireEvent(new GetInfoEvent(fileGridModel));
AppController.getEventBus().fireEvent(new GetShareLinkEvent(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>() {
@ -452,14 +474,13 @@ public class GxtToolBarItemFunctionality {
this.btnRenameItem.disable();
this.btnDownloadFile.disable();
this.btnOpen.disable();
this.btnGetInfo.disable();
// this.btnGetInfo.disable();
} else {
this.btnRemoveItem.enable();
this.btnRenameItem.enable();
this.btnDownloadFile.enable();
this.btnOpen.enable();
this.btnGetInfo.enable();
// this.btnGetInfo.enable();
}
}
@ -468,7 +489,7 @@ public class GxtToolBarItemFunctionality {
btnRemoveItem.setEnabled(active);
btnRenameItem.setEnabled(active);
btnGetInfo.setEnabled(active);
// btnGetInfo.setEnabled(active);
btnDownloadFile.setEnabled(active);
btnPreview.setEnabled(active);
btnOpen.setEnabled(active);