|
From: <eri...@us...> - 2008-07-15 10:01:44
|
Revision: 4606
http://giews.svn.sourceforge.net/giews/?rev=4606&view=rev
Author: erikvaningen
Date: 2008-07-15 03:01:52 -0700 (Tue, 15 Jul 2008)
Log Message:
-----------
fexiing adding dataset from new chart wizard
Modified Paths:
--------------
trunk/fenix-web/src/main/java/org/fao/fenix/web/client/re2/catalogue/CatalogueContextMenu.java
Modified: trunk/fenix-web/src/main/java/org/fao/fenix/web/client/re2/catalogue/CatalogueContextMenu.java
===================================================================
--- trunk/fenix-web/src/main/java/org/fao/fenix/web/client/re2/catalogue/CatalogueContextMenu.java 2008-07-15 09:25:36 UTC (rev 4605)
+++ trunk/fenix-web/src/main/java/org/fao/fenix/web/client/re2/catalogue/CatalogueContextMenu.java 2008-07-15 10:01:52 UTC (rev 4606)
@@ -41,14 +41,18 @@
private void removeResource() {
- final String resourceType = (String) Fenix.newResourceExplorer.catalogueList.table.getSelectedItem().getValues()[1];
- long resourceId = Long.valueOf((String) Fenix.newResourceExplorer.catalogueList.table.getSelectedItem().getValues()[5]).longValue();
+ final String resourceType = (String) Fenix.newResourceExplorer.catalogueList.table.getSelectedItem()
+ .getValues()[1];
+ long resourceId = Long.valueOf(
+ (String) Fenix.newResourceExplorer.catalogueList.table.getSelectedItem().getValues()[5]).longValue();
Fenix.reService.deleteResource(resourceId, resourceType, new AsyncCallback() {
public void onSuccess(Object result) {
ResourceExplorer.searchEvent.searchStart();
- // Fenix.newResourceExplorer.catalogueList.fill(resourceType, Fenix.newResourceExplorer.catalogueList.table, 1, FenixConstants.ITEMS_PER_PAGE);
+ // Fenix.newResourceExplorer.catalogueList.fill(resourceType,
+ // Fenix.newResourceExplorer.catalogueList.table, 1,
+ // FenixConstants.ITEMS_PER_PAGE);
}
public void onFailure(Throwable caught) {
@@ -60,7 +64,7 @@
public Menu build(String resourceType) {
- /* ***** OPEN ***** */
+ /* OPEN */
MenuItem open = new MenuItem(Style.PUSH);
open.setText(Fenix.fenixLang.open());
open.addSelectionListener(new SelectionListener() {
@@ -73,7 +77,7 @@
separator = new MenuItem(Style.SEPARATOR);
contextMenu.add(separator);
- /* ***** OPEN AS A CHART ***** */
+ /* OPEN AS A CHART */
MenuItem openAsChart = new MenuItem(Style.PUSH);
openAsChart.setText(Fenix.fenixLang.openAsChart());
openAsChart.addSelectionListener(new SelectionListener() {
@@ -86,7 +90,8 @@
if (((String) item.getValue(1)).equals(ResourceTypeNew.DATASET)) {
List chartList = new ArrayList();
- // chartList.add(CatalogueOpener.cleanTitle(((String) item.getValue(0))));
+ // chartList.add(CatalogueOpener.cleanTitle(((String)
+ // item.getValue(0))));
chartList.add((String) item.getValue(5));
// open wizard
@@ -109,7 +114,7 @@
if (resourceType.equals(ResourceTypeNew.DATASET))
contextMenu.add(openAsChart);
- /* ***** OPEN AS A MAP ***** */
+ /* OPEN AS A MAP */
final MenuItem openAsMap = new MenuItem(Style.PUSH);
openAsMap.setText(Fenix.fenixLang.openAsMap());
@@ -154,7 +159,7 @@
contextMenu.add(separator);
}
- /* ***** OPEN AS A TABLE ***** */
+ /* OPEN AS A TABLE */
MenuItem openAsTable = new MenuItem(Style.PUSH);
openAsTable.setText(Fenix.fenixLang.openAsTable());
openAsTable.addSelectionListener(new SelectionListener() {
@@ -191,7 +196,7 @@
contextMenu.add(separator);
}
- /* ***** DUPLICATE ***** */
+ /* DUPLICATE */
MenuItem duplicate = new MenuItem(Style.PUSH);
duplicate.setText(Fenix.fenixLang.duplicate());
duplicate.addSelectionListener(new SelectionListener() {
@@ -205,7 +210,7 @@
separator = new MenuItem(Style.SEPARATOR);
contextMenu.add(separator);
- /* ***** EXPORT ***** */
+ /* EXPORT */
MenuItem export = new MenuItem(Style.PUSH);
export.setText(Fenix.fenixLang.export());
export.addSelectionListener(new SelectionListener() {
@@ -216,7 +221,7 @@
export.setEnabled(false);
contextMenu.add(export);
- /* ***** DELETE ***** */
+ /* DELETE */
MenuItem delete = new MenuItem(Style.PUSH);
delete.setText(Fenix.fenixLang.delete());
delete.addSelectionListener(new SelectionListener() {
@@ -226,7 +231,7 @@
});
contextMenu.add(delete);
- /* ***** RENAME ***** */
+ /* RENAME */
MenuItem rename = new MenuItem(Style.PUSH);
rename.setText(Fenix.fenixLang.rename());
rename.addSelectionListener(new SelectionListener() {
@@ -239,7 +244,7 @@
separator = new MenuItem(Style.SEPARATOR);
contextMenu.add(separator);
- /* ***** VIEW METADATA ***** */
+ /* VIEW METADATA */
MenuItem viewMetadata = new MenuItem(Style.PUSH);
viewMetadata.setText(Fenix.fenixLang.viewMetadata());
viewMetadata.addSelectionListener(new SelectionListener() {
@@ -252,7 +257,7 @@
});
contextMenu.add(viewMetadata);
- /* ***** LINKED RESOURCES ***** */
+ /* LINKED RESOURCES */
MenuItem linkedResources = new MenuItem(Style.PUSH);
linkedResources.setText(Fenix.fenixLang.linkedResources());
linkedResources.addSelectionListener(new SelectionListener() {
@@ -266,7 +271,7 @@
separator = new MenuItem(Style.SEPARATOR);
contextMenu.add(separator);
- /* ***** SHARE RESOURCE ***** */
+ /* SHARE RESOURCE */
MenuItem shareResource = new MenuItem(Style.PUSH);
shareResource.setText(Fenix.fenixLang.shareResource());
shareResource.addSelectionListener(new SelectionListener() {
@@ -286,70 +291,99 @@
public void onSuccess(Object result) {
String digest = (String) result;
com.setDigest(digest);
- // push the information to other nodes. I had to put this inside another asynchronous call in order to calculate and send to the WS the digest for the shared resource.
+ // push the information to other nodes. I had to put
+ // this inside another asynchronous call in order to
+ // calculate and send to the WS the digest for the
+ // shared resource.
Fenix.communicationService.pushInformation(Fenix.fenixServicesUrl, com, new AsyncCallback() {
public void onSuccess(Object result) {
- new FenixDebugShell("<ul><b>" + Fenix.fenixLang.giewsNetwork() + "</b></ul><ul>" + (String) result + "</ul>");
+ new FenixDebugShell("<ul><b>" + Fenix.fenixLang.giewsNetwork() + "</b></ul><ul>"
+ + (String) result + "</ul>");
progress.destroy();
}
public void onFailure(Throwable caught) {
- new FenixDebugShell("<ul><b>CatalogueContextMenu</b></ul><ul>RPC to pushInformation(resource).</ul><ul>" + caught.getMessage() + "</ul>");
+ new FenixDebugShell(
+ "<ul><b>CatalogueContextMenu</b></ul><ul>RPC to pushInformation(resource).</ul><ul>"
+ + caught.getMessage() + "</ul>");
progress.destroy();
}
});
}
public void onFailure(Throwable caught) {
- new FenixDebugShell("<ul><b>CatalogueContextMenu</b></ul><ul>RPC to pushInformation(resource).</ul><ul>" + caught.getMessage() + "</ul>");
+ new FenixDebugShell(
+ "<ul><b>CatalogueContextMenu</b></ul><ul>RPC to pushInformation(resource).</ul><ul>"
+ + caught.getMessage() + "</ul>");
progress.destroy();
}
});
}
});
- if (resourceType.equals(ResourceTypeNew.DATASET) || resourceType.equals(ResourceTypeNew.LAYER))
- if (((ListBox) Fenix.newResourceExplorer.searchMask.scope).getItemText(((ListBox) Fenix.newResourceExplorer.searchMask.scope).getSelectedIndex()).equals(Fenix.fenixLang.thisNode()))
+
+ if (resourceType.equals(ResourceTypeNew.DATASET) || resourceType.equals(ResourceTypeNew.LAYER)) {
+ if (Fenix.newResourceExplorer.searchMask.scope != null) {
+ String scope = Fenix.newResourceExplorer.searchMask.scope
+ .getItemText(Fenix.newResourceExplorer.searchMask.scope.getSelectedIndex());
+ if (scope.equals(Fenix.fenixLang.thisNode()))
+ contextMenu.add(shareResource);
+ } else {
+ // if no scope is defined, local scope is assumed
contextMenu.add(shareResource);
-
- /* ***** DOWNLOAD RESOURCE ***** */
+ }
+ }
+ /* DOWNLOAD RESOURCE */
MenuItem downloadResource = new MenuItem(Style.PUSH);
downloadResource.setText(Fenix.fenixLang.downloadResource());
downloadResource.addSelectionListener(new SelectionListener() {
public void widgetSelected(BaseEvent be) {
TableItem item = Fenix.newResourceExplorer.catalogueList.table.getSelectedItem();
final String localResourceId = (String) item.getValues()[3];
- String scope = Fenix.newResourceExplorer.searchMask.scope.getItemText(Fenix.newResourceExplorer.searchMask.scope.getSelectedIndex());
+ String scope = Fenix.newResourceExplorer.searchMask.scope
+ .getItemText(Fenix.newResourceExplorer.searchMask.scope.getSelectedIndex());
if (!scope.equals(Fenix.fenixLang.thisNode())) {
final Loading progress = new Loading();
progress.create();
- Fenix.communicationService.downloadResource((String) item.getValues()[2], localResourceId, new AsyncCallback() {
- public void onSuccess(Object result) {
- Fenix.communicationService.importDataset(localResourceId, new AsyncCallback() {
+ Fenix.communicationService.downloadResource((String) item.getValues()[2], localResourceId,
+ new AsyncCallback() {
public void onSuccess(Object result) {
- new FenixDebugShell("Resource has been downloaded.");
- progress.destroy();
+ Fenix.communicationService.importDataset(localResourceId, new AsyncCallback() {
+ public void onSuccess(Object result) {
+ new FenixDebugShell("Resource has been downloaded.");
+ progress.destroy();
+ }
+
+ public void onFailure(Throwable caught) {
+ new FenixDebugShell(
+ "<ul><b>CatalogueContextMenu</b></ul><ul>RPC to downloadResource(id).</ul><ul>"
+ + caught.getMessage() + "</ul>");
+ progress.destroy();
+ }
+ });
}
public void onFailure(Throwable caught) {
- new FenixDebugShell("<ul><b>CatalogueContextMenu</b></ul><ul>RPC to downloadResource(id).</ul><ul>" + caught.getMessage() + "</ul>");
+ new FenixDebugShell(
+ "<ul><b>CatalogueContextMenu</b></ul><ul>RPC to downloadResource(id).</ul><ul>"
+ + caught.getMessage() + "</ul>");
progress.destroy();
}
});
- }
-
- public void onFailure(Throwable caught) {
- new FenixDebugShell("<ul><b>CatalogueContextMenu</b></ul><ul>RPC to downloadResource(id).</ul><ul>" + caught.getMessage() + "</ul>");
- progress.destroy();
- }
- });
} else
- new FenixDebugShell("We're sorry, but you can not download a resource from your own node. Please change the search scope to 'This Group' or 'GIEWS Network'. Thank you.");
+ new FenixDebugShell(
+ "We're sorry, but you can not download a resource from your own node. Please change the search scope to 'This Group' or 'GIEWS Network'. Thank you.");
}
});
Info.show("CATALOGUE", "Resource type {0}", resourceType);
- if (resourceType.equals(ResourceTypeNew.DATASET) || resourceType.equals(ResourceTypeNew.LAYER) || resourceType.equals("dataset"));
- //if (!((ListBox) Fenix.newResourceExplorer.searchMask.scope).getItemText(((ListBox) Fenix.newResourceExplorer.searchMask.scope).getSelectedIndex()).equals(Fenix.fenixLang.thisNode()))
- contextMenu.add(downloadResource);
+ if (resourceType.equals(ResourceTypeNew.DATASET) || resourceType.equals(ResourceTypeNew.LAYER)
+ || resourceType.equals("dataset"))
+ ;
+ // if (!((ListBox)
+ // Fenix.newResourceExplorer.searchMask.scope).getItemText(((ListBox)
+ // Fenix
+ // .newResourceExplorer.searchMask.scope).getSelectedIndex()).equals
+ // (Fenix.fenixLang.thisNode()))
+ contextMenu.add(downloadResource);
// URL to share birt report
MenuItem birtReportURL = new MenuItem(Style.PUSH);
@@ -358,7 +392,8 @@
public void widgetSelected(BaseEvent be) {
birtURL = Fenix.fenixServicesUrl;
final TableItem item = Fenix.newResourceExplorer.catalogueList.table.getSelectedItem();
- // parser URL http://host:port/fenix-services/services/CommunicationModuleService
+ // parser URL http://host:port/fenix-services/services/
+ // CommunicationModuleService
int numSlash = 3;
for (int i = (birtURL.length() - 1); i > 0; i--) {
if (birtURL.charAt(i) == '/') {
@@ -373,7 +408,9 @@
Fenix.birtService.getBirtApplName(new AsyncCallback() {
public void onSuccess(Object result) {
- new FenixDebugShell("You can add that link in your web site to view the report<br>" + birtURL + "/" + (String) result + "/FenixBirtServlet?dataViewId=" + (String) item.getValues()[5] + "&servletType=frameset");
+ new FenixDebugShell("You can add that link in your web site to view the report<br>" + birtURL
+ + "/" + (String) result + "/FenixBirtServlet?dataViewId="
+ + (String) item.getValues()[5] + "&servletType=frameset");
}
public void onFailure(Throwable caught) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|