This commit is contained in:
Giancarlo Panichi 2019-01-17 19:11:53 +00:00
parent 3a56852f7d
commit 1630f645c1
957 changed files with 24665 additions and 0 deletions

38
.classpath Normal file
View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/data-miner-executor-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/data-miner-executor-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/data-miner-executor-1.0.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

64
.project Normal file
View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>data-miner-executor</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,6 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View File

@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="data-miner-executor-1.0.0-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="java-output-path" value="/data-miner-manager/target/data-miner-executor-1.0.0-SNAPSHOT/WEB-INF/classes"/>
<property name="context-root" value="data-miner-executor"/>
</wb-module>
</project-modules>

View File

@ -0,0 +1,7 @@
<root>
<facet id="jst.jaxrs">
<node name="libprov">
<attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
</node>
</facet>
</root>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.7"/>
<installed facet="jst.jaxrs" version="2.0"/>
</faceted-project>

View File

@ -0,0 +1,2 @@
disabled=06target
eclipse.preferences.version=1

1
distro/LICENSE Normal file
View File

@ -0,0 +1 @@
${gcube.license}

68
distro/README Normal file
View File

@ -0,0 +1,68 @@
The gCube System - ${name}
--------------------------------------------------
${description}
${gcube.description}
${gcube.funding}
Version
--------------------------------------------------
${version} (${buildDate})
Please see the file named "changelog.xml" in this directory for the release notes.
Authors
--------------------------------------------------
* Giancarlo Panichi (giancarlo.panichi-AT-isti.cnr.it),
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" CNR, Pisa IT
Maintainers
-----------
* Giancarlo Panichi (giancarlo.panichi-AT-isti.cnr.it),
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" CNR, Pisa IT
Download information
--------------------------------------------------
Source code is available from SVN:
${scm.url}
Binaries can be downloaded from the gCube website:
${gcube.website}
Installation
--------------------------------------------------
Installation documentation is available on-line in the gCube Wiki:
https://gcube.wiki.gcube-system.org/gcube/Data_Miner_Manager
Documentation
--------------------------------------------------
Documentation is available on-line in the gCube Wiki:
https://gcube.wiki.gcube-system.org/gcube/Data_Miner_Manager
Support
--------------------------------------------------
Bugs and support requests can be reported in the gCube issue tracking tool:
${gcube.issueTracking}
Licensing
--------------------------------------------------
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.

5
distro/changelog.xml Normal file
View File

@ -0,0 +1,5 @@
<ReleaseNotes>
<Changeset component="${groupId}.${artifactId}.1-0-0" date="2019-01-31">
<Change>First release</Change>
</Changeset>
</ReleaseNotes>

32
distro/descriptor.xml Normal file
View File

@ -0,0 +1,32 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>servicearchive</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>/</baseDirectory>
<fileSets>
<fileSet>
<directory>${distroDirectory}</directory>
<outputDirectory>/</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<includes>
<include>README</include>
<include>LICENSE</include>
<include>changelog.xml</include>
<include>profile.xml</include>
</includes>
<fileMode>755</fileMode>
<filtered>true</filtered>
</fileSet>
</fileSets>
<files>
<file>
<source>target/${build.finalName}.${project.packaging}</source>
<outputDirectory>/${artifactId}</outputDirectory>
</file>
</files>
</assembly>

29
distro/profile.xml Normal file
View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource>
<ID></ID>
<Type>Service</Type>
<Profile>
<Description>${project.description}</Description>
<Class>PortletsUser</Class>
<Name>${project.artifactId}</Name>
<Version>1.0.0</Version>
<Packages>
<Software>
<Description>${project.description}</Description>
<Name>${project.artifactId}</Name>
<Version>${version}</Version>
<MavenCoordinates>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
</MavenCoordinates>
<Type>webapplication</Type>
<Files>
<File>${project.build.finalName}.${project.packaging}</File>
</Files>
</Software>
</Packages>
</Profile>
</Resource>

385
pom.xml Normal file
View File

@ -0,0 +1,385 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.0.0</version>
<relativePath />
</parent>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>data-miner-executor</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>data-miner-executor</name>
<description>data-miner-executor allows the execution of an algorithm.</description>
<scm>
<url>https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-executor</url>
</scm>
<developers>
<developer>
<name>Giancarlo Panichi</name>
<email>g.panichi@isti.cnr.it</email>
<organization>CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"</organization>
<roles>
<role>architect</role>
<role>developer</role>
</roles>
</developer>
</developers>
<properties>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<distroDirectory>distro</distroDirectory>
<configDirectory>config</configDirectory>
<!-- Java -->
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- GWT configuration -->
<gwtVersion>2.6.1</gwtVersion>
<gwtLogVersion>3.3.2</gwtLogVersion>
<gxtVersion>3.1.1</gxtVersion>
<gxt2Version>2.6.1</gxt2Version>
<KEYS>${env.KEYS}</KEYS>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<profiles>
<profile>
<id>localRun</id>
<dependencies>
<!-- Logger -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xerces</artifactId>
<version>2.4.0</version>
</dependency>
<!-- StorageHub -->
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>storagehub-client-library</artifactId>
<scope>runtime</scope>
</dependency>
<!-- Authorization -->
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>common-authorization</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-client</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
</profile>
</profiles>
<dependencies>
<!-- GWT -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwtVersion}</version>
</dependency>
<!-- GXT 3 -->
<dependency>
<groupId>com.sencha.gxt</groupId>
<artifactId>gxt</artifactId>
<version>${gxtVersion}</version>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
</dependency>
<!-- PORTAL -->
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.common.portal</groupId>
<artifactId>portal-manager</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>client-context-library</artifactId>
<version>[1.0.0-SNAPSHOT,)</version>
<scope>compile</scope>
</dependency>
<!-- Authorization -->
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>common-authorization</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-client</artifactId>
<scope>provided</scope>
</dependency>
<!-- StorageHub -->
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>storagehub-client-library</artifactId>
<scope>compile</scope>
</dependency>
<!-- Information System Client IC-Client -->
<dependency>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId>
</dependency>
<!-- DataMiner CL -->
<dependency>
<groupId>org.gcube.data.analysis</groupId>
<artifactId>data-miner-manager-cl</artifactId>
<version>[1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<!-- csv4j -->
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>csv4j</artifactId>
<version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<!-- Workspace Explorer -->
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>workspace-explorer</artifactId>
<version>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</version>
</dependency>
<!-- Workspace Uploader -->
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>workspace-uploader</artifactId>
<version>[1.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</version>
</dependency>
<!-- OpenLayer Basic Widget -->
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>openlayer-basic-widgets</artifactId>
<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>
<!-- DataMiner Invocation Model -->
<dependency>
<groupId>org.gcube.data.analysis</groupId>
<artifactId>dataminer-invocation-model</artifactId>
<version>[0.1.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.14.4</version>
</dependency>
<!-- LOGGING -->
<dependency>
<groupId>com.allen-sauer.gwt.log</groupId>
<artifactId>gwt-log</artifactId>
<version>${gwtLogVersion}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>[3.0.0,4.0.0)</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>LATEST</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwtVersion}</version>
<executions>
<execution>
<configuration>
<!-- <extraJvmArgs>-Xss512m -Xmx3072m -XX:MaxPermSize=2048m</extraJvmArgs> -->
</configuration>
<goals>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<runTarget>DataMinerExecutor.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<module>org.gcube.portlets.user.dataminerexecutor.dataminerexecutor</module>
<!-- <style>DETAILED</style> -->
</configuration>
</plugin>
<!-- Copy static web files before executing gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>compile</phase>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
<warName>${project.build.finalName}</warName>
</configuration>
</plugin>
<!-- Maven Compiler Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>servicearchive</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,209 @@
package org.gcube.portlets.user.dataminerexecutor.client;
import org.gcube.portlets.user.dataminerexecutor.client.common.EventBusProvider;
import org.gcube.portlets.user.dataminerexecutor.client.events.InvocationModelRequestEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.MenuSwitchEvent;
import org.gcube.portlets.user.dataminerexecutor.client.experiments.ExperimentPanel;
import org.gcube.portlets.user.dataminerexecutor.client.resources.Resources;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.RootPanel;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer;
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderLayoutData;
import com.sencha.gxt.widget.core.client.container.MarginData;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.Viewport;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class DataMinerExecutor implements EntryPoint {
public static final Resources resources = GWT.create(Resources.class);
private static final String SM_DIV = "contentDiv";
private DataMinerExecutorController dataMinerExecutorController;
private Header header;
//private HomePanel homePanel;
private ExperimentPanel experimentPanel;
//private SimpleContainer previousPanel;
private SimpleContainer centerPanel;
/**
* {@inheritDoc}
*/
public void onModuleLoad() {
/*
* Install an UncaughtExceptionHandler which will produce
* <code>FATAL</code> log messages
*/
Log.setUncaughtExceptionHandler();
// use deferred command to catch initialization exceptions in
// onModuleLoad2
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
// loadScope();
loadMainPanel();
}
});
}
/*
* private void loadScope() {
* ClientScopeHelper.getService().setScope(Location.getHref(), new
* AsyncCallback<Boolean>() {
*
* @Override public void onSuccess(Boolean result) { if (result) {
* loadMainPanel(); } else { UtilsGXT3 .info("Attention",
* "ClientScopeHelper has returned a false value!"); } }
*
* @Override public void onFailure(Throwable caught) {
* UtilsGXT3.alert("Error", "Error setting scope: " +
* caught.getLocalizedMessage()); caught.printStackTrace(); } });
*
* }
*/
private void loadMainPanel() {
Log.info("DataMinerExecutor");
dataMinerExecutorController = new DataMinerExecutorController();
//homePanel = new HomePanel();
experimentPanel = new ExperimentPanel();
bind();
// Layout
final BorderLayoutContainer mainPanelLayout = new BorderLayoutContainer();
mainPanelLayout.setId("mainPanelLayout");
mainPanelLayout.setBorders(false);
mainPanelLayout.setResize(true);
mainPanelLayout.getElement().getStyle().setBackgroundColor("#FFFFFF");
// Center
centerPanel = new SimpleContainer();
MarginData mainData = new MarginData(new Margins(0));
mainPanelLayout.setCenterWidget(centerPanel, mainData);
// Menu
header = new Header();
BorderLayoutData menuData = new BorderLayoutData(40);
menuData.setMargins(new Margins(5));
menuData.setCollapsible(false);
menuData.setSplit(false);
mainPanelLayout.setNorthWidget(header, menuData);
//
if (dataMinerExecutorController.getDataMinerInvocationModelFileUrl() != null
&& !dataMinerExecutorController.getDataMinerInvocationModelFileUrl().isEmpty()) {
centerPanel.add(experimentPanel);
}
bindWindow(mainPanelLayout);
Scheduler.get().scheduleDeferred(new Command() {
public void execute() {
mainPanelLayout.forceLayout();
EventBusProvider.INSTANCE.fireEvent(new InvocationModelRequestEvent());
}
});
}
private void bind() {
EventBusProvider.INSTANCE.addHandler(MenuSwitchEvent.TYPE,
new MenuSwitchEvent.MenuSwitchEventHandler() {
@Override
public void onSelect(MenuSwitchEvent event) {
Log.debug("Catch MenuSwitchEvent");
menuSwitch(event);
}
});
}
/**
*
* @param mainWidget
*/
private void bindWindow(BorderLayoutContainer mainWidget) {
try {
RootPanel root = RootPanel.get(SM_DIV);
Log.info("Root Panel: " + root);
if (root == null) {
Log.info("Div with id " + SM_DIV
+ " not found, starting in dev mode");
Viewport viewport = new Viewport();
viewport.setWidget(mainWidget);
viewport.onResize();
RootPanel.get().add(viewport);
} else {
Log.info("Application div with id " + SM_DIV
+ " found, starting in portal mode");
PortalViewport viewport = new PortalViewport();
Log.info("Created Viewport");
viewport.setEnableScroll(false);
viewport.setWidget(mainWidget);
Log.info("Set Widget");
Log.info("getOffsetWidth(): " + viewport.getOffsetWidth());
Log.info("getOffsetHeight(): " + viewport.getOffsetHeight());
viewport.onResize();
root.add(viewport);
Log.info("Added viewport to root");
}
} catch (Exception e) {
e.printStackTrace();
Log.error("Error in attach viewport:" + e.getLocalizedMessage());
}
}
/**
*
* @param event
*/
private void menuSwitch(MenuSwitchEvent event) {
if (event == null || event.getMenuType() == null) {
return;
}
switch (event.getMenuType()) {
case EXPERIMENT:
switchPanel(experimentPanel);
break;
default:
break;
}
}
/**
*
* @param panel
*/
private void switchPanel(SimpleContainer panel) {
/*centerPanel.remove(previousPanel);
centerPanel.add(panel);
centerPanel.forceLayout();
previousPanel = panel;*/
}
}

View File

@ -0,0 +1,490 @@
package org.gcube.portlets.user.dataminerexecutor.client;
import org.gcube.data.analysis.dataminermanagercl.shared.data.OutputData;
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationData;
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationId;
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
import org.gcube.data.analysis.dataminermanagercl.shared.workspace.ItemDescription;
import org.gcube.portlets.user.dataminerexecutor.client.common.EventBusProvider;
import org.gcube.portlets.user.dataminerexecutor.client.events.CancelComputationExecutionRequestEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.CancelExecutionFromComputationsRequestEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.ComputationDataEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.ComputationDataRequestEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.DeleteItemRequestEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.InvocationModelEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.InvocationModelRequestEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.MenuEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.MenuSwitchEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.OutputDataEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.OutputDataRequestEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.ResubmitComputationExecutionEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.ResubmitComputationExecutionRequestEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.SessionExpiredEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.StartComputationExecutionEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.StartComputationExecutionRequestEvent;
import org.gcube.portlets.user.dataminerexecutor.client.monitor.StatusMonitor;
import org.gcube.portlets.user.dataminerexecutor.client.rpc.DataMinerExecutorServiceAsync;
import org.gcube.portlets.user.dataminerexecutor.client.type.MenuType;
import org.gcube.portlets.user.dataminerexecutor.client.util.InfoMessageBox;
import org.gcube.portlets.user.dataminerexecutor.client.util.UtilsGXT3;
import org.gcube.portlets.user.dataminerexecutor.shared.Constants;
import org.gcube.portlets.user.dataminerexecutor.shared.exception.SessionExpiredServiceException;
import org.gcube.portlets.user.dataminerexecutor.shared.session.UserInfo;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sencha.gxt.widget.core.client.box.AutoProgressMessageBox;
import com.sencha.gxt.widget.core.client.event.HideEvent;
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class DataMinerExecutorController {
private UserInfo userInfo;
private String invocationModelFileUrl;
public DataMinerExecutorController() {
restoreUISession();
bind();
callHello();
checkSession();
}
public UserInfo getUserInfo() {
return userInfo;
}
public String getDataMinerInvocationModelFileUrl() {
return invocationModelFileUrl;
}
private void checkSession() {
// if you do not need to something when the session expire
// CheckSession.getInstance().startPolling();
}
private void sessionExpiredShow() {
// CheckSession.showLogoutDialog();
}
/*
* private void sessionExpiredShowDelayed() { Timer timeoutTimer = new
* Timer() { public void run() { sessionExpiredShow();
*
* } }; int TIMEOUT = 3; // 3 second timeout
*
* timeoutTimer.schedule(TIMEOUT * 1000); // timeout is in milliseconds
*
* }
*/
private void bind() {
EventBusProvider.INSTANCE.addHandler(SessionExpiredEvent.TYPE,
new SessionExpiredEvent.SessionExpiredEventHandler() {
@Override
public void onChange(SessionExpiredEvent event) {
Log.debug("Catch SessionExpiredEvent");
sessionExpiredShow();
}
});
EventBusProvider.INSTANCE.addHandler(MenuEvent.TYPE, new MenuEvent.MenuEventHandler() {
@Override
public void onSelect(MenuEvent event) {
Log.debug("Catch MenuEvent:" + event);
// manageMenuEvent(event);
}
});
EventBusProvider.INSTANCE.addHandler(StartComputationExecutionRequestEvent.TYPE,
new StartComputationExecutionRequestEvent.StartComputationExecutionRequestEventHandler() {
@Override
public void onStart(StartComputationExecutionRequestEvent event) {
Log.debug("Catch StartComputationExecutionRequestEvent: " + event);
startComputationRequest(event);
}
});
EventBusProvider.INSTANCE.addHandler(CancelComputationExecutionRequestEvent.TYPE,
new CancelComputationExecutionRequestEvent.CancelComputationExecutionRequestEventHandler() {
@Override
public void onCancel(CancelComputationExecutionRequestEvent event) {
Log.debug("Catch CancelComputationRequestEvent: " + event);
cancelComputationRequest(event);
}
});
EventBusProvider.INSTANCE.addHandler(CancelExecutionFromComputationsRequestEvent.TYPE,
new CancelExecutionFromComputationsRequestEvent.CancelExecutionFromComputationsRequestEventHandler() {
@Override
public void onCancel(CancelExecutionFromComputationsRequestEvent event) {
Log.debug("Catch CancelExecutionFromComputationsRequestEvent: " + event);
cancelExecutionFromComputationsRequest(event);
}
});
EventBusProvider.INSTANCE.addHandler(ResubmitComputationExecutionRequestEvent.TYPE,
new ResubmitComputationExecutionRequestEvent.ResubmitComputationExecutionRequestEventHandler() {
@Override
public void onResubmit(ResubmitComputationExecutionRequestEvent event) {
Log.debug("Catch ResubmitComputationExecutionRequestEvent: " + event);
resubmitComputationRequest(event);
}
});
EventBusProvider.INSTANCE.addHandler(OutputDataRequestEvent.TYPE,
new OutputDataRequestEvent.OutputDataRequestEventHandler() {
@Override
public void onOutputRequest(OutputDataRequestEvent event) {
Log.debug("Catch OutputDataRequestEvent: " + event);
manageOutputDataRequestEvent(event);
}
});
EventBusProvider.INSTANCE.addHandler(ComputationDataRequestEvent.TYPE,
new ComputationDataRequestEvent.ComputationDataRequestEventHandler() {
@Override
public void onComputationDataRequest(ComputationDataRequestEvent event) {
Log.debug("Catch ComputationDataRequestEvent: " + event);
manageComputationDataRequestEvent(event);
}
});
EventBusProvider.INSTANCE.addHandler(InvocationModelRequestEvent.TYPE,
new InvocationModelRequestEvent.InvocationModelRequestEventHandler() {
@Override
public void onInvocationRequest(InvocationModelRequestEvent event) {
Log.debug("Catch InvocationModelRequestEvent: " + event);
getDataMinerInvocationModelRequest();
}
});
EventBusProvider.INSTANCE.addHandler(DeleteItemRequestEvent.TYPE,
new DeleteItemRequestEvent.DeleteItemRequestEventHandler() {
@Override
public void onDeleteRequest(DeleteItemRequestEvent event) {
Log.debug("Catch DeleteItemRequestEvent: " + event);
// deleteItemRequest(event);
}
});
}
private void restoreUISession() {
// checkLocale();
invocationModelFileUrl = com.google.gwt.user.client.Window.Location
.getParameter(Constants.DATA_MINER_EXECUTOR_INVOCATION_MODEL);
}
private void callHello() {
DataMinerExecutorServiceAsync.INSTANCE.hello(new AsyncCallback<UserInfo>() {
@Override
public void onFailure(Throwable caught) {
if (caught instanceof SessionExpiredServiceException) {
UtilsGXT3.alert("Error", "Expired Session!");
EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent());
} else {
UtilsGXT3.alert("Error", "No user found: " + caught.getLocalizedMessage());
}
}
@Override
public void onSuccess(UserInfo result) {
userInfo = result;
Log.info("Hello: " + userInfo.getUsername());
}
});
}
/*
* private void manageMenuEvent(MenuEvent event) {
* Log.debug("CurrentVisualization=" + currentVisualization); if (event ==
* null || event.getMenuType() == null || (currentVisualization == null &&
* event.getMenuType().compareTo(MenuType.HOME) == 0) ||
* (currentVisualization != null &&
* event.getMenuType().compareTo(currentVisualization) == 0)) {
*
* return; } currentVisualization = event.getMenuType(); MenuSwitchEvent
* menuSwitchEvent = new MenuSwitchEvent(event.getMenuType());
* EventBusProvider.INSTANCE.fireEvent(menuSwitchEvent); }
*/
private void startComputationRequest(final StartComputationExecutionRequestEvent event) {
DataMinerExecutorServiceAsync.INSTANCE.startComputation(event.getOp(), new AsyncCallback<ComputationId>() {
@Override
public void onFailure(Throwable caught) {
if (caught instanceof SessionExpiredServiceException) {
UtilsGXT3.alert("Error", "Expired Session!");
EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent());
} else {
UtilsGXT3.alert("Error", "Failed start computation " + event.getOp().getName() + "! "
+ caught.getLocalizedMessage());
caught.printStackTrace();
}
}
@Override
public void onSuccess(ComputationId computationId) {
if (computationId == null)
UtilsGXT3.alert("Error",
"Failed start computation " + event.getOp().getName() + ", the computation id is null!");
else {
startComputation(computationId, event.getComputationStatusPanelIndex());
}
}
});
}
private void startComputation(ComputationId computationId, int computationStatusPanelIndex) {
StartComputationExecutionEvent event = new StartComputationExecutionEvent(computationId,
computationStatusPanelIndex);
EventBusProvider.INSTANCE.fireEvent(event);
}
private void cancelExecutionFromComputationsRequest(CancelExecutionFromComputationsRequestEvent event) {
final ItemDescription itemDescription = event.getItemDescription();
DataMinerExecutorServiceAsync.INSTANCE.cancelComputation(itemDescription, new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
if (caught instanceof SessionExpiredServiceException) {
UtilsGXT3.alert("Error", "Expired Session!");
EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent());
} else {
Log.error("Error in cancenExecutionFromComputations:" + caught.getLocalizedMessage());
UtilsGXT3.alert("Error", "Error in cancel computation " + itemDescription.getName() + ": "
+ caught.getLocalizedMessage());
}
}
@Override
public void onSuccess(String result) {
Log.debug("Computation Cancelled!");
final InfoMessageBox d = new InfoMessageBox("Info",
"Computation cancellation request has been accepted!");
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
// fireRefreshDataMinerWorkAreaEvent(DataMinerWorkAreaElementType.Computations);
}
});
d.show();
}
});
}
private void cancelComputationRequest(CancelComputationExecutionRequestEvent event) {
final ComputationId computationId = event.getComputationId();
DataMinerExecutorServiceAsync.INSTANCE.cancelComputation(computationId, new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
if (caught instanceof SessionExpiredServiceException) {
UtilsGXT3.alert("Error", "Expired Session!");
EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent());
} else {
UtilsGXT3.alert("Error", "Error in cancel computation " + computationId.getId() + ": "
+ caught.getLocalizedMessage());
}
}
@Override
public void onSuccess(String result) {
Log.debug("Computation Cancelled!");
}
});
}
private void resubmitComputationRequest(final ResubmitComputationExecutionRequestEvent event) {
MenuSwitchEvent menuSwitchEvent = new MenuSwitchEvent(MenuType.EXPERIMENT);
EventBusProvider.INSTANCE.fireEvent(menuSwitchEvent);
DataMinerExecutorServiceAsync.INSTANCE.resubmit(event.getItemDescription(), new AsyncCallback<ComputationId>() {
@Override
public void onFailure(Throwable caught) {
if (caught instanceof SessionExpiredServiceException) {
UtilsGXT3.alert("Error", "Expired Session!");
EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent());
} else {
UtilsGXT3.alert("Error", "Failed to resubmit computation: " + caught.getMessage());
}
}
@Override
public void onSuccess(ComputationId result) {
if (result == null)
UtilsGXT3.alert("Error", "Failed to resubmit computation, the computation id is null!");
else {
resubmitComputation(result);
}
}
});
}
private void resubmitComputation(ComputationId computationId) {
ResubmitComputationExecutionEvent event = new ResubmitComputationExecutionEvent(computationId);
EventBusProvider.INSTANCE.fireEvent(event);
}
private void getDataMinerInvocationModelRequest() {
if (invocationModelFileUrl == null || invocationModelFileUrl.isEmpty()) {
Log.error("Invalid request, the invocation model has not been specified correctly: " + invocationModelFileUrl);
UtilsGXT3.alert("Error", "Invalid request, the invocation model has not been specified correctly!");
} else {
final AutoProgressMessageBox messageBox = new AutoProgressMessageBox("Retrieve Info",
"Retrieving information, please wait...");
messageBox.setProgressText("Loading...");
messageBox.auto();
messageBox.show();
DataMinerExecutorServiceAsync.INSTANCE.getInvocationModel(invocationModelFileUrl,
new AsyncCallback<Operator>() {
@Override
public void onFailure(Throwable caught) {
messageBox.hide();
if (caught instanceof SessionExpiredServiceException) {
UtilsGXT3.alert("Error", "Expired Session");
EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent());
} else {
UtilsGXT3.alert("Error",
"The VRE currently has problems loading the required operator using the invocation model specified!");
Log.error(
"The VRE currently has problems loading the required operator using the invocation model specified: "
+ caught.getLocalizedMessage(),caught);
}
}
@Override
public void onSuccess(Operator operator) {
messageBox.hide();
Log.debug("Invocation Retrieved: " + operator);
InvocationModelEvent event = new InvocationModelEvent(operator);
Log.debug("Fire: " + event);
EventBusProvider.INSTANCE.fireEvent(event);
}
});
}
}
private void manageOutputDataRequestEvent(OutputDataRequestEvent event) {
if (event == null) {
UtilsGXT3.alert("Error", "Invalid output request!");
} else {
if (event.getComputationId() == null || event.getComputationId().getId() == null
|| event.getComputationId().getId().isEmpty()) {
UtilsGXT3.alert("Error", "Invalid output request, computation id: " + event.getComputationId());
} else {
final StatusMonitor monitor = new StatusMonitor();
DataMinerExecutorServiceAsync.INSTANCE.getOutputDataByComputationId(event.getComputationId(),
new AsyncCallback<OutputData>() {
@Override
public void onSuccess(OutputData outputData) {
monitor.hide();
fireOutputDataEvent(outputData);
}
@Override
public void onFailure(Throwable caught) {
monitor.hide();
Log.error("Error in getResourceByComputationId: " + caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Impossible to retrieve output info. " + caught.getLocalizedMessage());
}
});
}
}
}
private void fireOutputDataEvent(OutputData outputData) {
OutputDataEvent event = new OutputDataEvent(outputData);
EventBusProvider.INSTANCE.fireEvent(event);
}
private void manageComputationDataRequestEvent(ComputationDataRequestEvent event) {
if (event == null) {
UtilsGXT3.alert("Error", "Invalid computation info request!");
} else {
if (event.getItemDescription() == null || event.getItemDescription().getId() == null
|| event.getItemDescription().getId().isEmpty()) {
UtilsGXT3.alert("Error",
"Invalid computation info request, item description: " + event.getItemDescription());
} else {
final StatusMonitor monitor = new StatusMonitor();
DataMinerExecutorServiceAsync.INSTANCE.getComputationData(event.getItemDescription(),
new AsyncCallback<ComputationData>() {
@Override
public void onSuccess(ComputationData computationData) {
monitor.hide();
fireComputationDataEvent(computationData);
}
@Override
public void onFailure(Throwable caught) {
monitor.hide();
Log.error("Error in getComputationData: " + caught.getLocalizedMessage());
caught.printStackTrace();
UtilsGXT3.alert("Error",
"Impossible to retrieve computation info. " + caught.getLocalizedMessage());
}
});
}
}
}
private void fireComputationDataEvent(ComputationData computationData) {
ComputationDataEvent event = new ComputationDataEvent(computationData);
EventBusProvider.INSTANCE.fireEvent(event);
}
}

View File

@ -0,0 +1,181 @@
/**
*
*/
package org.gcube.portlets.user.dataminerexecutor.client;
import org.gcube.portlets.user.dataminerexecutor.client.common.EventBusProvider;
import org.gcube.portlets.user.dataminerexecutor.client.events.MenuSwitchEvent;
import org.gcube.portlets.user.dataminerexecutor.client.type.MenuType;
import org.gcube.portlets.user.dataminerexecutor.client.util.UtilsGXT3;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.resources.client.ResourceCallback;
import com.google.gwt.resources.client.ResourceException;
import com.google.gwt.resources.client.TextResource;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class Header extends HorizontalPanel {
// private Image menuGoBack;
//private Image menuExperiment;
private Image menuHelp;
//private Enum<MenuType> currentSelection;
public Header() {
super();
create();
bind();
}
private void bind() {
EventBusProvider.INSTANCE.addHandler(MenuSwitchEvent.TYPE, new MenuSwitchEvent.MenuSwitchEventHandler() {
@Override
public void onSelect(MenuSwitchEvent event) {
Log.debug("Catch MenuSwitchEvent");
}
});
}
private void create() {
// this.setStyleAttribute("background-color", "#FFFFFF");
Image logo = new Image(DataMinerExecutor.resources.logoLittle());
logo.setAltText("Data Miner Executor");
logo.setTitle("Data Miner Executor");
logo.addStyleName("menuImgLogo");
/*
* menuGoBack = new Image(DataMinerExecutor.resources.goBack());
* menuGoBack.addStyleName("menuItemImage");
* menuGoBack.addClickHandler(new ClickHandler() {
*
* @Override public void onClick(ClickEvent event) { MenuEvent menuEvent
* = new MenuEvent(MenuType.HOME);
* EventBusProvider.INSTANCE.fireEvent(menuEvent);
*
* } });
*/
/*menuExperiment = new Image(DataMinerExecutor.resources.menuItemExperiment());
menuExperiment.addStyleName("menuItemImage");
menuExperiment.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Log.debug("Click Menu Experiment");
MenuEvent menuEvent = new MenuEvent(MenuType.EXPERIMENT);
EventBusProvider.INSTANCE.fireEvent(menuEvent);
}
});*/
menuHelp = new Image(DataMinerExecutor.resources.menuItemHelp());
menuHelp.addStyleName("menuItemImage");
menuHelp.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Log.debug("Click Menu Help");
showHelp();
}
});
add(logo);
// add(menuGoBack);
//add(menuExperiment);
add(menuHelp);
this.setCellWidth(logo, "100px");
// this.setCellWidth(menuGoBack, "100px");
//this.setCellWidth(menuExperiment, "80px"); //
this.setCellWidth(menuHelp, "80px");
// menuGoBack.setVisible(false);
//menuExperiment.setVisible(true);
menuHelp.setVisible(true);
}
public void setMenu(MenuType menuType) {
Log.debug("SetMenu: " + menuType);
menuHelp.setVisible(true);
/*if (currentSelection == null) {
// menuGoBack.setVisible(true);
//menuExperiment.setVisible(true);
}
if (currentSelection != null && currentSelection.compareTo(MenuType.EXPERIMENT) == 0)
menuExperiment.removeStyleName("menuItemImage-selected");
Image imgNew = menuExperiment;
imgNew.addStyleName("menuItemImage-selected");
*/
//currentSelection = menuType;
return;
}
/*
private void menuSwitch(MenuSwitchEvent event) {
Log.debug("MenuSwitch: " + event);
if (event.getMenuType().compareTo(MenuType.HOME) == 0) {
// menuGoBack.setVisible(false);
menuExperiment.setVisible(false);
menuHelp.setVisible(false);
if (currentSelection != null && currentSelection.compareTo(MenuType.EXPERIMENT) == 0)
menuExperiment.removeStyleName("menuItemImage-selected");
} else {
if (currentSelection == null
|| (currentSelection != null && currentSelection.compareTo(MenuType.HOME) == 0)) {
// menuGoBack.setVisible(true);
menuExperiment.setVisible(true);
menuHelp.setVisible(true);
}
if (currentSelection != null && currentSelection.compareTo(MenuType.EXPERIMENT) == 0)
menuExperiment.removeStyleName("menuItemImage-selected");
Image imgNew = menuExperiment;
imgNew.addStyleName("menuItemImage-selected");
}
currentSelection = event.getMenuType();
return;
}*/
private void showHelp() {
try {
DataMinerExecutor.resources.wikiLink().getText(new ResourceCallback<TextResource>() {
public void onError(ResourceException e) {
Log.error("Error retrieving wiki link!: " + e.getLocalizedMessage());
UtilsGXT3.alert("Error", "Error retrieving wiki link!");
}
public void onSuccess(TextResource r) {
String s = r.getText();
Window.open(s, "DMExecutor Wiki", "");
}
});
} catch (ResourceException e) {
Log.error("Error retrieving wiki link!: " + e.getLocalizedMessage());
UtilsGXT3.alert("Error", "Error retrieving wiki link!");
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,124 @@
package org.gcube.portlets.user.dataminerexecutor.client;
import org.gcube.portlets.user.dataminerexecutor.client.common.EventBusProvider;
import org.gcube.portlets.user.dataminerexecutor.client.events.MenuEvent;
import org.gcube.portlets.user.dataminerexecutor.client.type.MenuType;
import com.google.gwt.event.dom.client.MouseDownEvent;
import com.google.gwt.event.dom.client.MouseDownHandler;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Image;
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
//import com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer.HorizontalLayoutData;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class HomePanel extends SimpleContainer {
public HomePanel() {
super();
init();
create();
}
private void init() {
setItemId("HomePanel");
setStylePrimaryName("smMenu");
//setBodyStyle("backgroundColor:white;");
//addStyleName("smLayoutContainer");
//setHeaderVisible(false);
setBorders(false);
//setBodyBorder(false);
}
private void create() {
VerticalLayoutContainer lc = new VerticalLayoutContainer();
lc.setScrollMode(ScrollMode.AUTO);
VerticalLayoutData layoutTop = new VerticalLayoutData(1, -1,
new Margins(20,0,10,0));
//VerticalLayoutData layoutNext = new VerticalLayoutData(1, -1,
// new Margins(10,0,10,0));
SimpleContainer itemExperiment = createMenuItem(
"Execute an Experiment",
"This section allows to execute or prepare an online experiment or method. The section is endowed with a list of algorithms for executing models for various application domains.",
DataMinerExecutor.resources.executionIcon(), new MouseDownHandler() {
@Override
public void onMouseDown(MouseDownEvent event) {
MenuEvent menuEvent=new MenuEvent(MenuType.EXPERIMENT);
EventBusProvider.INSTANCE.fireEvent(menuEvent);
}
});
lc.add(itemExperiment, layoutTop);
add(lc);
}
private SimpleContainer createMenuItem(String title, String description,
ImageResource imgResource, MouseDownHandler handle) {
HBoxLayoutContainer horiz=new HBoxLayoutContainer(HBoxLayoutAlign.MIDDLE);
horiz.setPack(BoxLayoutPack.CENTER);
horiz.setEnableOverflow(false);
//HorizontalLayoutContainer horiz = new HorizontalLayoutContainer();
Image img = new Image(imgResource);
HTML text = new HTML("<b>" + title + "</b><br>" + description);
text.addStyleName("smMenuItemText");
text.setWidth("400px");
/*HorizontalLayoutData textLayoutData = new HorizontalLayoutData(400,
140, new Margins(10, 5, 10, 10));
HorizontalLayoutData imgLayoutData = new HorizontalLayoutData(140, 140,
new Margins(10, 10, 10, 5));*/
//horiz.add(text, textLayoutData);
//horiz.add(img, imgLayoutData);
horiz.add(text, new BoxLayoutData(new Margins(0)));
horiz.add(img,new BoxLayoutData(new Margins(0)));
SimpleContainer container = new SimpleContainer();
container.addDomHandler(handle, MouseDownEvent.getType());
container.setWidth(540);
container.setHeight(160);
container.addStyleName("smMenuItem");
container.addStyleOnOver(container.getElement(), "smMenuItem:HOVER");
container.add(horiz);
SimpleContainer container2 = new SimpleContainer();
HBoxLayoutContainer hbox=new HBoxLayoutContainer(HBoxLayoutAlign.MIDDLE);
hbox.setPack(BoxLayoutPack.CENTER);
hbox.setEnableOverflow(false);
hbox.add(container, new BoxLayoutData(new Margins(0)));
container2.add(hbox);
return container2;
}
}

View File

@ -0,0 +1,153 @@
/**
*
*/
package org.gcube.portlets.user.dataminerexecutor.client;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.client.Window;
import com.sencha.gxt.core.client.dom.XDOM;
import com.sencha.gxt.core.client.dom.XElement;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.Viewport.ViewportAppearance;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class PortalViewport extends SimpleContainer {
protected int rightScrollBarSize = 17;
protected boolean enableScroll;
/**
* Creates a viewport layout container with the default appearance.
*/
public PortalViewport() {
this(GWT.<ViewportAppearance> create(ViewportAppearance.class));
}
/**
* Creates a viewport layout container with the specified appearance.
*
* @param appearance
* the appearance of the viewport layout container
*/
public PortalViewport(ViewportAppearance appearance) {
super(true);
try {
SafeHtmlBuilder sb = new SafeHtmlBuilder();
appearance.render(sb);
XElement element=XDOM.create(sb.toSafeHtml());
setElement((Element)element);
monitorWindowResize = true;
forceLayoutOnResize = true;
getFocusSupport().setIgnore(false);
resize();
} catch (Exception e) {
Log.error("PortalViewport: constructor error "
+ e.getLocalizedMessage());
}
}
/**
* Returns true if window scrolling is enabled.
*
* @return true if window scrolling is enabled
*/
public boolean isEnableScroll() {
return enableScroll;
}
/**
* Sets whether window scrolling is enabled.
*
* @param enableScroll
* true to enable window scrolling
*/
public void setEnableScroll(boolean enableScroll) {
this.enableScroll = enableScroll;
Window.enableScrolling(enableScroll);
}
/**
* @return the rightScrollBarSize
*/
public int getRightScrollBarSize() {
return rightScrollBarSize;
}
/**
* @param rightScrollBarSize
* the rightScrollBarSize to set
*/
public void setRightScrollBarSize(int rightScrollBarSize) {
this.rightScrollBarSize = rightScrollBarSize;
}
@Override
protected void onAttach() {
super.onAttach();
setEnableScroll(enableScroll);
resize();
}
protected void resize() {
int viewWidth;
if(enableScroll){
viewWidth= calculateWidth() - rightScrollBarSize;
} else {
viewWidth = calculateWidth();
}
int viewHeight = calculateHeight();
Log.info("DataMiner resize viewWidth: " + viewWidth + " viewHeight: "
+ viewHeight + " clientWidth: " + Window.getClientWidth()
+ " clientHeight: " + Window.getClientHeight());
try {
setPixelSize(viewWidth, viewHeight);
} catch (Exception e) {
Log.error("PortalViewport: error in resize() at setPixelSize "
+ e.getLocalizedMessage());
}
}
/**
* {@inheritDoc}
*/
@Override
protected void onWindowResize(int width, int height) {
int viewWidth = calculateWidth();
int viewHeight = calculateHeight();
Log.trace("DataMiner onWindowResize viewWidth: " + viewWidth
+ " viewHeight: " + viewHeight + " clientWidth: "
+ Window.getClientWidth() + " clientHeight: "
+ Window.getClientHeight());
setPixelSize(viewWidth, viewHeight);
}
protected int calculateWidth() {
int leftBorder = getAbsoluteLeft();
Log.info("DataMiner width: "
+ String.valueOf(Window.getClientWidth() - 2 * leftBorder));
return Window.getClientWidth() - 2 * leftBorder;
}
protected int calculateHeight() {
int topBorder = getAbsoluteTop();
Log.info("DataMiner height: "
+ String.valueOf(Window.getClientHeight() - topBorder - 34));
return Window.getClientHeight() - topBorder - 34;
}
}

View File

@ -0,0 +1,19 @@
/**
*
*/
package org.gcube.portlets.user.dataminerexecutor.client.common;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.SimpleEventBus;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class EventBusProvider {
public static final EventBus INSTANCE = new SimpleEventBus();
}

View File

@ -0,0 +1,21 @@
package org.gcube.portlets.user.dataminerexecutor.client.custom;
/**
* Fix for z-index bug between GXT3 and GXT2
*
* @author Giancarlo Panichi
*
*
*/
public class Gxt2ZIndexXDOM extends
com.sencha.gxt.core.client.dom.XDOM.XDOMImpl {
/*
public int getTopZIndex() {
return com.extjs.gxt.ui.client.core.XDOM.getTopZIndex();
}
public int getTopZIndex(int i) {
return com.extjs.gxt.ui.client.core.XDOM.getTopZIndex(i);
}*/
}

View File

@ -0,0 +1,50 @@
/**
*
*/
.progressWrapGreen {
border: 1px solid #65cf81;
overflow: hidden;
}
@sprite .progressInnerGreen {
background-color: #e0f3e5;
gwt-image: 'innerBarGreen';
height: auto;
position: relative;
}
@sprite .progressBarGreen {
background-color: #9ceeb0;
gwt-image: 'barGreen';
background-repeat: repeat-x;
background-position: left center;
height: 18px;
border-top-color: #d1fdd9;
border-bottom-color: #7fe498;
border-right-color: #7fe498;
}
.progressTextGreen {
color: #fff;
text-align: center;
font-size: 11px;
font-weight: bold;
font-family: sans-serif;
padding: 1px 5px;
overflow: hidden;
position: absolute;
z-index: 99;
}
.progressTextBackGreen {
color: #399544 !important;
z-index: 9 !important;
}
@if user.agent ie6 ie8 ie9 {
.progressTextBackGreen {
line-height: 15px;
color: #953941 !important;
z-index: 9 !important;
}
}

View File

@ -0,0 +1,12 @@
<div class="{style.progressWrapGreen}" style="{wrapStyles}">
<div class="{style.progressInnerGreen}">
<div class="{style.progressBarGreen}" style="{progressBarStyles}">
<div class="{style.progressTextGreen}" style="{progressTextStyles}">
<div style="{widthStyles}">{text}</div>
</div>
<div class="{style.progressTextGreen} {style.progressTextBackGreen}">
<div style="{widthStyles}">{text}</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,18 @@
package org.gcube.portlets.user.dataminerexecutor.client.custom.progress;
import com.sencha.gxt.cell.core.client.ProgressBarCell;
import com.sencha.gxt.widget.core.client.ProgressBar;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class GreenProgressBar extends ProgressBar {
public GreenProgressBar() {
super(new ProgressBarCell(new GreenProgressBarAppearance()));
}
}

View File

@ -0,0 +1,132 @@
package org.gcube.portlets.user.dataminerexecutor.client.custom.progress;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.ImageResource.ImageOptions;
import com.google.gwt.resources.client.ImageResource.RepeatStyle;
import com.google.gwt.safecss.shared.SafeStyles;
import com.google.gwt.safecss.shared.SafeStylesUtils;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
import com.sencha.gxt.cell.core.client.ProgressBarCell.ProgressBarAppearance;
import com.sencha.gxt.cell.core.client.ProgressBarCell.ProgressBarAppearanceOptions;
import com.sencha.gxt.core.client.GXT;
import com.sencha.gxt.core.client.XTemplates;
import com.sencha.gxt.core.client.util.Format;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class GreenProgressBarAppearance implements ProgressBarAppearance {
public interface GreenProgressBarResources {
ImageResource barGreen();
ImageResource innerBarGreen();
GreenProgressBarStyle style();
}
public interface GreenProgressBarStyle extends CssResource {
String progressBarGreen();
String progressInnerGreen();
String progressTextGreen();
String progressTextBackGreen();
String progressWrapGreen();
}
public interface GreenProgressBarTemplate extends XTemplates {
@XTemplate(source = "GreenProgressBar.html")
SafeHtml render(SafeHtml text, GreenProgressBarStyle style,
SafeStyles wrapStyles, SafeStyles progressBarStyles,
SafeStyles progressTextStyles, SafeStyles widthStyles);
}
public interface GreenProgressBarDefaultResources extends
GreenProgressBarResources, ClientBundle {
@Source({ "GreenProgressBar.css" })
@Override
GreenProgressBarStyle style();
@Source("green-progress-bg.gif")
@ImageOptions(repeatStyle = RepeatStyle.Horizontal)
@Override
ImageResource barGreen();
@Source("green-bg.gif")
@ImageOptions(repeatStyle = RepeatStyle.Horizontal)
@Override
ImageResource innerBarGreen();
}
private final GreenProgressBarStyle style;
private GreenProgressBarTemplate template;
public GreenProgressBarAppearance() {
this(
GWT.<GreenProgressBarDefaultResources> create(GreenProgressBarDefaultResources.class),
GWT.<GreenProgressBarTemplate> create(GreenProgressBarTemplate.class));
}
public GreenProgressBarAppearance(GreenProgressBarResources resources,
GreenProgressBarTemplate template) {
this.style = resources.style();
this.style.ensureInjected();
this.template = template;
}
@Override
public void render(SafeHtmlBuilder sb, Double value,
ProgressBarAppearanceOptions options) {
value = value == null ? 0 : value;
double valueWidth = value * options.getWidth();
int vw = new Double(valueWidth).intValue();
String text = options.getProgressText();
if (text != null) {
int v = (int) Math.round(value * 100);
text = Format.substitute(text, v);
}
SafeHtml txt;
if (text == null) {
txt = SafeHtmlUtils.fromSafeConstant("&#160;");
} else {
txt = SafeHtmlUtils.fromString(text);
}
int adj = GXT.isIE() ? 4 : 2;
SafeStyles wrapStyles = SafeStylesUtils.fromTrustedString("width:"
+ (options.getWidth() - adj) + "px;");
SafeStyles progressBarStyles = SafeStylesUtils
.fromTrustedString("width:" + vw + "px;");
SafeStyles progressTextStyles = SafeStylesUtils
.fromTrustedString("width:" + Math.max(vw - 8, 0) + "px;");
SafeStyles widthStyles = SafeStylesUtils.fromTrustedString("width:"
+ (Math.max(0, options.getWidth() - adj)) + "px;");
sb.append(template.render(txt, style, wrapStyles, progressBarStyles,
progressTextStyles, widthStyles));
}
}

View File

@ -0,0 +1,50 @@
/**
*
*/
.progressWrapOrange {
border: 1px solid #ffd075;
overflow: hidden;
}
@sprite .progressInnerOrange {
background-color: #f3ede0;
gwt-image: 'innerBarOrange';
height: auto;
position: relative;
}
@sprite .progressBarOrange {
background-color: #ffdf9f;
gwt-image: 'barOrange';
background-repeat: repeat-x;
background-position: left center;
height: 18px;
border-top-color: #fdefd1;
border-bottom-color: #f9d793;
border-right-color: #ffdd97;
}
.progressTextOrange {
color: #fff;
text-align: center;
font-size: 11px;
font-weight: bold;
font-family: sans-serif;
padding: 1px 5px;
overflow: hidden;
position: absolute;
z-index: 99;
}
.progressTextBackOrange {
color: #ffaf0d!important;
z-index: 9 !important;
}
@if user.agent ie6 ie8 ie9 {
.progressTextBackOrange {
line-height: 15px;
color: #ffaa00!important;
z-index: 9 !important;
}
}

View File

@ -0,0 +1,12 @@
<div class="{style.progressWrapOrange}" style="{wrapStyles}">
<div class="{style.progressInnerOrange}">
<div class="{style.progressBarOrange}" style="{progressBarStyles}">
<div class="{style.progressTextOrange}" style="{progressTextStyles}">
<div style="{widthStyles}">{text}</div>
</div>
<div class="{style.progressTextOrange} {style.progressTextBackOrange}">
<div style="{widthStyles}">{text}</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,18 @@
package org.gcube.portlets.user.dataminerexecutor.client.custom.progress;
import com.sencha.gxt.cell.core.client.ProgressBarCell;
import com.sencha.gxt.widget.core.client.ProgressBar;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class OrangeProgressBar extends ProgressBar {
public OrangeProgressBar() {
super(new ProgressBarCell(new OrangeProgressBarAppearance()));
}
}

View File

@ -0,0 +1,132 @@
package org.gcube.portlets.user.dataminerexecutor.client.custom.progress;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.ImageResource.ImageOptions;
import com.google.gwt.resources.client.ImageResource.RepeatStyle;
import com.google.gwt.safecss.shared.SafeStyles;
import com.google.gwt.safecss.shared.SafeStylesUtils;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
import com.sencha.gxt.cell.core.client.ProgressBarCell.ProgressBarAppearance;
import com.sencha.gxt.cell.core.client.ProgressBarCell.ProgressBarAppearanceOptions;
import com.sencha.gxt.core.client.GXT;
import com.sencha.gxt.core.client.XTemplates;
import com.sencha.gxt.core.client.util.Format;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class OrangeProgressBarAppearance implements ProgressBarAppearance {
public interface OrangeProgressBarResources {
ImageResource barOrange();
ImageResource innerBarOrange();
OrangeProgressBarStyle style();
}
public interface OrangeProgressBarStyle extends CssResource {
String progressBarOrange();
String progressInnerOrange();
String progressTextOrange();
String progressTextBackOrange();
String progressWrapOrange();
}
public interface OrangeProgressBarTemplate extends XTemplates {
@XTemplate(source = "OrangeProgressBar.html")
SafeHtml render(SafeHtml text, OrangeProgressBarStyle style,
SafeStyles wrapStyles, SafeStyles progressBarStyles,
SafeStyles progressTextStyles, SafeStyles widthStyles);
}
public interface OrangeProgressBarDefaultResources extends
OrangeProgressBarResources, ClientBundle {
@Source({ "OrangeProgressBar.css" })
@Override
OrangeProgressBarStyle style();
@Source("orange-progress-bg.gif")
@ImageOptions(repeatStyle = RepeatStyle.Horizontal)
@Override
ImageResource barOrange();
@Source("orange-bg.gif")
@ImageOptions(repeatStyle = RepeatStyle.Horizontal)
@Override
ImageResource innerBarOrange();
}
private final OrangeProgressBarStyle style;
private OrangeProgressBarTemplate template;
public OrangeProgressBarAppearance() {
this(
GWT.<OrangeProgressBarDefaultResources> create(OrangeProgressBarDefaultResources.class),
GWT.<OrangeProgressBarTemplate> create(OrangeProgressBarTemplate.class));
}
public OrangeProgressBarAppearance(OrangeProgressBarResources resources,
OrangeProgressBarTemplate template) {
this.style = resources.style();
this.style.ensureInjected();
this.template = template;
}
@Override
public void render(SafeHtmlBuilder sb, Double value,
ProgressBarAppearanceOptions options) {
value = value == null ? 0 : value;
double valueWidth = value * options.getWidth();
int vw = new Double(valueWidth).intValue();
String text = options.getProgressText();
if (text != null) {
int v = (int) Math.round(value * 100);
text = Format.substitute(text, v);
}
SafeHtml txt;
if (text == null) {
txt = SafeHtmlUtils.fromSafeConstant("&#160;");
} else {
txt = SafeHtmlUtils.fromString(text);
}
int adj = GXT.isIE() ? 4 : 2;
SafeStyles wrapStyles = SafeStylesUtils.fromTrustedString("width:"
+ (options.getWidth() - adj) + "px;");
SafeStyles progressBarStyles = SafeStylesUtils
.fromTrustedString("width:" + vw + "px;");
SafeStyles progressTextStyles = SafeStylesUtils
.fromTrustedString("width:" + Math.max(vw - 8, 0) + "px;");
SafeStyles widthStyles = SafeStylesUtils.fromTrustedString("width:"
+ (Math.max(0, options.getWidth() - adj)) + "px;");
sb.append(template.render(txt, style, wrapStyles, progressBarStyles,
progressTextStyles, widthStyles));
}
}

View File

@ -0,0 +1,50 @@
/**
*
*/
.progressWrapRed {
border: 1px solid #cf656f;
overflow: hidden;
}
@sprite .progressInnerRed {
background-color: #f3e0e2;
gwt-image: 'innerBarRed';
height: auto;
position: relative;
}
@sprite .progressBarRed {
background-color: #ee9ca4;
gwt-image: 'barRed';
background-repeat: repeat-x;
background-position: left center;
height: 18px;
border-top-color: #fdd1d5;
border-bottom-color: #e47f88;
border-right-color: #e47f88;
}
.progressTextRed {
color: #fff;
text-align: center;
font-size: 11px;
font-weight: bold;
font-family: sans-serif;
padding: 1px 5px;
overflow: hidden;
position: absolute;
z-index: 99;
}
.progressTextBackRed {
color: #953941 !important;
z-index: 9 !important;
}
@if user.agent ie6 ie8 ie9 {
.progressTextBackRed {
line-height: 15px;
color: #953941 !important;
z-index: 9 !important;
}
}

View File

@ -0,0 +1,12 @@
<div class="{style.progressWrapRed}" style="{wrapStyles}">
<div class="{style.progressInnerRed}">
<div class="{style.progressBarRed}" style="{progressBarStyles}">
<div class="{style.progressTextRed}" style="{progressTextStyles}">
<div style="{widthStyles}">{text}</div>
</div>
<div class="{style.progressTextRed} {style.progressTextBackRed}">
<div style="{widthStyles}">{text}</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,18 @@
package org.gcube.portlets.user.dataminerexecutor.client.custom.progress;
import com.sencha.gxt.cell.core.client.ProgressBarCell;
import com.sencha.gxt.widget.core.client.ProgressBar;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class RedProgressBar extends ProgressBar {
public RedProgressBar() {
super(new ProgressBarCell(new RedProgressBarAppearance()));
}
}

View File

@ -0,0 +1,132 @@
package org.gcube.portlets.user.dataminerexecutor.client.custom.progress;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.ImageResource.ImageOptions;
import com.google.gwt.resources.client.ImageResource.RepeatStyle;
import com.google.gwt.safecss.shared.SafeStyles;
import com.google.gwt.safecss.shared.SafeStylesUtils;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
import com.sencha.gxt.cell.core.client.ProgressBarCell.ProgressBarAppearance;
import com.sencha.gxt.cell.core.client.ProgressBarCell.ProgressBarAppearanceOptions;
import com.sencha.gxt.core.client.GXT;
import com.sencha.gxt.core.client.XTemplates;
import com.sencha.gxt.core.client.util.Format;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class RedProgressBarAppearance implements ProgressBarAppearance {
public interface RedProgressBarResources {
ImageResource barRed();
ImageResource innerBarRed();
RedProgressBarStyle style();
}
public interface RedProgressBarStyle extends CssResource {
String progressBarRed();
String progressInnerRed();
String progressTextRed();
String progressTextBackRed();
String progressWrapRed();
}
public interface RedProgressBarTemplate extends XTemplates {
@XTemplate(source = "RedProgressBar.html")
SafeHtml render(SafeHtml text, RedProgressBarStyle style,
SafeStyles wrapStyles, SafeStyles progressBarStyles,
SafeStyles progressTextStyles, SafeStyles widthStyles);
}
public interface RedProgressBarDefaultResources extends
RedProgressBarResources, ClientBundle {
@Source({ "RedProgressBar.css" })
@Override
RedProgressBarStyle style();
@Source("red-progress-bg.gif")
@ImageOptions(repeatStyle = RepeatStyle.Horizontal)
@Override
ImageResource barRed();
@Source("red-bg.gif")
@ImageOptions(repeatStyle = RepeatStyle.Horizontal)
@Override
ImageResource innerBarRed();
}
private final RedProgressBarStyle style;
private RedProgressBarTemplate template;
public RedProgressBarAppearance() {
this(
GWT.<RedProgressBarDefaultResources> create(RedProgressBarDefaultResources.class),
GWT.<RedProgressBarTemplate> create(RedProgressBarTemplate.class));
}
public RedProgressBarAppearance(RedProgressBarResources resources,
RedProgressBarTemplate template) {
this.style = resources.style();
this.style.ensureInjected();
this.template = template;
}
@Override
public void render(SafeHtmlBuilder sb, Double value,
ProgressBarAppearanceOptions options) {
value = value == null ? 0 : value;
double valueWidth = value * options.getWidth();
int vw = new Double(valueWidth).intValue();
String text = options.getProgressText();
if (text != null) {
int v = (int) Math.round(value * 100);
text = Format.substitute(text, v);
}
SafeHtml txt;
if (text == null) {
txt = SafeHtmlUtils.fromSafeConstant("&#160;");
} else {
txt = SafeHtmlUtils.fromString(text);
}
int adj = GXT.isIE() ? 4 : 2;
SafeStyles wrapStyles = SafeStylesUtils.fromTrustedString("width:"
+ (options.getWidth() - adj) + "px;");
SafeStyles progressBarStyles = SafeStylesUtils
.fromTrustedString("width:" + vw + "px;");
SafeStyles progressTextStyles = SafeStylesUtils
.fromTrustedString("width:" + Math.max(vw - 8, 0) + "px;");
SafeStyles widthStyles = SafeStylesUtils.fromTrustedString("width:"
+ (Math.max(0, options.getWidth() - adj)) + "px;");
sb.append(template.render(txt, style, wrapStyles, progressBarStyles,
progressTextStyles, widthStyles));
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

View File

@ -0,0 +1,70 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationId;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Cancel Computation Request Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class CancelComputationExecutionRequestEvent
extends
GwtEvent<CancelComputationExecutionRequestEvent.CancelComputationExecutionRequestEventHandler> {
public static Type<CancelComputationExecutionRequestEventHandler> TYPE = new Type<CancelComputationExecutionRequestEventHandler>();
private ComputationId computationId;
public interface CancelComputationExecutionRequestEventHandler extends
EventHandler {
void onCancel(CancelComputationExecutionRequestEvent event);
}
public interface HasCancelComputationExecutionRequestEventHandler extends
HasHandlers {
public HandlerRegistration addCancelComputationExecutionRequestEventHandler(
CancelComputationExecutionRequestEventHandler handler);
}
public CancelComputationExecutionRequestEvent(ComputationId computationId) {
this.computationId = computationId;
}
@Override
protected void dispatch(
CancelComputationExecutionRequestEventHandler handler) {
handler.onCancel(this);
}
@Override
public Type<CancelComputationExecutionRequestEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<CancelComputationExecutionRequestEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source,
CancelComputationExecutionRequestEvent event) {
source.fireEvent(event);
}
public ComputationId getComputationId() {
return computationId;
}
@Override
public String toString() {
return "CancelComputationExecutionRequestEvent [computationId="
+ computationId + "]";
}
}

View File

@ -0,0 +1,71 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.data.analysis.dataminermanagercl.shared.workspace.ItemDescription;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Cancel Execution From Computations Request Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class CancelExecutionFromComputationsRequestEvent
extends
GwtEvent<CancelExecutionFromComputationsRequestEvent.CancelExecutionFromComputationsRequestEventHandler> {
public static Type<CancelExecutionFromComputationsRequestEventHandler> TYPE = new Type<CancelExecutionFromComputationsRequestEventHandler>();
private ItemDescription itemDescription;
public interface CancelExecutionFromComputationsRequestEventHandler extends
EventHandler {
void onCancel(CancelExecutionFromComputationsRequestEvent event);
}
public interface HasCancelExecutionFromComputationsRequestEventHandler
extends HasHandlers {
public HandlerRegistration addCancelExecutionFromComputationsRequestEventHandler(
CancelExecutionFromComputationsRequestEventHandler handler);
}
public CancelExecutionFromComputationsRequestEvent(
ItemDescription itemDescription) {
this.itemDescription = itemDescription;
}
@Override
protected void dispatch(
CancelExecutionFromComputationsRequestEventHandler handler) {
handler.onCancel(this);
}
@Override
public Type<CancelExecutionFromComputationsRequestEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<CancelExecutionFromComputationsRequestEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source,
CancelExecutionFromComputationsRequestEvent event) {
source.fireEvent(event);
}
public ItemDescription getItemDescription() {
return itemDescription;
}
@Override
public String toString() {
return "CancelExecutionFromComputationsRequestEvent [itemDescription="
+ itemDescription + "]";
}
}

View File

@ -0,0 +1,64 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationData;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Computation Data Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class ComputationDataEvent extends
GwtEvent<ComputationDataEvent.ComputationDataEventHandler> {
public static Type<ComputationDataEventHandler> TYPE = new Type<ComputationDataEventHandler>();
private ComputationData computationData;
public interface ComputationDataEventHandler extends EventHandler {
void onComputationData(ComputationDataEvent event);
}
public interface HasOutputShowResourceEventHandler extends HasHandlers {
public HandlerRegistration addOutputShowResourceEventHandler(
ComputationDataEventHandler handler);
}
public ComputationDataEvent(ComputationData computationData) {
this.computationData = computationData;
}
@Override
protected void dispatch(ComputationDataEventHandler handler) {
handler.onComputationData(this);
}
@Override
public Type<ComputationDataEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<ComputationDataEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, ComputationDataEvent event) {
source.fireEvent(event);
}
public ComputationData getComputationData() {
return computationData;
}
@Override
public String toString() {
return "ComputationDataEvent [computationData=" + computationData + "]";
}
}

View File

@ -0,0 +1,67 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.data.analysis.dataminermanagercl.shared.workspace.ItemDescription;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Output Show Request Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class ComputationDataRequestEvent
extends
GwtEvent<ComputationDataRequestEvent.ComputationDataRequestEventHandler> {
public static Type<ComputationDataRequestEventHandler> TYPE = new Type<ComputationDataRequestEventHandler>();
private ItemDescription itemDescription;
public interface ComputationDataRequestEventHandler extends EventHandler {
void onComputationDataRequest(ComputationDataRequestEvent event);
}
public interface HasComputationDataRequestEventHandler extends HasHandlers {
public HandlerRegistration addComputationDataRequestEventHandler(
ComputationDataRequestEventHandler handler);
}
public ComputationDataRequestEvent(ItemDescription itemDescription) {
this.itemDescription = itemDescription;
}
@Override
protected void dispatch(ComputationDataRequestEventHandler handler) {
handler.onComputationDataRequest(this);
}
@Override
public Type<ComputationDataRequestEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<ComputationDataRequestEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source,
ComputationDataRequestEvent event) {
source.fireEvent(event);
}
public ItemDescription getItemDescription() {
return itemDescription;
}
@Override
public String toString() {
return "ComputationDataRequestEvent [itemDescription="
+ itemDescription + "]";
}
}

View File

@ -0,0 +1,70 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Computation Ready Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class ComputationReadyEvent extends
GwtEvent<ComputationReadyEvent.ComputationReadyEventHandler> {
public static Type<ComputationReadyEventHandler> TYPE = new Type<ComputationReadyEventHandler>();
private Operator operator;
public interface ComputationReadyEventHandler extends EventHandler {
void onReady(ComputationReadyEvent event);
}
public interface HasComputationReadyEventHandler extends HasHandlers {
public HandlerRegistration addComputationReadyEventHandler(
ComputationReadyEventHandler handler);
}
public ComputationReadyEvent(Operator operator) {
super();
this.operator = operator;
}
@Override
protected void dispatch(ComputationReadyEventHandler handler) {
handler.onReady(this);
}
@Override
public Type<ComputationReadyEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<ComputationReadyEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, ComputationReadyEvent event) {
source.fireEvent(event);
}
public static Type<ComputationReadyEventHandler> getTYPE() {
return TYPE;
}
public Operator getOperator() {
return operator;
}
@Override
public String toString() {
return "ComputationReadyEvent [operator=" + operator + "]";
}
}

View File

@ -0,0 +1,76 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.data.analysis.dataminermanagercl.shared.workspace.ItemDescription;
import org.gcube.portlets.user.dataminerexecutor.client.type.DataMinerWorkAreaElementType;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Delete Item Request Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class DeleteItemRequestEvent extends
GwtEvent<DeleteItemRequestEvent.DeleteItemRequestEventHandler> {
public static Type<DeleteItemRequestEventHandler> TYPE = new Type<DeleteItemRequestEventHandler>();
private DataMinerWorkAreaElementType dataMinerWorkAreaElementType;
private ItemDescription itemDescription;
public interface DeleteItemRequestEventHandler extends EventHandler {
void onDeleteRequest(DeleteItemRequestEvent event);
}
public interface HasDeleteItemRequestEventHandler extends HasHandlers {
public HandlerRegistration addDeleteItemRequestEventHandler(
DeleteItemRequestEventHandler handler);
}
public DeleteItemRequestEvent(
DataMinerWorkAreaElementType dataMinerWorkAreaElementType,
ItemDescription itemDescription) {
this.itemDescription = itemDescription;
this.dataMinerWorkAreaElementType = dataMinerWorkAreaElementType;
}
@Override
protected void dispatch(DeleteItemRequestEventHandler handler) {
handler.onDeleteRequest(this);
}
@Override
public Type<DeleteItemRequestEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<DeleteItemRequestEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source,
DeleteItemRequestEvent deleteItemEvent) {
source.fireEvent(deleteItemEvent);
}
public ItemDescription getItemDescription() {
return itemDescription;
}
public DataMinerWorkAreaElementType getDataMinerWorkAreaElementType() {
return dataMinerWorkAreaElementType;
}
@Override
public String toString() {
return "DeleteItemRequestEvent [dataMinerWorkAreaElementType="
+ dataMinerWorkAreaElementType + ", itemDescription="
+ itemDescription + "]";
}
}

View File

@ -0,0 +1,66 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Operators Classification Request Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class InvocationModelEvent
extends GwtEvent<InvocationModelEvent.InvocationModelEventHandler> {
public static Type<InvocationModelEventHandler> TYPE = new Type<InvocationModelEventHandler>();
private Operator operator;
public interface InvocationModelEventHandler extends EventHandler {
void onInvocation(InvocationModelEvent event);
}
public interface HasInvocationModelEventHandler extends HasHandlers {
public HandlerRegistration addInvocationModelEventHandler(
InvocationModelEventHandler handler);
}
public InvocationModelEvent(Operator operator) {
this.operator=operator;
}
@Override
protected void dispatch(InvocationModelEventHandler handler) {
handler.onInvocation(this);
}
@Override
public Type<InvocationModelEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<InvocationModelEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, InvocationModelEvent event) {
source.fireEvent(event);
}
public Operator getOperator() {
return operator;
}
@Override
public String toString() {
return "InvocationModelEvent [operator=" + operator + "]";
}
}

View File

@ -0,0 +1,55 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Operators Classification Request Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class InvocationModelRequestEvent
extends GwtEvent<InvocationModelRequestEvent.InvocationModelRequestEventHandler> {
public static Type<InvocationModelRequestEventHandler> TYPE = new Type<InvocationModelRequestEventHandler>();
public interface InvocationModelRequestEventHandler extends EventHandler {
void onInvocationRequest(InvocationModelRequestEvent event);
}
public interface HasInvocationModelEventHandler extends HasHandlers {
public HandlerRegistration addInvocationModelEventHandler(InvocationModelRequestEventHandler handler);
}
public InvocationModelRequestEvent() {
}
@Override
protected void dispatch(InvocationModelRequestEventHandler handler) {
handler.onInvocationRequest(this);
}
@Override
public Type<InvocationModelRequestEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<InvocationModelRequestEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, InvocationModelRequestEvent event) {
source.fireEvent(event);
}
@Override
public String toString() {
return "InvocationModelRequestEvent []";
}
}

View File

@ -0,0 +1,68 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.portlets.user.dataminerexecutor.client.type.MenuType;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Menu Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class MenuEvent extends
GwtEvent<MenuEvent.MenuEventHandler> {
public static Type<MenuEventHandler> TYPE = new Type<MenuEventHandler>();
private MenuType menuType;
public interface MenuEventHandler extends EventHandler {
void onSelect(MenuEvent event);
}
public interface HasMenuEventHandler extends HasHandlers {
public HandlerRegistration addMenuEventHandler(
MenuEventHandler handler);
}
public MenuEvent(
MenuType menuType) {
this.menuType = menuType;
}
@Override
protected void dispatch(MenuEventHandler handler) {
handler.onSelect(this);
}
@Override
public Type<MenuEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<MenuEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, MenuEvent event) {
source.fireEvent(event);
}
public MenuType getMenuType() {
return menuType;
}
@Override
public String toString() {
return "MenuEvent [menuType=" + menuType + "]";
}
}

View File

@ -0,0 +1,64 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.portlets.user.dataminerexecutor.client.type.MenuType;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Menu Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class MenuSwitchEvent extends
GwtEvent<MenuSwitchEvent.MenuSwitchEventHandler> {
public static Type<MenuSwitchEventHandler> TYPE = new Type<MenuSwitchEventHandler>();
private MenuType menuType;
public interface MenuSwitchEventHandler extends EventHandler {
void onSelect(MenuSwitchEvent event);
}
public interface HasMenuSwitchEventHandler extends HasHandlers {
public HandlerRegistration addMenuSwitchEventHandler(
MenuSwitchEventHandler handler);
}
public MenuSwitchEvent(MenuType menuType) {
this.menuType = menuType;
}
@Override
protected void dispatch(MenuSwitchEventHandler handler) {
handler.onSelect(this);
}
@Override
public Type<MenuSwitchEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<MenuSwitchEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, MenuSwitchEvent event) {
source.fireEvent(event);
}
public MenuType getMenuType() {
return menuType;
}
@Override
public String toString() {
return "MenuSwitchEvent [menuType=" + menuType + "]";
}
}

View File

@ -0,0 +1,63 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.data.analysis.dataminermanagercl.shared.data.OutputData;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Output Data Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class OutputDataEvent extends
GwtEvent<OutputDataEvent.OutputDataEventHandler> {
public static Type<OutputDataEventHandler> TYPE = new Type<OutputDataEventHandler>();
public OutputData outputData;
public interface OutputDataEventHandler extends EventHandler {
void onOutput(OutputDataEvent event);
}
public interface HasOutputDataEventHandler extends HasHandlers {
public HandlerRegistration addOutputDataEventHandler(
OutputDataEventHandler handler);
}
public OutputDataEvent(OutputData outputData) {
this.outputData = outputData;
}
@Override
protected void dispatch(OutputDataEventHandler handler) {
handler.onOutput(this);
}
@Override
public Type<OutputDataEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<OutputDataEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, OutputDataEvent event) {
source.fireEvent(event);
}
public OutputData getOutputData() {
return outputData;
}
@Override
public String toString() {
return "OutputDataEvent [outputData=" + outputData + "]";
}
}

View File

@ -0,0 +1,66 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationId;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Output Data Request Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class OutputDataRequestEvent extends
GwtEvent<OutputDataRequestEvent.OutputDataRequestEventHandler> {
public static Type<OutputDataRequestEventHandler> TYPE = new Type<OutputDataRequestEventHandler>();
private ComputationId computationId;
public interface OutputDataRequestEventHandler extends EventHandler {
void onOutputRequest(OutputDataRequestEvent event);
}
public interface HasOutputDataRequestEventHandler extends HasHandlers {
public HandlerRegistration addOutputDataRequestEventHandler(
OutputDataRequestEventHandler handler);
}
public OutputDataRequestEvent(ComputationId computationId) {
this.computationId = computationId;
}
@Override
protected void dispatch(OutputDataRequestEventHandler handler) {
handler.onOutputRequest(this);
}
@Override
public Type<OutputDataRequestEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<OutputDataRequestEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, OutputDataRequestEvent event) {
source.fireEvent(event);
}
public ComputationId getComputationId() {
return computationId;
}
@Override
public String toString() {
return "OutputDataRequestEvent [computationId=" + computationId + "]";
}
}

View File

@ -0,0 +1,48 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
public class RemoveSelectedOperatorEvent
extends GwtEvent<RemoveSelectedOperatorEvent.RemoveSelectedOperatorEventHandler> {
public static Type<RemoveSelectedOperatorEventHandler> TYPE = new Type<RemoveSelectedOperatorEventHandler>();
public interface RemoveSelectedOperatorEventHandler extends EventHandler {
void onSelect(RemoveSelectedOperatorEvent event);
}
public interface HasRemoveSelectedOperatorEventHandler extends HasHandlers {
public HandlerRegistration removeSelectedOperatorEventHandler(RemoveSelectedOperatorEventHandler handler);
}
public RemoveSelectedOperatorEvent() {
}
@Override
protected void dispatch(RemoveSelectedOperatorEventHandler handler) {
handler.onSelect(this);
}
@Override
public Type<RemoveSelectedOperatorEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<RemoveSelectedOperatorEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, MenuEvent event) {
source.fireEvent(event);
}
@Override
public String toString() {
return "RemoveSelectedOperatorEvent []";
}
}

View File

@ -0,0 +1,71 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationId;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Resubmit Computation Execution Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class ResubmitComputationExecutionEvent
extends
GwtEvent<ResubmitComputationExecutionEvent.ResubmitComputationExecutionEventHandler> {
public static Type<ResubmitComputationExecutionEventHandler> TYPE = new Type<ResubmitComputationExecutionEventHandler>();
private ComputationId computationId;
public interface ResubmitComputationExecutionEventHandler extends
EventHandler {
void onResubmit(ResubmitComputationExecutionEvent event);
}
public interface HasResubmitComputationExecutionEventHandler extends
HasHandlers {
public HandlerRegistration addResubmitComputationExecutionEventHandler(
ResubmitComputationExecutionEventHandler handler);
}
public ResubmitComputationExecutionEvent(ComputationId computationId) {
this.computationId = computationId;
}
@Override
protected void dispatch(ResubmitComputationExecutionEventHandler handler) {
handler.onResubmit(this);
}
@Override
public Type<ResubmitComputationExecutionEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<ResubmitComputationExecutionEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source,
ResubmitComputationExecutionEvent event) {
source.fireEvent(event);
}
public ComputationId getComputationId() {
return computationId;
}
@Override
public String toString() {
return "ResubmitComputationExecutionEvent [computationId="
+ computationId + "]";
}
}

View File

@ -0,0 +1,71 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.data.analysis.dataminermanagercl.shared.workspace.ItemDescription;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Resubmit Computation Execution Request Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class ResubmitComputationExecutionRequestEvent
extends
GwtEvent<ResubmitComputationExecutionRequestEvent.ResubmitComputationExecutionRequestEventHandler> {
public static Type<ResubmitComputationExecutionRequestEventHandler> TYPE = new Type<ResubmitComputationExecutionRequestEventHandler>();
private ItemDescription itemDescription;
public interface ResubmitComputationExecutionRequestEventHandler extends
EventHandler {
void onResubmit(ResubmitComputationExecutionRequestEvent event);
}
public interface HasResubmitComputationExecutionRequestEventHandler extends
HasHandlers {
public HandlerRegistration addResubmitComputationExecutionRequestEventHandler(
ResubmitComputationExecutionRequestEventHandler handler);
}
public ResubmitComputationExecutionRequestEvent(
ItemDescription itemDescription) {
this.itemDescription = itemDescription;
}
@Override
protected void dispatch(
ResubmitComputationExecutionRequestEventHandler handler) {
handler.onResubmit(this);
}
@Override
public Type<ResubmitComputationExecutionRequestEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<ResubmitComputationExecutionRequestEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source,
ResubmitComputationExecutionRequestEvent event) {
source.fireEvent(event);
}
public ItemDescription getItemDescription() {
return itemDescription;
}
@Override
public String toString() {
return "ResubmitComputationExecutionRequestEvent [itemDescription="
+ itemDescription + "]";
}
}

View File

@ -0,0 +1,70 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.portlets.user.dataminerexecutor.client.type.SessionExpiredEventType;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Session Expired Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class SessionExpiredEvent extends GwtEvent<SessionExpiredEvent.SessionExpiredEventHandler> {
public static Type<SessionExpiredEventHandler> TYPE = new Type<SessionExpiredEventHandler>();
private SessionExpiredEventType sessionExpiredEventType;
public interface SessionExpiredEventHandler extends EventHandler {
void onChange(SessionExpiredEvent event);
}
public interface HasSessionExpiredEventHandler extends HasHandlers {
public HandlerRegistration addSessionExpiredEventHandler(
SessionExpiredEventHandler handler);
}
public SessionExpiredEvent() {
this.sessionExpiredEventType = SessionExpiredEventType.EXPIREDONSERVER;
}
public SessionExpiredEvent(SessionExpiredEventType sessionExpiredEventType) {
this.sessionExpiredEventType = sessionExpiredEventType;
}
@Override
protected void dispatch(SessionExpiredEventHandler handler) {
handler.onChange(this);
}
@Override
public Type<SessionExpiredEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<SessionExpiredEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, SessionExpiredEvent sessionExpieredEvent) {
source.fireEvent(sessionExpieredEvent);
}
public SessionExpiredEventType getSessionExpiredEventType() {
return sessionExpiredEventType;
}
@Override
public String toString() {
return "SessionExpiredEvent [sessionExpiredEventType="
+ sessionExpiredEventType + "]";
}
}

View File

@ -0,0 +1,76 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationId;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Start Computation Execution Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class StartComputationExecutionEvent
extends
GwtEvent<StartComputationExecutionEvent.StartComputationExecutionEventHandler> {
public static Type<StartComputationExecutionEventHandler> TYPE = new Type<StartComputationExecutionEventHandler>();
private ComputationId computationId;
private int computationStatusPanelIndex;
public interface StartComputationExecutionEventHandler extends EventHandler {
void onStart(StartComputationExecutionEvent event);
}
public interface HasStartComputationExecutionEventHandler extends
HasHandlers {
public HandlerRegistration addStartComputationExecutionEventHandler(
StartComputationExecutionEventHandler handler);
}
public StartComputationExecutionEvent(ComputationId computationId,
int computationStatusPanelIndex) {
this.computationId = computationId;
this.computationStatusPanelIndex = computationStatusPanelIndex;
}
@Override
protected void dispatch(StartComputationExecutionEventHandler handler) {
handler.onStart(this);
}
@Override
public Type<StartComputationExecutionEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<StartComputationExecutionEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source,
StartComputationExecutionEvent event) {
source.fireEvent(event);
}
public ComputationId getComputationId() {
return computationId;
}
public int getComputationStatusPanelIndex() {
return computationStatusPanelIndex;
}
@Override
public String toString() {
return "StartComputationExecutionEvent [computationId=" + computationId
+ ", computationStatusPanelIndex="
+ computationStatusPanelIndex + "]";
}
}

View File

@ -0,0 +1,78 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Start Computation Execution Request Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class StartComputationExecutionRequestEvent
extends
GwtEvent<StartComputationExecutionRequestEvent.StartComputationExecutionRequestEventHandler> {
public static Type<StartComputationExecutionRequestEventHandler> TYPE = new Type<StartComputationExecutionRequestEventHandler>();
private Operator op;
private int computationStatusPanelIndex;
public interface StartComputationExecutionRequestEventHandler extends
EventHandler {
void onStart(StartComputationExecutionRequestEvent event);
}
public interface HasStartComputationExecutionRequestEventHandler extends
HasHandlers {
public HandlerRegistration addStartComputationExecutionRequestEventHandler(
StartComputationExecutionRequestEventHandler handler);
}
public StartComputationExecutionRequestEvent(Operator op,
int computationStatusPanelIndex) {
this.op = op;
this.computationStatusPanelIndex = computationStatusPanelIndex;
}
@Override
protected void dispatch(StartComputationExecutionRequestEventHandler handler) {
handler.onStart(this);
}
@Override
public Type<StartComputationExecutionRequestEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<StartComputationExecutionRequestEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source,
StartComputationExecutionRequestEvent event) {
source.fireEvent(event);
}
public Operator getOp() {
return op;
}
public int getComputationStatusPanelIndex() {
return computationStatusPanelIndex;
}
@Override
public String toString() {
return "StartComputationExecutionRequestEvent [op=" + op
+ ", computationStatusPanelIndex="
+ computationStatusPanelIndex + "]";
}
}

View File

@ -0,0 +1,57 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* SyncRefreshUpload
*
*
* @author Giancarlo Panichi
*
*
*/
public class SyncRefreshUploadDataSpaceEvent
extends GwtEvent<SyncRefreshUploadDataSpaceEvent.SyncRefreshUploadDataSpaceEventHandler> {
public static Type<SyncRefreshUploadDataSpaceEventHandler> TYPE = new Type<SyncRefreshUploadDataSpaceEventHandler>();
public interface SyncRefreshUploadDataSpaceEventHandler extends EventHandler {
void onRefresh(SyncRefreshUploadDataSpaceEvent event);
}
public interface HasSyncRefreshUploadDataSpaceEventHandler extends HasHandlers {
public HandlerRegistration addSyncRefreshUploadDataSpaceEventHandler(
SyncRefreshUploadDataSpaceEventHandler handler);
}
public SyncRefreshUploadDataSpaceEvent() {
}
@Override
protected void dispatch(SyncRefreshUploadDataSpaceEventHandler handler) {
handler.onRefresh(this);
}
@Override
public Type<SyncRefreshUploadDataSpaceEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<SyncRefreshUploadDataSpaceEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, SyncRefreshUploadDataSpaceEvent deleteItemEvent) {
source.fireEvent(deleteItemEvent);
}
@Override
public String toString() {
return "SyncRefreshUploadDataSpaceEvent []";
}
}

View File

@ -0,0 +1,66 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.data.analysis.dataminermanagercl.shared.data.TableItemSimple;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* Start Computation Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class TabularFldChangeEvent extends
GwtEvent<TabularFldChangeEvent.TabularFldChangeEventHandler> {
public static Type<TabularFldChangeEventHandler> TYPE = new Type<TabularFldChangeEventHandler>();
private TableItemSimple tableItemSimple;
public interface TabularFldChangeEventHandler extends EventHandler {
void onChange(TabularFldChangeEvent event);
}
public interface HasTabularFldChangeEventHandler extends HasHandlers {
public HandlerRegistration addTabularFldChangeEventHandler(
TabularFldChangeEventHandler handler);
}
public TabularFldChangeEvent(TableItemSimple tableItemSimple) {
this.tableItemSimple = tableItemSimple;
}
@Override
protected void dispatch(TabularFldChangeEventHandler handler) {
handler.onChange(this);
}
@Override
public Type<TabularFldChangeEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<TabularFldChangeEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, TabularFldChangeEvent event) {
source.fireEvent(event);
}
public TableItemSimple getTableItemSimple() {
return tableItemSimple;
}
@Override
public String toString() {
return "TabularFldChangeEvent [tableItemSimple=" + tableItemSimple
+ "]";
}
}

View File

@ -0,0 +1,67 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.portlets.user.dataminerexecutor.client.type.UIStateEventType;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* User Interface State Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class UIStateEvent extends GwtEvent<UIStateEvent.UIStateEventHandler> {
public static Type<UIStateEventHandler> TYPE = new Type<UIStateEventHandler>();
private UIStateEventType uiStateType;
public interface UIStateEventHandler extends EventHandler {
void onChange(UIStateEvent event);
}
public interface HasUIStateEventHandler extends HasHandlers {
public HandlerRegistration addUIStateEventHandler(
UIStateEventHandler handler);
}
public UIStateEvent() {
this.uiStateType = UIStateEventType.START;
}
public UIStateEvent(UIStateEventType uiStateType) {
this.uiStateType = uiStateType;
}
@Override
protected void dispatch(UIStateEventHandler handler) {
handler.onChange(this);
}
@Override
public Type<UIStateEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<UIStateEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, UIStateEvent uiStateEvent) {
source.fireEvent(uiStateEvent);
}
public UIStateEventType getUiStateType() {
return uiStateType;
}
@Override
public String toString() {
return "UIStatusEvent [uiStateType=" + uiStateType + "]";
}
}

View File

@ -0,0 +1,68 @@
package org.gcube.portlets.user.dataminerexecutor.client.events;
import org.gcube.portlets.user.dataminerexecutor.client.type.WPSMenuType;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.event.shared.HasHandlers;
/**
* WPS Menu Event
*
*
* @author Giancarlo Panichi
*
*
*/
public class WPSMenuEvent extends
GwtEvent<WPSMenuEvent.WPSMenuEventHandler> {
public static Type<WPSMenuEventHandler> TYPE = new Type<WPSMenuEventHandler>();
private WPSMenuType menuType;
public interface WPSMenuEventHandler extends EventHandler {
void onMenu(WPSMenuEvent event);
}
public interface HasWPSMenuEventHandler extends HasHandlers {
public HandlerRegistration addWPSMenuEventHandler(
WPSMenuEventHandler handler);
}
public WPSMenuEvent(WPSMenuType menuType) {
this.menuType = menuType;
}
@Override
protected void dispatch(WPSMenuEventHandler handler) {
handler.onMenu(this);
}
@Override
public Type<WPSMenuEventHandler> getAssociatedType() {
return TYPE;
}
public static Type<WPSMenuEventHandler> getType() {
return TYPE;
}
public static void fire(HasHandlers source, WPSMenuEvent wpsMenuEvent) {
source.fireEvent(wpsMenuEvent);
}
public WPSMenuType getMenuType() {
return menuType;
}
@Override
public String toString() {
return "WPSMenuEvent [menuType=" + menuType + "]";
}
}

View File

@ -0,0 +1,209 @@
package org.gcube.portlets.user.dataminerexecutor.client.experiments;
import java.util.ArrayList;
import java.util.List;
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
import org.gcube.portlets.user.dataminerexecutor.client.DataMinerExecutor;
import org.gcube.portlets.user.dataminerexecutor.client.common.EventBusProvider;
import org.gcube.portlets.user.dataminerexecutor.client.events.ResubmitComputationExecutionEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.StartComputationExecutionEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.StartComputationExecutionRequestEvent;
import com.allen_sauer.gwt.log.client.Log;
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.FramedPanel;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class ComputationExecutionPanel extends FramedPanel {
private List<ComputationStatusPanel> computationStatusPanels = new ArrayList<ComputationStatusPanel>();
private static final String DELETE_ALL_BUTTON_TOOLTIP = "Remove Computations Log";
private TextButton removeAllButton;
private VerticalLayoutContainer v;
private ToolBar toolBar;
private VerticalLayoutContainer topV;
/**
*
*/
public ComputationExecutionPanel() {
super();
Log.debug("Computation Execution Panel");
init();
create();
bind();
}
private void init() {
setHeaderVisible(false);
addStyleName("computationExcecutionPanel");
setBodyStyle("backgroundColor:white;");
}
private void create() {
topV = new VerticalLayoutContainer();
setToolBar();
topV.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
SimpleContainer computations = new SimpleContainer();
v = new VerticalLayoutContainer();
v.setScrollMode(ScrollMode.AUTO);
computations.add(v);
topV.add(computations, new VerticalLayoutData(1, 1, new Margins(0)));
add(topV);
}
private void bind() {
EventBusProvider.INSTANCE
.addHandler(
ResubmitComputationExecutionEvent.getType(),
new ResubmitComputationExecutionEvent.ResubmitComputationExecutionEventHandler() {
@Override
public void onResubmit(
ResubmitComputationExecutionEvent event) {
Log.debug("ResubmitComputationExecutionEvent: "
+ event);
resubmitComputation(event);
}
});
EventBusProvider.INSTANCE
.addHandler(
StartComputationExecutionEvent.getType(),
new StartComputationExecutionEvent.StartComputationExecutionEventHandler() {
@Override
public void onStart(
StartComputationExecutionEvent event) {
Log.debug("Catch StartComputationExecutionEvent: "
+ event);
startComputation(event);
}
});
}
public void startNewComputation(final Operator operator) {
Log.debug("Computation Panel: start new computation ");
ComputationStatusPanel statusPanel = new ComputationStatusPanel(
operator.getName());
computationStatusPanels.add(statusPanel);
int index = computationStatusPanels.indexOf(statusPanel);
statusPanel.setItemId("ComputationStatusPanel" + String.valueOf(index));
Log.debug("Added status bar");
v.insert(statusPanel, 0, new VerticalLayoutData(1, -1, new Margins(20)));
removeAllButton.setEnabled(true);
forceLayout();
StartComputationExecutionRequestEvent event = new StartComputationExecutionRequestEvent(
operator, index);
EventBusProvider.INSTANCE.fireEvent(event);
}
private void startComputation(StartComputationExecutionEvent event) {
try {
ComputationStatusPanel statusPanel = null;
try {
statusPanel = computationStatusPanels.get(event
.getComputationStatusPanelIndex());
} catch (IndexOutOfBoundsException e) {
Log.debug("No ComputationStatusPanel retrieved!");
Log.debug(e.getLocalizedMessage());
}
if (statusPanel == null) {
} else {
statusPanel.computationStarted(event.getComputationId());
forceLayout();
}
} catch (Throwable e) {
Log.error(e.getLocalizedMessage());
e.printStackTrace();
}
}
private void resubmitComputation(ResubmitComputationExecutionEvent event) {
final ComputationStatusPanel statusPanel = new ComputationStatusPanel(
event.getComputationId().getOperatorName());
computationStatusPanels.add(statusPanel);
if (v.getWidgetCount() == 0) {
v.add(statusPanel, new VerticalLayoutData(1, -1, new Margins(20)));
} else {
v.insert(statusPanel, 0, new VerticalLayoutData(1, -1, new Margins(
20)));
}
removeAllButton.setEnabled(true);
statusPanel.computationStarted(event.getComputationId());
forceLayout();
}
/**
*
*/
private void emptyPanel() {
// stop timers
for (ComputationStatusPanel statusPanel : computationStatusPanels)
statusPanel.stopTimer();
removeAllButton.setEnabled(false);
v.clear();
computationStatusPanels.clear();
forceLayout();
}
private void setToolBar() {
toolBar = new ToolBar();
removeAllButton = new TextButton("Remove All");
removeAllButton.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
emptyPanel();
}
});
removeAllButton.setIcon(DataMinerExecutor.resources.removeAll());
removeAllButton.setToolTip(DELETE_ALL_BUTTON_TOOLTIP);
// removeAllButton.setScale(ButtonScale.MEDIUM);
removeAllButton.setEnabled(false);
toolBar.add(new LabelToolItem("Tools:"));
toolBar.add(removeAllButton);
}
}

View File

@ -0,0 +1,295 @@
/**
*
*/
package org.gcube.portlets.user.dataminerexecutor.client.experiments;
import java.util.LinkedHashMap;
import java.util.Map;
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationId;
import org.gcube.data.analysis.dataminermanagercl.shared.data.output.FileResource;
import org.gcube.data.analysis.dataminermanagercl.shared.data.output.ImageResource;
import org.gcube.data.analysis.dataminermanagercl.shared.data.output.MapResource;
import org.gcube.data.analysis.dataminermanagercl.shared.data.output.ObjectResource;
import org.gcube.data.analysis.dataminermanagercl.shared.data.output.Resource;
import org.gcube.data.analysis.dataminermanagercl.shared.data.output.Resource.ResourceType;
import org.gcube.portlets.user.dataminerexecutor.client.common.EventBusProvider;
import org.gcube.portlets.user.dataminerexecutor.client.events.OutputDataEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.OutputDataRequestEvent;
import org.gcube.portlets.user.dataminerexecutor.client.util.UtilsGXT3;
import org.gcube.portlets.user.dataminerexecutor.client.widgets.FileViewer;
import org.gcube.portlets.user.dataminerexecutor.client.widgets.ImageViewer;
import org.gcube.portlets.user.dataminerexecutor.client.widgets.ResourceViewer;
import org.gcube.data.analysis.dataminermanagercl.shared.data.output.TableResource;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.sencha.gxt.core.client.XTemplates;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class ComputationOutputPanel extends SimpleContainer {
private ComputationId computationId;
private VerticalLayoutContainer v;
public ComputationOutputPanel(ComputationId computationId) {
super();
this.computationId = computationId;
Log.debug("ComputationOutputPanel: " + computationId);
bind();
init();
OutputDataRequestEvent event = new OutputDataRequestEvent(computationId);
EventBusProvider.INSTANCE.fireEvent(event);
}
private void init() {
v = new VerticalLayoutContainer();
add(v);
}
private void bind() {
EventBusProvider.INSTANCE.addHandler(OutputDataEvent.TYPE,
new OutputDataEvent.OutputDataEventHandler() {
@Override
public void onOutput(OutputDataEvent event) {
Log.debug("Catch OutputDataEvent: " + event);
if (event!=null&& event.getOutputData()!=null&&
event.getOutputData().getComputationId()!=null&&
event.getOutputData().getComputationId().getId()
.compareTo(computationId.getId()) == 0) {
manageOutputDataEvent(event);
}
}
});
}
/**
*
* @param resource
*/
private void manageOutputDataEvent(OutputDataEvent event) {
try {
if (event == null || event.getOutputData() == null) {
Log.error("OutputDataEvent is null");
UtilsGXT3.alert("Error", "Invalid output data!");
return;
}
Resource resource = event.getOutputData().getResource();
showResource(resource);
} catch (Throwable e) {
Log.error("Error in show output info: " + e.getLocalizedMessage());
e.printStackTrace();
}
}
private void showResource(Resource resource) {
try {
Log.info("Show Output Info on: " + resource);
if (resource == null) {
Log.debug("Output Data hasn't resource!");
return;
}
ResourceType resourceType = resource.getResourceType();
switch (resourceType) {
case FILE:
FileResource fileResource = (FileResource) resource;
v.add(getHtmlTitle("The algorithm produced a", "File"),
new VerticalLayoutData(1, -1, new Margins(0)));
v.add(getFileResourceOutput(fileResource),
new VerticalLayoutData(1, -1, new Margins(0)));
break;
case TABULAR:
//TableResource tabResource = (TableResource) resource;
v.add(getHtmlTitle("The algorithm produced a", "Table"),
new VerticalLayoutData(1, -1, new Margins(0)));
// v.add(getTabResourceOutput(tabResource),
// new VerticalLayoutData(1, -1, new Margins(0)));
break;
case IMAGE:
v.add(getHtmlTitle("The algorithm produced an", "Set of Images"),
new VerticalLayoutData(1, -1, new Margins(0)));
final ImageResource imagesResource = (ImageResource) resource;
v.add(getImagesResourceOutput(imagesResource),
new VerticalLayoutData(1, -1, new Margins(0)));
break;
case MAP:
v.add(getHtmlTitle("The algorithm produced ",
"Multiple Results"), new VerticalLayoutData(1, -1,
new Margins(0)));
final MapResource mapResource = (MapResource) resource;
v.add(getMultipleOutput(mapResource), new VerticalLayoutData(1,
-1, new Margins(0)));
break;
case OBJECT:
break;
default:
break;
}
forceLayout();
} catch (Throwable e) {
Log.error("Error in show resource: " + e.getLocalizedMessage());
e.printStackTrace();
}
}
public interface TitleTemplate extends XTemplates {
@XTemplate("<div class='computation-output-outputType'><p>{intro} <b>{produced}<b>.</p></div>")
SafeHtml getTemplate(String intro, String produced);
}
/**
* @param string
* @return
*/
private HtmlLayoutContainer getHtmlTitle(String intro, String produced) {
TitleTemplate templates = GWT.create(TitleTemplate.class);
HtmlLayoutContainer c = new HtmlLayoutContainer(templates.getTemplate(
intro, produced));
return c;
}
/**
* @param imagesResource
* @return
*/
private SimpleContainer getImagesResourceOutput(
ImageResource imagesResource) {
return new ImageViewer(computationId, imagesResource);
}
/**
*
* @param fileResource
* @return
*/
private SimpleContainer getFileResourceOutput(FileResource fileResource) {
return new FileViewer(computationId, fileResource);
}
/**
* @param map
* @return
*/
private SimpleContainer getMultipleOutput(MapResource mapResource) {
Map<String, Resource> map = mapResource.getMap();
VerticalLayoutContainer vp = new VerticalLayoutContainer();
SimpleContainer container = new SimpleContainer();
Map<String, ObjectResource> mapValues = new LinkedHashMap<>();
Map<String, FileResource> mapFiles = new LinkedHashMap<>();
Map<String, TableResource> mapTabs = new LinkedHashMap<>();
Map<String, ImageResource> mapImages = new LinkedHashMap<>();
for (String key : map.keySet()) {
Resource resource = map.get(key);
ResourceType resourceType = resource.getResourceType();
switch (resourceType) {
case OBJECT:
mapValues.put(key, (ObjectResource) resource);
break;
case FILE:
mapFiles.put(key, (FileResource) resource);
break;
case TABULAR:
mapTabs.put(key, (TableResource) resource);
break;
case IMAGE:
mapImages.put(key, (ImageResource) resource);
break;
case MAP:
break;
default:
break;
}
}
if (mapValues.size() > 0) {
HtmlLayoutContainer html = new HtmlLayoutContainer("Output Values");
html.setStyleName("computation-output-groupTitle");
vp.add(html, new VerticalLayoutData(-1, -1, new Margins(0)));
vp.add((new ResourceViewer(mapValues)).getHtml(),
new VerticalLayoutData(1, -1, new Margins(0)));
html = new HtmlLayoutContainer(
"<div class='computation-output-separator'></div>");
vp.add(html, new VerticalLayoutData(-1, -1, new Margins(0)));
}
if (mapFiles.size() > 0) {
HtmlLayoutContainer html = new HtmlLayoutContainer("Files");
html.setStyleName("computation-output-groupTitle");
vp.add(html, new VerticalLayoutData(-1, -1, new Margins(0)));
for (String fileKey : mapFiles.keySet()) {
// vp.add(new Html("<i>"+fileKey+"</i>"));
vp.add(getFileResourceOutput(mapFiles.get(fileKey)),
new VerticalLayoutData(1, -1, new Margins(0)));
}
html = new HtmlLayoutContainer(
"<div class='computation-output-separator'></div>");
vp.add(html, new VerticalLayoutData(-1, -1, new Margins(0)));
}
if (mapTabs.size() > 0) {
HtmlLayoutContainer html = new HtmlLayoutContainer("Tables");
html.setStyleName("computation-output-groupTitle");
vp.add(html, new VerticalLayoutData(-1, -1, new Margins(0)));
//for (String tabKey : mapTabs.keySet()) {
// vp.add(new Html("<i>"+tabKey+"</i>"));
// vp.add(getTabResourceOutput(mapTabs.get(tabKey)));
//}
html = new HtmlLayoutContainer(
"<div class='computation-output-separator'></div>");
vp.add(html, new VerticalLayoutData(-1, -1, new Margins(0)));
}
if (mapImages.size() > 0) {
HtmlLayoutContainer html = new HtmlLayoutContainer("Images");
html.setStyleName("computation-output-groupTitle");
vp.add(html, new VerticalLayoutData(-1, -1, new Margins(0)));
for (String imagesKey : mapImages.keySet()) {
vp.add(getImagesResourceOutput(mapImages.get(imagesKey)),
new VerticalLayoutData(1, -1, new Margins(0)));
}
html = new HtmlLayoutContainer(
"<div class='computation-output-separator'></div>");
vp.add(html, new VerticalLayoutData(-1, -1, new Margins(0)));
}
container.add(vp);
return container;
}
}

View File

@ -0,0 +1,155 @@
package org.gcube.portlets.user.dataminerexecutor.client.experiments;
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
import org.gcube.portlets.user.dataminerexecutor.client.DataMinerExecutor;
import org.gcube.portlets.user.dataminerexecutor.client.events.ComputationReadyEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.ComputationReadyEvent.ComputationReadyEventHandler;
import org.gcube.portlets.user.dataminerexecutor.client.events.ComputationReadyEvent.HasComputationReadyEventHandler;
import org.gcube.portlets.user.dataminerexecutor.client.experiments.ComputationParametersPanel.ComputationParametersPanelHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.Image;
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.FramedPanel;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class ComputationPanel extends FramedPanel implements HasComputationReadyEventHandler
{
//private static final String DELETE_ALL_BUTTON_TOOLTIP = "Remove All Operators";
//private TextButton removeAllButton;
//private ToolBar toolBar;
private VerticalLayoutContainer topV;
private VerticalLayoutContainer v;
private ComputationParametersPanel computationParametersPanel;
public ComputationPanel() {
super();
init();
create();
bind();
}
private void init() {
setHeaderVisible(false);
setBodyStyle("backgroundColor:white;");
}
private void create() {
computationParametersPanel=null;
topV = new VerticalLayoutContainer();
topV.setScrollMode(ScrollMode.NONE);
//setToolBar();
//topV.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
SimpleContainer operator = new SimpleContainer();
v = new VerticalLayoutContainer();
v.setScrollMode(ScrollMode.AUTO);
operator.add(v);
topV.add(operator, new VerticalLayoutData(1, 1, new Margins(0)));
add(topV);
//emptyPanel();
}
private void bind() {
/*EventBusProvider.INSTANCE.addHandler(RemoveSelectedOperatorEvent.TYPE,
new RemoveSelectedOperatorEvent.RemoveSelectedOperatorEventHandler() {
@Override
public void onSelect(RemoveSelectedOperatorEvent event) {
Log.debug("Catch RemoveSelectedOperatorEvent");
emptyPanel();
computationParametersPanel = null;
}
});*/
}
/*private void setToolBar() {
toolBar = new ToolBar();
toolBar.add(new LabelToolItem("Tools:"));
removeAllButton = new TextButton(DELETE_ALL_BUTTON_TOOLTIP);
removeAllButton.setToolTip(DELETE_ALL_BUTTON_TOOLTIP);
removeAllButton.setIcon(DataMinerExecutor.resources.removeAll());
removeAllButton.setEnabled(false);
removeAllButton.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
emptyPanel();
computationParametersPanel = null;
}
});
toolBar.add(removeAllButton);
}
private void emptyPanel() {
removeAllButton.setEnabled(false);
v.clear();
CenterLayoutContainer centerContainer = new CenterLayoutContainer();
centerContainer.add(new HTML(
"<span align='center'>Select an operator.</span>"));
v.add(centerContainer, new VerticalLayoutData(1, 1, new Margins(0)));
forceLayout();
}*/
private void addComputationParametersPanel(
ComputationParametersPanel computationParametersPanel) {
v.clear();
HBoxLayoutContainer hBox = new HBoxLayoutContainer();
hBox.setPack(BoxLayoutPack.CENTER);
hBox.add(new Image(DataMinerExecutor.resources.workflowConnector1()),
new BoxLayoutData(new Margins(0)));
v.add(hBox, new VerticalLayoutData(1, -1, new Margins(10,0,0,0)));
v.add(computationParametersPanel, new VerticalLayoutData(1, -1,
new Margins(0)));
//removeAllButton.setEnabled(true);
forceLayout();
}
@Override
public HandlerRegistration addComputationReadyEventHandler(
ComputationReadyEventHandler handler) {
return addHandler(handler, ComputationReadyEvent.getType());
}
public void addOperator(Operator operator) {
computationParametersPanel = new ComputationParametersPanel(operator);
computationParametersPanel.setHandler(new ComputationParametersPanelHandler() {
@Override
public void startComputation() {
if (computationParametersPanel != null) {
forceLayout();
Operator op = computationParametersPanel.getOperator();
ComputationReadyEvent event = new ComputationReadyEvent(op);
fireEvent(event);
}
}
});
addComputationParametersPanel(computationParametersPanel);
}
}

View File

@ -0,0 +1,233 @@
/**
*
*/
package org.gcube.portlets.user.dataminerexecutor.client.experiments;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
import org.gcube.portlets.user.dataminerexecutor.client.DataMinerExecutor;
import org.gcube.portlets.user.dataminerexecutor.client.parametersfield.OperatorFieldWidget;
import org.gcube.portlets.user.dataminerexecutor.shared.Constants;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.Window.Location;
import com.google.gwt.user.client.ui.Image;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
import com.sencha.gxt.widget.core.client.container.MarginData;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
import com.sencha.gxt.widget.core.client.form.FieldSet;
import com.sencha.gxt.widget.core.client.form.FormPanel;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class ComputationParametersPanel extends SimpleContainer {
public interface ComputationParametersPanelHandler {
public void startComputation();
}
private static final String START_BUTTON_TOOLTIP = "Start Computation";
private static final ImageResource PRELOAD_IMAGE = DataMinerExecutor.resources
.loaderBig();
private VerticalLayoutContainer v;
private Operator operator;
private FormPanel parametersPanel;
private FieldSet parametersFieldSet;
private VerticalLayoutContainer vParameters;
private Map<String, OperatorFieldWidget> fieldWidgetsMap;
private ComputationParametersPanelHandler handler = null;
private TextButton submit;
public ComputationParametersPanel(Operator operator) {
super();
this.operator = operator;
fieldWidgetsMap = new HashMap<>();
try {
init();
create();
} catch (Throwable e) {
Log.error("ComputationParametersPanel" + e.getLocalizedMessage());
e.printStackTrace();
}
}
private void init() {
setStylePrimaryName("workflow");
setResize(true);
}
private void create() {
v = new VerticalLayoutContainer();
add(v);
Image img = new Image(GWT.getModuleBaseURL() + "../images/operators/"
+ (operator.hasImage() ? operator.getId() : "DEFAULT_IMAGE")
+ ".png");
img.setStylePrimaryName("workflow-icon");// -15
v.add(img, new VerticalLayoutData(-1, -1, new Margins(-15, 0, 0, 5)));
String locationRef = "";
try {
String location = Location.getHref();
String[] locationData = location.split("\\?");
locationRef = locationData[0];
} catch (Throwable e) {
Log.error("Error retrieving location: " + e.getLocalizedMessage());
}
HtmlLayoutContainer title = new HtmlLayoutContainer("<span><a href='"
+ locationRef + "?" + Constants.DATA_MINER_EXECUTOR_OPERATOR_ID + "="
+ operator.getId() + "'>" + operator.getName() + "</a></span>");
title.addStyleName("workflow-title");
v.add(title, new VerticalLayoutData(-1, -1, new Margins(20, 0, 0, -25)));
String descr = operator.getDescription();
descr = (descr == null || descr.contentEquals("")) ? "no-description"
: operator.getDescription();// display:block;clear:both;'
HtmlLayoutContainer description = new HtmlLayoutContainer(
"<span style='padding-left:10px;padding-right:10px;display:inline-block;'>"
+ descr + "</span>");
description.addStyleName("workflow-description");
v.add(description, new VerticalLayoutData(-1, -1, new Margins(0)));
// addTitleField();
parametersPanel = new FormPanel() {
@Override
public boolean isValid(boolean preventMark) {
boolean flag = super.isValid(preventMark);
if (flag) {
for (Map.Entry<String, OperatorFieldWidget> entry : fieldWidgetsMap
.entrySet()) {
OperatorFieldWidget fieldWidget = entry.getValue();
flag = flag && fieldWidget.isValid();
}
}
return flag;
}
};
// parametersPanel = new FramedPanel();
parametersPanel.setBorders(false);
parametersPanel.getElement().getStyle().setPaddingBottom(20, Unit.PX);
parametersFieldSet = new FieldSet();
parametersFieldSet.setHeadingText("Parameters");
vParameters = new VerticalLayoutContainer();
Image imgLoading = new Image(PRELOAD_IMAGE);
vParameters.add(imgLoading, new VerticalLayoutData(1, -1,
new Margins(0)));
parametersFieldSet.add(vParameters, new MarginData(new Margins(0)));
parametersFieldSet.setCollapsible(false);
parametersPanel.add(parametersFieldSet);
v.add(parametersPanel, new VerticalLayoutData(1, -1, new Margins(5)));
submit = new TextButton("Start Computation");
submit.setToolTip(START_BUTTON_TOOLTIP);
submit.setIcon(DataMinerExecutor.resources.startComputation());
submit.getElement().getStyle().setMarginLeft(20, Unit.PX);
submit.getElement().getStyle().setMarginBottom(20, Unit.PX);
submit.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
if (handler != null && parametersPanel.isValid()) {
handler.startComputation(); // TODO insert
// description
}
}
});
v.add(submit);
// , new VerticalLayoutData(-1, -1, new Margins(0, 0, 20, 20)));
submit.setVisible(false);
forceLayout();
loadOperatorParameters();
}
/*
* private void addTitleField() { titleField = new TextField();
* titleField.setWidth(250); titleField.setValue(defaultComputationTitle);
* FieldLabel titleLabel = new FieldLabel(titleField, "Computation Title");
* titleLabel.addStyleName("workflow-computation-title"); v.add(titleLabel,
* new VerticalLayoutData(-1, -1, new Margins(0))); }
*/
/**
* @param parameter parametersPanel
*/
private void loadOperatorParameters() {
vParameters.clear();
showForm();
}
/**
*
*/
protected void showForm() {
try {
// field widgets creation
for (Parameter p : operator.getOperatorParameters()) {
OperatorFieldWidget fieldWidget = new OperatorFieldWidget(p);
fieldWidgetsMap.put(p.getName(), fieldWidget);
vParameters.add(fieldWidget.getParameterLabel(),
new VerticalLayoutData(1, -1, new Margins(0)));
}
parametersPanel.getElement().getStyle()
.setPaddingBottom(0, Unit.PX);
submit.setVisible(true);
parametersPanel.forceLayout();
forceLayout();
} catch (Throwable e) {
Log.error("Error in show form:" + e.getLocalizedMessage());
Log.error("Error: " + Arrays.asList(e.getStackTrace()).toString(),e);
}
}
/**
* @return the operator
*/
public Operator getOperator() {
return operator;
}
public void setHandler(ComputationParametersPanelHandler handler) {
this.handler = handler;
}
}

View File

@ -0,0 +1,320 @@
/**
*
*/
package org.gcube.portlets.user.dataminerexecutor.client.experiments;
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationId;
import org.gcube.data.analysis.dataminermanagercl.shared.process.ComputationStatus;
import org.gcube.data.analysis.dataminermanagercl.shared.process.ComputationStatus.Status;
import org.gcube.portlets.user.dataminerexecutor.client.common.EventBusProvider;
import org.gcube.portlets.user.dataminerexecutor.client.custom.progress.GreenProgressBar;
import org.gcube.portlets.user.dataminerexecutor.client.custom.progress.OrangeProgressBar;
import org.gcube.portlets.user.dataminerexecutor.client.custom.progress.RedProgressBar;
import org.gcube.portlets.user.dataminerexecutor.client.events.CancelComputationExecutionRequestEvent;
import org.gcube.portlets.user.dataminerexecutor.client.rpc.DataMinerExecutorServiceAsync;
import org.gcube.portlets.user.dataminerexecutor.client.util.ElementsHighlights;
import org.gcube.portlets.user.dataminerexecutor.client.util.UtilsGXT3;
import org.gcube.portlets.user.dataminerexecutor.shared.Constants;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.ProgressBar;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
import com.sencha.gxt.widget.core.client.form.FieldLabel;
import com.sencha.gxt.widget.core.client.info.Info;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class ComputationStatusPanel extends SimpleContainer {
private ProgressBar progressBar;
private ComputationId computationId;
private String operatorName;
private boolean terminated = false;
private ComputationTimer timer = new ComputationTimer();
private TextButton cancelComputationBtn;
private VerticalLayoutContainer vert;
/**
*
* @param operatorName operator name
*/
public ComputationStatusPanel(String operatorName) {
super();
this.operatorName = operatorName;
init();
create();
}
private void init() {
setStylePrimaryName("computationStatusPanel");
}
private void create() {
vert = new VerticalLayoutContainer();
HtmlLayoutContainer title = new HtmlLayoutContainer(
"<div class='computationStatusTitle'><p>Computation of <b>"
+ operatorName + "</b></p></div>");
vert.add(title, new VerticalLayoutData(-1, -1, new Margins(0)));
add(vert);
forceLayout();
}
/**
* @param computationId
* the computationId to set
*/
public void computationStarted(ComputationId computationId) {
this.computationId = computationId;
/*
* HtmlLayoutContainer date = new HtmlLayoutContainer(
* "<div class='computationStatusDate'><p>" + new Date().toString() +
* "</p></div>");
*/
// vert.add(date, new VerticalLayoutData(-1, -1, new Margins(0)));
vert.add(new HtmlLayoutContainer("<p>Created, the id is "
+ computationId.getId() + "</p>"));
TextButton equivalentRequestBtn = new TextButton();
equivalentRequestBtn.setText("Show");
equivalentRequestBtn.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
showEquivalentRequestDialog();
}
});
FieldLabel equivalentRequestLabel = new FieldLabel(
equivalentRequestBtn, "Equivalent Get Request");
equivalentRequestLabel.setLabelWidth(140);
//vert.add(equivalentRequestLabel, new VerticalLayoutData(-1, -1,
// new Margins(0)));
progressBar = new ProgressBar();
progressBar.updateProgress(0, "Starting...");
vert.add(progressBar, new VerticalLayoutData(1, -1, new Margins(20)));
cancelComputationBtn = new TextButton("Cancel");
cancelComputationBtn.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
cancelComputationBtn.disable();
cancelComputation();
}
});
cancelComputationBtn.getElement().getStyle()
.setMarginBottom(36, Unit.PX);
vert.add(cancelComputationBtn, new VerticalLayoutData(-1, -1,
new Margins(0)));
forceLayout();
timer.scheduleRepeating(Constants.TIME_UPDATE_COMPUTATION_STATUS_PANEL);
}
private void showEquivalentRequestDialog() {
EquivalentRequestDialog equivalentRequestDialog = new EquivalentRequestDialog(
computationId);
equivalentRequestDialog.show();
}
private void cancelComputation() {
CancelComputationExecutionRequestEvent event = new CancelComputationExecutionRequestEvent(
computationId);
EventBusProvider.INSTANCE.fireEvent(event);
}
/**
* @param computationId
* @param operator
*
*/
private void computationTerminated(ComputationId computationId,
ComputationStatus computationStatus) {
Log.debug("Computation Terminated");
Log.debug("Computation Status:" + computationStatus);
if (terminated == false) {
terminated = true;
cancelComputationBtn.setVisible(false);
if (computationStatus.isComplete()) {
Log.debug("Computation is Complete");
Info.display("Terminated",
"The computation " + computationId.getId() + " of "
+ computationId.getOperatorName()
+ " is terminated correctly.");
int index = vert.getWidgetIndex(progressBar);
vert.remove(index);
// TODO
progressBar = new GreenProgressBar();
progressBar.updateProgress(1, "Computation Complete");
vert.insert(progressBar, index, new VerticalLayoutData(1, -1,
new Margins(20)));
showComputationCompletedOutput();
} else if (computationStatus.isFailed()) {
Log.debug("Computation is Failed");
String errorMessage;
if (computationStatus.getError() == null) {
errorMessage = new String("Computation Failed!");
} else {
errorMessage = computationStatus.getError()
.getLocalizedMessage();
ElementsHighlights el=new ElementsHighlights();
errorMessage=el.createLinkFromText(errorMessage);
}
Info.display("Failed",
"The computation " + computationId.getId() + " of "
+ computationId.getOperatorName()
+ " is failed.");
UtilsGXT3.alert("Failed",
"The computation " + computationId.getId() + " of "
+ computationId.getOperatorName()
+ " has failed.</br>" + errorMessage);
int index = vert.getWidgetIndex(progressBar);
vert.remove(index);
// TODO
progressBar = new RedProgressBar();
progressBar.updateProgress(1, "Computation Fail");
progressBar.getElement().getStyle()
.setMarginBottom(36, Unit.PX);
vert.insert(progressBar, index, new VerticalLayoutData(1, -1,
new Margins(20)));
} else if (computationStatus.isCancelled()) {
Log.debug("Computation Cancelled");
String errorMessage;
errorMessage = new String("Computation Cancelled!");
Info.display("Info", "The computation " + computationId.getId()
+ " of " + computationId.getOperatorName()
+ " has been cancelled.");
UtilsGXT3.info("Info",
"The computation " + computationId.getId() + " of "
+ computationId.getOperatorName()
+ " has been cancelled.</br>" + errorMessage);
int index = vert.getWidgetIndex(progressBar);
vert.remove(index);
// TODO
progressBar = new OrangeProgressBar();
progressBar.updateProgress(1, "Computation Cancelled");
progressBar.getElement().getStyle()
.setMarginBottom(36, Unit.PX);
vert.insert(progressBar, index, new VerticalLayoutData(1, -1,
new Margins(20)));
}
}
forceLayout();
}
/**
*
*/
private void showComputationCompletedOutput() {
HtmlLayoutContainer computationEndMessage = new HtmlLayoutContainer(
"<p>The computation <b>" + computationId.getOperatorName()
+ "</b> finished.</p>");
vert.add(computationEndMessage, new VerticalLayoutData(-1, -1,
new Margins(0)));
ComputationOutputPanel computationOutputPanel = new ComputationOutputPanel(
computationId);
computationOutputPanel.getElement().getStyle()
.setMarginBottom(36, Unit.PX);
vert.add(computationOutputPanel, new VerticalLayoutData(1, -1,
new Margins(0)));
}
/**
* @param computationStatus
*/
private void updateStatus(ComputationStatus computationStatus) {
Log.debug("Conputation Status Panel ::Update Status "
+ computationStatus);
if (computationStatus.getStatus().compareTo(Status.ACCEPTED) == 0)
progressBar.updateText("Accepted...");
else {
double percentage = computationStatus.getPercentage();
if (percentage == 0) {
progressBar.updateText("Running, 0% Complete");
} else {
progressBar.updateProgress(percentage / 100, "Running, "
+ percentage + "% Complete");
}
}
forceLayout();
}
private class ComputationTimer extends Timer {
@Override
public void run() {
Log.debug("Timer run .....");
DataMinerExecutorServiceAsync.INSTANCE.getComputationStatus(
computationId, new AsyncCallback<ComputationStatus>() {
@Override
public void onFailure(Throwable caught) {
int index = vert.getWidgetIndex(progressBar);
vert.remove(index);
// TODO
progressBar = new RedProgressBar();
progressBar.updateProgress(1,
"Failed to get the status");
progressBar.getElement().getStyle()
.setMarginBottom(36, Unit.PX);
vert.insert(progressBar, index,
new VerticalLayoutData(1, -1, new Margins(
20)));
}
@Override
public void onSuccess(
ComputationStatus computationStatus) {
Log.debug("ComputationStatus: "+computationStatus);
if (computationStatus != null) {
if (computationStatus.isTerminated()) {
ComputationTimer.this.cancel();
computationTerminated(computationId,
computationStatus);
} else
updateStatus(computationStatus);
}
}
});
}
}
/**
*
*/
public void stopTimer() {
try {
timer.cancel();
} catch (Exception e) {
}
vert.clear();
}
}

View File

@ -0,0 +1,46 @@
package org.gcube.portlets.user.dataminerexecutor.client.experiments;
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationId;
import com.allen_sauer.gwt.log.client.Log;
import com.sencha.gxt.widget.core.client.Dialog;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.form.TextArea;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class EquivalentRequestDialog extends Dialog {
private ComputationId computationId;
public EquivalentRequestDialog(ComputationId computationId) {
super();
Log.debug("EquivalentRequestDialog: " + computationId);
this.computationId = computationId;
init();
create();
}
private void init() {
setModal(true);
setClosable(true);
setHeadingText("Equivalent Get Request");
setBodyBorder(true);
setHideOnButtonClick(true);
setPredefinedButtons(PredefinedButton.CLOSE);
getButtonBar().setPack(BoxLayoutPack.CENTER);
}
private void create() {
TextArea equivalentRequestArea = new TextArea();
equivalentRequestArea.setHeight(200);
equivalentRequestArea.setWidth(640);
equivalentRequestArea.setValue(computationId.getEquivalentRequest());
equivalentRequestArea.setReadOnly(true);
add(equivalentRequestArea);
}
}

View File

@ -0,0 +1,88 @@
package org.gcube.portlets.user.dataminerexecutor.client.experiments;
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
import org.gcube.portlets.user.dataminerexecutor.client.common.EventBusProvider;
import org.gcube.portlets.user.dataminerexecutor.client.events.InvocationModelEvent;
//import org.gcube.portlets.user.dataminerexecutor.client.events.InvocationModelRequestEvent;
import com.allen_sauer.gwt.log.client.Log;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer;
import com.sencha.gxt.widget.core.client.container.MarginData;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class ExperimentPanel extends SimpleContainer {
private WorkflowPanel workflowPanel;
//private OperatorsPanel operatorsPanel;
//private OperatorPanel lastOperatorSelected = null;
/**
*
*/
public ExperimentPanel() {
super();
init();
create();
bind();
}
private void init() {
}
private void bind(){
EventBusProvider.INSTANCE.addHandler(InvocationModelEvent.TYPE,
new InvocationModelEvent.InvocationModelEventHandler() {
@Override
public void onInvocation(InvocationModelEvent event) {
Log.debug("Catch InvocationModelEvent: " + event);
addOperator(event.getOperator());
}
});
}
private void create() {
//operatorsPanel = new OperatorsPanel(this);
workflowPanel = new WorkflowPanel();
//
BorderLayoutContainer experimentPanelLayout = new BorderLayoutContainer();
experimentPanelLayout.setBorders(false);
experimentPanelLayout.setResize(true);
experimentPanelLayout.getElement().getStyle()
.setBackgroundColor("white");
// Center
MarginData mainData = new MarginData(new Margins(0));
experimentPanelLayout.setCenterWidget(workflowPanel, mainData);
add(experimentPanelLayout, new MarginData(0));
}
/**
*
*/
private void addOperator(Operator operator) {
//if (lastOperatorSelected != null
// && lastOperatorSelected != operatorPanel)
// lastOperatorSelected.toggleSelected(false);
//if (lastOperatorSelected != operatorPanel)
// operatorPanel.toggleSelected(true);
//lastOperatorSelected = operatorPanel;
workflowPanel.addOperator(operator);
}
}

View File

@ -0,0 +1,113 @@
/**
*
*/
package org.gcube.portlets.user.dataminerexecutor.client.experiments;
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
import org.gcube.portlets.user.dataminerexecutor.client.DataMinerExecutor;
import org.gcube.portlets.user.dataminerexecutor.client.common.EventBusProvider;
import org.gcube.portlets.user.dataminerexecutor.client.events.ComputationReadyEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.ResubmitComputationExecutionEvent;
import com.allen_sauer.gwt.log.client.Log;
import com.sencha.gxt.widget.core.client.TabItemConfig;
import com.sencha.gxt.widget.core.client.TabPanel;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class WorkflowPanel extends TabPanel {
public static final String DEFAULT_OPERATOR = "AQUAMAPS_SUITABLE";
private ComputationExecutionPanel computationExecutionPanel;
private ComputationPanel computationPanel;
/**
*
*/
public WorkflowPanel() {
super();
init();
create();
bind();
}
private void init() {
setBodyBorder(false);
}
private void create() {
TabItemConfig tabWorkFlowLcItemConf = new TabItemConfig("Operator",
false);
tabWorkFlowLcItemConf.setIcon(DataMinerExecutor.resources
.folderExplore());
computationPanel = new ComputationPanel();
computationPanel
.addComputationReadyEventHandler(new ComputationReadyEvent.ComputationReadyEventHandler() {
@Override
public void onReady(ComputationReadyEvent event) {
Log.debug("StartComputationEvent Received:" + event);
startComputation(event.getOperator());
}
});
add(computationPanel, tabWorkFlowLcItemConf);
TabItemConfig tabComputationPanelItemConf = new TabItemConfig(
"Computations Execution", false);
tabComputationPanelItemConf.setIcon(DataMinerExecutor.resources
.folderExplore());
computationExecutionPanel = new ComputationExecutionPanel();
add(computationExecutionPanel, tabComputationPanelItemConf);
setActiveWidget(computationPanel);
}
/**
*
*/
private void bind() {
EventBusProvider.INSTANCE
.addHandler(
ResubmitComputationExecutionEvent.getType(),
new ResubmitComputationExecutionEvent.ResubmitComputationExecutionEventHandler() {
@Override
public void onResubmit(
ResubmitComputationExecutionEvent event) {
resubmitComputation();
}
});
}
/**
*
*/
private void resubmitComputation() {
setActiveWidget(computationExecutionPanel);
}
/**
* @param computationTitle
* @param operator
*
*/
private void startComputation(Operator op) {
setActiveWidget(computationExecutionPanel);
computationExecutionPanel.startNewComputation(op);
}
public void addOperator(Operator op) {
setActiveWidget(computationPanel);
computationPanel.addOperator(op);
}
}

View File

@ -0,0 +1,69 @@
package org.gcube.portlets.user.dataminerexecutor.client.monitor;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.sencha.gxt.widget.core.client.box.AutoProgressMessageBox;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class StatusMonitor extends AutoProgressMessageBox {
public StatusMonitor() {
super("Waiting", "Please wait...");
create();
}
/**
*
* @param headingHtml
* head
* @param messageHtml
* message
*/
public StatusMonitor(SafeHtml headingHtml, SafeHtml messageHtml) {
super(headingHtml, messageHtml);
create();
}
/**
*
* @param headingHtml
* head
*/
public StatusMonitor(SafeHtml headingHtml) {
super(headingHtml);
create();
}
/**
*
* @param headingHtml
* head
* @param messageHtml
* message
*/
public StatusMonitor(String headingHtml, String messageHtml) {
super(headingHtml, messageHtml);
create();
}
/**
*
* @param headingHtml
* head
*/
public StatusMonitor(String headingHtml) {
super(headingHtml);
create();
}
private void create() {
setProgressText("In progress...");
auto();
show();
}
}

View File

@ -0,0 +1,58 @@
/**
*
*/
package org.gcube.portlets.user.dataminerexecutor.client.parametersfield;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
import com.google.gwt.user.client.ui.Widget;
/**
*
* @author Giancarlo Panichi
*
*
*/
public abstract class AbstractFld {
protected Parameter parameter;
public abstract String getValue();
public abstract Widget getWidget();
/**
*
* @param parameter parameter
* parameter
*/
public AbstractFld(Parameter parameter) {
this.parameter = parameter;
}
/**
*
* @return Parameter
*/
public Parameter getParameter() {
return parameter;
}
/**
*
* @param parameter parameter
* parameter
*/
public void setParameter(Parameter parameter) {
this.parameter = parameter;
}
/**
*
* @return true if is valid
*/
public boolean isValid() {
return true;
}
}

View File

@ -0,0 +1,184 @@
/**
*
*/
package org.gcube.portlets.user.dataminerexecutor.client.parametersfield;
import java.util.ArrayList;
import org.gcube.data.analysis.dataminermanagercl.shared.data.ColumnItem;
import org.gcube.data.analysis.dataminermanagercl.shared.data.TableItemSimple;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.ColumnParameter;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
import org.gcube.portlets.user.dataminerexecutor.client.events.TabularFldChangeEvent;
import org.gcube.portlets.user.dataminerexecutor.client.events.TabularFldChangeEvent.TabularFldChangeEventHandler;
import org.gcube.portlets.user.dataminerexecutor.client.properties.ColumnItemPropertiesCombo;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
import com.sencha.gxt.core.client.util.Format;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.data.shared.ListStore;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import com.sencha.gxt.widget.core.client.form.ComboBox;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class ColumnFld extends AbstractFld implements
TabularFldChangeEventHandler {
private String defaultColumn;
private ComboBox<ColumnItem> comboBox;
private ListStore<ColumnItem> store;
private String referredTabularParameterName;
private SimpleContainer fieldContainer;
private SimpleContainer vContainer;
/**
* @param parameter parameter
*/
public ColumnFld(Parameter parameter) {
super(parameter);
ColumnParameter columnParameter = (ColumnParameter) parameter;
referredTabularParameterName = columnParameter
.getReferredTabularParameterName();
defaultColumn = columnParameter.getDefaultColumn();
fieldContainer = new SimpleContainer();
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
horiz.setPack(BoxLayoutPack.START);
horiz.setEnableOverflow(false);
ColumnItemPropertiesCombo props = GWT
.create(ColumnItemPropertiesCombo.class);
store = new ListStore<ColumnItem>(props.id());
comboBox = new ComboBox<ColumnItem>(store, props.label());
comboBox.setAllowBlank(false);
comboBox.setForceSelection(true);
comboBox.setEditable(false);
comboBox.setTriggerAction(TriggerAction.ALL);
comboBox.setEnabled(false);
HtmlLayoutContainer descr;
if (columnParameter.getDescription() == null) {
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
descr.addStyleName("workflow-fieldDescription");
} else {
//comboBox.setToolTip(columnParameter.getDescription());
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'>"
+ columnParameter.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");
}
vContainer = new SimpleContainer();
showNoSelectionField();
horiz.add(vContainer, new BoxLayoutData(new Margins()));
horiz.add(descr, new BoxLayoutData(new Margins()));
fieldContainer.add(horiz);
fieldContainer.forceLayout();
}
private void showNoSelectionField() {
vContainer.clear();
VerticalLayoutContainer vField = new VerticalLayoutContainer();
HtmlLayoutContainer typeDescription = new HtmlLayoutContainer(
"<div class='workflow-parameters-description'><p>Select table from parameter "
+ Format.ellipse(referredTabularParameterName, 30)
+ "</p></div>");
typeDescription.setStylePrimaryName("workflow-parameters-description");
vField.add(comboBox, new VerticalLayoutData(1, -1, new Margins(0)));
vField.add(typeDescription, new VerticalLayoutData(-1, -1, new Margins(
0)));
vContainer.add(vField);
}
private void showFieldWithSelection(TableItemSimple tableItem) {
vContainer.clear();
VerticalLayoutContainer vField = new VerticalLayoutContainer();
HtmlLayoutContainer typeDescription = new HtmlLayoutContainer(
"<div class='workflow-parameters-description'><p>Columns of Table "
+ Format.ellipse(tableItem.getName(), 30)
+ "</p></div>");
typeDescription.setStylePrimaryName("workflow-parameters-description");
vField.add(comboBox, new VerticalLayoutData(1, -1, new Margins(0)));
vField.add(typeDescription, new VerticalLayoutData(-1, -1, new Margins(
0)));
vContainer.add(vField);
}
/**
*
*/
@Override
public String getValue() {
ColumnItem columnItem = comboBox.getCurrentValue();
return columnItem != null ? columnItem.getName() : null;
}
/**
*
*/
@Override
public Widget getWidget() {
return fieldContainer;
}
@Override
public boolean isValid() {
return comboBox.isValid();
}
@Override
public void onChange(TabularFldChangeEvent event) {
TableItemSimple tableItemSimple = event.getTableItemSimple();
if (tableItemSimple == null) {
store.clear();
store.commitChanges();
comboBox.clear();
comboBox.setEnabled(false);
showNoSelectionField();
} else {
store.clear();
store.commitChanges();
comboBox.clear();
ArrayList<ColumnItem> columns = tableItemSimple.getColumns();
if (columns != null) {
store.addAll(columns);
store.commitChanges();
Log.debug("DefaultColumn: "+defaultColumn);
for (ColumnItem columnItem : columns) {
Log.debug("ColumnItem: "+ columnItem);
if (columnItem.getName().compareToIgnoreCase(defaultColumn) == 0) {
comboBox.setValue(columnItem);
break;
}
}
}
comboBox.setEnabled(true);
showFieldWithSelection(tableItemSimple);
}
fieldContainer.forceLayout();
}
}

View File

@ -0,0 +1,129 @@
/**
*
*/
package org.gcube.portlets.user.dataminerexecutor.client.parametersfield;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.ColumnListParameter;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class ColumnListFld extends AbstractFld {
private SimpleContainer fieldContainer;
// private TextField textField;
private String value;
/**
* @param parameter
* parameter
*/
public ColumnListFld(Parameter parameter) {
super(parameter);
// ObjectParameter p = (ObjectParameter) parameter;
Log.debug("Create Column List field: " + parameter.getName());
value = parameter.getValue();
ColumnListParameter columnListParameter = (ColumnListParameter) parameter;
StringBuilder columnListHtml = new StringBuilder();
String tempValue = new String(value);
int pos = tempValue.indexOf(columnListParameter.getSeparator());
while (pos > -1) {
SafeHtmlBuilder safeValue=new SafeHtmlBuilder();
safeValue.appendEscaped(tempValue.substring(0, pos));
columnListHtml.append("<span style='display:block;overflow-wrap: break-word;'>" + safeValue.toSafeHtml().asString()
+ "</span>");
tempValue = tempValue.substring(pos + 1, tempValue.length());
pos = tempValue.indexOf(columnListParameter.getSeparator());
}
if (tempValue != null && !tempValue.isEmpty()) {
SafeHtmlBuilder safeValue=new SafeHtmlBuilder();
safeValue.appendEscaped(tempValue);
columnListHtml.append("<span style='display:block;overflow-wrap: break-word;'>" +safeValue.toSafeHtml().asString() + "</span>");
} else {
columnListHtml.append("<span style='display:block;overflow-wrap: break-word;'></span>");
}
HtmlLayoutContainer descr;
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
descr.addStyleName("workflow-fieldDescription");
descr = new HtmlLayoutContainer(
"<p style='margin-left:5px !important;'>" + parameter.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");
String typology = "Columns of Table "+columnListParameter.getReferredTabularParameterName();
SimpleContainer vContainer = new SimpleContainer();
VerticalLayoutContainer vField = new VerticalLayoutContainer();
HtmlLayoutContainer typeDescription = new HtmlLayoutContainer(typology);
typeDescription.setStylePrimaryName("workflow-parameters-description");
HtmlLayoutContainer val = new HtmlLayoutContainer(columnListHtml.toString());
val.addStyleName("workflow-fieldValue");
vField.add(val, new VerticalLayoutData(-1, -1, new Margins(0)));
vField.add(typeDescription, new VerticalLayoutData(-1, -1, new Margins(0)));
vContainer.add(vField);
fieldContainer = new SimpleContainer();
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
horiz.setPack(BoxLayoutPack.START);
horiz.setEnableOverflow(false);
horiz.add(vContainer, new BoxLayoutData(new Margins()));
horiz.add(descr, new BoxLayoutData(new Margins()));
fieldContainer.add(horiz);
fieldContainer.forceLayout();
}
/**
*
*/
@Override
public String getValue() {
return value;
}
/**
*
*/
@Override
public Widget getWidget() {
return fieldContainer;
}
@Override
public boolean isValid() {
if (value != null && !value.isEmpty()) {
return true;
} else {
return false;
}
}
}

View File

@ -0,0 +1,94 @@
/**
*
*/
package org.gcube.portlets.user.dataminerexecutor.client.parametersfield;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.EnumParameter;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.data.shared.StringLabelProvider;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.form.SimpleComboBox;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class EnumFld extends AbstractFld {
private SimpleContainer fieldContainer;
private SimpleComboBox<String> listBox;
/**
* @param parameter
* parameter
*/
public EnumFld(Parameter parameter) {
super(parameter);
fieldContainer = new SimpleContainer();
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
horiz.setPack(BoxLayoutPack.START);
horiz.setEnableOverflow(false);
EnumParameter p = (EnumParameter) parameter;
listBox = new SimpleComboBox<String>(new StringLabelProvider<>());
listBox.add(p.getValues());
listBox.setAllowBlank(false);
listBox.setForceSelection(true);
listBox.setEditable(false);
listBox.setTriggerAction(TriggerAction.ALL);
if (p.getDefaultValue() != null)
listBox.setValue(p.getDefaultValue());
HtmlLayoutContainer descr;
if (p.getDescription() == null) {
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
descr.addStyleName("workflow-fieldDescription");
} else {
// listBox.setToolTip(p.getDescription());
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'>" + p.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");
}
horiz.add(listBox, new BoxLayoutData(new Margins()));
horiz.add(descr, new BoxLayoutData(new Margins()));
fieldContainer.add(horiz);
fieldContainer.forceLayout();
}
/**
*
*/
@Override
public String getValue() {
return listBox.getCurrentValue();
}
/**
*
*/
@Override
public Widget getWidget() {
return fieldContainer;
}
@Override
public boolean isValid() {
return listBox.isValid();
}
}

View File

@ -0,0 +1,109 @@
/**
*
*/
package org.gcube.portlets.user.dataminerexecutor.client.parametersfield;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class FileFld extends AbstractFld {
private SimpleContainer fieldContainer;
//private TextField textField;
private String value;
/**
* @param parameter
* parameter
*/
public FileFld(Parameter parameter) {
super(parameter);
//ObjectParameter p = (ObjectParameter) parameter;
Log.debug("Create File field: "+parameter.getName());
value=parameter.getValue();
HtmlLayoutContainer descr;
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
descr.addStyleName("workflow-fieldDescription");
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'>" + parameter.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");
SimpleContainer vContainer = new SimpleContainer();
VerticalLayoutContainer vField = new VerticalLayoutContainer();
HtmlLayoutContainer typeDescription = new HtmlLayoutContainer("File Value");
typeDescription.setStylePrimaryName("workflow-parameters-description");
//textField = new TextField();
//textField.setValue(p.getValue());
//textField.isReadOnly();
HtmlLayoutContainer val = new HtmlLayoutContainer("<span style='overflow-wrap: break-word;'><a href='" + parameter.getValue() + "'>File</a></span>");
val.addStyleName("workflow-fieldValue");
vField.add(val, new VerticalLayoutData(-1, -1, new Margins(0)));
vField.add(typeDescription, new VerticalLayoutData(-1, -1, new Margins(0)));
vContainer.add(vField);
fieldContainer = new SimpleContainer();
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
horiz.setPack(BoxLayoutPack.START);
horiz.setEnableOverflow(false);
horiz.add(vContainer, new BoxLayoutData(new Margins()));
horiz.add(descr, new BoxLayoutData(new Margins()));
fieldContainer.add(horiz);
fieldContainer.forceLayout();
}
/**
*
*/
@Override
public String getValue() {
return value;
}
/**
*
*/
@Override
public Widget getWidget() {
return fieldContainer;
}
@Override
public boolean isValid() {
if(value!=null&&!value.isEmpty()){
return true;
} else {
return false;
}
}
}

View File

@ -0,0 +1,238 @@
/**
*
*/
package org.gcube.portlets.user.dataminerexecutor.client.parametersfield;
import java.util.ArrayList;
import java.util.List;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.ListParameter;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.ObjectParameter;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
import org.gcube.portlets.user.dataminerexecutor.client.DataMinerExecutor;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
import com.sencha.gxt.widget.core.client.container.MarginData;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.form.IntegerField;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class ListIntFld extends AbstractFld {
private List<Item> items;
private SimpleContainer simpleContainer;
private VerticalLayoutContainer vp;
private ListParameter listParameter;
private SimpleContainer listContainer;
private SimpleContainer fieldContainer;
private HBoxLayoutContainer horiz;
/**
* @param parameter
* parameter
*/
public ListIntFld(Parameter parameter) {
super(parameter);
this.listParameter = (ListParameter) parameter;
listContainer = new SimpleContainer();
vp = new VerticalLayoutContainer();
items = new ArrayList<Item>();
addField(null);
listContainer.add(vp, new MarginData(new Margins()));
fieldContainer = new SimpleContainer();
horiz = new HBoxLayoutContainer();
horiz.setPack(BoxLayoutPack.START);
horiz.setEnableOverflow(false);
HtmlLayoutContainer descr;
if (listParameter.getDescription() == null) {
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
descr.addStyleName("workflow-fieldDescription");
} else {
// listContainer.setToolTip(listParameter.getDescription());
descr = new HtmlLayoutContainer(
"<p style='margin-left:5px !important;'>" + listParameter.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");
}
horiz.add(listContainer, new BoxLayoutData(new Margins(0)));
horiz.add(descr, new BoxLayoutData(new Margins(0)));
fieldContainer.add(horiz);
fieldContainer.forceLayout();
}
private void addField(Item upperItem) {
ObjectParameter objPar = new ObjectParameter(listParameter.getName(), listParameter.getDescription(),
listParameter.getType(), null);
if (upperItem == null) {
Item item = new Item(objPar, true);
items.add(item);
vp.add(item, new VerticalLayoutData(1, -1, new Margins()));
} else {
// search the position of the upper item
int pos = 0;
for (int i = 0; i < items.size(); i++)
if (items.get(i) == upperItem) {
pos = i;
break;
}
upperItem.showCancelButton();
Item item = new Item(objPar, false);
items.add(pos + 1, item);
vp.insert(item, pos + 1);
}
}
/**
* @param item
*/
private void removeField(Item item) {
items.remove(item);
vp.remove(item);
if (items.size() == 1) {
items.get(0).hideCancelButton();
}
simpleContainer.forceLayout();
}
/**
*
*/
@Override
public String getValue() {
String separator = listParameter.getSeparator();
String value = "";
boolean first = true;
for (Item item : items) {
Integer itemValue = item.getValue();
if (itemValue != null) {
value += (first ? "" : separator) + itemValue;
first = false;
}
}
return value;
}
/**
*
*/
@Override
public Widget getWidget() {
return fieldContainer;
}
/**
*
*/
@Override
public boolean isValid() {
for (Item item : items)
if (!item.isValid()) {
return false;
}
return true;
}
private class Item extends HBoxLayoutContainer {
private IntegerField field;
private TextButton addBtn;
private TextButton removeBtn;
/**
* @param objPar
*/
public Item(ObjectParameter objectParameter, boolean first) {
super();
field = new IntegerField();
field.setAllowBlank(false);
addBtn = new TextButton("");
addBtn.setIcon(DataMinerExecutor.resources.add());
addBtn.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
addField(Item.this);
forceLayout();
vp.forceLayout();
fieldContainer.forceLayout();
}
});
removeBtn = new TextButton("");
removeBtn.setIcon(DataMinerExecutor.resources.cancel());
removeBtn.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
removeField(Item.this);
forceLayout();
vp.forceLayout();
fieldContainer.forceLayout();
}
});
removeBtn.setVisible(!first);
setPack(BoxLayoutPack.START);
setEnableOverflow(false);
add(field, new BoxLayoutData(new Margins()));
add(addBtn, new BoxLayoutData(new Margins()));
add(removeBtn, new BoxLayoutData(new Margins()));
forceLayout();
}
public void showCancelButton() {
removeBtn.setVisible(true);
}
public void hideCancelButton() {
removeBtn.setVisible(false);
}
public Integer getValue() {
return field.getCurrentValue();
}
public boolean isValid() {
return field.isValid();
}
}
}

View File

@ -0,0 +1,169 @@
/**
*
*/
package org.gcube.portlets.user.dataminerexecutor.client.parametersfield;
import java.util.ArrayList;
import java.util.List;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.ListParameter;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.ObjectParameter;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
import com.sencha.gxt.widget.core.client.container.MarginData;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class ListStringFld extends AbstractFld {
private SimpleContainer fieldContainer;
private HBoxLayoutContainer horiz;
private SimpleContainer listContainer;
private VerticalLayoutContainer vp;
private List<StringItem> items;
private ListParameter listParameter;
/**
*
* @param parameter
* parameter
*/
public ListStringFld(Parameter parameter) {
super(parameter);
listParameter = (ListParameter) parameter;
listContainer = new SimpleContainer();
vp = new VerticalLayoutContainer();
items = new ArrayList<StringItem>();
listContainer.add(vp, new MarginData(new Margins()));
fieldContainer = new SimpleContainer();
horiz = new HBoxLayoutContainer();
horiz.setPack(BoxLayoutPack.START);
horiz.setEnableOverflow(false);
HtmlLayoutContainer descr;
if (listParameter.getDescription() == null) {
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
descr.addStyleName("workflow-fieldDescription");
} else {
/* listContainer.setToolTip(listParameter.getDescription()); */
descr = new HtmlLayoutContainer(
"<p style='margin-left:5px !important;'>" + listParameter.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");
}
horiz.add(listContainer, new BoxLayoutData(new Margins(0)));
horiz.add(descr, new BoxLayoutData(new Margins(0)));
fieldContainer.add(horiz);
addField(null);
}
protected void addField(StringItem upperItem) {
ObjectParameter objPar = new ObjectParameter(listParameter.getName(), listParameter.getDescription(),
listParameter.getType(), null);
if (upperItem == null) {
StringItem item = new StringItem(this, objPar, true);
items.add(item);
vp.add(item);
} else {
// search the position of the upper item
int pos = items.indexOf(upperItem);
if (pos > -1) {
upperItem.showCancelButton();
upperItem.forceLayout();
StringItem item = new StringItem(this, objPar, false);
items.add(pos + 1, item);
vp.insert(item, pos + 1);// don't use new VerticalLayoutData(1,
// -1,new Margins(0))
} else {
upperItem.forceLayout();
StringItem item = new StringItem(this, objPar, true);
items.add(item);
vp.add(item);// don't use new VerticalLayoutData(-1, -1, new
// Margins(0))
}
}
forceLayout();
}
protected void forceLayout() {
vp.forceLayout();
horiz.forceLayout();
fieldContainer.forceLayout();
}
protected void removeField(StringItem item) {
items.remove(item);
vp.remove(item);
if (items.size() == 1) {
items.get(0).hideCancelButton();
items.get(0).forceLayout();
}
forceLayout();
}
/**
*
*/
@Override
public String getValue() {
String separator = listParameter.getSeparator();
String value = "";
boolean first = true;
for (StringItem item : items) {
String itemValue = item.getValue();
if (itemValue != null && !itemValue.contentEquals("")) {
value += (first ? "" : separator) + itemValue;
first = false;
}
}
return value;
}
/**
*
*/
@Override
public Widget getWidget() {
return fieldContainer;
}
/**
*
*/
@Override
public boolean isValid() {
boolean valid = false;
for (StringItem item : items)
if (item.isValid()) {
valid = true;
break;
}
return valid;
}
}

View File

@ -0,0 +1,115 @@
/**
*
*/
package org.gcube.portlets.user.dataminerexecutor.client.parametersfield;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
import com.allen_sauer.gwt.log.client.Log;
import com.sencha.gxt.widget.core.client.form.FieldLabel;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class OperatorFieldWidget {
private Parameter parameter;
private AbstractFld field;
private FieldLabel parameterLabel;
/**
*
* @param parameter
* parameter
*/
public OperatorFieldWidget(Parameter parameter) {
super();
this.parameter = parameter;
try {
field = new StringFld(parameter);
if (parameter.getTypology() != null) {
switch (parameter.getTypology()) {
case COLUMN:
case WKT:
case DATE:
case TIME:
case ENUM:
case OBJECT:
field = new StringFld(parameter);
break;
case FILE:
field = new FileFld(parameter);
break;
case TABULAR:
field = new TabularFld(parameter);
break;
case COLUMN_LIST:
field = new ColumnListFld(parameter);
break;
case LIST:
field = new ListStringFld(parameter);
break;
case TABULAR_LIST:
field = new TabularListFld(parameter);
break;
default:
break;
}
}
if (field == null) {
parameterLabel = new FieldLabel(null, parameter.getName());
parameterLabel.setLabelWidth(200);
parameterLabel.setLabelWordWrap(true);
} else {
parameterLabel = new FieldLabel(field.getWidget(), parameter.getName());
parameterLabel.setLabelWidth(200);
parameterLabel.setLabelWordWrap(true);
}
} catch (Throwable e) {
Log.error("Error: " + e.getLocalizedMessage(),e);
}
}
/**
* @return the parameter
*/
public Parameter getParameter() {
return parameter;
}
public String getFieldValue() {
return field.getValue();
}
public String getValue() {
return getFieldValue();
}
public FieldLabel getParameterLabel() {
return parameterLabel;
}
public AbstractFld getField() {
return field;
}
public boolean isValid() {
if (field != null)
return field.isValid();
else
return false;
}
}

View File

@ -0,0 +1,145 @@
/**
*
*/
package org.gcube.portlets.user.dataminerexecutor.client.parametersfield;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.ObjectParameter;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
//import com.sencha.gxt.widget.core.client.form.TextField;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class StringFld extends AbstractFld {
private SimpleContainer fieldContainer;
// private TextField textField;
private String value;
/**
* @param parameter
* parameter
*/
public StringFld(Parameter parameter) {
super(parameter);
// ObjectParameter p = (ObjectParameter) parameter;
Log.debug("Create String field: " + parameter.getName());
value = parameter.getValue();
HtmlLayoutContainer descr;
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
descr.addStyleName("workflow-fieldDescription");
descr = new HtmlLayoutContainer(
"<p style='margin-left:5px !important;'>" + parameter.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");
String typology;
switch (parameter.getTypology()) {
case COLUMN:
typology="Column Value";
case WKT:
typology="Wkt Value";
case DATE:
typology="Date Value";
case TIME:
typology="Time Value";
case ENUM:
typology="Enum Value";
case OBJECT:
typology=getObjectParameterTypology();
break;
default:
typology="Value";
break;
}
SimpleContainer vContainer = new SimpleContainer();
VerticalLayoutContainer vField = new VerticalLayoutContainer();
HtmlLayoutContainer typeDescription = new HtmlLayoutContainer(typology);
typeDescription.setStylePrimaryName("workflow-parameters-description");
HtmlLayoutContainer val = new HtmlLayoutContainer(
"<span style='overflow-wrap: break-word;'>" + parameter.getValue() + "</span>");
val.addStyleName("workflow-fieldValue");
vField.add(val, new VerticalLayoutData(-1, -1, new Margins(0)));
vField.add(typeDescription, new VerticalLayoutData(-1, -1, new Margins(0)));
vContainer.add(vField);
fieldContainer = new SimpleContainer();
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
horiz.setPack(BoxLayoutPack.START);
horiz.setEnableOverflow(false);
horiz.add(vContainer, new BoxLayoutData(new Margins()));
horiz.add(descr, new BoxLayoutData(new Margins()));
fieldContainer.add(horiz);
fieldContainer.forceLayout();
}
private String getObjectParameterTypology(){
ObjectParameter objectParameter = (ObjectParameter) parameter;
String type = objectParameter.getType();
if (type.contentEquals(Integer.class.getName())) {
return "Integer Value";
} else if (type.contentEquals(String.class.getName())) {
return "String Value";
} else if (type.contentEquals(Boolean.class.getName())) {
return "Boolean Value";
} else if (type.contentEquals(Double.class.getName())) {
return "Double Value";
} else if (type.contentEquals(Float.class.getName())) {
return "Float Value";
} else
return "Value";
}
/**
*
*/
@Override
public String getValue() {
return value;
}
/**
*
*/
@Override
public Widget getWidget() {
return fieldContainer;
}
@Override
public boolean isValid() {
if (value != null && !value.isEmpty()) {
return true;
} else {
return false;
}
}
}

View File

@ -0,0 +1,95 @@
package org.gcube.portlets.user.dataminerexecutor.client.parametersfield;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.ObjectParameter;
import org.gcube.portlets.user.dataminerexecutor.client.DataMinerExecutor;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.form.TextField;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class StringItem extends HBoxLayoutContainer {
private ListStringFld parent;
private TextField field;
private TextButton addBtn;
private TextButton removeBtn;
/**
*
* @param parent parend
* @param objectParameter object parameter
* @param first true if is first
*/
public StringItem(ListStringFld parent, ObjectParameter objectParameter, boolean first) {
super();
this.parent=parent;
create(objectParameter,first);
}
private void create( ObjectParameter objectParameter, boolean first){
field = new TextField();
field.setAllowBlank(false);
addBtn = new TextButton("");
addBtn.setIcon(DataMinerExecutor.resources.add());
addBtn.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
parent.addField(StringItem.this);
}
});
removeBtn = new TextButton("");
removeBtn.setIcon(DataMinerExecutor.resources.cancel());
removeBtn.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
parent.removeField(StringItem.this);
}
});
removeBtn.setVisible(!first);
setPack(BoxLayoutPack.START);
setEnableOverflow(false);
add(field, new BoxLayoutData(new Margins()));
add(addBtn, new BoxLayoutData(new Margins()));
add(removeBtn, new BoxLayoutData(new Margins()));
forceLayout();
}
public void showCancelButton() {
removeBtn.setVisible(true);
}
public void hideCancelButton() {
removeBtn.setVisible(false);
}
public String getValue() {
return field.getCurrentValue();
}
public boolean isValid() {
return field.isValid();
}
}

View File

@ -0,0 +1,264 @@
package org.gcube.portlets.user.dataminerexecutor.client.parametersfield;
import org.gcube.data.analysis.dataminermanagercl.shared.data.TableItemSimple;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.TabularParameter;
import org.gcube.data.analysis.dataminermanagercl.shared.workspace.ItemDescription;
import org.gcube.portlets.user.dataminerexecutor.client.DataMinerExecutor;
import org.gcube.portlets.user.dataminerexecutor.client.rpc.DataMinerExecutorServiceAsync;
import org.gcube.portlets.user.dataminerexecutor.client.util.UtilsGXT3;
import org.gcube.portlets.user.dataminerexecutor.client.workspace.DownloadWidget;
import org.gcube.portlets.user.dataminerexecutor.shared.exception.SessionExpiredServiceException;
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.user.client.rpc.AsyncCallback;
import com.sencha.gxt.core.client.dom.XDOM;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.form.TextField;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class TabItem extends HBoxLayoutContainer {
private TabularListFld parent;
private TextButton selectButton;
private TextButton selectButton2;
private TableItemSimple selectedTableItem;
private TextButton addBtn;
private TextButton removeBtn;
private TextField tableDescription;
private WorkspaceExplorerSelectDialog wselectDialog;
private TextButton downloadButton;
private ItemDescription itemDescriptionSelected;
/**
*
* @param parent
* parent
* @param tabularParameter
* tabular parameter
* @param first
* true if is first
*/
public TabItem(TabularListFld parent, TabularParameter tabularParameter, boolean first) {
super();
this.parent = parent;
initDialog();
create(tabularParameter, first);
}
private void create(TabularParameter tabularParameter, boolean first) {
tableDescription = new TextField();
tableDescription.setReadOnly(true);
tableDescription.setVisible(false);
selectButton = new TextButton("Select Data Set");
selectButton.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
wselectDialog.show();
}
});
selectButton.setIcon(DataMinerExecutor.resources.folderExplore());
selectButton.setToolTip("Select Data Set");
selectButton2 = new TextButton("");
selectButton2.setIcon(DataMinerExecutor.resources.folderExplore());
selectButton2.setToolTip("Select Another Data Set");
selectButton2.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
wselectDialog.show();
}
});
selectButton2.setVisible(false);
downloadButton = new TextButton("");
downloadButton.setIcon(DataMinerExecutor.resources.download());
downloadButton.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
downloadFile();
}
});
downloadButton.setVisible(false);
addBtn = new TextButton("");
addBtn.setIcon(DataMinerExecutor.resources.add());
addBtn.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
parent.addField(TabItem.this);
}
});
removeBtn = new TextButton("");
removeBtn.setIcon(DataMinerExecutor.resources.cancel());
removeBtn.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
selectedTableItem = null;
parent.removeField(TabItem.this);
}
});
removeBtn.setVisible(!first);
setPack(BoxLayoutPack.START);
setEnableOverflow(false);
add(tableDescription, new BoxLayoutData(new Margins()));
add(selectButton, new BoxLayoutData(new Margins()));
add(selectButton2, new BoxLayoutData(new Margins()));
add(downloadButton, new BoxLayoutData(new Margins()));
add(addBtn, new BoxLayoutData(new Margins()));
add(removeBtn, new BoxLayoutData(new Margins()));
forceLayout();
}
private void initDialog() {
wselectDialog = new WorkspaceExplorerSelectDialog("Select CSV", false);
WorskpaceExplorerSelectNotificationListener handler = new WorskpaceExplorerSelectNotificationListener() {
@Override
public void onSelectedItem(Item item) {
if (item == null || item.getType() == ItemType.FOLDER
|| item.getType() == ItemType.PRIVATE_FOLDER
|| item.getType() == ItemType.SHARED_FOLDER
|| item.getType() == ItemType.VRE_FOLDER) {
UtilsGXT3.info("Attention", "Select a valid csv!");
} else {
TabItem.this.retrieveTableInformation(item);
}
}
@Override
public void onFailed(Throwable throwable) {
Log.error("Error in create project: " + throwable.getLocalizedMessage());
UtilsGXT3.alert("Error", throwable.getLocalizedMessage());
throwable.printStackTrace();
}
@Override
public void onAborted() {
}
@Override
public void onNotValidSelection() {
UtilsGXT3.info("Attention", "Select a valid csv!");
}
};
wselectDialog.addWorkspaceExplorerSelectNotificationListener(handler);
wselectDialog.setZIndex(XDOM.getTopZIndex());
}
private void retrieveTableInformation(Item item) {
Log.debug("Retrieved: " + item);
itemDescriptionSelected = new ItemDescription(item.getId(), item.getName(), item.getOwner(), item.getPath(),
item.getType().name());
DataMinerExecutorServiceAsync.INSTANCE.retrieveTableInformation(itemDescriptionSelected, new AsyncCallback<TableItemSimple>() {
@Override
public void onFailure(Throwable caught) {
Log.error("Error in retrieveTableInformation " + caught.getMessage());
if (caught instanceof SessionExpiredServiceException) {
UtilsGXT3.alert("Error", "Expired Session");
} else {
UtilsGXT3.alert("Error", "Error retrieving table information: " + caught.getLocalizedMessage());
}
}
@Override
public void onSuccess(TableItemSimple result) {
Log.debug("Retrieved: " + result);
selectedTableItem = result;
showFieldWithSelection();
}
});
}
private void downloadFile() {
if (itemDescriptionSelected != null) {
DownloadWidget downloadWidget = new DownloadWidget();
downloadWidget.download(itemDescriptionSelected.getId());
} else {
UtilsGXT3.info("Attention", "Select a table!");
}
}
/**
*
*/
private void showFieldWithSelection() {
try {
String tableName = selectedTableItem.getName();
if (tableName == null || tableName.isEmpty()) {
tableName = "NoName";
}
tableDescription.setValue(tableName);
tableDescription.setVisible(true);
selectButton.setVisible(false);
selectButton2.setVisible(true);
downloadButton.setVisible(true);
parent.forceLayout();
} catch (Throwable e) {
Log.error(e.getLocalizedMessage());
e.printStackTrace();
}
}
public void showCancelButton() {
removeBtn.setVisible(true);
}
public void hideCancelButton() {
removeBtn.setVisible(false);
}
public String getValue() {
return (selectedTableItem == null) ? null : selectedTableItem.getId();
}
public boolean isValid() {
return (selectedTableItem != null);
}
}

View File

@ -0,0 +1,109 @@
/**
*
*/
package org.gcube.portlets.user.dataminerexecutor.client.parametersfield;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class TabularFld extends AbstractFld {
private SimpleContainer fieldContainer;
//private TextField textField;
private String value;
/**
* @param parameter
* parameter
*/
public TabularFld(Parameter parameter) {
super(parameter);
//ObjectParameter p = (ObjectParameter) parameter;
Log.debug("Create File field: "+parameter.getName());
value=parameter.getValue();
HtmlLayoutContainer descr;
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
descr.addStyleName("workflow-fieldDescription");
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'>" + parameter.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");
SimpleContainer vContainer = new SimpleContainer();
VerticalLayoutContainer vField = new VerticalLayoutContainer();
HtmlLayoutContainer typeDescription = new HtmlLayoutContainer("Table Value");
typeDescription.setStylePrimaryName("workflow-parameters-description");
//textField = new TextField();
//textField.setValue(p.getValue());
//textField.isReadOnly();
HtmlLayoutContainer val = new HtmlLayoutContainer("<span style='overflow-wrap: break-word;'><a href='" + parameter.getValue() + "'>Table</a></span>");
val.addStyleName("workflow-fieldValue");
vField.add(val, new VerticalLayoutData(-1, -1, new Margins(0)));
vField.add(typeDescription, new VerticalLayoutData(-1, -1, new Margins(0)));
vContainer.add(vField);
fieldContainer = new SimpleContainer();
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
horiz.setPack(BoxLayoutPack.START);
horiz.setEnableOverflow(false);
horiz.add(vContainer, new BoxLayoutData(new Margins()));
horiz.add(descr, new BoxLayoutData(new Margins()));
fieldContainer.add(horiz);
fieldContainer.forceLayout();
}
/**
*
*/
@Override
public String getValue() {
return value;
}
/**
*
*/
@Override
public Widget getWidget() {
return fieldContainer;
}
@Override
public boolean isValid() {
if(value!=null&&!value.isEmpty()){
return true;
} else {
return false;
}
}
}

View File

@ -0,0 +1,191 @@
/**
*
*/
package org.gcube.portlets.user.dataminerexecutor.client.parametersfield;
import java.util.ArrayList;
import java.util.List;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.TabularListParameter;
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.TabularParameter;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
import com.sencha.gxt.widget.core.client.container.MarginData;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
/**
*
* @author Giancarlo Panichi
*
*
*/
public class TabularListFld extends AbstractFld {
private SimpleContainer fieldContainer;
private HBoxLayoutContainer horiz;
private SimpleContainer listContainer;
private List<TabItem> items;
private VerticalLayoutContainer vp;
private TabularListParameter tabularListParameter;
/**
* @param parameter
* parameter
*/
public TabularListFld(Parameter parameter) {
super(parameter);
Log.debug("TabularListField");
try {
tabularListParameter = (TabularListParameter) parameter;
createField();
} catch (Throwable e) {
Log.error("TabularListField: " + e.getLocalizedMessage());
e.printStackTrace();
}
}
private void createField() {
vp = new VerticalLayoutContainer();
items = new ArrayList<>();
listContainer = new SimpleContainer();
listContainer.add(vp, new MarginData(new Margins(0)));
/*
* List<String> templates = tabularListParameter.getTemplates(); String
* list = ""; boolean firstTemplate = true; for (String template :
* templates) { list += (firstTemplate ? "" : ", ") +
* Format.ellipse(template,50); firstTemplate = false; }
* HtmlLayoutContainer templatesList = new
* HtmlLayoutContainer("<p>Suitable Data Set Templates: <br>" +
* list+"</p>");
* templatesList.addStyleName("workflow-parameters-description");
*/
fieldContainer = new SimpleContainer();
// fieldContainer.setResize(true);
horiz = new HBoxLayoutContainer();
horiz.setPack(BoxLayoutPack.START);
horiz.setEnableOverflow(false);
HtmlLayoutContainer descr;
if (tabularListParameter.getDescription() == null) {
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
descr.addStyleName("workflow-fieldDescription");
} else {
/* listContainer.setToolTip(listParameter.getDescription()); */
descr = new HtmlLayoutContainer(
"<p style='margin-left:5px !important;'>" + tabularListParameter.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");
}
horiz.add(listContainer);
horiz.add(descr);
fieldContainer.add(horiz, new MarginData(new Margins(0)));
fieldContainer.forceLayout();
addField(null);
}
protected void addField(TabItem upperItem) {
try {
TabularParameter tabPar = new TabularParameter(tabularListParameter.getName(),
tabularListParameter.getDescription(), null, tabularListParameter.getTemplates(),
tabularListParameter.getDefaultMimeType(), tabularListParameter.getSupportedMimeTypes());
if (upperItem == null) {
TabItem item = new TabItem(this, tabPar, true);
items.add(item);
vp.add(item);// don't use new VerticalLayoutData(1, -1, new
// Margins(0))
} else {
// search the position of the upper item
int pos = items.indexOf(upperItem);
if (pos > -1) {
upperItem.showCancelButton();
upperItem.forceLayout();
TabItem item = new TabItem(this, tabPar, false);
items.add(pos + 1, item);
vp.insert(item, pos + 1);// don't use new
// VerticalLayoutData(-1, -1,new
// Margins(0))
} else {
upperItem.forceLayout();
TabItem item = new TabItem(this, tabPar, true);
items.add(item);
vp.add(item);// don't use new VerticalLayoutData(-1, -1, new
// Margins(0))
}
}
forceLayout();
} catch (Throwable e) {
Log.error(e.getLocalizedMessage());
e.printStackTrace();
}
}
protected void removeField(TabItem item) {
items.remove(item);
if (items.size() == 1) {
items.get(0).hideCancelButton();
items.get(0).forceLayout();
}
vp.remove(item);
forceLayout();
}
protected void forceLayout() {
vp.forceLayout();
listContainer.forceLayout();
horiz.forceLayout();
fieldContainer.forceLayout();
}
@Override
public String getValue() {
String separator = tabularListParameter.getSeparator();
// String separator="";
String value = "";
boolean first = true;
for (TabItem item : items) {
String itemValue = item.getValue();
if (itemValue != null && !itemValue.contentEquals("")) {
value += (first ? "" : separator) + itemValue;
first = false;
}
}
return value;
}
/**
*
*/
@Override
public Widget getWidget() {
return fieldContainer;
}
@Override
public boolean isValid() {
boolean valid = false;
for (TabItem item : items)
if (item.isValid()) {
valid = true;
break;
}
return valid;
}
}

View File

@ -0,0 +1,24 @@
package org.gcube.portlets.user.dataminerexecutor.client.properties;
import org.gcube.data.analysis.dataminermanagercl.shared.data.ColumnItem;
import com.google.gwt.editor.client.Editor.Path;
import com.sencha.gxt.core.client.ValueProvider;
import com.sencha.gxt.data.shared.ModelKeyProvider;
import com.sencha.gxt.data.shared.PropertyAccess;
/**
*
* @author Giancarlo Panichi
*
*
*/
public interface ColumnItemProperties extends PropertyAccess<ColumnItem> {
@Path("id")
ModelKeyProvider<ColumnItem> id();
ValueProvider<ColumnItem, String> label();
}

View File

@ -0,0 +1,23 @@
package org.gcube.portlets.user.dataminerexecutor.client.properties;
import org.gcube.data.analysis.dataminermanagercl.shared.data.ColumnItem;
import com.google.gwt.editor.client.Editor.Path;
import com.sencha.gxt.data.shared.LabelProvider;
import com.sencha.gxt.data.shared.ModelKeyProvider;
import com.sencha.gxt.data.shared.PropertyAccess;
/**
*
* @author Giancarlo Panichi
*
*
*/
public interface ColumnItemPropertiesCombo extends PropertyAccess<ColumnItem> {
@Path("id")
ModelKeyProvider<ColumnItem> id();
LabelProvider<ColumnItem> label();
}

View File

@ -0,0 +1,108 @@
package org.gcube.portlets.user.dataminerexecutor.client.resources;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ExternalTextResource;
import com.google.gwt.resources.client.ImageResource;
/**
*
* @author Giancarlo Panichi
*
*
*/
public interface Resources extends ClientBundle {
@Source("WikiLink.txt")
ExternalTextResource wikiLink();
@Source("logoLittle.png")
ImageResource logoLittle();
@Source("goBack.png")
ImageResource goBack();
@Source("computation.png")
ImageResource executionIcon();
@Source("computations.png")
ImageResource computationsIcon();
@Source("inputSpace.png")
ImageResource inputSpaceIcon();
@Source("connector1.png")
ImageResource workflowConnector1();
@Source("triangle.png")
ImageResource startComputation();
@Source("delete.png")
ImageResource removeAll();
@Source("sort_asc.gif")
ImageResource sortAscending();
@Source("tree.gif")
ImageResource tree();
@Source("folder_explore.png")
ImageResource folderExplore();
@Source("draw-geometry.png")
ImageResource drawGeometry();
@Source("cancel_icon.png")
ImageResource cancel();
@Source("add.png")
ImageResource add();
@Source("menuItemComputations.png")
ImageResource menuItemComputations();
@Source("menuItemExperiment.png")
ImageResource menuItemExperiment();
@Source("menuItemDataspace.png")
ImageResource menuItemInputspace();
@Source("menuItemHelp.png")
ImageResource menuItemHelp();
@Source("ajax-loader-big.gif")
ImageResource loaderBig();
@Source("ajax-complete.gif")
ImageResource loadingComplete();
//@Source("save.png")
//ImageResource save();
@Source("user_green.png")
ImageResource userPerspective();
@Source("monitor.png")
ImageResource computationPerspective();
@Source("download.png")
ImageResource download();
@Source("show.png")
ImageResource netcdf();
@Source("cancel_circle.png")
ImageResource cancelCircle();
@Source("delete_circle.png")
ImageResource deleteCircle();
@Source("refresh.png")
ImageResource refresh();
@Source("resubmit.png")
ImageResource resubmit();
@Source("show.png")
ImageResource show();
}

View File

@ -0,0 +1 @@
http://wiki.gcube-system.org/gcube/DataMiner_Executor

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 723 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 890 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Some files were not shown because too many files have changed in this diff Show More