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

@ -181,16 +181,18 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
private boolean selectRootItem;
private FileUploader fileUploader;
public static String myLogin;
private static AppControllerExplorer singleton;
public AppControllerExplorer() {
Registry.register(ConstantsExplorer.RPC_WORKSPACE_SERVICE, rpcWorkspaceService);
subscribers = new HashMap<EventsTypeEnum, ArrayList<SubscriberInterface>>();
bind();
singleton = this;
}
public AppControllerExplorer getInstance() {
return this;
public static AppControllerExplorer getInstance() {
return singleton;
}
public static HandlerManager getEventBus() {
@ -1633,45 +1635,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
public void onClickUrl(OpenUrlEvent 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);
}
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")
ImageResource xml();
@Source("icons/mime/html.gif")
@Source("icons/mime/ico_htm.gif")
ImageResource html();
@Source("icons/mime/java.gif")
@ -284,6 +284,10 @@ public interface Icons extends ClientBundle {
@Source("icons/link-try.png")
ImageResource shareLink();
@Source("icons/openURL.png")
ImageResource extLink();
@Source("icons/sharelink.png")
ImageResource publicLink();

View File

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