open url with double click implemented, changed icons for html and links, updated revision

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@99428 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2014-09-03 13:52:14 +00:00
parent 902802e954
commit c087e182e6
6 changed files with 54 additions and 45 deletions

View File

@ -182,15 +182,17 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
private FileUploader fileUploader; private FileUploader fileUploader;
public static String myLogin; public static String myLogin;
private static AppControllerExplorer singleton;
public AppControllerExplorer() { public AppControllerExplorer() {
Registry.register(ConstantsExplorer.RPC_WORKSPACE_SERVICE, rpcWorkspaceService); Registry.register(ConstantsExplorer.RPC_WORKSPACE_SERVICE, rpcWorkspaceService);
subscribers = new HashMap<EventsTypeEnum, ArrayList<SubscriberInterface>>(); subscribers = new HashMap<EventsTypeEnum, ArrayList<SubscriberInterface>>();
bind(); bind();
singleton = this;
} }
public AppControllerExplorer getInstance() { public static AppControllerExplorer getInstance() {
return this; return singleton;
} }
public static HandlerManager getEventBus() { public static HandlerManager getEventBus() {
@ -1634,44 +1636,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
doClickUrl(openUrlEvent); doClickUrl(openUrlEvent);
} }
private void doClickUrl(OpenUrlEvent openUrlEvent) {
final FileModel fileModel = openUrlEvent.getSourceFileModel();
if(fileModel==null)
return;
rpcWorkspaceService.getUrlById(fileModel.getIdentifier(), fileModel.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.URL_DOCUMENT), false, new AsyncCallback<GWTWorkspaceItem>() {
@Override
public void onFailure(Throwable caught) {
explorerPanel.getAsycTreePanel().unmask();
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " clicking url.", null);
explorerPanel.getAsycTreePanel().removeAllAndRecoveryRoot();
}
@Override
public void onSuccess(GWTWorkspaceItem result) {
if(fileModel.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.URL_DOCUMENT)){
new WindowOpenUrl(((GWTUrlDocument) result).getUrl(), "_blank", "");
GWT.log("URL_DOCUMENT Open " + ((GWTUrlDocument) result).getUrl());
}
else{
new WindowOpenUrl(((GWTExternalUrl) result).getUrl(), "_blank", "");
GWT.log("ExternalUrl Open " + ((GWTExternalUrl) result).getUrl());
}
}
});
// com.google.gwt.user.client.Window.open(ConstantsExplorer.DOWNLOAD_WORKSPACE_SERVICE+"?id="+fileModel.getIdentifier()+"&viewContent=true", fileModel.getName(), "");
}
}); });
@ -2528,4 +2492,41 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
explorerPanel.getAsycTreePanel().setSearch(isSearch); explorerPanel.getAsycTreePanel().setSearch(isSearch);
} }
public void doClickUrl(OpenUrlEvent openUrlEvent) {
final FileModel fileModel = openUrlEvent.getSourceFileModel();
if(fileModel==null)
return;
rpcWorkspaceService.getUrlById(fileModel.getIdentifier(), fileModel.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.URL_DOCUMENT), false, new AsyncCallback<GWTWorkspaceItem>() {
@Override
public void onFailure(Throwable caught) {
explorerPanel.getAsycTreePanel().unmask();
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " clicking url.", null);
explorerPanel.getAsycTreePanel().removeAllAndRecoveryRoot();
}
@Override
public void onSuccess(GWTWorkspaceItem result) {
if(fileModel.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.URL_DOCUMENT)){
new WindowOpenUrl(((GWTUrlDocument) result).getUrl(), "_blank", "");
GWT.log("URL_DOCUMENT Open " + ((GWTUrlDocument) result).getUrl());
}
else{
new WindowOpenUrl(((GWTExternalUrl) result).getUrl(), "_blank", "");
GWT.log("ExternalUrl Open " + ((GWTExternalUrl) result).getUrl());
}
}
});
// com.google.gwt.user.client.Window.open(ConstantsExplorer.DOWNLOAD_WORKSPACE_SERVICE+"?id="+fileModel.getIdentifier()+"&viewContent=true", fileModel.getName(), "");
}
} }

View File

@ -32,7 +32,7 @@ public interface Icons extends ClientBundle {
@Source("icons/mime/xml.gif") @Source("icons/mime/xml.gif")
ImageResource xml(); ImageResource xml();
@Source("icons/mime/html.gif") @Source("icons/mime/ico_htm.gif")
ImageResource html(); ImageResource html();
@Source("icons/mime/java.gif") @Source("icons/mime/java.gif")
@ -284,6 +284,10 @@ public interface Icons extends ClientBundle {
@Source("icons/link-try.png") @Source("icons/link-try.png")
ImageResource shareLink(); ImageResource shareLink();
@Source("icons/openURL.png")
ImageResource extLink();
@Source("icons/sharelink.png") @Source("icons/sharelink.png")
ImageResource publicLink(); ImageResource publicLink();

View File

@ -55,6 +55,10 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.undo()); return AbstractImagePrototype.create(ICONS.undo());
} }
public static AbstractImagePrototype getIconLink(){
return AbstractImagePrototype.create(ICONS.extLink());
}
public static AbstractImagePrototype getIconShareLink(){ public static AbstractImagePrototype getIconShareLink(){
return AbstractImagePrototype.create(ICONS.shareLink()); return AbstractImagePrototype.create(ICONS.shareLink());
@ -625,7 +629,7 @@ public class Resources {
}else if(itemType.equals(GXTFolderItemTypeEnum.EXTERNAL_PDF_FILE)){ }else if(itemType.equals(GXTFolderItemTypeEnum.EXTERNAL_PDF_FILE)){
return Resources.getIconPdf(); return Resources.getIconPdf();
}else if(itemType.equals(GXTFolderItemTypeEnum.EXTERNAL_URL)){ }else if(itemType.equals(GXTFolderItemTypeEnum.EXTERNAL_URL)){
return Resources.getIconHtml(); return Resources.getIconLink();
}else if(itemType.equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT)){ }else if(itemType.equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT)){
return Resources.getIconPng(); return Resources.getIconPng();
}else if(itemType.equals(GXTFolderItemTypeEnum.METADATA)){ }else if(itemType.equals(GXTFolderItemTypeEnum.METADATA)){
@ -641,7 +645,7 @@ public class Resources {
}else if(itemType.equals(GXTFolderItemTypeEnum.REPORT_TEMPLATE)){ }else if(itemType.equals(GXTFolderItemTypeEnum.REPORT_TEMPLATE)){
return Resources.getIconReportTemplate(); return Resources.getIconReportTemplate();
}else if(itemType.equals(GXTFolderItemTypeEnum.URL_DOCUMENT)){ }else if(itemType.equals(GXTFolderItemTypeEnum.URL_DOCUMENT)){
return Resources.getIconHtml(); return Resources.getIconLink();
}else if(itemType.equals(GXTFolderItemTypeEnum.WORKFLOW_REPORT)){ }else if(itemType.equals(GXTFolderItemTypeEnum.WORKFLOW_REPORT)){
return Resources.getIconWorkflowReport(); return Resources.getIconWorkflowReport();
}else if(itemType.equals(GXTFolderItemTypeEnum.WORKFLOW_TEMPLATE)){ }else if(itemType.equals(GXTFolderItemTypeEnum.WORKFLOW_TEMPLATE)){

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB