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>
<!-- GCube Widgets -->
<!-- <dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-widgets</artifactId>
<scope>compile</scope>
</dependency> -->
<!-- <dependency> <groupId>org.gcube.portlets.user</groupId> <artifactId>gcube-widgets</artifactId>
<scope>compile</scope> </dependency> -->
<!-- Storage -->
<dependency>
@ -279,6 +276,7 @@
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>workspace-explorer</artifactId>
<version>[1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<!-- <version>1.6.0-SNAPSHOT</version> -->
</dependency>
<!-- Workspace Uploader -->
@ -295,6 +293,13 @@
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</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 -->
<dependency>
<groupId>com.allen-sauer.gwt.log</groupId>
@ -312,7 +317,7 @@
<artifactId>slf4j-log4j12</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@ -387,7 +392,7 @@
<executions>
<execution>
<configuration>
<extraJvmArgs>-Xss512m -Xmx3072m -XX:MaxPermSize=2048m</extraJvmArgs>
<!-- <extraJvmArgs>-Xss512m -Xmx3072m -XX:MaxPermSize=2048m</extraJvmArgs> -->
</configuration>
<goals>
<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.Parameter;
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.select.WorkspaceExplorerSelectDialog;
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
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.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Widget;
@ -60,6 +64,7 @@ public class FileFld extends AbstractFld {
private HBoxLayoutContainer horiz;
private TextButton downloadButton;
private TextButton netcdfButton;
/**
* @param parameter parameter
@ -187,6 +192,16 @@ public class FileFld extends AbstractFld {
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() {
vp.clear();
@ -282,6 +318,9 @@ public class FileFld extends AbstractFld {
h.add(tableDescription, new BoxLayoutData(new Margins()));
h.add(selectButton2, 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()));
vp.clear();
vp.add(h);

View File

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

View File

@ -20,7 +20,12 @@
<!-- OpenLayer Basic Widgets -->
<inherits
name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' />
<!-- NetCDF Basic Widgets -->
<inherits
name='org.gcube.portlets.widgets.netcdfbasicwidgets.netcdfbasicwidgets' />
<!-- inherits WorkspaceExplorer widget -->
<inherits name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' />
@ -31,17 +36,17 @@
<entry-point
class='org.gcube.portlets.user.dataminermanager.client.DataMinerManager' />
<!--
<set-property name="log_ConsoleLogger" value="ENABLED" /> <set-property
name="log_DivLogger" value="ENABLED" /> <set-property name="log_GWTLogger"
value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED"
/>
/> -->
<!--
<set-property name="log_ConsoleLogger" value="DISABLED" />
<set-property name="log_DivLogger" 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);
} else {
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 {
if (title.contains("[a sequence of http links")) {
Pattern pattern = Pattern.compile(
@ -311,18 +315,26 @@ public class WPS2DM {
converted = new TabularListParameter(id, title, separator, mimeType,
supportedMimeTypes);
} 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 {
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 {
converted = new FileParameter(id, title, mimeType, supportedMimeTypes);
converted = new FileParameter(id, title, mimeType, supportedMimeTypes,false);
}
} else {
converted = new FileParameter(id, title, mimeType, supportedMimeTypes);
converted = new FileParameter(id, title, mimeType, supportedMimeTypes,false);
}
return converted;
}

View File

@ -7,7 +7,7 @@ package org.gcube.portlets.user.dataminermanager.shared;
*
*/
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 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 DEFAULT_USER = "giancarlo.panichi";
public final static String DEFAULT_SCOPE = "/gcube/devNext";
public final static String DEFAULT_TOKEN = "16e65d4f-11e0-4e4a-84b9-351688fccc12-98187548";
public final static String DEFAULT_SCOPE = "/gcube/devNext/NextNext";
public final static String DEFAULT_TOKEN = "ae1208f0-210d-47c9-9b24-d3f2dfcce05f-98187548";
public static final String DEFAULT_ROLE = "OrganizationMember";
// 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 String defaultMimeType;
private ArrayList<String> supportedMimeTypes;
private boolean netcdf;
/**
*
@ -23,6 +24,7 @@ public class FileParameter extends Parameter {
public FileParameter() {
super();
this.typology = ParameterType.FILE;
netcdf=false;
}
/**
@ -37,10 +39,11 @@ public class FileParameter extends Parameter {
* supported mime types
*/
public FileParameter(String name, String description, String defaultMimeType,
ArrayList<String> supportedMimeTypes) {
ArrayList<String> supportedMimeTypes, boolean netcdf) {
super(name, ParameterType.FILE, description);
this.defaultMimeType = defaultMimeType;
this.supportedMimeTypes = supportedMimeTypes;
this.netcdf=netcdf;
}
public String getDefaultMimeType() {
@ -59,11 +62,21 @@ public class FileParameter extends Parameter {
this.supportedMimeTypes = supportedMimeTypes;
}
@Override
public String toString() {
return "FileParameter [value=" + value + ", defaultMimeType=" + defaultMimeType + ", supportedMimeTypes="
+ supportedMimeTypes + ", name=" + name + ", description=" + description + ", typology=" + typology
+ "]";
public boolean isNetcdf() {
return netcdf;
}
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 -->
<inherits
name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' />
<!-- NetCDF Basic Widgets -->
<inherits
name='org.gcube.portlets.widgets.netcdfbasicwidgets.netcdfbasicwidgets' />
<!-- inherits WorkspaceExplorer widget -->
<inherits name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' />
@ -32,17 +37,18 @@
<entry-point
class='org.gcube.portlets.user.dataminermanager.client.DataMinerManager' />
<!--
<set-property name="log_ConsoleLogger" value="ENABLED" /> <set-property
name="log_DivLogger" value="ENABLED" /> <set-property name="log_GWTLogger"
value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED"
/>
/> -->
<!--
<set-property name="log_ConsoleLogger" value="DISABLED" />
<set-property name="log_DivLogger" 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='shared' />

View File

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

View File

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