Added NetCDF Preview support

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@157544 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-10-24 19:21:32 +00:00
parent 70f484c387
commit a96e288843
10 changed files with 133 additions and 33 deletions

19
pom.xml
View File

@ -200,11 +200,8 @@
</dependency> </dependency>
<!-- GCube Widgets --> <!-- GCube Widgets -->
<!-- <dependency> <!-- <dependency> <groupId>org.gcube.portlets.user</groupId> <artifactId>gcube-widgets</artifactId>
<groupId>org.gcube.portlets.user</groupId> <scope>compile</scope> </dependency> -->
<artifactId>gcube-widgets</artifactId>
<scope>compile</scope>
</dependency> -->
<!-- Storage --> <!-- Storage -->
<dependency> <dependency>
@ -279,6 +276,7 @@
<groupId>org.gcube.portlets.widgets</groupId> <groupId>org.gcube.portlets.widgets</groupId>
<artifactId>workspace-explorer</artifactId> <artifactId>workspace-explorer</artifactId>
<version>[1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> <version>[1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<!-- <version>1.6.0-SNAPSHOT</version> -->
</dependency> </dependency>
<!-- Workspace Uploader --> <!-- Workspace Uploader -->
@ -295,6 +293,13 @@
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version> <version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency> </dependency>
<!-- NetCDF Basic Widget -->
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>netcdf-basic-widgets</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency>
<!-- LOGGING --> <!-- LOGGING -->
<dependency> <dependency>
<groupId>com.allen-sauer.gwt.log</groupId> <groupId>com.allen-sauer.gwt.log</groupId>
@ -312,7 +317,7 @@
<artifactId>slf4j-log4j12</artifactId> <artifactId>slf4j-log4j12</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
@ -387,7 +392,7 @@
<executions> <executions>
<execution> <execution>
<configuration> <configuration>
<extraJvmArgs>-Xss512m -Xmx3072m -XX:MaxPermSize=2048m</extraJvmArgs> <!-- <extraJvmArgs>-Xss512m -Xmx3072m -XX:MaxPermSize=2048m</extraJvmArgs> -->
</configuration> </configuration>
<goals> <goals>
<goal>compile</goal> <goal>compile</goal>

View File

@ -16,12 +16,16 @@ import org.gcube.portlets.user.dataminermanager.shared.exception.SessionExpiredS
import org.gcube.portlets.user.dataminermanager.shared.parameters.FileParameter; import org.gcube.portlets.user.dataminermanager.shared.parameters.FileParameter;
import org.gcube.portlets.user.dataminermanager.shared.parameters.Parameter; import org.gcube.portlets.user.dataminermanager.shared.parameters.Parameter;
import org.gcube.portlets.user.dataminermanager.shared.workspace.ItemDescription; import org.gcube.portlets.user.dataminermanager.shared.workspace.ItemDescription;
import org.gcube.portlets.widgets.netcdfbasicwidgets.client.event.SelectVariableEvent;
import org.gcube.portlets.widgets.netcdfbasicwidgets.client.event.SelectVariableEvent.SelectVariableEventHandler;
import org.gcube.portlets.widgets.netcdfbasicwidgets.client.widgets.NetCDFPreviewDialog;
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener; import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
import org.gcube.portlets.widgets.wsexplorer.client.select.WorkspaceExplorerSelectDialog; import org.gcube.portlets.widgets.wsexplorer.client.select.WorkspaceExplorerSelectDialog;
import org.gcube.portlets.widgets.wsexplorer.shared.Item; import org.gcube.portlets.widgets.wsexplorer.shared.Item;
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType; import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.user.client.Window; import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;
@ -60,6 +64,7 @@ public class FileFld extends AbstractFld {
private HBoxLayoutContainer horiz; private HBoxLayoutContainer horiz;
private TextButton downloadButton; private TextButton downloadButton;
private TextButton netcdfButton;
/** /**
* @param parameter parameter * @param parameter parameter
@ -187,6 +192,16 @@ public class FileFld extends AbstractFld {
downloadFile(); downloadFile();
} }
}); });
netcdfButton = new TextButton("");
netcdfButton.setIcon(DataMinerManager.resources.netcdf());
netcdfButton.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
showNetCDFFile();
}
});
} }
@ -259,6 +274,27 @@ public class FileFld extends AbstractFld {
} }
} }
private void showNetCDFFile() {
if (selectedFileItem != null) {
GWT.log("NetcdfBasicWidgetsManager");
// Example
SelectVariableEventHandler handler=new SelectVariableEventHandler() {
@Override
public void onResponse(SelectVariableEvent event) {
GWT.log("SelectVariable Response: "+event);
}
};
NetCDFPreviewDialog netcdfDialog=new NetCDFPreviewDialog(selectedFileItem.getPublicLink());
netcdfDialog.addSelectVariableEventHandler(handler);
netcdfDialog.setZIndex(XDOM.getTopZIndex());
}
}
private void showNoSelectionField() { private void showNoSelectionField() {
vp.clear(); vp.clear();
@ -282,6 +318,9 @@ public class FileFld extends AbstractFld {
h.add(tableDescription, new BoxLayoutData(new Margins())); h.add(tableDescription, new BoxLayoutData(new Margins()));
h.add(selectButton2, new BoxLayoutData(new Margins())); h.add(selectButton2, new BoxLayoutData(new Margins()));
h.add(downloadButton, new BoxLayoutData(new Margins())); h.add(downloadButton, new BoxLayoutData(new Margins()));
if(fileParameter.isNetcdf()){
h.add(netcdfButton, new BoxLayoutData(new Margins()));
}
h.add(cancelButton, new BoxLayoutData(new Margins())); h.add(cancelButton, new BoxLayoutData(new Margins()));
vp.clear(); vp.clear();
vp.add(h); vp.add(h);

View File

@ -87,6 +87,9 @@ public interface Resources extends ClientBundle {
@Source("download.png") @Source("download.png")
ImageResource download(); ImageResource download();
@Source("show.png")
ImageResource netcdf();
@Source("cancel_circle.png") @Source("cancel_circle.png")
ImageResource cancelCircle(); ImageResource cancelCircle();

View File

@ -20,7 +20,12 @@
<!-- OpenLayer Basic Widgets --> <!-- OpenLayer Basic Widgets -->
<inherits <inherits
name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' /> name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' />
<!-- NetCDF Basic Widgets -->
<inherits
name='org.gcube.portlets.widgets.netcdfbasicwidgets.netcdfbasicwidgets' />
<!-- inherits WorkspaceExplorer widget --> <!-- inherits WorkspaceExplorer widget -->
<inherits name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' /> <inherits name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' />
@ -31,17 +36,17 @@
<entry-point <entry-point
class='org.gcube.portlets.user.dataminermanager.client.DataMinerManager' /> class='org.gcube.portlets.user.dataminermanager.client.DataMinerManager' />
<!--
<set-property name="log_ConsoleLogger" value="ENABLED" /> <set-property <set-property name="log_ConsoleLogger" value="ENABLED" /> <set-property
name="log_DivLogger" value="ENABLED" /> <set-property name="log_GWTLogger" name="log_DivLogger" value="ENABLED" /> <set-property name="log_GWTLogger"
value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED" value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED"
/> /> -->
<!--
<set-property name="log_ConsoleLogger" value="DISABLED" /> <set-property name="log_ConsoleLogger" value="DISABLED" />
<set-property name="log_DivLogger" value="DISABLED" /> <set-property name="log_DivLogger" value="DISABLED" />
<set-property name="log_GWTLogger" value="DISABLED" /> <set-property name="log_GWTLogger" value="DISABLED" />
<set-property name="log_SystemLogger" value="DISABLED" /> --> <set-property name="log_SystemLogger" value="DISABLED" />

View File

@ -291,7 +291,11 @@ public class WPS2DM {
supportedMimeTypes); supportedMimeTypes);
} else { } else {
if (title.contains("[a http link to a file")) { if (title.contains("[a http link to a file")) {
converted = new FileParameter(id, title, mimeType, supportedMimeTypes); if (title.contains("[NETCDF]")) {
converted = new FileParameter(id, title, mimeType, supportedMimeTypes, true);
} else {
converted = new FileParameter(id, title, mimeType, supportedMimeTypes, false);
}
} else { } else {
if (title.contains("[a sequence of http links")) { if (title.contains("[a sequence of http links")) {
Pattern pattern = Pattern.compile( Pattern pattern = Pattern.compile(
@ -311,18 +315,26 @@ public class WPS2DM {
converted = new TabularListParameter(id, title, separator, mimeType, converted = new TabularListParameter(id, title, separator, mimeType,
supportedMimeTypes); supportedMimeTypes);
} else { } else {
converted = new FileParameter(id, title, mimeType, supportedMimeTypes); if (title.contains("[NETCDF]")) {
converted = new FileParameter(id, title, mimeType, supportedMimeTypes, true);
} else {
converted = new FileParameter(id, title, mimeType, supportedMimeTypes, false);
}
} }
} else { } else {
converted = new FileParameter(id, title, mimeType, supportedMimeTypes); if (title.contains("[NETCDF]")) {
converted = new FileParameter(id, title, mimeType, supportedMimeTypes, true);
} else {
converted = new FileParameter(id, title, mimeType, supportedMimeTypes,false);
}
} }
} }
} }
} else { } else {
converted = new FileParameter(id, title, mimeType, supportedMimeTypes); converted = new FileParameter(id, title, mimeType, supportedMimeTypes,false);
} }
} else { } else {
converted = new FileParameter(id, title, mimeType, supportedMimeTypes); converted = new FileParameter(id, title, mimeType, supportedMimeTypes,false);
} }
return converted; return converted;
} }

View File

@ -7,7 +7,7 @@ package org.gcube.portlets.user.dataminermanager.shared;
* *
*/ */
public class Constants { public class Constants {
public static final boolean DEBUG_MODE = true; public static final boolean DEBUG_MODE = false;
public static final boolean TEST_ENABLE = false; public static final boolean TEST_ENABLE = false;
public static final String APPLICATION_ID = "org.gcube.portlets.user.dataminermanager.portlet.DataMinerManager"; public static final String APPLICATION_ID = "org.gcube.portlets.user.dataminermanager.portlet.DataMinerManager";
@ -17,12 +17,11 @@ public class Constants {
public static final String DATA_MINER_OPERATOR_ID = "OperatorId"; public static final String DATA_MINER_OPERATOR_ID = "OperatorId";
public static final String DEFAULT_USER = "giancarlo.panichi"; public static final String DEFAULT_USER = "giancarlo.panichi";
public final static String DEFAULT_SCOPE = "/gcube/devNext"; public final static String DEFAULT_SCOPE = "/gcube/devNext/NextNext";
public final static String DEFAULT_TOKEN = "16e65d4f-11e0-4e4a-84b9-351688fccc12-98187548"; public final static String DEFAULT_TOKEN = "ae1208f0-210d-47c9-9b24-d3f2dfcce05f-98187548";
public static final String DEFAULT_ROLE = "OrganizationMember"; public static final String DEFAULT_ROLE = "OrganizationMember";
// public final static String DEFAULT_SCOPE = "/gcube/devNext"; // public final static String DEFAULT_SCOPE = "/gcube/devNext";
//public final static String DEFAULT_SCOPE = "/gcube/devNext/NextNext";

View File

@ -16,6 +16,7 @@ public class FileParameter extends Parameter {
private static final long serialVersionUID = -2967577990287112937L; private static final long serialVersionUID = -2967577990287112937L;
private String defaultMimeType; private String defaultMimeType;
private ArrayList<String> supportedMimeTypes; private ArrayList<String> supportedMimeTypes;
private boolean netcdf;
/** /**
* *
@ -23,6 +24,7 @@ public class FileParameter extends Parameter {
public FileParameter() { public FileParameter() {
super(); super();
this.typology = ParameterType.FILE; this.typology = ParameterType.FILE;
netcdf=false;
} }
/** /**
@ -37,10 +39,11 @@ public class FileParameter extends Parameter {
* supported mime types * supported mime types
*/ */
public FileParameter(String name, String description, String defaultMimeType, public FileParameter(String name, String description, String defaultMimeType,
ArrayList<String> supportedMimeTypes) { ArrayList<String> supportedMimeTypes, boolean netcdf) {
super(name, ParameterType.FILE, description); super(name, ParameterType.FILE, description);
this.defaultMimeType = defaultMimeType; this.defaultMimeType = defaultMimeType;
this.supportedMimeTypes = supportedMimeTypes; this.supportedMimeTypes = supportedMimeTypes;
this.netcdf=netcdf;
} }
public String getDefaultMimeType() { public String getDefaultMimeType() {
@ -59,11 +62,21 @@ public class FileParameter extends Parameter {
this.supportedMimeTypes = supportedMimeTypes; this.supportedMimeTypes = supportedMimeTypes;
} }
@Override
public String toString() { public boolean isNetcdf() {
return "FileParameter [value=" + value + ", defaultMimeType=" + defaultMimeType + ", supportedMimeTypes=" return netcdf;
+ supportedMimeTypes + ", name=" + name + ", description=" + description + ", typology=" + typology
+ "]";
} }
public void setNetcdf(boolean netcdf) {
this.netcdf = netcdf;
}
@Override
public String toString() {
return "FileParameter [defaultMimeType=" + defaultMimeType + ", supportedMimeTypes=" + supportedMimeTypes
+ ", netcdf=" + netcdf + ", name=" + name + ", description=" + description + ", typology=" + typology
+ ", value=" + value + "]";
}
} }

View File

@ -20,7 +20,12 @@
<!-- OpenLayer Basic Widgets --> <!-- OpenLayer Basic Widgets -->
<inherits <inherits
name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' /> name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' />
<!-- NetCDF Basic Widgets -->
<inherits
name='org.gcube.portlets.widgets.netcdfbasicwidgets.netcdfbasicwidgets' />
<!-- inherits WorkspaceExplorer widget --> <!-- inherits WorkspaceExplorer widget -->
<inherits name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' /> <inherits name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' />
@ -32,17 +37,18 @@
<entry-point <entry-point
class='org.gcube.portlets.user.dataminermanager.client.DataMinerManager' /> class='org.gcube.portlets.user.dataminermanager.client.DataMinerManager' />
<!--
<set-property name="log_ConsoleLogger" value="ENABLED" /> <set-property <set-property name="log_ConsoleLogger" value="ENABLED" /> <set-property
name="log_DivLogger" value="ENABLED" /> <set-property name="log_GWTLogger" name="log_DivLogger" value="ENABLED" /> <set-property name="log_GWTLogger"
value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED" value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED"
/> /> -->
<!--
<set-property name="log_ConsoleLogger" value="DISABLED" /> <set-property name="log_ConsoleLogger" value="DISABLED" />
<set-property name="log_DivLogger" value="DISABLED" /> <set-property name="log_DivLogger" value="DISABLED" />
<set-property name="log_GWTLogger" value="DISABLED" /> <set-property name="log_GWTLogger" value="DISABLED" />
<set-property name="log_SystemLogger" value="DISABLED" /> <set-property name="log_SystemLogger" value="DISABLED" />
-->
<source path='client' /> <source path='client' />
<source path='shared' /> <source path='shared' />

View File

@ -462,4 +462,12 @@
.computation-output-fileName { .computation-output-fileName {
margin-top: 2px; margin-top: 2px;
margin-bottom: 2px; margin-bottom: 2px;
} }
#netcdfSampleTextArea {
height: 318px;
width: 616px !important;
resize: none;
}

View File

@ -28,6 +28,10 @@
<servlet-name>workspaceUploadServletStream</servlet-name> <servlet-name>workspaceUploadServletStream</servlet-name>
<servlet-class>org.gcube.portlets.widgets.workspaceuploader.server.WorkspaceUploadServletStream</servlet-class> <servlet-class>org.gcube.portlets.widgets.workspaceuploader.server.WorkspaceUploadServletStream</servlet-class>
</servlet> </servlet>
<servlet>
<servlet-name>NetCDFBasicWidgetService</servlet-name>
<servlet-class>org.gcube.portlets.widgets.netcdfbasicwidgets.server.NetCDFBasicWidgetServiceImpl</servlet-class>
</servlet>
<servlet-mapping> <servlet-mapping>
@ -53,8 +57,14 @@
<servlet-mapping> <servlet-mapping>
<servlet-name>workspaceUploadServletStream</servlet-name> <servlet-name>workspaceUploadServletStream</servlet-name>
<url-pattern>/dataminermanager/workspaceUploadServletStream</url-pattern> <url-pattern>/dataminermanager/workspaceUploadServletStream</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>NetCDFBasicWidgetService</servlet-name>
<url-pattern>/dataminermanager/netcdfservice</url-pattern>
</servlet-mapping> </servlet-mapping>
<welcome-file-list> <welcome-file-list>
<welcome-file>DataMinerManager.html</welcome-file> <welcome-file>DataMinerManager.html</welcome-file>
</welcome-file-list> </welcome-file-list>