Initial import.
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/data-miner-manager-widget@144761 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
9aa872bb8b
commit
775a4dccb1
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry including="**/*.java" kind="src" path="src/main/resources"/>
|
||||
<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 including="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<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="output" path="target/data-miner-manager-1.3.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
|
@ -0,0 +1,64 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>data-miner-manager-widget</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>
|
|
@ -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
|
|
@ -0,0 +1,8 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
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
|
|
@ -0,0 +1,4 @@
|
|||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="data-miner-manager">
|
||||
<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"/>
|
||||
<dependent-module archiveName="data-miner-manager-cl-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/data-miner-manager-cl/data-miner-manager-cl">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<property name="context-root" value="data-miner-manager"/>
|
||||
<property name="java-output-path" value="/data-miner-manager/target/data-miner-manager-1.2.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<fixed facet="wst.jsdt.web"/>
|
||||
<installed facet="java" version="1.7"/>
|
||||
<installed facet="jst.web" version="3.0"/>
|
||||
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||
</faceted-project>
|
|
@ -0,0 +1,2 @@
|
|||
disabled=06target
|
||||
eclipse.preferences.version=1
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="com.google.gdt.eclipse.suite.webapp">
|
||||
<stringAttribute key="com.google.gdt.eclipse.suiteMainTypeProcessor.PREVIOUSLY_SET_MAIN_TYPE_NAME" value="com.google.gwt.dev.GWTShell"/>
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.URL" value="DataMinerManagerWidget.html"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/data-miner-manager-widget"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gdt.eclipse.maven.mavenClasspathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.GWTShell"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -codeServerPort 9997 -port 8888 DataMinerManagerWidget.html"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="data-miner-manager-widget"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx512m -Dgwt.nowarn.legacy.tools"/>
|
||||
</launchConfiguration>
|
|
@ -0,0 +1 @@
|
|||
${gcube.license}
|
|
@ -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.
|
|
@ -0,0 +1,6 @@
|
|||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.portlets.widgets.data-miner-manager-widget.1-0-0"
|
||||
date="2017-03-31">
|
||||
<Change>First release</Change>
|
||||
</Changeset>
|
||||
</ReleaseNotes>
|
|
@ -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>
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Resource>
|
||||
<ID></ID>
|
||||
<Type>Service</Type>
|
||||
<Profile>
|
||||
<Description>${project.description}</Description>
|
||||
<Class>PortletsWidgets</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>library</Type>
|
||||
<Files>
|
||||
<File>${project.build.finalName}.${project.packaging}</File>
|
||||
</Files>
|
||||
</Software>
|
||||
</Packages>
|
||||
</Profile>
|
||||
</Resource>
|
||||
|
||||
|
|
@ -0,0 +1,452 @@
|
|||
<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.widgets</groupId>
|
||||
<artifactId>data-miner-manager-widget</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<name>data-miner-manager-widget</name>
|
||||
<description>data-miner-manager-widget offers a unique access to perform data mining and statistical operations on heterogeneous data</description>
|
||||
|
||||
<scm>
|
||||
<url>https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/data-miner-manager-widget</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 Version -->
|
||||
<javaVersion>1.7</javaVersion>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<!-- Storage -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.contentmanagement</groupId>
|
||||
<artifactId>storage-manager-core</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.contentmanagement</groupId>
|
||||
<artifactId>storage-manager-wrapper</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Home Library -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library-jcr</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library-model</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>
|
||||
|
||||
<!-- GCube Widgets -->
|
||||
<!-- <dependency> <groupId>org.gcube.portlets.user</groupId> <artifactId>gcube-widgets</artifactId>
|
||||
<scope>compile</scope> </dependency> -->
|
||||
|
||||
<!-- Storage -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.contentmanagement</groupId>
|
||||
<artifactId>storage-manager-core</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.contentmanagement</groupId>
|
||||
<artifactId>storage-manager-wrapper</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Home Library -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library-jcr</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library-model</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Information System Client IC-Client -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>ic-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Nord52 -->
|
||||
<dependency>
|
||||
<groupId>org.n52.wps</groupId>
|
||||
<artifactId>52n-wps-client-lib</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>gt-opengis</artifactId>
|
||||
<groupId>org.geotools</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</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>[1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Workspace Uploader -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>workspace-uploader</artifactId>
|
||||
<version>[1.4.0-SNAPSHOT,2.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>
|
||||
|
||||
<!-- DataMinerManagerCL -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.data.analysis</groupId>
|
||||
<artifactId>data-miner-manager-cl</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</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>
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
|
||||
<repository>
|
||||
<id>gCubeExternal</id>
|
||||
<name>gcube-externals</name>
|
||||
<url>http://maven.research-infrastructures.eu/nexus/content/repositories/gcube-externals/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>n52-releases</id>
|
||||
<name>52n Releases</name>
|
||||
<url>http://52north.org/maven/repo/releases/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
|
||||
<!-- <repository> -->
|
||||
<!-- <id>52north-releases</id> -->
|
||||
<!-- <name>52north-releases</name> -->
|
||||
<!-- <url>http://maven.research-infrastructures.eu/nexus/content/repositories/52north-releases/</url> -->
|
||||
<!-- </repository> -->
|
||||
|
||||
</repositories>
|
||||
|
||||
|
||||
|
||||
<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>DataMinerManagerWidget.html</runTarget>
|
||||
<hostedWebapp>${webappDirectory}</hostedWebapp>
|
||||
<module>org.gcube.portlets.widgets.dataminermanagerwidget.dataminermanagerwidget</module>
|
||||
|
||||
</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>${javaVersion}</source>
|
||||
<target>${javaVersion}</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>
|
|
@ -0,0 +1,239 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client;
|
||||
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.computations.ComputationsPanel;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.dataspace.DataSpacePanel;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.DataMinerWorkAreaRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.MenuSwitchEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.experiments.ExperimentPanel;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.resources.Resources;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.DataMinerWorkAreaRegionType;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.DataMinerWorkAreaRequestEventType;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.MenuType;
|
||||
|
||||
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.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 DataMinerManager implements EntryPoint {
|
||||
public static final Resources resources = GWT.create(Resources.class);
|
||||
|
||||
private static final String SM_DIV = "contentDiv";
|
||||
private DataMinerManagerController dataMinerManagerController;
|
||||
|
||||
private Header header;
|
||||
private HomePanel homePanel;
|
||||
private DataSpacePanel dataSpacePanel;
|
||||
private ExperimentPanel experimentPanel;
|
||||
private ComputationsPanel computationsPanel;
|
||||
|
||||
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() {
|
||||
dataMinerManagerController = new DataMinerManagerController();
|
||||
homePanel = new HomePanel();
|
||||
dataSpacePanel = new DataSpacePanel();
|
||||
experimentPanel = new ExperimentPanel();
|
||||
computationsPanel = new ComputationsPanel();
|
||||
|
||||
bind();
|
||||
|
||||
// Layout
|
||||
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 (dataMinerManagerController.getOperatorId() != null
|
||||
&& !dataMinerManagerController.getOperatorId().isEmpty()){
|
||||
header.setMenu(MenuType.EXPERIMENT);
|
||||
centerPanel.add(experimentPanel);
|
||||
previousPanel = experimentPanel;
|
||||
|
||||
} else {
|
||||
centerPanel.add(homePanel);
|
||||
previousPanel = homePanel;
|
||||
|
||||
}
|
||||
|
||||
bindWindow(mainPanelLayout);
|
||||
mainPanelLayout.forceLayout();
|
||||
|
||||
}
|
||||
|
||||
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 COMPUTATIONS:
|
||||
switchPanel(computationsPanel);
|
||||
fireDataMinerWorkAreareRequestUpdate(DataMinerWorkAreaRegionType.Computations);
|
||||
break;
|
||||
case DATA_SPACE:
|
||||
switchPanel(dataSpacePanel);
|
||||
fireDataMinerWorkAreareRequestUpdate(DataMinerWorkAreaRegionType.DataSets);
|
||||
break;
|
||||
case EXPERIMENT:
|
||||
switchPanel(experimentPanel);
|
||||
break;
|
||||
case HOME:
|
||||
switchPanel(homePanel);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void fireDataMinerWorkAreareRequestUpdate(
|
||||
DataMinerWorkAreaRegionType dataMinerWorkAreaRegionType) {
|
||||
DataMinerWorkAreaRequestEvent event = new DataMinerWorkAreaRequestEvent(
|
||||
DataMinerWorkAreaRequestEventType.UPDATE,
|
||||
dataMinerWorkAreaRegionType);
|
||||
EventBusProvider.INSTANCE.fireEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param panel
|
||||
*/
|
||||
private void switchPanel(SimpleContainer panel) {
|
||||
centerPanel.remove(previousPanel);
|
||||
centerPanel.add(panel);
|
||||
centerPanel.forceLayout();
|
||||
previousPanel = panel;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,749 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.OperatorsClassification;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.CancelComputationExecutionRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.CancelExecutionFromComputationsRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.ComputationDataEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.ComputationDataRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.DataMinerWorkAreaEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.DataMinerWorkAreaRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.DeleteItemRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.MenuEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.MenuSwitchEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.OperatorsClassificationEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.OperatorsClassificationRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.OutputDataEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.OutputDataRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.RefreshDataMinerWorkAreaEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.ResubmitComputationExecutionEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.ResubmitComputationExecutionRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.SessionExpiredEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.StartComputationExecutionEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.StartComputationExecutionRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.monitor.StatusMonitor;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.rpc.DataMinerPortletServiceAsync;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.DataMinerWorkAreaElementType;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.DataMinerWorkAreaEventType;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.MenuType;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.util.InfoMessageBox;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.util.UtilsGXT3;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.Constants;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.exception.SessionExpiredServiceException;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.session.UserInfo;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.workspace.DataMinerWorkArea;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.workspace.ItemDescription;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class DataMinerManagerController {
|
||||
private UserInfo userInfo;
|
||||
private DataMinerWorkArea dataMinerWorkArea;
|
||||
private List<OperatorsClassification> operatorsClassifications;
|
||||
private MenuType currentVisualization;
|
||||
private String operatorId;
|
||||
|
||||
public DataMinerManagerController() {
|
||||
init();
|
||||
}
|
||||
|
||||
public UserInfo getUserInfo() {
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
public DataMinerWorkArea getDataMinerWorkArea() {
|
||||
return dataMinerWorkArea;
|
||||
}
|
||||
|
||||
public String getOperatorId(){
|
||||
return operatorId;
|
||||
}
|
||||
|
||||
private void init() {
|
||||
currentVisualization = MenuType.HOME;
|
||||
restoreUISession();
|
||||
bind();
|
||||
callHello();
|
||||
checkSession();
|
||||
}
|
||||
|
||||
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(
|
||||
OperatorsClassificationRequestEvent.TYPE,
|
||||
new OperatorsClassificationRequestEvent.OperatorsClassificationRequestEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onRequest(
|
||||
OperatorsClassificationRequestEvent event) {
|
||||
Log.debug("Catch OperatorsClassificationRequestEvent: "
|
||||
+ event);
|
||||
operatorsClassificationRequest(event);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
EventBusProvider.INSTANCE.addHandler(DeleteItemRequestEvent.TYPE,
|
||||
new DeleteItemRequestEvent.DeleteItemRequestEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onDeleteRequest(DeleteItemRequestEvent event) {
|
||||
Log.debug("Catch DeleteItemRequestEvent: " + event);
|
||||
deleteItemRequest(event);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
EventBusProvider.INSTANCE
|
||||
.addHandler(
|
||||
DataMinerWorkAreaRequestEvent.TYPE,
|
||||
new DataMinerWorkAreaRequestEvent.DataMinerWorkAreaRequestEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onRequest(
|
||||
DataMinerWorkAreaRequestEvent event) {
|
||||
Log.debug("Catch DataMinerWorkAreaRequestEvent: "
|
||||
+ event);
|
||||
retrieveDataMinerWorkArea(event);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void restoreUISession() {
|
||||
// checkLocale();
|
||||
operatorId = com.google.gwt.user.client.Window.Location
|
||||
.getParameter(Constants.DATA_MINER_OPERATOR_ID);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void callHello() {
|
||||
|
||||
DataMinerPortletServiceAsync.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) {
|
||||
DataMinerPortletServiceAsync.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();
|
||||
DataMinerPortletServiceAsync.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();
|
||||
DataMinerPortletServiceAsync.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) {
|
||||
currentVisualization = MenuType.EXPERIMENT;
|
||||
MenuSwitchEvent menuSwitchEvent = new MenuSwitchEvent(
|
||||
MenuType.EXPERIMENT);
|
||||
EventBusProvider.INSTANCE.fireEvent(menuSwitchEvent);
|
||||
|
||||
DataMinerPortletServiceAsync.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 operatorsClassificationRequest(
|
||||
OperatorsClassificationRequestEvent event) {
|
||||
if (operatorsClassifications == null) {
|
||||
getOperatorsClassifications(event);
|
||||
} else {
|
||||
if (event.getOperatorsClassificationRequestType() == null) {
|
||||
return;
|
||||
}
|
||||
switch (event.getOperatorsClassificationRequestType()) {
|
||||
case ByName:
|
||||
getOperatorsClassificationByName(event);
|
||||
break;
|
||||
case Default:
|
||||
getOperatorsClassificationDefault(event);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void getOperatorsClassifications(
|
||||
final OperatorsClassificationRequestEvent event) {
|
||||
DataMinerPortletServiceAsync.INSTANCE
|
||||
.getOperatorsClassifications(new AsyncCallback<List<OperatorsClassification>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<OperatorsClassification> result) {
|
||||
operatorsClassifications = result;
|
||||
operatorsClassificationRequest(event);
|
||||
}
|
||||
|
||||
@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 retrieving operators classification! "
|
||||
+ caught.getLocalizedMessage());
|
||||
Log.error("Error retrieving operators classification: "
|
||||
+ caught.getLocalizedMessage());
|
||||
caught.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getOperatorsClassificationDefault(
|
||||
OperatorsClassificationRequestEvent event) {
|
||||
OperatorsClassification find = null;
|
||||
for (OperatorsClassification oc : operatorsClassifications) {
|
||||
if (oc.getName().equals(Constants.UserClassificationName)) {
|
||||
find = oc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
OperatorsClassificationEvent ocEvent;
|
||||
if(event.isOperatorId()){
|
||||
ocEvent = new OperatorsClassificationEvent(
|
||||
find, operatorId);
|
||||
} else {
|
||||
ocEvent = new OperatorsClassificationEvent(
|
||||
find);
|
||||
}
|
||||
EventBusProvider.INSTANCE.fireEvent(ocEvent);
|
||||
}
|
||||
|
||||
private void getOperatorsClassificationByName(
|
||||
OperatorsClassificationRequestEvent event) {
|
||||
OperatorsClassification find = null;
|
||||
for (OperatorsClassification oc : operatorsClassifications) {
|
||||
if (oc.getName().equals(event.getClassificationName())) {
|
||||
find = oc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (find == null) {
|
||||
for (OperatorsClassification oc : operatorsClassifications) {
|
||||
if (oc.getName().equals(Constants.UserClassificationName)) {
|
||||
find = oc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OperatorsClassificationEvent ocEvent;
|
||||
if(event.isOperatorId()){
|
||||
ocEvent = new OperatorsClassificationEvent(
|
||||
event.getClassificationName(), find, operatorId);
|
||||
} else {
|
||||
ocEvent = new OperatorsClassificationEvent(
|
||||
event.getClassificationName(), find);
|
||||
}
|
||||
EventBusProvider.INSTANCE.fireEvent(ocEvent);
|
||||
}
|
||||
|
||||
private void retrieveDataMinerWorkArea(
|
||||
final DataMinerWorkAreaRequestEvent event) {
|
||||
final StatusMonitor monitor = new StatusMonitor();
|
||||
DataMinerPortletServiceAsync.INSTANCE
|
||||
.getDataMinerWorkArea(new AsyncCallback<DataMinerWorkArea>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof SessionExpiredServiceException) {
|
||||
UtilsGXT3.alert("Error", "Expired Session");
|
||||
EventBusProvider.INSTANCE
|
||||
.fireEvent(new SessionExpiredEvent());
|
||||
} else {
|
||||
UtilsGXT3.alert("Error",
|
||||
"Error retrieving DataMiner work area info: "
|
||||
+ caught.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(DataMinerWorkArea result) {
|
||||
monitor.hide();
|
||||
Log.debug("DataMinerWorkArea: " + result);
|
||||
fireDataMinerWorkAreaEventRetrieved(event, result);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void fireDataMinerWorkAreaEventRetrieved(
|
||||
DataMinerWorkAreaRequestEvent event, DataMinerWorkArea result) {
|
||||
dataMinerWorkArea = result;
|
||||
DataMinerWorkAreaEvent dataMinerWorkAreaEvent = new DataMinerWorkAreaEvent(
|
||||
DataMinerWorkAreaEventType.OPEN,
|
||||
event.getDataMinerWorkAreaRegionType(), result);
|
||||
EventBusProvider.INSTANCE.fireEvent(dataMinerWorkAreaEvent);
|
||||
}
|
||||
|
||||
private void deleteItemRequest(final DeleteItemRequestEvent event) {
|
||||
final StatusMonitor monitor = new StatusMonitor();
|
||||
DataMinerPortletServiceAsync.INSTANCE.deleteItem(
|
||||
event.getItemDescription(), new AsyncCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
monitor.hide();
|
||||
if (caught instanceof SessionExpiredServiceException) {
|
||||
UtilsGXT3.alert("Error", "Expired Session");
|
||||
EventBusProvider.INSTANCE
|
||||
.fireEvent(new SessionExpiredEvent());
|
||||
} else {
|
||||
UtilsGXT3.alert("Error",
|
||||
"Error deleting item on workspace: "
|
||||
+ caught.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
monitor.hide();
|
||||
Log.debug("Deleted Item!");
|
||||
fireRefreshDataMinerWorkAreaEvent(event
|
||||
.getDataMinerWorkAreaElementType());
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void fireRefreshDataMinerWorkAreaEvent(
|
||||
DataMinerWorkAreaElementType dataMinerWorkAreaElementType) {
|
||||
RefreshDataMinerWorkAreaEvent refreshEvent = new RefreshDataMinerWorkAreaEvent(
|
||||
dataMinerWorkAreaElementType);
|
||||
EventBusProvider.INSTANCE.fireEvent(refreshEvent);
|
||||
|
||||
}
|
||||
|
||||
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();
|
||||
DataMinerPortletServiceAsync.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();
|
||||
DataMinerPortletServiceAsync.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);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,274 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.client;
|
||||
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.MenuEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.MenuSwitchEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.MenuType;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.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 email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class Header extends HorizontalPanel {
|
||||
|
||||
private Image menuGoBack, menuExperiment, menuDataSpace, menuComputations, 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");
|
||||
menuSwitch(event);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void create() {
|
||||
// this.setStyleAttribute("background-color", "#FFFFFF");
|
||||
Image logo = new Image(DataMinerManager.resources.logoLittle());
|
||||
logo.setAltText("Data Miner Manager");
|
||||
logo.setTitle("Data Miner Manager");
|
||||
logo.addStyleName("menuImgLogo");
|
||||
|
||||
menuGoBack = new Image(DataMinerManager.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);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
menuDataSpace = new Image(
|
||||
DataMinerManager.resources.menuItemInputspace());
|
||||
menuDataSpace.addStyleName("menuItemImage");
|
||||
menuDataSpace.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Log.debug("Click Menu Data Space");
|
||||
MenuEvent menuEvent = new MenuEvent(MenuType.DATA_SPACE);
|
||||
EventBusProvider.INSTANCE.fireEvent(menuEvent);
|
||||
}
|
||||
});
|
||||
|
||||
menuExperiment = new Image(
|
||||
DataMinerManager.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);
|
||||
}
|
||||
});
|
||||
|
||||
menuComputations = new Image(
|
||||
DataMinerManager.resources.menuItemComputations());
|
||||
menuComputations.addStyleName("menuItemImage");
|
||||
menuComputations.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
Log.debug("Click Menu Computations");
|
||||
MenuEvent menuEvent = new MenuEvent(MenuType.COMPUTATIONS);
|
||||
EventBusProvider.INSTANCE.fireEvent(menuEvent);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
menuHelp = new Image(
|
||||
DataMinerManager.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(menuDataSpace);
|
||||
add(menuExperiment);
|
||||
add(menuComputations);
|
||||
add(menuHelp);
|
||||
|
||||
this.setCellWidth(logo, "100px");
|
||||
this.setCellWidth(menuGoBack, "100px");
|
||||
this.setCellWidth(menuDataSpace, "80px");
|
||||
this.setCellWidth(menuExperiment, "80px"); //
|
||||
this.setCellWidth(menuComputations, "80px");
|
||||
this.setCellWidth(menuHelp, "80px");
|
||||
|
||||
menuGoBack.setVisible(false);
|
||||
menuDataSpace.setVisible(false);
|
||||
menuExperiment.setVisible(false);
|
||||
menuComputations.setVisible(false);
|
||||
menuHelp.setVisible(false);
|
||||
}
|
||||
|
||||
public void setMenu(MenuType menuType){
|
||||
Log.debug("SetMenu: " + menuType);
|
||||
|
||||
if (menuType.compareTo(MenuType.HOME) == 0) {
|
||||
menuGoBack.setVisible(false);
|
||||
menuDataSpace.setVisible(false);
|
||||
menuExperiment.setVisible(false);
|
||||
menuComputations.setVisible(false);
|
||||
menuHelp.setVisible(false);
|
||||
|
||||
if (currentSelection != null
|
||||
&& currentSelection.compareTo(MenuType.EXPERIMENT) == 0)
|
||||
menuExperiment.removeStyleName("menuItemImage-selected");
|
||||
else if (currentSelection != null
|
||||
&& currentSelection.compareTo(MenuType.DATA_SPACE) == 0)
|
||||
menuDataSpace.removeStyleName("menuItemImage-selected");
|
||||
else if (currentSelection != null
|
||||
&& currentSelection.compareTo(MenuType.COMPUTATIONS) == 0)
|
||||
menuComputations.removeStyleName("menuItemImage-selected");
|
||||
} else {
|
||||
if (currentSelection == null
|
||||
|| (currentSelection != null && currentSelection
|
||||
.compareTo(MenuType.HOME) == 0)) {
|
||||
menuGoBack.setVisible(true);
|
||||
menuDataSpace.setVisible(true);
|
||||
menuExperiment.setVisible(true);
|
||||
menuComputations.setVisible(true);
|
||||
menuHelp.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
if (currentSelection != null
|
||||
&& currentSelection.compareTo(MenuType.EXPERIMENT) == 0)
|
||||
menuExperiment.removeStyleName("menuItemImage-selected");
|
||||
else if (currentSelection != null
|
||||
&& currentSelection.compareTo(MenuType.DATA_SPACE) == 0)
|
||||
menuDataSpace.removeStyleName("menuItemImage-selected");
|
||||
else if (currentSelection != null
|
||||
&& currentSelection.compareTo(MenuType.COMPUTATIONS) == 0)
|
||||
menuComputations.removeStyleName("menuItemImage-selected");
|
||||
|
||||
Image imgNew = (menuType.compareTo(MenuType.DATA_SPACE) == 0 ? menuDataSpace
|
||||
: (menuType.compareTo(MenuType.EXPERIMENT) == 0 ? menuExperiment
|
||||
: menuComputations));
|
||||
|
||||
imgNew.addStyleName("menuItemImage-selected");
|
||||
}
|
||||
|
||||
currentSelection = menuType;
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @param inputSpace
|
||||
*/
|
||||
private void menuSwitch(MenuSwitchEvent event) {
|
||||
Log.debug("MenuSwitch: " + event);
|
||||
|
||||
if (event.getMenuType().compareTo(MenuType.HOME) == 0) {
|
||||
menuGoBack.setVisible(false);
|
||||
menuDataSpace.setVisible(false);
|
||||
menuExperiment.setVisible(false);
|
||||
menuComputations.setVisible(false);
|
||||
menuHelp.setVisible(false);
|
||||
|
||||
if (currentSelection != null
|
||||
&& currentSelection.compareTo(MenuType.EXPERIMENT) == 0)
|
||||
menuExperiment.removeStyleName("menuItemImage-selected");
|
||||
else if (currentSelection != null
|
||||
&& currentSelection.compareTo(MenuType.DATA_SPACE) == 0)
|
||||
menuDataSpace.removeStyleName("menuItemImage-selected");
|
||||
else if (currentSelection != null
|
||||
&& currentSelection.compareTo(MenuType.COMPUTATIONS) == 0)
|
||||
menuComputations.removeStyleName("menuItemImage-selected");
|
||||
} else {
|
||||
if (currentSelection == null
|
||||
|| (currentSelection != null && currentSelection
|
||||
.compareTo(MenuType.HOME) == 0)) {
|
||||
menuGoBack.setVisible(true);
|
||||
menuDataSpace.setVisible(true);
|
||||
menuExperiment.setVisible(true);
|
||||
menuComputations.setVisible(true);
|
||||
menuHelp.setVisible(true);
|
||||
}
|
||||
|
||||
if (currentSelection != null
|
||||
&& currentSelection.compareTo(MenuType.EXPERIMENT) == 0)
|
||||
menuExperiment.removeStyleName("menuItemImage-selected");
|
||||
else if (currentSelection != null
|
||||
&& currentSelection.compareTo(MenuType.DATA_SPACE) == 0)
|
||||
menuDataSpace.removeStyleName("menuItemImage-selected");
|
||||
else if (currentSelection != null
|
||||
&& currentSelection.compareTo(MenuType.COMPUTATIONS) == 0)
|
||||
menuComputations.removeStyleName("menuItemImage-selected");
|
||||
|
||||
Image imgNew = (event.getMenuType().compareTo(MenuType.DATA_SPACE) == 0 ? menuDataSpace
|
||||
: (event.getMenuType().compareTo(MenuType.EXPERIMENT) == 0 ? menuExperiment
|
||||
: menuComputations));
|
||||
|
||||
imgNew.addStyleName("menuItemImage-selected");
|
||||
}
|
||||
|
||||
currentSelection = event.getMenuType();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
private void showHelp() {
|
||||
try {
|
||||
DataMinerManager.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,
|
||||
"DataMiner Wiki", "");
|
||||
}
|
||||
});
|
||||
} catch (ResourceException e) {
|
||||
Log.error("Error retrieving wiki link!: " + e.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error", "Error retrieving wiki link!");
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,158 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client;
|
||||
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.MenuEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.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 email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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));
|
||||
/*
|
||||
VerticalLayoutData layoutTop = new VerticalLayoutData(1, -1,
|
||||
new Margins(20, 90, 10, 90));
|
||||
VerticalLayoutData layoutNext = new VerticalLayoutData(1, -1,
|
||||
new Margins(10, 90, 10, 90));
|
||||
*/
|
||||
SimpleContainer itemDataSpace = createMenuItem(
|
||||
"Access to the Data Space",
|
||||
"The data space contains the set of input and output data sets of the users. It is possible to upload and share tables. Data sources can be chosen from those hosted by the infrastructure. Outputs of the computations can be even saved in this space.",
|
||||
DataMinerManager.resources.inputSpaceIcon(), new MouseDownHandler() {
|
||||
|
||||
@Override
|
||||
public void onMouseDown(MouseDownEvent event) {
|
||||
MenuEvent menuEvent=new MenuEvent(MenuType.DATA_SPACE);
|
||||
EventBusProvider.INSTANCE.fireEvent(menuEvent);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
lc.add(itemDataSpace, layoutTop);
|
||||
|
||||
SimpleContainer itemExperiment = createMenuItem(
|
||||
"Execute an Experiment",
|
||||
"This section allows to execute or prepare a Niche Modeling experiment. The section is endowed with a list of algorithms for training and executing statistical models for biological applications. Evaluation of the performances is possible by means of several kinds of measurement systems and processes.",
|
||||
DataMinerManager.resources.executionIcon(), new MouseDownHandler() {
|
||||
|
||||
@Override
|
||||
public void onMouseDown(MouseDownEvent event) {
|
||||
MenuEvent menuEvent=new MenuEvent(MenuType.EXPERIMENT);
|
||||
EventBusProvider.INSTANCE.fireEvent(menuEvent);
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
lc.add(itemExperiment, layoutNext);
|
||||
|
||||
SimpleContainer itemComputations = createMenuItem(
|
||||
"Check the Computations",
|
||||
"This section allows to check the status of the computation. A list of processes launched by the user is shown along with meta-information. By clicking on the completed jobs it is possible to visualize the data set contents.",
|
||||
DataMinerManager.resources.computationsIcon(), new MouseDownHandler() {
|
||||
|
||||
@Override
|
||||
public void onMouseDown(MouseDownEvent event) {
|
||||
MenuEvent menuEvent=new MenuEvent(MenuType.COMPUTATIONS);
|
||||
EventBusProvider.INSTANCE.fireEvent(menuEvent);
|
||||
}
|
||||
});
|
||||
|
||||
lc.add(itemComputations, layoutNext);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,153 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.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"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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("AM 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("AM onWindowResize viewWidth: " + viewWidth
|
||||
+ " viewHeight: " + viewHeight + " clientWidth: "
|
||||
+ Window.getClientWidth() + " clientHeight: "
|
||||
+ Window.getClientHeight());
|
||||
setPixelSize(viewWidth, viewHeight);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected int calculateWidth() {
|
||||
int leftBorder = getAbsoluteLeft();
|
||||
Log.info("AM width: "
|
||||
+ String.valueOf(Window.getClientWidth() - 2 * leftBorder));
|
||||
return Window.getClientWidth() - 2 * leftBorder;
|
||||
}
|
||||
|
||||
protected int calculateHeight() {
|
||||
int topBorder = getAbsoluteTop();
|
||||
Log.info("AM height: "
|
||||
+ String.valueOf(Window.getClientHeight() - topBorder - 34));
|
||||
return Window.getClientHeight() - topBorder - 34;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.common;
|
||||
|
||||
import com.google.gwt.event.shared.EventBus;
|
||||
import com.google.gwt.event.shared.SimpleEventBus;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class EventBusProvider {
|
||||
|
||||
public static final EventBus INSTANCE = new SimpleEventBus();
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.computations;
|
||||
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationValue;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationValueFile;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationValueFileList;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationValueImage;
|
||||
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
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 email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ComputationValueFileListPanel extends SimpleContainer {
|
||||
private ComputationValueFileList computationValueFileList;
|
||||
|
||||
public ComputationValueFileListPanel(ComputationValueFileList computationValueFileList) {
|
||||
this.computationValueFileList = computationValueFileList;
|
||||
init();
|
||||
create();
|
||||
}
|
||||
|
||||
private void init(){
|
||||
setBorders(false);
|
||||
}
|
||||
|
||||
private void create() {
|
||||
VerticalLayoutContainer lc = new VerticalLayoutContainer();
|
||||
SimpleContainer simpleContainer;
|
||||
TextField textField;
|
||||
for(ComputationValue computationValue: computationValueFileList.getFileList()){
|
||||
if(computationValue instanceof ComputationValueFile){
|
||||
ComputationValueFile computationValueFile=(ComputationValueFile) computationValue;
|
||||
simpleContainer=new ComputationValueFilePanel(computationValueFile);
|
||||
lc.add(simpleContainer, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
} else {
|
||||
if(computationValue instanceof ComputationValueImage){
|
||||
ComputationValueImage computationValueImage=(ComputationValueImage) computationValue;
|
||||
simpleContainer=new ComputationValueImagePanel(computationValueImage);
|
||||
lc.add(simpleContainer, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
} else {
|
||||
textField = new TextField();
|
||||
textField.setValue(computationValue.getValue());
|
||||
textField.setReadOnly(true);
|
||||
lc.add(textField, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
add(lc);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.computations;
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationValueFile;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.DataMinerManager;
|
||||
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ComputationValueFilePanel extends SimpleContainer {
|
||||
private ComputationValueFile computationValueFile;
|
||||
|
||||
public ComputationValueFilePanel(ComputationValueFile computationValueFile) {
|
||||
this.computationValueFile = computationValueFile;
|
||||
init();
|
||||
create();
|
||||
}
|
||||
|
||||
private void init(){
|
||||
setBorders(false);
|
||||
}
|
||||
|
||||
private void create() {
|
||||
VerticalLayoutContainer lc = new VerticalLayoutContainer();
|
||||
final String fileName = computationValueFile.getFileName();
|
||||
final String fileUrl = computationValueFile.getValue();
|
||||
HtmlLayoutContainer fileNameHtml;
|
||||
if (fileName != null) {
|
||||
fileNameHtml = new HtmlLayoutContainer(
|
||||
"<div class='computation-output-fileName'><p>"
|
||||
+ new SafeHtmlBuilder().appendEscaped(fileName)
|
||||
.toSafeHtml().asString() + "</p></div>");
|
||||
} else {
|
||||
fileNameHtml = new HtmlLayoutContainer(
|
||||
"<div class='computation-output-fileName'><p>"
|
||||
+ new SafeHtmlBuilder().appendEscaped("NoName")
|
||||
.toSafeHtml().asString() + "</p></div>");
|
||||
}
|
||||
|
||||
lc.add(fileNameHtml, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
TextButton downloadBtn = new TextButton("Download File");
|
||||
downloadBtn.setIcon(DataMinerManager.resources.download());
|
||||
downloadBtn.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
com.google.gwt.user.client.Window.open(fileUrl, fileName, "");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
lc.add(downloadBtn, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
add(lc);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.computations;
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationValueImage;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.DataMinerManager;
|
||||
|
||||
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.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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ComputationValueImagePanel extends SimpleContainer {
|
||||
private ComputationValueImage computationValueImage;
|
||||
|
||||
public ComputationValueImagePanel(
|
||||
ComputationValueImage computationValueImage) {
|
||||
this.computationValueImage = computationValueImage;
|
||||
init();
|
||||
create();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setBorders(false);
|
||||
}
|
||||
|
||||
private void create() {
|
||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||
add(v);
|
||||
if (computationValueImage == null
|
||||
|| computationValueImage.getValue() == null
|
||||
|| computationValueImage.getValue().isEmpty())
|
||||
v.add(new HtmlLayoutContainer("<i>No image found.</i>"),
|
||||
new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
else {
|
||||
HtmlLayoutContainer imageName;
|
||||
if (computationValueImage.getFileName() == null
|
||||
|| computationValueImage.getFileName().isEmpty()) {
|
||||
imageName = new HtmlLayoutContainer("");
|
||||
} else {
|
||||
imageName = new HtmlLayoutContainer(
|
||||
computationValueImage.getFileName());
|
||||
}
|
||||
|
||||
v.add(imageName, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
TextButton saveImageBtn = new TextButton("Download Image");
|
||||
saveImageBtn.setIcon(DataMinerManager.resources.download());
|
||||
saveImageBtn.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
com.google.gwt.user.client.Window.open(
|
||||
computationValueImage.getValue(),
|
||||
computationValueImage.getFileName(), "");
|
||||
}
|
||||
});
|
||||
|
||||
v.add(saveImageBtn, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
final Image img = new Image(computationValueImage.getValue());
|
||||
img.setPixelSize(640, 480);
|
||||
v.add(img, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
}
|
||||
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,580 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.computations;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portal.clientcontext.client.GCubeClientContext;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.DataMinerManager;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.CancelExecutionFromComputationsRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.ComputationDataRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.DataMinerWorkAreaEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.DeleteItemRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.RefreshDataMinerWorkAreaEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.ResubmitComputationExecutionRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.SessionExpiredEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.UIStateEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.rpc.DataMinerPortletServiceAsync;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.DataMinerWorkAreaElementType;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.util.UtilsGXT3;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.Constants;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.exception.SessionExpiredServiceException;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.workspace.ItemDescription;
|
||||
import org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploadNotification.WorskpaceUploadNotificationListener;
|
||||
import org.gcube.portlets.widgets.workspaceuploader.client.uploader.DialogUpload.UPLOAD_TYPE;
|
||||
import org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.explore.WorkspaceResourcesExplorerPanel;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.view.grid.ItemsTable.DISPLAY_FIELD;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.logical.shared.ResizeEvent;
|
||||
import com.google.gwt.event.logical.shared.ResizeHandler;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sencha.gxt.cell.core.client.ButtonCell.ButtonScale;
|
||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||
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.BoxLayoutContainer.BoxLayoutData;
|
||||
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.ToolBar;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ComputationsExecutedPanel extends FramedPanel {
|
||||
|
||||
private Item selectedItem;
|
||||
private MultipleDNDUpload dnd;
|
||||
private WorkspaceResourcesExplorerPanel wsResourcesExplorerPanel;
|
||||
private TextButton btnShow;
|
||||
private TextButton btnDownload;
|
||||
private TextButton btnDelete;
|
||||
private TextButton btnRefresh;
|
||||
private TextButton btnResubmit;
|
||||
private TextButton btnCancel;
|
||||
private VerticalLayoutContainer v;
|
||||
|
||||
public ComputationsExecutedPanel() {
|
||||
super();
|
||||
Log.debug("ComputationsPanel");
|
||||
|
||||
// msgs = GWT.create(ServiceCategoryMessages.class);
|
||||
init();
|
||||
bindToEvents();
|
||||
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setItemId("ComputationsExecutedPanel");
|
||||
forceLayoutOnResize = true;
|
||||
setBodyBorder(false);
|
||||
setBorders(false);
|
||||
setBodyStyle("backgroundColor:white;");
|
||||
setHeaderVisible(false);
|
||||
setResize(true);
|
||||
setHeadingText("List of Computations");
|
||||
setBodyStyle("backgroundColor:white;");
|
||||
|
||||
}
|
||||
|
||||
private void bindToEvents() {
|
||||
|
||||
EventBusProvider.INSTANCE.addHandler(UIStateEvent.TYPE,
|
||||
new UIStateEvent.UIStateEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(UIStateEvent event) {
|
||||
manageStateEvents(event);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
EventBusProvider.INSTANCE.addHandler(DataMinerWorkAreaEvent.TYPE,
|
||||
new DataMinerWorkAreaEvent.DataMinerWorkAreaEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(DataMinerWorkAreaEvent event) {
|
||||
manageDataMinerWorkAreaEvents(event);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
EventBusProvider.INSTANCE
|
||||
.addHandler(
|
||||
RefreshDataMinerWorkAreaEvent.TYPE,
|
||||
new RefreshDataMinerWorkAreaEvent.RefreshDataMinerWorkAreaEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onRefresh(
|
||||
RefreshDataMinerWorkAreaEvent event) {
|
||||
manageRefreshDataMinerWorkAreaEvents(event);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void manageStateEvents(UIStateEvent event) {
|
||||
Log.debug("ComputationsExecutedPanel recieved UIStateEvent: " + event);
|
||||
if (event == null) {
|
||||
Log.error("UIStateEvent null");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event.getUiStateType()) {
|
||||
case START:
|
||||
break;
|
||||
case WAITING:
|
||||
break;
|
||||
case UPDATE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void manageDataMinerWorkAreaEvents(DataMinerWorkAreaEvent event) {
|
||||
|
||||
Log.debug("ComputationsExecutedPanel recieved DataMinerWorkAreaEvent: "
|
||||
+ event);
|
||||
if (event == null) {
|
||||
Log.error("DataMinerWorkAreaEvent null");
|
||||
return;
|
||||
}
|
||||
switch (event.getDataMinerWorkAreaRegionType()) {
|
||||
case Computations:
|
||||
manageMyDataMinerWorkAreaEvents(event);
|
||||
break;
|
||||
case DataSets:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void manageMyDataMinerWorkAreaEvents(DataMinerWorkAreaEvent event) {
|
||||
|
||||
switch (event.getDataMinerWorkAreaEventType()) {
|
||||
case OPEN:
|
||||
case UPDATE:
|
||||
refreshWSResourceExplorerPanel(event);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void manageRefreshDataMinerWorkAreaEvents(
|
||||
RefreshDataMinerWorkAreaEvent event) {
|
||||
Log.debug("ComputationsExecutedPanel recieved RefreshDataMinerWorkAreaEvent: "
|
||||
+ event);
|
||||
if (event == null) {
|
||||
Log.error("RefreshDataMinerWorkAreaEvent null");
|
||||
return;
|
||||
}
|
||||
switch (event.getDataMinerWorkAreaElementType()) {
|
||||
case Computations:
|
||||
refreshWSResourceExplorerPanel();
|
||||
break;
|
||||
case InputDataSets:
|
||||
break;
|
||||
case OutputDataSets:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void create(DataMinerWorkAreaEvent event) {
|
||||
try {
|
||||
|
||||
if (event == null
|
||||
|| event.getDataMinerWorkArea() == null
|
||||
|| event.getDataMinerWorkArea().getComputations() == null
|
||||
|| event.getDataMinerWorkArea().getComputations()
|
||||
.getFolder() == null
|
||||
|| event.getDataMinerWorkArea().getComputations()
|
||||
.getFolder().getId() == null
|
||||
|| event.getDataMinerWorkArea().getComputations()
|
||||
.getFolder().getId().isEmpty()) {
|
||||
if (v != null) {
|
||||
remove(v);
|
||||
forceLayout();
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
List<String> showProperties = new ArrayList<String>();
|
||||
for (ComputationsPropertiesType computationsProperties : ComputationsPropertiesType
|
||||
.values()) {
|
||||
showProperties.add(computationsProperties.getLabel());
|
||||
}
|
||||
FilterCriteria filterCriteria = new FilterCriteria();
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
filterCriteria.setRequiredProperties(map);
|
||||
|
||||
wsResourcesExplorerPanel = new WorkspaceResourcesExplorerPanel(
|
||||
event.getDataMinerWorkArea().getComputations().getFolder()
|
||||
.getId(), false, showProperties, filterCriteria,
|
||||
true, DISPLAY_FIELD.CREATION_DATE);
|
||||
WorskpaceExplorerSelectNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectNotificationListener() {
|
||||
@Override
|
||||
public void onSelectedItem(Item item) {
|
||||
Log.debug("Listener Selected Item " + item);
|
||||
selectedItem = item;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Throwable throwable) {
|
||||
Log.error(throwable.getLocalizedMessage());
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAborted() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNotValidSelection() {
|
||||
selectedItem = null;
|
||||
}
|
||||
};
|
||||
|
||||
wsResourcesExplorerPanel
|
||||
.addWorkspaceExplorerSelectNotificationListener(wsResourceExplorerListener);
|
||||
wsResourcesExplorerPanel.ensureDebugId("wsResourceExplorerPanel");
|
||||
wsResourcesExplorerPanel.setHeightToInternalScroll(300);
|
||||
|
||||
/*
|
||||
* VerticalLayoutContainer vResourcesExplorerContainer = new
|
||||
* VerticalLayoutContainer();
|
||||
* vResourcesExplorerContainer.setScrollMode(ScrollMode.AUTO);
|
||||
* vResourcesExplorerContainer.add(wsResourcesExplorerPanel, new
|
||||
* VerticalLayoutData(1, -1, new Margins(0)));
|
||||
*/
|
||||
// DND
|
||||
|
||||
dnd = new MultipleDNDUpload();
|
||||
dnd.setParameters(event.getDataMinerWorkArea().getComputations()
|
||||
.getFolder().getId(), UPLOAD_TYPE.File);
|
||||
dnd.addUniqueContainer(wsResourcesExplorerPanel);
|
||||
WorskpaceUploadNotificationListener workspaceUploaderListener = new WorskpaceUploadNotificationListener() {
|
||||
|
||||
@Override
|
||||
public void onUploadCompleted(String parentId, String itemId) {
|
||||
Log.debug("Upload completed: [parentID: " + parentId
|
||||
+ ", itemId: " + itemId + "]");
|
||||
wsResourcesExplorerPanel.refreshRootFolderView();
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUploadAborted(String parentId, String itemId) {
|
||||
Log.debug("Upload Aborted: [parentID: " + parentId
|
||||
+ ", itemId: " + itemId + "]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String parentId, String itemId,
|
||||
Throwable throwable) {
|
||||
Log.debug("Upload Error: [parentID: " + parentId
|
||||
+ ", itemId: " + itemId + "]");
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOverwriteCompleted(String parentId, String itemId) {
|
||||
Log.debug("Upload Override Completed: [parentID: "
|
||||
+ parentId + ", itemId: " + itemId + "]");
|
||||
wsResourcesExplorerPanel.refreshRootFolderView();
|
||||
forceLayout();
|
||||
}
|
||||
};
|
||||
|
||||
dnd.addWorkspaceUploadNotificationListener(workspaceUploaderListener);
|
||||
|
||||
// ToolBar
|
||||
btnShow = new TextButton("Show");
|
||||
btnShow.setIcon(DataMinerManager.resources.show());
|
||||
btnShow.setScale(ButtonScale.SMALL);
|
||||
btnShow.setIconAlign(IconAlign.LEFT);
|
||||
btnShow.setToolTip("Show");
|
||||
btnShow.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
showComputation();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
btnDownload = new TextButton("Download");
|
||||
btnDownload.setIcon(DataMinerManager.resources.download());
|
||||
btnDownload.setScale(ButtonScale.SMALL);
|
||||
btnDownload.setIconAlign(IconAlign.LEFT);
|
||||
btnDownload.setToolTip("Download");
|
||||
btnDownload.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
downloadFile();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
btnDelete = new TextButton("Delete");
|
||||
btnDelete.setIcon(DataMinerManager.resources.deleteCircle());
|
||||
btnDelete.setScale(ButtonScale.SMALL);
|
||||
btnDelete.setIconAlign(IconAlign.LEFT);
|
||||
btnDelete.setToolTip("Delete");
|
||||
btnDelete.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
deleteItem(event);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
btnRefresh = new TextButton("Refresh");
|
||||
btnRefresh.setIcon(DataMinerManager.resources.refresh());
|
||||
btnRefresh.setScale(ButtonScale.SMALL);
|
||||
btnRefresh.setIconAlign(IconAlign.LEFT);
|
||||
btnRefresh.setToolTip("Refresh");
|
||||
btnRefresh.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
refreshWSResourceExplorerPanel();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
btnResubmit = new TextButton("Resubmit");
|
||||
btnResubmit.setIcon(DataMinerManager.resources.resubmit());
|
||||
btnResubmit.setScale(ButtonScale.SMALL);
|
||||
btnResubmit.setIconAlign(IconAlign.LEFT);
|
||||
btnResubmit.setToolTip("Resubmit");
|
||||
btnResubmit.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
resubmitComputation();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
btnCancel = new TextButton("Cancel");
|
||||
btnCancel.setIcon(DataMinerManager.resources.cancelCircle());
|
||||
btnCancel.setScale(ButtonScale.SMALL);
|
||||
btnCancel.setIconAlign(IconAlign.LEFT);
|
||||
btnCancel.setToolTip("Cancel");
|
||||
btnCancel.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
cancelComputation();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
final ToolBar toolBar = new ToolBar();
|
||||
toolBar.add(btnShow, new BoxLayoutData(new Margins(0)));
|
||||
toolBar.add(btnDownload, new BoxLayoutData(new Margins(0)));
|
||||
toolBar.add(btnDelete, new BoxLayoutData(new Margins(0)));
|
||||
toolBar.add(btnRefresh, new BoxLayoutData(new Margins(0)));
|
||||
toolBar.add(btnResubmit, new BoxLayoutData(new Margins(0)));
|
||||
toolBar.add(btnCancel, new BoxLayoutData(new Margins(0)));
|
||||
|
||||
v = new VerticalLayoutContainer();
|
||||
|
||||
v.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
v.add(dnd, new VerticalLayoutData(1, 1, new Margins(0)));
|
||||
add(v);
|
||||
|
||||
v.addResizeHandler(new ResizeHandler() {
|
||||
|
||||
@Override
|
||||
public void onResize(ResizeEvent event) {
|
||||
int scrollBarHeight = event.getHeight()
|
||||
- toolBar.getElement().getHeight(false);
|
||||
Log.debug("ScrollBarHeight: " + scrollBarHeight);
|
||||
wsResourcesExplorerPanel
|
||||
.setHeightToInternalScroll(scrollBarHeight);
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
});
|
||||
forceLayout();
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.error("Error opening wsResourceExplorerPanel");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshWSResourceExplorerPanel() {
|
||||
if (wsResourcesExplorerPanel != null) {
|
||||
wsResourcesExplorerPanel.refreshRootFolderView();
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshWSResourceExplorerPanel(DataMinerWorkAreaEvent event) {
|
||||
try {
|
||||
|
||||
if (v != null) {
|
||||
remove(v);
|
||||
create(event);
|
||||
} else {
|
||||
create(event);
|
||||
}
|
||||
|
||||
} catch (Throwable e) {
|
||||
Log.error("Error in ComputationsPanel: " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteItem(SelectEvent event) {
|
||||
ItemDescription itemDescription = new ItemDescription(
|
||||
selectedItem.getId(), selectedItem.getName(),
|
||||
selectedItem.getOwner(), selectedItem.getPath(), selectedItem
|
||||
.getType().name());
|
||||
DeleteItemRequestEvent deleteItemEvent = new DeleteItemRequestEvent(
|
||||
DataMinerWorkAreaElementType.Computations, itemDescription);
|
||||
EventBusProvider.INSTANCE.fireEvent(deleteItemEvent);
|
||||
Log.debug("Fired: " + deleteItemEvent);
|
||||
}
|
||||
|
||||
private void showComputation() {
|
||||
if (selectedItem != null) {
|
||||
|
||||
final ItemDescription itemDescription = new ItemDescription(
|
||||
selectedItem.getId(), selectedItem.getName(),
|
||||
selectedItem.getOwner(), selectedItem.getPath(),
|
||||
selectedItem.getType().name());
|
||||
|
||||
ComputationDataRequestEvent event = new ComputationDataRequestEvent(
|
||||
itemDescription);
|
||||
EventBusProvider.INSTANCE.fireEvent(event);
|
||||
|
||||
} else {
|
||||
UtilsGXT3.info("Attention", "Select a computation!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void downloadFile() {
|
||||
if (selectedItem != null) {
|
||||
if (selectedItem.isFolder()) {
|
||||
StringBuilder actionUrl = new StringBuilder();
|
||||
actionUrl.append(GWT.getModuleBaseURL());
|
||||
actionUrl
|
||||
.append(Constants.DOWNLOAD_FOLDER_SERVLET
|
||||
+ "?"
|
||||
+ Constants.DOWNLOAD_FOLDER_SERVLET_ITEM_ID_PARAMETER
|
||||
+ "="
|
||||
+ selectedItem.getId()
|
||||
+ "&"
|
||||
+ Constants.DOWNLOAD_FOLDER_SERVLET_FOLDER_NAME_PARAMETER
|
||||
+ "=" + selectedItem.getName() + "&"
|
||||
+ Constants.CURR_GROUP_ID + "="
|
||||
+ GCubeClientContext.getCurrentContextId());
|
||||
|
||||
Log.debug("Retrieved link: " + actionUrl);
|
||||
Window.open(actionUrl.toString(), selectedItem.getName(), "");
|
||||
|
||||
} else {
|
||||
|
||||
final ItemDescription itemDescription = new ItemDescription(
|
||||
selectedItem.getId(), selectedItem.getName(),
|
||||
selectedItem.getOwner(), selectedItem.getPath(),
|
||||
selectedItem.getType().name());
|
||||
|
||||
DataMinerPortletServiceAsync.INSTANCE.getPublicLink(
|
||||
itemDescription, new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof SessionExpiredServiceException) {
|
||||
EventBusProvider.INSTANCE
|
||||
.fireEvent(new SessionExpiredEvent());
|
||||
} else {
|
||||
Log.error("Error open file: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String link) {
|
||||
Log.debug("Retrieved link: " + link);
|
||||
Window.open(link, itemDescription.getName(), "");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
} else {
|
||||
UtilsGXT3.info("Attention", "Select a file!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void cancelComputation() {
|
||||
if (selectedItem != null) {
|
||||
ItemDescription itemDescription = new ItemDescription(
|
||||
selectedItem.getId(), selectedItem.getName(),
|
||||
selectedItem.getOwner(), selectedItem.getPath(),
|
||||
selectedItem.getType().name());
|
||||
CancelExecutionFromComputationsRequestEvent cancelComputationEvent = new CancelExecutionFromComputationsRequestEvent(
|
||||
itemDescription);
|
||||
EventBusProvider.INSTANCE.fireEvent(cancelComputationEvent);
|
||||
Log.debug("Fired: " + cancelComputationEvent);
|
||||
} else {
|
||||
UtilsGXT3.info("Attention", "Select a computation!");
|
||||
}
|
||||
}
|
||||
|
||||
private void resubmitComputation() {
|
||||
if (selectedItem != null) {
|
||||
ItemDescription itemDescription = new ItemDescription(
|
||||
selectedItem.getId(), selectedItem.getName(),
|
||||
selectedItem.getOwner(), selectedItem.getPath(),
|
||||
selectedItem.getType().name());
|
||||
ResubmitComputationExecutionRequestEvent resubmitComputationEvent = new ResubmitComputationExecutionRequestEvent(
|
||||
itemDescription);
|
||||
EventBusProvider.INSTANCE.fireEvent(resubmitComputationEvent);
|
||||
Log.debug("Fired: " + resubmitComputationEvent);
|
||||
} else {
|
||||
UtilsGXT3.info("Attention", "Select a computation!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,206 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.computations;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.DataMinerManager;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.ComputationDataEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.DataMinerWorkAreaEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.RefreshDataMinerWorkAreaEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.util.UtilsGXT3;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.sencha.gxt.widget.core.client.TabItemConfig;
|
||||
import com.sencha.gxt.widget.core.client.TabPanel;
|
||||
import com.sencha.gxt.widget.core.client.container.MarginData;
|
||||
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ComputationsPanel extends SimpleContainer {
|
||||
private ArrayList<ComputationsViewerPanel> computationsViewers;
|
||||
|
||||
private ComputationsExecutedPanel computationsExecutedPanel;
|
||||
private TabPanel computationsTabPanel;
|
||||
|
||||
public ComputationsPanel() {
|
||||
super();
|
||||
Log.debug("ComputationsPanel");
|
||||
init();
|
||||
create();
|
||||
bind();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
|
||||
}
|
||||
|
||||
private void bind() {
|
||||
EventBusProvider.INSTANCE.addHandler(ComputationDataEvent.getType(),
|
||||
new ComputationDataEvent.ComputationDataEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onComputationData(ComputationDataEvent event) {
|
||||
Log.debug("Catch ComputationDataEvent: " + event);
|
||||
addComputationsViewerPanel(event);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
EventBusProvider.INSTANCE.addHandler(DataMinerWorkAreaEvent.TYPE,
|
||||
new DataMinerWorkAreaEvent.DataMinerWorkAreaEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(DataMinerWorkAreaEvent event) {
|
||||
manageDataMinerWorkAreaEvents(event);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
EventBusProvider.INSTANCE
|
||||
.addHandler(
|
||||
RefreshDataMinerWorkAreaEvent.TYPE,
|
||||
new RefreshDataMinerWorkAreaEvent.RefreshDataMinerWorkAreaEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onRefresh(
|
||||
RefreshDataMinerWorkAreaEvent event) {
|
||||
Log.debug("Catch RefreshDataMinerWorkAreaEvent: "
|
||||
+ event);
|
||||
manageRefreshDataMinerWorkAreaEvents(event);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void manageDataMinerWorkAreaEvents(DataMinerWorkAreaEvent event) {
|
||||
Log.debug("ComputationsPanel recieved DataMinerWorkAreaEvent: " + event);
|
||||
if (event == null) {
|
||||
Log.error("DataMinerWorkAreaEvent null");
|
||||
return;
|
||||
}
|
||||
switch (event.getDataMinerWorkAreaRegionType()) {
|
||||
case Computations:
|
||||
closeAllComputationsViewer();
|
||||
break;
|
||||
case DataSets:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void manageRefreshDataMinerWorkAreaEvents(
|
||||
RefreshDataMinerWorkAreaEvent event) {
|
||||
Log.debug("ComputationsPanel recieved RefreshDataMinerWorkAreaEvent: "
|
||||
+ event);
|
||||
if (event == null) {
|
||||
Log.error("RefreshDataMinerWorkAreaEvent null");
|
||||
return;
|
||||
}
|
||||
switch (event.getDataMinerWorkAreaElementType()) {
|
||||
case Computations:
|
||||
closeAllComputationsViewer();
|
||||
break;
|
||||
case InputDataSets:
|
||||
break;
|
||||
case OutputDataSets:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void create() {
|
||||
computationsViewers = new ArrayList<>();
|
||||
computationsExecutedPanel = new ComputationsExecutedPanel();
|
||||
|
||||
computationsTabPanel = new TabPanel();
|
||||
computationsTabPanel.setTabScroll(true);
|
||||
computationsTabPanel.setBorders(false);
|
||||
computationsTabPanel.setBodyBorder(false);
|
||||
|
||||
TabItemConfig computationsExecutedItemConf = new TabItemConfig(
|
||||
"List of Computations", false);
|
||||
|
||||
computationsExecutedItemConf.setIcon(DataMinerManager.resources
|
||||
.folderExplore());
|
||||
|
||||
computationsTabPanel.add(computationsExecutedPanel,
|
||||
computationsExecutedItemConf);
|
||||
|
||||
computationsTabPanel.setActiveWidget(computationsExecutedPanel);
|
||||
|
||||
add(computationsTabPanel, new MarginData(0));
|
||||
|
||||
}
|
||||
|
||||
private void addComputationsViewerPanel(ComputationDataEvent event) {
|
||||
if (event == null || event.getComputationData() == null) {
|
||||
Log.error("Invalid ComputationDataEvent: " + event);
|
||||
UtilsGXT3.alert("Error", "Invalid ComputationDataEvent: " + event);
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getComputationData().getComputationId() == null) {
|
||||
Log.error("Invalid ComputationId: "
|
||||
+ event.getComputationData().getComputationId());
|
||||
UtilsGXT3.alert("Error", "Invalid ComputationId: "
|
||||
+ event.getComputationData().getComputationId());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getComputationData().getComputationId().getId() == null
|
||||
|| event.getComputationData().getComputationId().getId()
|
||||
.isEmpty()) {
|
||||
Log.error("Invalid Computation id: "
|
||||
+ event.getComputationData().getComputationId().getId());
|
||||
UtilsGXT3.alert("Error", "Invalid Computation id: "
|
||||
+ event.getComputationData().getComputationId().getId());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ComputationsViewerPanel computationsViewerPanel = new ComputationsViewerPanel(
|
||||
event.getComputationData());
|
||||
computationsViewers.add(computationsViewerPanel);
|
||||
TabItemConfig computationsViewerItemConf = new TabItemConfig(event
|
||||
.getComputationData().getComputationId().getId(), true);
|
||||
computationsViewerItemConf.setIcon(DataMinerManager.resources
|
||||
.folderExplore());
|
||||
computationsTabPanel.add(computationsViewerPanel,
|
||||
computationsViewerItemConf);
|
||||
|
||||
computationsTabPanel.setActiveWidget(computationsViewerPanel);
|
||||
|
||||
computationsTabPanel.forceLayout();
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
private void closeAllComputationsViewer() {
|
||||
for (ComputationsViewerPanel view : computationsViewers) {
|
||||
if (computationsTabPanel.getWidgetIndex(view) != -1) {
|
||||
computationsTabPanel.remove(view);
|
||||
}
|
||||
}
|
||||
computationsViewers.clear();
|
||||
computationsTabPanel.forceLayout();
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.computations;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public enum ComputationsPropertiesType {
|
||||
OPERATOR_NAME("operator_name"), START_DATE("start_date"), END_DATE(
|
||||
"end_date"), STATUS("status"), EXECUTION_TYPE("execution_platform"), VRE(
|
||||
"VRE");
|
||||
|
||||
// COMPUTATION_ID("computation_id"),
|
||||
// OPERATOR_DESCRIPTION("operator_description"),
|
||||
// ERROR("error"),
|
||||
// EXECUTION_PLATFORM("execution_platform")
|
||||
/**
|
||||
* @param text
|
||||
*/
|
||||
private ComputationsPropertiesType(final String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
private final String id;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public static ComputationsPropertiesType getFromId(String id) {
|
||||
for (ComputationsPropertiesType prop : values()) {
|
||||
if (prop.id.compareToIgnoreCase(id) == 0) {
|
||||
return prop;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,379 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.computations;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationData;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationValue;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationValueFile;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationValueFileList;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationValueImage;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.util.UtilsGXT3;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
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.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.form.FieldLabel;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldSet;
|
||||
import com.sencha.gxt.widget.core.client.form.TextArea;
|
||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ComputationsViewerPanel extends FramedPanel {
|
||||
|
||||
private VerticalLayoutContainer v;
|
||||
private ComputationData computationData;
|
||||
|
||||
public ComputationsViewerPanel(ComputationData computationData) {
|
||||
super();
|
||||
Log.debug("ComputationsViewerPanel");
|
||||
this.computationData = computationData;
|
||||
Log.debug("ComputationData: " + computationData);
|
||||
init();
|
||||
create();
|
||||
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setItemId("ComputationsViewerPanel");
|
||||
forceLayoutOnResize = true;
|
||||
setBodyBorder(false);
|
||||
setBorders(false);
|
||||
setBodyStyle("backgroundColor:white;");
|
||||
setHeaderVisible(false);
|
||||
setResize(true);
|
||||
setHeadingText("Computations Viewer");
|
||||
setBodyStyle("backgroundColor:white;");
|
||||
|
||||
}
|
||||
|
||||
private void create() {
|
||||
try {
|
||||
v = new VerticalLayoutContainer();
|
||||
v.setScrollMode(ScrollMode.AUTO);
|
||||
add(v);
|
||||
createView();
|
||||
forceLayout();
|
||||
} catch (Throwable e) {
|
||||
Log.error("Error creating ComputationsViewerPanel: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void createView() {
|
||||
|
||||
if (computationData == null) {
|
||||
Log.error("ComputationData is null!");
|
||||
UtilsGXT3.alert("Error",
|
||||
"No information on computation is retrieved!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (computationData.getComputationId() == null
|
||||
|| computationData.getComputationId().getId() == null
|
||||
|| computationData.getComputationId().getId().isEmpty()) {
|
||||
Log.error("Error in computationId: " + computationData);
|
||||
UtilsGXT3.alert("Error",
|
||||
"No information on computation id is retrieved!");
|
||||
return;
|
||||
}
|
||||
|
||||
SimpleContainer sectionTitle = new SimpleContainer();
|
||||
// title
|
||||
HtmlLayoutContainer title = new HtmlLayoutContainer(
|
||||
"<center>Computation Report of <b>"
|
||||
+ computationData.getComputationId().getId()
|
||||
+ "</b></center>");
|
||||
sectionTitle.add(title, new MarginData());
|
||||
sectionTitle.getElement().getStyle().setMarginRight(20, Unit.PX);
|
||||
// v.add(sectionTitle, new VerticalLayoutData(1, -1, new
|
||||
// Margins(0)));
|
||||
v.add(sectionTitle, new VerticalLayoutData(-1, -1, new Margins(10)));
|
||||
|
||||
if (computationData.getOutputParameters() != null
|
||||
&& !computationData.getOutputParameters().isEmpty()) {
|
||||
FieldSet outputFieldSet = outputView();
|
||||
v.add(outputFieldSet, new VerticalLayoutData(-1, -1,
|
||||
new Margins(10)));
|
||||
}
|
||||
|
||||
if (computationData.getInputParameters() != null
|
||||
&& !computationData.getInputParameters().isEmpty()) {
|
||||
FieldSet inputFieldSet = inputView();
|
||||
v.add(inputFieldSet,
|
||||
new VerticalLayoutData(-1, -1, new Margins(10)));
|
||||
}
|
||||
|
||||
FieldSet detailsFieldSet = detailsView();
|
||||
v.add(detailsFieldSet, new VerticalLayoutData(-1, -1, new Margins(10)));
|
||||
|
||||
FieldSet operatorFieldSet = operatorView();
|
||||
v.add(operatorFieldSet, new VerticalLayoutData(-1, -1, new Margins(10)));
|
||||
|
||||
}
|
||||
|
||||
private FieldSet operatorView() {
|
||||
try {
|
||||
|
||||
VerticalLayoutContainer operatorVBox = new VerticalLayoutContainer();
|
||||
TextField operatorNameField = new TextField();
|
||||
operatorNameField.setValue(computationData.getComputationId()
|
||||
.getOperatorName());
|
||||
operatorNameField.setReadOnly(true);
|
||||
FieldLabel operatorNameLabel = new FieldLabel(operatorNameField,
|
||||
"Operator Name");
|
||||
operatorNameLabel.setLabelWidth(200);
|
||||
operatorNameLabel.setLabelWordWrap(true);
|
||||
operatorVBox.add(operatorNameLabel, new VerticalLayoutData(1, -1,
|
||||
new Margins(0, 4, 0, 4)));
|
||||
|
||||
TextArea operatorDescriptionField = new TextArea();
|
||||
operatorDescriptionField.setHeight(40);
|
||||
operatorDescriptionField.setValue(computationData
|
||||
.getOperatorDescription());
|
||||
operatorDescriptionField.setReadOnly(true);
|
||||
FieldLabel operatorDescriptionLabel = new FieldLabel(
|
||||
operatorDescriptionField, "Operator Description");
|
||||
operatorDescriptionLabel.setLabelWidth(200);
|
||||
operatorDescriptionLabel.setLabelWordWrap(true);
|
||||
operatorDescriptionLabel.setHeight(65);
|
||||
operatorVBox.add(operatorDescriptionLabel, new VerticalLayoutData(
|
||||
1, -1, new Margins(0, 5, 0, 5)));
|
||||
|
||||
FieldSet operatorFieldSet = new FieldSet();
|
||||
operatorFieldSet.setHeadingText("Operator Details");
|
||||
operatorFieldSet.setCollapsible(true);
|
||||
operatorFieldSet.setHeight(130);
|
||||
operatorFieldSet.add(operatorVBox);
|
||||
operatorFieldSet.getElement().getStyle()
|
||||
.setMarginBottom(120, Unit.PX);
|
||||
operatorFieldSet.getElement().getStyle()
|
||||
.setMarginRight(20, Unit.PX);
|
||||
return operatorFieldSet;
|
||||
} catch (Throwable e) {
|
||||
Log.error("Error in ComputationsViewerPanel in operator: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private FieldSet detailsView() {
|
||||
try {
|
||||
VerticalLayoutContainer detailsVBox = new VerticalLayoutContainer();
|
||||
TextField startDateField = new TextField();
|
||||
startDateField.setValue(computationData.getStartDate());
|
||||
startDateField.setReadOnly(true);
|
||||
FieldLabel startDateLabel = new FieldLabel(startDateField,
|
||||
"Start Date");
|
||||
startDateLabel.setLabelWidth(200);
|
||||
startDateLabel.setLabelWordWrap(true);
|
||||
detailsVBox.add(startDateLabel, new VerticalLayoutData(1, -1,
|
||||
new Margins(0, 4, 0, 4)));
|
||||
|
||||
TextField endDateField = new TextField();
|
||||
endDateField.setValue(computationData.getEndDate());
|
||||
endDateField.setReadOnly(true);
|
||||
FieldLabel endDateLabel = new FieldLabel(endDateField, "End Date");
|
||||
endDateLabel.setLabelWidth(200);
|
||||
endDateLabel.setLabelWordWrap(true);
|
||||
detailsVBox.add(endDateLabel, new VerticalLayoutData(1, -1,
|
||||
new Margins(0, 4, 0, 4)));
|
||||
|
||||
TextField statusField = new TextField();
|
||||
statusField.setValue(computationData.getStatus());
|
||||
statusField.setReadOnly(true);
|
||||
FieldLabel statusLabel = new FieldLabel(statusField, "Status");
|
||||
statusLabel.setLabelWidth(200);
|
||||
statusLabel.setLabelWordWrap(true);
|
||||
detailsVBox.add(statusLabel, new VerticalLayoutData(1, -1,
|
||||
new Margins(0, 4, 0, 4)));
|
||||
|
||||
TextField vreField = new TextField();
|
||||
vreField.setValue(computationData.getVre());
|
||||
vreField.setReadOnly(true);
|
||||
FieldLabel vreLabel = new FieldLabel(vreField, "VRE");
|
||||
vreLabel.setLabelWidth(200);
|
||||
vreLabel.setLabelWordWrap(true);
|
||||
detailsVBox.add(vreLabel, new VerticalLayoutData(1, -1,
|
||||
new Margins(0, 4, 0, 4)));
|
||||
|
||||
FieldSet detailsFieldSet = new FieldSet();
|
||||
detailsFieldSet.setHeadingText("Computation Details");
|
||||
detailsFieldSet.setCollapsible(true);
|
||||
detailsFieldSet.add(detailsVBox);
|
||||
detailsFieldSet.getElement().getStyle().setMarginRight(20, Unit.PX);
|
||||
return detailsFieldSet;
|
||||
} catch (Throwable e) {
|
||||
Log.error("Error in ComputationsViewerPanel in details: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private FieldSet inputView() {
|
||||
try {
|
||||
VerticalLayoutContainer inputVBox = new VerticalLayoutContainer();
|
||||
LinkedHashMap<String, ComputationValue> input = computationData
|
||||
.getInputParameters();
|
||||
for (String key : input.keySet()) {
|
||||
ComputationValue computationValue = input.get(key);
|
||||
Log.debug("Input: [key=" + key + ", ComputationValue="
|
||||
+ computationValue + "]");
|
||||
FieldLabel fieldLabel = null;
|
||||
SimpleContainer simpleContainer;
|
||||
if(computationValue==null){
|
||||
TextField textField = new TextField();
|
||||
textField.setReadOnly(true);
|
||||
fieldLabel = new FieldLabel(textField, key);
|
||||
fieldLabel.setLabelWidth(200);
|
||||
fieldLabel.setLabelWordWrap(true);
|
||||
inputVBox.add(fieldLabel, new VerticalLayoutData(1, -1,
|
||||
new Margins(0, 4, 0, 4)));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
switch (computationValue.getType()) {
|
||||
case File:
|
||||
ComputationValueFile computationValueFile = (ComputationValueFile) computationValue;
|
||||
simpleContainer = new ComputationValueFilePanel(
|
||||
computationValueFile);
|
||||
fieldLabel = new FieldLabel(simpleContainer, key);
|
||||
fieldLabel.setLabelWidth(200);
|
||||
fieldLabel.setLabelWordWrap(true);
|
||||
break;
|
||||
case Image:
|
||||
ComputationValueImage computationValueImage = (ComputationValueImage) computationValue;
|
||||
simpleContainer = new ComputationValueImagePanel(
|
||||
computationValueImage);
|
||||
fieldLabel = new FieldLabel(simpleContainer, key);
|
||||
fieldLabel.setLabelWidth(200);
|
||||
fieldLabel.setLabelWordWrap(true);
|
||||
break;
|
||||
case FileList:
|
||||
ComputationValueFileList computationValueFileList = (ComputationValueFileList) computationValue;
|
||||
simpleContainer = new ComputationValueFileListPanel(
|
||||
computationValueFileList);
|
||||
fieldLabel = new FieldLabel(simpleContainer, key);
|
||||
fieldLabel.setLabelWidth(200);
|
||||
fieldLabel.setLabelWordWrap(true);
|
||||
break;
|
||||
case String:
|
||||
default:
|
||||
TextField textField = new TextField();
|
||||
textField.setValue(computationValue.getValue());
|
||||
textField.setReadOnly(true);
|
||||
fieldLabel = new FieldLabel(textField, key);
|
||||
fieldLabel.setLabelWidth(200);
|
||||
fieldLabel.setLabelWordWrap(true);
|
||||
break;
|
||||
|
||||
}
|
||||
inputVBox.add(fieldLabel, new VerticalLayoutData(1, -1,
|
||||
new Margins(0, 4, 0, 4)));
|
||||
}
|
||||
|
||||
FieldSet inputFieldSet = new FieldSet();
|
||||
inputFieldSet.setHeadingText("Input Parameters");
|
||||
inputFieldSet.setCollapsible(true);
|
||||
inputFieldSet.add(inputVBox);
|
||||
inputFieldSet.getElement().getStyle().setMarginRight(20, Unit.PX);
|
||||
return inputFieldSet;
|
||||
} catch (Throwable e) {
|
||||
Log.error("Error in ComputationsViewerPanel creating input view: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private FieldSet outputView() {
|
||||
try {
|
||||
VerticalLayoutContainer outputVBox = new VerticalLayoutContainer();
|
||||
LinkedHashMap<String, ComputationValue> output = computationData
|
||||
.getOutputParameters();
|
||||
for (String key : output.keySet()) {
|
||||
ComputationValue computationValue = output.get(key);
|
||||
Log.debug("Output: [key=" + key + ", ComputationValue="
|
||||
+ computationValue + "]");
|
||||
FieldLabel fieldLabel = null;
|
||||
SimpleContainer simpleContainer;
|
||||
if(computationValue==null){
|
||||
TextField textField = new TextField();
|
||||
textField.setReadOnly(true);
|
||||
fieldLabel = new FieldLabel(textField, key);
|
||||
fieldLabel.setLabelWidth(200);
|
||||
fieldLabel.setLabelWordWrap(true);
|
||||
outputVBox.add(fieldLabel, new VerticalLayoutData(1, -1,
|
||||
new Margins(0, 4, 0, 4)));
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (computationValue.getType()) {
|
||||
case File:
|
||||
ComputationValueFile computationValueFile = (ComputationValueFile) computationValue;
|
||||
simpleContainer = new ComputationValueFilePanel(
|
||||
computationValueFile);
|
||||
fieldLabel = new FieldLabel(simpleContainer, key);
|
||||
fieldLabel.setLabelWidth(200);
|
||||
fieldLabel.setLabelWordWrap(true);
|
||||
break;
|
||||
case Image:
|
||||
ComputationValueImage computationValueImage = (ComputationValueImage) computationValue;
|
||||
simpleContainer = new ComputationValueImagePanel(
|
||||
computationValueImage);
|
||||
fieldLabel = new FieldLabel(simpleContainer, key);
|
||||
fieldLabel.setLabelWidth(200);
|
||||
fieldLabel.setLabelWordWrap(true);
|
||||
break;
|
||||
case FileList:
|
||||
ComputationValueFileList computationValueFileList = (ComputationValueFileList) computationValue;
|
||||
simpleContainer = new ComputationValueFileListPanel(
|
||||
computationValueFileList);
|
||||
fieldLabel = new FieldLabel(simpleContainer, key);
|
||||
fieldLabel.setLabelWidth(200);
|
||||
fieldLabel.setLabelWordWrap(true);
|
||||
case String:
|
||||
default:
|
||||
TextField textField = new TextField();
|
||||
textField.setValue(computationValue.getValue());
|
||||
textField.setReadOnly(true);
|
||||
fieldLabel = new FieldLabel(textField, key);
|
||||
fieldLabel.setLabelWidth(200);
|
||||
fieldLabel.setLabelWordWrap(true);
|
||||
break;
|
||||
|
||||
}
|
||||
outputVBox.add(fieldLabel, new VerticalLayoutData(1, -1,
|
||||
new Margins(0, 4, 0, 4)));
|
||||
}
|
||||
|
||||
FieldSet outputFieldSet = new FieldSet();
|
||||
outputFieldSet.setHeadingText("Output Result");
|
||||
outputFieldSet.setCollapsible(true);
|
||||
outputFieldSet.add(outputVBox);
|
||||
outputFieldSet.getElement().getStyle().setMarginRight(20, Unit.PX);
|
||||
return outputFieldSet;
|
||||
} catch (Throwable e) {
|
||||
Log.error("Error in ComputationsViewerPanel creating output view: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.custom;
|
||||
|
||||
/**
|
||||
* Fix for z-index bug between GXT3 and GXT2
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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);
|
||||
}*/
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -0,0 +1,18 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.custom.progress;
|
||||
|
||||
import com.sencha.gxt.cell.core.client.ProgressBarCell;
|
||||
import com.sencha.gxt.widget.core.client.ProgressBar;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class GreenProgressBar extends ProgressBar {
|
||||
|
||||
public GreenProgressBar() {
|
||||
super(new ProgressBarCell(new GreenProgressBarAppearance()));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.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 email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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(" ");
|
||||
} 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));
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -0,0 +1,18 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.custom.progress;
|
||||
|
||||
import com.sencha.gxt.cell.core.client.ProgressBarCell;
|
||||
import com.sencha.gxt.widget.core.client.ProgressBar;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class OrangeProgressBar extends ProgressBar {
|
||||
|
||||
public OrangeProgressBar() {
|
||||
super(new ProgressBarCell(new OrangeProgressBarAppearance()));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.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 email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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(" ");
|
||||
} 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));
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -0,0 +1,18 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.custom.progress;
|
||||
|
||||
import com.sencha.gxt.cell.core.client.ProgressBarCell;
|
||||
import com.sencha.gxt.widget.core.client.ProgressBar;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class RedProgressBar extends ProgressBar {
|
||||
|
||||
public RedProgressBar() {
|
||||
super(new ProgressBarCell(new RedProgressBarAppearance()));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.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 email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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(" ");
|
||||
} 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 |
|
@ -0,0 +1,62 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.dataspace;
|
||||
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.DataMinerManager;
|
||||
|
||||
import com.sencha.gxt.widget.core.client.TabItemConfig;
|
||||
import com.sencha.gxt.widget.core.client.TabPanel;
|
||||
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class DataSpacePanel extends SimpleContainer {
|
||||
|
||||
private TabPanel dataSpaceTabPanel;
|
||||
private OutputDataSetsPanel outputDataSetsPanel;
|
||||
private InputDataSetsPanel inputDataSetsPanel;
|
||||
|
||||
public DataSpacePanel() {
|
||||
super();
|
||||
init();
|
||||
create();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
}
|
||||
|
||||
private void create() {
|
||||
outputDataSetsPanel = new OutputDataSetsPanel();
|
||||
inputDataSetsPanel = new InputDataSetsPanel();
|
||||
|
||||
dataSpaceTabPanel=new TabPanel();
|
||||
dataSpaceTabPanel.setBorders(false);
|
||||
dataSpaceTabPanel.setBodyBorder(false);
|
||||
|
||||
TabItemConfig outputDataItemConf = new TabItemConfig("Output Data Sets",
|
||||
false);
|
||||
outputDataItemConf.setIcon(DataMinerManager.resources
|
||||
.folderExplore());
|
||||
|
||||
dataSpaceTabPanel.add(outputDataSetsPanel, outputDataItemConf);
|
||||
|
||||
TabItemConfig inputDataSetsItemConf = new TabItemConfig(
|
||||
"Input Data Sets", false);
|
||||
inputDataSetsItemConf.setIcon(DataMinerManager.resources
|
||||
.folderExplore());
|
||||
dataSpaceTabPanel.add(inputDataSetsPanel, inputDataSetsItemConf);
|
||||
|
||||
dataSpaceTabPanel.setActiveWidget(outputDataSetsPanel);
|
||||
|
||||
add(dataSpaceTabPanel);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.dataspace;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public enum DataSpacePropertiesType {
|
||||
COMPUTATION_ID("computation_id"), DATA_DESCRIPTION("data_description"), DATA_TYPE(
|
||||
"data_type"), OPERATOR_NAME("operator_name"), VRE("VRE");
|
||||
/**
|
||||
* @param text
|
||||
*/
|
||||
private DataSpacePropertiesType(final String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
private final String id;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public static DataSpacePropertiesType getFromId(String id) {
|
||||
for (DataSpacePropertiesType prop : values()) {
|
||||
if (prop.id.compareToIgnoreCase(id) == 0) {
|
||||
return prop;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,471 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.dataspace;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portal.clientcontext.client.GCubeClientContext;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.DataMinerManager;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.DataMinerWorkAreaEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.DeleteItemRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.RefreshDataMinerWorkAreaEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.SessionExpiredEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.UIStateEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.rpc.DataMinerPortletServiceAsync;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.DataMinerWorkAreaElementType;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.util.UtilsGXT3;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.Constants;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.exception.SessionExpiredServiceException;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.workspace.ItemDescription;
|
||||
import org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploadNotification.WorskpaceUploadNotificationListener;
|
||||
import org.gcube.portlets.widgets.workspaceuploader.client.uploader.DialogUpload.UPLOAD_TYPE;
|
||||
import org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.explore.WorkspaceResourcesExplorerPanel;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.view.grid.ItemsTable.DISPLAY_FIELD;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.logical.shared.ResizeEvent;
|
||||
import com.google.gwt.event.logical.shared.ResizeHandler;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sencha.gxt.cell.core.client.ButtonCell.ButtonScale;
|
||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||
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.BoxLayoutContainer.BoxLayoutData;
|
||||
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.ToolBar;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class InputDataSetsPanel extends FramedPanel {
|
||||
|
||||
private Item selectedItem;
|
||||
private MultipleDNDUpload dnd;
|
||||
private WorkspaceResourcesExplorerPanel wsResourcesExplorerPanel;
|
||||
private TextButton btnDownload;
|
||||
private TextButton btnDelete;
|
||||
private TextButton btnRefresh;
|
||||
private VerticalLayoutContainer v;
|
||||
|
||||
public InputDataSetsPanel() {
|
||||
super();
|
||||
Log.debug("InputDataSetsPanel");
|
||||
|
||||
// msgs = GWT.create(ServiceCategoryMessages.class);
|
||||
init();
|
||||
bindToEvents();
|
||||
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setItemId("InputDataSetsPanel");
|
||||
forceLayoutOnResize = true;
|
||||
setBodyBorder(false);
|
||||
setBorders(false);
|
||||
setHeaderVisible(false);
|
||||
setResize(true);
|
||||
setAnimCollapse(false);
|
||||
setCollapsible(true);
|
||||
setHeadingText("Input Data Sets");
|
||||
setBodyStyle("backgroundColor:white;");
|
||||
}
|
||||
|
||||
private void bindToEvents() {
|
||||
|
||||
EventBusProvider.INSTANCE.addHandler(UIStateEvent.TYPE,
|
||||
new UIStateEvent.UIStateEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(UIStateEvent event) {
|
||||
manageStateEvents(event);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
EventBusProvider.INSTANCE.addHandler(DataMinerWorkAreaEvent.TYPE,
|
||||
new DataMinerWorkAreaEvent.DataMinerWorkAreaEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(DataMinerWorkAreaEvent event) {
|
||||
manageDataMinerWorkAreaEvents(event);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
EventBusProvider.INSTANCE
|
||||
.addHandler(
|
||||
RefreshDataMinerWorkAreaEvent.TYPE,
|
||||
new RefreshDataMinerWorkAreaEvent.RefreshDataMinerWorkAreaEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onRefresh(
|
||||
RefreshDataMinerWorkAreaEvent event) {
|
||||
manageRefreshDataMinerWorkAreaEvents(event);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void manageStateEvents(UIStateEvent event) {
|
||||
Log.debug("InputDataSetsPanel recieved UIStateEvent: " + event);
|
||||
if (event == null) {
|
||||
Log.error("UIStateEvent null");
|
||||
return;
|
||||
}
|
||||
switch (event.getUiStateType()) {
|
||||
case START:
|
||||
break;
|
||||
case WAITING:
|
||||
break;
|
||||
case UPDATE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void manageDataMinerWorkAreaEvents(DataMinerWorkAreaEvent event) {
|
||||
Log.debug("InputDataSetsPanel recieved DataMinerWorkAreaEvent: "
|
||||
+ event);
|
||||
if (event == null) {
|
||||
Log.error("DataMinerWorkAreaEvent");
|
||||
return;
|
||||
}
|
||||
switch (event.getDataMinerWorkAreaRegionType()) {
|
||||
case Computations:
|
||||
break;
|
||||
case DataSets:
|
||||
manageMyDataMinerWorkAreaEvents(event);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void manageMyDataMinerWorkAreaEvents(DataMinerWorkAreaEvent event) {
|
||||
switch (event.getDataMinerWorkAreaEventType()) {
|
||||
case OPEN:
|
||||
case UPDATE:
|
||||
refreshWSResourceExplorerPanel(event);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void manageRefreshDataMinerWorkAreaEvents(
|
||||
RefreshDataMinerWorkAreaEvent event) {
|
||||
Log.debug("InputDataSetsPanel recieved RefreshDataMinerWorkAreaEvent: "
|
||||
+ event);
|
||||
if (event == null) {
|
||||
Log.error("RefreshDataMinerWorkAreaEvent");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event.getDataMinerWorkAreaElementType()) {
|
||||
case Computations:
|
||||
break;
|
||||
case InputDataSets:
|
||||
refreshWSResourceExplorerPanel();
|
||||
break;
|
||||
case OutputDataSets:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void create(DataMinerWorkAreaEvent event) {
|
||||
try {
|
||||
|
||||
if (event == null
|
||||
|| event.getDataMinerWorkArea() == null
|
||||
|| event.getDataMinerWorkArea().getInputDataSets() == null
|
||||
|| event.getDataMinerWorkArea().getInputDataSets()
|
||||
.getFolder() == null
|
||||
|| event.getDataMinerWorkArea().getInputDataSets()
|
||||
.getFolder().getId() == null
|
||||
|| event.getDataMinerWorkArea().getInputDataSets()
|
||||
.getFolder().getId().isEmpty()) {
|
||||
if (v != null) {
|
||||
remove(v);
|
||||
forceLayout();
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
List<String> showProperties = new ArrayList<String>();
|
||||
for (DataSpacePropertiesType dataSpaceProperties : DataSpacePropertiesType
|
||||
.values()) {
|
||||
showProperties.add(dataSpaceProperties.getLabel());
|
||||
}
|
||||
FilterCriteria filterCriteria = new FilterCriteria();
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
filterCriteria.setRequiredProperties(map);
|
||||
|
||||
wsResourcesExplorerPanel = new WorkspaceResourcesExplorerPanel(
|
||||
event.getDataMinerWorkArea().getInputDataSets().getFolder()
|
||||
.getId(), false, showProperties, filterCriteria,
|
||||
true, DISPLAY_FIELD.CREATION_DATE);
|
||||
WorskpaceExplorerSelectNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectNotificationListener() {
|
||||
@Override
|
||||
public void onSelectedItem(Item item) {
|
||||
Log.debug("Listener Selected Item " + item);
|
||||
selectedItem = item;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Throwable throwable) {
|
||||
Log.error(throwable.getLocalizedMessage());
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAborted() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNotValidSelection() {
|
||||
selectedItem = null;
|
||||
}
|
||||
};
|
||||
|
||||
wsResourcesExplorerPanel
|
||||
.addWorkspaceExplorerSelectNotificationListener(wsResourceExplorerListener);
|
||||
wsResourcesExplorerPanel.ensureDebugId("wsResourceExplorerPanel");
|
||||
wsResourcesExplorerPanel.setHeightToInternalScroll(300);
|
||||
|
||||
// DND
|
||||
|
||||
dnd = new MultipleDNDUpload();
|
||||
dnd.setParameters(event.getDataMinerWorkArea().getInputDataSets()
|
||||
.getFolder().getId(), UPLOAD_TYPE.File);
|
||||
dnd.addUniqueContainer(wsResourcesExplorerPanel);
|
||||
WorskpaceUploadNotificationListener workspaceUploaderListener = new WorskpaceUploadNotificationListener() {
|
||||
|
||||
@Override
|
||||
public void onUploadCompleted(String parentId, String itemId) {
|
||||
Log.debug("Upload completed: [parentID: " + parentId
|
||||
+ ", itemId: " + itemId + "]");
|
||||
wsResourcesExplorerPanel.refreshRootFolderView();
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUploadAborted(String parentId, String itemId) {
|
||||
Log.debug("Upload Aborted: [parentID: " + parentId
|
||||
+ ", itemId: " + itemId + "]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String parentId, String itemId,
|
||||
Throwable throwable) {
|
||||
Log.debug("Upload Error: [parentID: " + parentId
|
||||
+ ", itemId: " + itemId + "]");
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOverwriteCompleted(String parentId, String itemId) {
|
||||
Log.debug("Upload Override Completed: [parentID: "
|
||||
+ parentId + ", itemId: " + itemId + "]");
|
||||
wsResourcesExplorerPanel.refreshRootFolderView();
|
||||
forceLayout();
|
||||
}
|
||||
};
|
||||
|
||||
dnd.addWorkspaceUploadNotificationListener(workspaceUploaderListener);
|
||||
|
||||
// ToolBar
|
||||
btnDownload = new TextButton("Download");
|
||||
btnDownload.setIcon(DataMinerManager.resources.download());
|
||||
btnDownload.setScale(ButtonScale.SMALL);
|
||||
btnDownload.setIconAlign(IconAlign.LEFT);
|
||||
btnDownload.setToolTip("Download");
|
||||
btnDownload.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
downloadFile();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
btnDelete = new TextButton("Delete");
|
||||
btnDelete.setIcon(DataMinerManager.resources.deleteCircle());
|
||||
btnDelete.setScale(ButtonScale.SMALL);
|
||||
btnDelete.setIconAlign(IconAlign.LEFT);
|
||||
btnDelete.setToolTip("Delete");
|
||||
btnDelete.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
deleteItem(event);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
btnRefresh = new TextButton("Refresh");
|
||||
btnRefresh.setIcon(DataMinerManager.resources.refresh());
|
||||
btnRefresh.setScale(ButtonScale.SMALL);
|
||||
btnRefresh.setIconAlign(IconAlign.LEFT);
|
||||
btnRefresh.setToolTip("Refresh");
|
||||
btnRefresh.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
refreshWSResourceExplorerPanel();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
final ToolBar toolBar = new ToolBar();
|
||||
toolBar.add(btnDownload, new BoxLayoutData(new Margins(0)));
|
||||
toolBar.add(btnDelete, new BoxLayoutData(new Margins(0)));
|
||||
toolBar.add(btnRefresh, new BoxLayoutData(new Margins(0)));
|
||||
|
||||
v = new VerticalLayoutContainer();
|
||||
v.setItemId("InputDataSetsPanelVert");
|
||||
|
||||
v.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
v.add(dnd, new VerticalLayoutData(1, 1, new Margins(0)));
|
||||
add(v);
|
||||
|
||||
v.addResizeHandler(new ResizeHandler() {
|
||||
|
||||
@Override
|
||||
public void onResize(ResizeEvent event) {
|
||||
int scrollBarHeight = event.getHeight()
|
||||
- toolBar.getElement().getHeight(false);
|
||||
Log.debug("ScrollBarHeight: " + scrollBarHeight);
|
||||
wsResourcesExplorerPanel
|
||||
.setHeightToInternalScroll(scrollBarHeight);
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
});
|
||||
forceLayout();
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.error("Error opening wsResourceExplorerPanel");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshWSResourceExplorerPanel() {
|
||||
if (wsResourcesExplorerPanel != null) {
|
||||
wsResourcesExplorerPanel.refreshRootFolderView();
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshWSResourceExplorerPanel(DataMinerWorkAreaEvent event) {
|
||||
try {
|
||||
|
||||
if (v != null) {
|
||||
remove(v);
|
||||
create(event);
|
||||
} else {
|
||||
create(event);
|
||||
}
|
||||
|
||||
} catch (Throwable e) {
|
||||
Log.error("Error in InputDataSetsPanel: " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteItem(SelectEvent event) {
|
||||
ItemDescription itemDescription = new ItemDescription(
|
||||
selectedItem.getId(), selectedItem.getName(),
|
||||
selectedItem.getOwner(), selectedItem.getPath(), selectedItem
|
||||
.getType().name());
|
||||
DeleteItemRequestEvent deleteItemEvent = new DeleteItemRequestEvent(
|
||||
DataMinerWorkAreaElementType.InputDataSets, itemDescription);
|
||||
EventBusProvider.INSTANCE.fireEvent(deleteItemEvent);
|
||||
Log.debug("Fired: " + deleteItemEvent);
|
||||
}
|
||||
|
||||
private void downloadFile() {
|
||||
if (selectedItem != null) {
|
||||
if (selectedItem.isFolder()) {
|
||||
StringBuilder actionUrl = new StringBuilder();
|
||||
actionUrl.append(GWT.getModuleBaseURL());
|
||||
actionUrl
|
||||
.append(Constants.DOWNLOAD_FOLDER_SERVLET
|
||||
+ "?"
|
||||
+ Constants.DOWNLOAD_FOLDER_SERVLET_ITEM_ID_PARAMETER
|
||||
+ "="
|
||||
+ selectedItem.getId()
|
||||
+ "&"
|
||||
+ Constants.DOWNLOAD_FOLDER_SERVLET_FOLDER_NAME_PARAMETER
|
||||
+ "=" + selectedItem.getName() + "&"
|
||||
+ Constants.CURR_GROUP_ID + "="
|
||||
+ GCubeClientContext.getCurrentContextId());
|
||||
|
||||
Log.debug("Retrieved link: " + actionUrl);
|
||||
Window.open(actionUrl.toString(), selectedItem.getName(), "");
|
||||
} else {
|
||||
|
||||
final ItemDescription itemDescription = new ItemDescription(
|
||||
selectedItem.getId(), selectedItem.getName(),
|
||||
selectedItem.getOwner(), selectedItem.getPath(),
|
||||
selectedItem.getType().name());
|
||||
|
||||
DataMinerPortletServiceAsync.INSTANCE.getPublicLink(
|
||||
itemDescription, new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof SessionExpiredServiceException) {
|
||||
EventBusProvider.INSTANCE
|
||||
.fireEvent(new SessionExpiredEvent());
|
||||
} else {
|
||||
Log.error("Error open file: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String link) {
|
||||
Log.debug("Retrieved link: " + link);
|
||||
Window.open(link, itemDescription.getName(), "");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
} else {
|
||||
UtilsGXT3.info("Attention", "Select a file!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,470 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.dataspace;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portal.clientcontext.client.GCubeClientContext;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.DataMinerManager;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.DataMinerWorkAreaEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.DeleteItemRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.RefreshDataMinerWorkAreaEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.SessionExpiredEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.UIStateEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.rpc.DataMinerPortletServiceAsync;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.DataMinerWorkAreaElementType;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.util.UtilsGXT3;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.Constants;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.exception.SessionExpiredServiceException;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.workspace.ItemDescription;
|
||||
import org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploadNotification.WorskpaceUploadNotificationListener;
|
||||
import org.gcube.portlets.widgets.workspaceuploader.client.uploader.DialogUpload.UPLOAD_TYPE;
|
||||
import org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.explore.WorkspaceResourcesExplorerPanel;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.view.grid.ItemsTable.DISPLAY_FIELD;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.logical.shared.ResizeEvent;
|
||||
import com.google.gwt.event.logical.shared.ResizeHandler;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sencha.gxt.cell.core.client.ButtonCell.ButtonScale;
|
||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||
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.BoxLayoutContainer.BoxLayoutData;
|
||||
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.ToolBar;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class OutputDataSetsPanel extends FramedPanel {
|
||||
|
||||
private Item selectedItem;
|
||||
private MultipleDNDUpload dnd;
|
||||
private WorkspaceResourcesExplorerPanel wsResourcesExplorerPanel;
|
||||
private TextButton btnDownload;
|
||||
private TextButton btnDelete;
|
||||
private TextButton btnRefresh;
|
||||
private VerticalLayoutContainer v;
|
||||
|
||||
public OutputDataSetsPanel() {
|
||||
super();
|
||||
Log.debug("OutputDataSetsPanel");
|
||||
|
||||
// msgs = GWT.create(ServiceCategoryMessages.class);
|
||||
init();
|
||||
bindToEvents();
|
||||
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setItemId("OutputDataSetsPanel");
|
||||
forceLayoutOnResize = true;
|
||||
setBodyBorder(false);
|
||||
setBorders(false);
|
||||
setHeaderVisible(false);
|
||||
setResize(true);
|
||||
setAnimCollapse(false);
|
||||
setHeadingText("Output Data Sets");
|
||||
setBodyStyle("backgroundColor:white;");
|
||||
}
|
||||
|
||||
private void bindToEvents() {
|
||||
|
||||
EventBusProvider.INSTANCE.addHandler(UIStateEvent.TYPE,
|
||||
new UIStateEvent.UIStateEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(UIStateEvent event) {
|
||||
manageStateEvents(event);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
EventBusProvider.INSTANCE.addHandler(DataMinerWorkAreaEvent.TYPE,
|
||||
new DataMinerWorkAreaEvent.DataMinerWorkAreaEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(DataMinerWorkAreaEvent event) {
|
||||
manageDataMinerWorkAreaEvents(event);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
EventBusProvider.INSTANCE
|
||||
.addHandler(
|
||||
RefreshDataMinerWorkAreaEvent.TYPE,
|
||||
new RefreshDataMinerWorkAreaEvent.RefreshDataMinerWorkAreaEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onRefresh(
|
||||
RefreshDataMinerWorkAreaEvent event) {
|
||||
manageRefreshDataMinerWorkAreaEvents(event);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void manageStateEvents(UIStateEvent event) {
|
||||
Log.debug("OutputDataSetsPanel recieved UIStateEvent: " + event);
|
||||
if (event == null) {
|
||||
Log.error("UIStateEvent");
|
||||
return;
|
||||
}
|
||||
switch (event.getUiStateType()) {
|
||||
case START:
|
||||
break;
|
||||
case WAITING:
|
||||
break;
|
||||
case UPDATE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void manageDataMinerWorkAreaEvents(DataMinerWorkAreaEvent event) {
|
||||
Log.debug("OutputDataSetsPanel recieved DataMinerWorkAreaEvent: "
|
||||
+ event);
|
||||
if (event == null) {
|
||||
Log.error("DataMinerWorkAreaEvent");
|
||||
return;
|
||||
}
|
||||
switch (event.getDataMinerWorkAreaRegionType()) {
|
||||
case Computations:
|
||||
break;
|
||||
case DataSets:
|
||||
manageMyDataMinerWorkAreaEvents(event);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void manageMyDataMinerWorkAreaEvents(DataMinerWorkAreaEvent event) {
|
||||
switch (event.getDataMinerWorkAreaEventType()) {
|
||||
case OPEN:
|
||||
case UPDATE:
|
||||
refreshWSResourceExplorerPanel(event);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void manageRefreshDataMinerWorkAreaEvents(
|
||||
RefreshDataMinerWorkAreaEvent event) {
|
||||
Log.debug("OutputDataSetsPanel recieved RefreshDataMinerWorkAreaEvent: "
|
||||
+ event);
|
||||
if (event == null) {
|
||||
Log.error("RefreshDataMinerWorkAreaEvent");
|
||||
return;
|
||||
}
|
||||
switch (event.getDataMinerWorkAreaElementType()) {
|
||||
case Computations:
|
||||
break;
|
||||
case InputDataSets:
|
||||
break;
|
||||
case OutputDataSets:
|
||||
refreshWSResourceExplorerPanel();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void create(DataMinerWorkAreaEvent event) {
|
||||
try {
|
||||
|
||||
if (event == null
|
||||
|| event.getDataMinerWorkArea() == null
|
||||
|| event.getDataMinerWorkArea().getOutputDataSets() == null
|
||||
|| event.getDataMinerWorkArea().getOutputDataSets()
|
||||
.getFolder() == null
|
||||
|| event.getDataMinerWorkArea().getOutputDataSets()
|
||||
.getFolder().getId() == null
|
||||
|| event.getDataMinerWorkArea().getOutputDataSets()
|
||||
.getFolder().getId().isEmpty()) {
|
||||
if (v != null) {
|
||||
remove(v);
|
||||
forceLayout();
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
List<String> showProperties = new ArrayList<String>();
|
||||
for (DataSpacePropertiesType dataSpaceProperties : DataSpacePropertiesType
|
||||
.values()) {
|
||||
showProperties.add(dataSpaceProperties.getLabel());
|
||||
}
|
||||
FilterCriteria filterCriteria = new FilterCriteria();
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
filterCriteria.setRequiredProperties(map);
|
||||
|
||||
wsResourcesExplorerPanel = new WorkspaceResourcesExplorerPanel(
|
||||
event.getDataMinerWorkArea().getOutputDataSets()
|
||||
.getFolder().getId(), false, showProperties,
|
||||
filterCriteria, true, DISPLAY_FIELD.CREATION_DATE);
|
||||
|
||||
WorskpaceExplorerSelectNotificationListener wsResourceExplorerListener = new WorskpaceExplorerSelectNotificationListener() {
|
||||
@Override
|
||||
public void onSelectedItem(Item item) {
|
||||
Log.debug("Listener Selected Item " + item);
|
||||
selectedItem = item;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(Throwable throwable) {
|
||||
Log.error(throwable.getLocalizedMessage());
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAborted() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNotValidSelection() {
|
||||
selectedItem = null;
|
||||
}
|
||||
};
|
||||
|
||||
wsResourcesExplorerPanel
|
||||
.addWorkspaceExplorerSelectNotificationListener(wsResourceExplorerListener);
|
||||
wsResourcesExplorerPanel.ensureDebugId("wsResourceExplorerPanel");
|
||||
wsResourcesExplorerPanel.setHeightToInternalScroll(300);
|
||||
|
||||
// DND
|
||||
|
||||
dnd = new MultipleDNDUpload();
|
||||
dnd.setParameters(event.getDataMinerWorkArea().getOutputDataSets()
|
||||
.getFolder().getId(), UPLOAD_TYPE.File);
|
||||
dnd.addUniqueContainer(wsResourcesExplorerPanel);
|
||||
WorskpaceUploadNotificationListener workspaceUploaderListener = new WorskpaceUploadNotificationListener() {
|
||||
|
||||
@Override
|
||||
public void onUploadCompleted(String parentId, String itemId) {
|
||||
Log.debug("Upload completed: [parentID: " + parentId
|
||||
+ ", itemId: " + itemId + "]");
|
||||
wsResourcesExplorerPanel.refreshRootFolderView();
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUploadAborted(String parentId, String itemId) {
|
||||
Log.debug("Upload Aborted: [parentID: " + parentId
|
||||
+ ", itemId: " + itemId + "]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String parentId, String itemId,
|
||||
Throwable throwable) {
|
||||
Log.debug("Upload Error: [parentID: " + parentId
|
||||
+ ", itemId: " + itemId + "]");
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOverwriteCompleted(String parentId, String itemId) {
|
||||
Log.debug("Upload Override Completed: [parentID: "
|
||||
+ parentId + ", itemId: " + itemId + "]");
|
||||
wsResourcesExplorerPanel.refreshRootFolderView();
|
||||
forceLayout();
|
||||
}
|
||||
};
|
||||
|
||||
dnd.addWorkspaceUploadNotificationListener(workspaceUploaderListener);
|
||||
|
||||
// ToolBar
|
||||
btnDownload = new TextButton("Download");
|
||||
btnDownload.setIcon(DataMinerManager.resources.download());
|
||||
btnDownload.setScale(ButtonScale.SMALL);
|
||||
btnDownload.setIconAlign(IconAlign.LEFT);
|
||||
btnDownload.setToolTip("Download");
|
||||
btnDownload.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
downloadFile();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
btnDelete = new TextButton("Delete");
|
||||
btnDelete.setIcon(DataMinerManager.resources.deleteCircle());
|
||||
btnDelete.setScale(ButtonScale.SMALL);
|
||||
btnDelete.setIconAlign(IconAlign.LEFT);
|
||||
btnDelete.setToolTip("Delete");
|
||||
btnDelete.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
deleteItem(event);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
btnRefresh = new TextButton("Refresh");
|
||||
btnRefresh.setIcon(DataMinerManager.resources.refresh());
|
||||
btnRefresh.setScale(ButtonScale.SMALL);
|
||||
btnRefresh.setIconAlign(IconAlign.LEFT);
|
||||
btnRefresh.setToolTip("Refresh");
|
||||
btnRefresh.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
refreshWSResourceExplorerPanel();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
final ToolBar toolBar = new ToolBar();
|
||||
toolBar.add(btnDownload, new BoxLayoutData(new Margins(0)));
|
||||
toolBar.add(btnDelete, new BoxLayoutData(new Margins(0)));
|
||||
toolBar.add(btnRefresh, new BoxLayoutData(new Margins(0)));
|
||||
|
||||
v = new VerticalLayoutContainer();
|
||||
|
||||
v.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
v.add(dnd, new VerticalLayoutData(1, 1, new Margins(0)));
|
||||
add(v);
|
||||
|
||||
v.addResizeHandler(new ResizeHandler() {
|
||||
|
||||
@Override
|
||||
public void onResize(ResizeEvent event) {
|
||||
int scrollBarHeight = event.getHeight()
|
||||
- toolBar.getElement().getHeight(false);
|
||||
Log.debug("ScrollBarHeight: " + scrollBarHeight);
|
||||
wsResourcesExplorerPanel
|
||||
.setHeightToInternalScroll(scrollBarHeight);
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
});
|
||||
forceLayout();
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.error("Error opening wsResourceExplorerPanel");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshWSResourceExplorerPanel() {
|
||||
if (wsResourcesExplorerPanel != null) {
|
||||
wsResourcesExplorerPanel.refreshRootFolderView();
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshWSResourceExplorerPanel(DataMinerWorkAreaEvent event) {
|
||||
try {
|
||||
|
||||
if (v != null) {
|
||||
remove(v);
|
||||
create(event);
|
||||
} else {
|
||||
create(event);
|
||||
}
|
||||
|
||||
} catch (Throwable e) {
|
||||
Log.error("Error in OutputDataSetsPanel: "
|
||||
+ e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteItem(SelectEvent event) {
|
||||
ItemDescription itemDescription = new ItemDescription(
|
||||
selectedItem.getId(), selectedItem.getName(),
|
||||
selectedItem.getOwner(), selectedItem.getPath(), selectedItem
|
||||
.getType().name());
|
||||
DeleteItemRequestEvent deleteItemEvent = new DeleteItemRequestEvent(
|
||||
DataMinerWorkAreaElementType.OutputDataSets, itemDescription);
|
||||
EventBusProvider.INSTANCE.fireEvent(deleteItemEvent);
|
||||
Log.debug("Fired: " + deleteItemEvent);
|
||||
}
|
||||
|
||||
private void downloadFile() {
|
||||
if (selectedItem != null) {
|
||||
if (selectedItem.isFolder()) {
|
||||
StringBuilder actionUrl = new StringBuilder();
|
||||
actionUrl.append(GWT.getModuleBaseURL());
|
||||
actionUrl
|
||||
.append(Constants.DOWNLOAD_FOLDER_SERVLET
|
||||
+ "?"
|
||||
+ Constants.DOWNLOAD_FOLDER_SERVLET_ITEM_ID_PARAMETER
|
||||
+ "="
|
||||
+ selectedItem.getId()
|
||||
+ "&"
|
||||
+ Constants.DOWNLOAD_FOLDER_SERVLET_FOLDER_NAME_PARAMETER
|
||||
+ "=" + selectedItem.getName() + "&"
|
||||
+ Constants.CURR_GROUP_ID + "="
|
||||
+ GCubeClientContext.getCurrentContextId());
|
||||
|
||||
Log.debug("Retrieved link: " + actionUrl);
|
||||
Window.open(actionUrl.toString(), selectedItem.getName(), "");
|
||||
} else {
|
||||
final ItemDescription itemDescription = new ItemDescription(
|
||||
selectedItem.getId(), selectedItem.getName(),
|
||||
selectedItem.getOwner(), selectedItem.getPath(),
|
||||
selectedItem.getType().name());
|
||||
|
||||
DataMinerPortletServiceAsync.INSTANCE.getPublicLink(
|
||||
itemDescription, new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof SessionExpiredServiceException) {
|
||||
EventBusProvider.INSTANCE
|
||||
.fireEvent(new SessionExpiredEvent());
|
||||
} else {
|
||||
Log.error("Error open file: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String link) {
|
||||
Log.debug("Retrieved link: " + link);
|
||||
Window.open(link, itemDescription.getName(), "");
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
UtilsGXT3.info("Attention", "Select a file!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.events;
|
||||
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.events;
|
||||
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.events;
|
||||
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.DataMinerWorkAreaEventType;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.DataMinerWorkAreaRegionType;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.workspace.DataMinerWorkArea;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Data Miner Work Area Event
|
||||
*
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class DataMinerWorkAreaEvent extends
|
||||
GwtEvent<DataMinerWorkAreaEvent.DataMinerWorkAreaEventHandler> {
|
||||
|
||||
public static Type<DataMinerWorkAreaEventHandler> TYPE = new Type<DataMinerWorkAreaEventHandler>();
|
||||
private DataMinerWorkAreaEventType dataMinerWorkAreaEventType;
|
||||
private DataMinerWorkAreaRegionType dataMinerWorkAreaRegionType;
|
||||
private DataMinerWorkArea dataMinerWorkArea;
|
||||
|
||||
public interface DataMinerWorkAreaEventHandler extends EventHandler {
|
||||
void onChange(DataMinerWorkAreaEvent event);
|
||||
}
|
||||
|
||||
public interface HasDataMinerWorkAreaEventHandler extends HasHandlers {
|
||||
public HandlerRegistration addDataMinerWorkAreaEventHandler(
|
||||
DataMinerWorkAreaEventHandler handler);
|
||||
}
|
||||
|
||||
public DataMinerWorkAreaEvent(
|
||||
DataMinerWorkAreaEventType dataMinerWorkAreaEventType,
|
||||
DataMinerWorkAreaRegionType dataMinerWorkAreaRegionType,
|
||||
DataMinerWorkArea dataMinerWorkArea) {
|
||||
this.dataMinerWorkAreaEventType = dataMinerWorkAreaEventType;
|
||||
this.dataMinerWorkAreaRegionType = dataMinerWorkAreaRegionType;
|
||||
this.dataMinerWorkArea = dataMinerWorkArea;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatch(DataMinerWorkAreaEventHandler handler) {
|
||||
handler.onChange(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type<DataMinerWorkAreaEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static Type<DataMinerWorkAreaEventHandler> getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static void fire(HasHandlers source,
|
||||
DataMinerWorkAreaEvent dataMinerWorkAreaEvent) {
|
||||
source.fireEvent(dataMinerWorkAreaEvent);
|
||||
}
|
||||
|
||||
public DataMinerWorkAreaEventType getDataMinerWorkAreaEventType() {
|
||||
return dataMinerWorkAreaEventType;
|
||||
}
|
||||
|
||||
public DataMinerWorkArea getDataMinerWorkArea() {
|
||||
return dataMinerWorkArea;
|
||||
}
|
||||
|
||||
public DataMinerWorkAreaRegionType getDataMinerWorkAreaRegionType() {
|
||||
return dataMinerWorkAreaRegionType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DataMinerWorkAreaEvent [dataMinerWorkAreaEventType="
|
||||
+ dataMinerWorkAreaEventType + ", dataMinerWorkAreaRegionType="
|
||||
+ dataMinerWorkAreaRegionType + ", dataMinerWorkArea="
|
||||
+ dataMinerWorkArea + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.events;
|
||||
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.DataMinerWorkAreaRegionType;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.DataMinerWorkAreaRequestEventType;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Data Miner Work Area Request Event
|
||||
*
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class DataMinerWorkAreaRequestEvent
|
||||
extends
|
||||
GwtEvent<DataMinerWorkAreaRequestEvent.DataMinerWorkAreaRequestEventHandler> {
|
||||
|
||||
public static Type<DataMinerWorkAreaRequestEventHandler> TYPE = new Type<DataMinerWorkAreaRequestEventHandler>();
|
||||
private DataMinerWorkAreaRequestEventType dataMinerWorkAreaRequestEventType;
|
||||
private DataMinerWorkAreaRegionType dataMinerWorkAreaRegionType;
|
||||
|
||||
public interface DataMinerWorkAreaRequestEventHandler extends EventHandler {
|
||||
void onRequest(DataMinerWorkAreaRequestEvent event);
|
||||
}
|
||||
|
||||
public interface HasDataMinerWorkAreaRequestEventHandler extends
|
||||
HasHandlers {
|
||||
public HandlerRegistration addDataMinerWorkAreaRequestEventHandler(
|
||||
DataMinerWorkAreaRequestEventHandler handler);
|
||||
}
|
||||
|
||||
public DataMinerWorkAreaRequestEvent(
|
||||
DataMinerWorkAreaRequestEventType dataMinerWorkAreaRequestEventType,
|
||||
DataMinerWorkAreaRegionType dataMinerWorkAreaRegionType) {
|
||||
this.dataMinerWorkAreaRequestEventType = dataMinerWorkAreaRequestEventType;
|
||||
this.dataMinerWorkAreaRegionType = dataMinerWorkAreaRegionType;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatch(DataMinerWorkAreaRequestEventHandler handler) {
|
||||
handler.onRequest(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type<DataMinerWorkAreaRequestEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static Type<DataMinerWorkAreaRequestEventHandler> getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static void fire(HasHandlers source,
|
||||
DataMinerWorkAreaRequestEvent event) {
|
||||
source.fireEvent(event);
|
||||
}
|
||||
|
||||
public DataMinerWorkAreaRequestEventType getDataMinerWorkAreaRequestEventType() {
|
||||
return dataMinerWorkAreaRequestEventType;
|
||||
}
|
||||
|
||||
public DataMinerWorkAreaRegionType getDataMinerWorkAreaRegionType() {
|
||||
return dataMinerWorkAreaRegionType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DataMinerWorkAreaRequestEvent [dataMinerWorkAreaRequestEventType="
|
||||
+ dataMinerWorkAreaRequestEventType
|
||||
+ ", dataMinerWorkAreaRegionType="
|
||||
+ dataMinerWorkAreaRegionType + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.events;
|
||||
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.DataMinerWorkAreaElementType;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.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;
|
||||
|
||||
/**
|
||||
* Delete Item Request Event
|
||||
*
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.events;
|
||||
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.events;
|
||||
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.events;
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorsClassification;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.OperatorsClassificationRequestType;
|
||||
|
||||
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 Event
|
||||
*
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class OperatorsClassificationEvent
|
||||
extends
|
||||
GwtEvent<OperatorsClassificationEvent.OperatorsClassificationEventHandler> {
|
||||
|
||||
public static Type<OperatorsClassificationEventHandler> TYPE = new Type<OperatorsClassificationEventHandler>();
|
||||
private OperatorsClassificationRequestType operatorsClassificationRequestType;
|
||||
private String classificationName;
|
||||
private OperatorsClassification operatorsClassification;
|
||||
private String operatorId;
|
||||
|
||||
public interface OperatorsClassificationEventHandler extends EventHandler {
|
||||
void onOperatorsClassification(OperatorsClassificationEvent event);
|
||||
}
|
||||
|
||||
public interface HasOperatorsClassificationEventHandler extends HasHandlers {
|
||||
public HandlerRegistration addOperatorsClassificationEventHandler(
|
||||
OperatorsClassificationEventHandler handler);
|
||||
}
|
||||
|
||||
public OperatorsClassificationEvent(
|
||||
OperatorsClassification operatorsClassification) {
|
||||
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.Default;
|
||||
this.operatorsClassification = operatorsClassification;
|
||||
this.operatorId = null;
|
||||
}
|
||||
|
||||
public OperatorsClassificationEvent(String classificationName,
|
||||
OperatorsClassification operatorsClassification) {
|
||||
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.ByName;
|
||||
this.classificationName = classificationName;
|
||||
this.operatorsClassification = operatorsClassification;
|
||||
this.operatorId = null;
|
||||
}
|
||||
|
||||
public OperatorsClassificationEvent(
|
||||
OperatorsClassification operatorsClassification, String operatorId) {
|
||||
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.Default;
|
||||
this.operatorsClassification = operatorsClassification;
|
||||
this.operatorId = operatorId;
|
||||
}
|
||||
|
||||
public OperatorsClassificationEvent(String classificationName,
|
||||
OperatorsClassification operatorsClassification, String operatorId) {
|
||||
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.ByName;
|
||||
this.classificationName = classificationName;
|
||||
this.operatorsClassification = operatorsClassification;
|
||||
this.operatorId = operatorId;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatch(OperatorsClassificationEventHandler handler) {
|
||||
handler.onOperatorsClassification(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type<OperatorsClassificationEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static Type<OperatorsClassificationEventHandler> getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static void fire(HasHandlers source,
|
||||
OperatorsClassificationEvent event) {
|
||||
source.fireEvent(event);
|
||||
}
|
||||
|
||||
public OperatorsClassificationRequestType getOperatorsClassificationRequestType() {
|
||||
return operatorsClassificationRequestType;
|
||||
}
|
||||
|
||||
public String getClassificationName() {
|
||||
return classificationName;
|
||||
}
|
||||
|
||||
public OperatorsClassification getOperatorsClassification() {
|
||||
return operatorsClassification;
|
||||
}
|
||||
|
||||
public String getOperatorId() {
|
||||
return operatorId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OperatorsClassificationEvent [operatorsClassificationRequestType="
|
||||
+ operatorsClassificationRequestType
|
||||
+ ", classificationName="
|
||||
+ classificationName
|
||||
+ ", operatorsClassification="
|
||||
+ operatorsClassification + ", operatorId=" + operatorId + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.events;
|
||||
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.OperatorsClassificationRequestType;
|
||||
|
||||
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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class OperatorsClassificationRequestEvent
|
||||
extends
|
||||
GwtEvent<OperatorsClassificationRequestEvent.OperatorsClassificationRequestEventHandler> {
|
||||
|
||||
public static Type<OperatorsClassificationRequestEventHandler> TYPE = new Type<OperatorsClassificationRequestEventHandler>();
|
||||
private OperatorsClassificationRequestType operatorsClassificationRequestType;
|
||||
private String classificationName;
|
||||
private boolean operatorId;
|
||||
|
||||
public interface OperatorsClassificationRequestEventHandler extends
|
||||
EventHandler {
|
||||
void onRequest(OperatorsClassificationRequestEvent event);
|
||||
}
|
||||
|
||||
public interface HasOperatorsClassificationRequestEventHandler extends
|
||||
HasHandlers {
|
||||
public HandlerRegistration addOperatorsClassificationRequestEventHandler(
|
||||
OperatorsClassificationRequestEventHandler handler);
|
||||
}
|
||||
|
||||
/*public OperatorsClassificationRequestEvent() {
|
||||
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.Default;
|
||||
this.operatorId = false;
|
||||
}*/
|
||||
|
||||
public OperatorsClassificationRequestEvent(String classificationName,
|
||||
boolean operatorId) {
|
||||
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.ByName;
|
||||
this.classificationName = classificationName;
|
||||
this.operatorId = operatorId;
|
||||
}
|
||||
|
||||
/*public OperatorsClassificationRequestEvent(String classificationName) {
|
||||
this.operatorsClassificationRequestType = OperatorsClassificationRequestType.ByName;
|
||||
this.classificationName = classificationName;
|
||||
this.operatorId = false;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
protected void dispatch(OperatorsClassificationRequestEventHandler handler) {
|
||||
handler.onRequest(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type<OperatorsClassificationRequestEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static Type<OperatorsClassificationRequestEventHandler> getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static void fire(HasHandlers source,
|
||||
OperatorsClassificationRequestEvent event) {
|
||||
source.fireEvent(event);
|
||||
}
|
||||
|
||||
public OperatorsClassificationRequestType getOperatorsClassificationRequestType() {
|
||||
return operatorsClassificationRequestType;
|
||||
}
|
||||
|
||||
public String getClassificationName() {
|
||||
return classificationName;
|
||||
}
|
||||
|
||||
public boolean isOperatorId() {
|
||||
return operatorId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OperatorsClassificationRequestEvent [operatorsClassificationRequestType="
|
||||
+ operatorsClassificationRequestType
|
||||
+ ", classificationName="
|
||||
+ classificationName + ", operatorId=" + operatorId + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.events;
|
||||
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.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;
|
||||
|
||||
/**
|
||||
* Refresh DataMiner Work Area Event
|
||||
*
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class RefreshDataMinerWorkAreaEvent extends
|
||||
GwtEvent<RefreshDataMinerWorkAreaEvent.RefreshDataMinerWorkAreaEventHandler> {
|
||||
|
||||
public static Type<RefreshDataMinerWorkAreaEventHandler> TYPE = new Type<RefreshDataMinerWorkAreaEventHandler>();
|
||||
private DataMinerWorkAreaElementType dataMinerWorkAreaElementType;
|
||||
|
||||
public interface RefreshDataMinerWorkAreaEventHandler extends EventHandler {
|
||||
void onRefresh(RefreshDataMinerWorkAreaEvent event);
|
||||
}
|
||||
|
||||
public interface HasRefreshDataMinerWorkAreaEventHandler extends HasHandlers {
|
||||
public HandlerRegistration addRefreshDataMinerWorkAreaEventHandler(
|
||||
RefreshDataMinerWorkAreaEventHandler handler);
|
||||
}
|
||||
|
||||
public RefreshDataMinerWorkAreaEvent(
|
||||
DataMinerWorkAreaElementType dataMinerWorkAreaElementType) {
|
||||
this.dataMinerWorkAreaElementType = dataMinerWorkAreaElementType;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatch(RefreshDataMinerWorkAreaEventHandler handler) {
|
||||
handler.onRefresh(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type<RefreshDataMinerWorkAreaEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static Type<RefreshDataMinerWorkAreaEventHandler> getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static void fire(HasHandlers source, RefreshDataMinerWorkAreaEvent deleteItemEvent) {
|
||||
source.fireEvent(deleteItemEvent);
|
||||
}
|
||||
|
||||
public DataMinerWorkAreaElementType getDataMinerWorkAreaElementType() {
|
||||
return dataMinerWorkAreaElementType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RefreshDataMinerWorkAreaEvent [dataMinerWorkAreaElementType="
|
||||
+ dataMinerWorkAreaElementType + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.events;
|
||||
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.events;
|
||||
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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
|
||||
+ "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.events;
|
||||
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.events;
|
||||
|
||||
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.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" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,209 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.experiments;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.DataMinerManager;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.ResubmitComputationExecutionEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.StartComputationExecutionEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.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 email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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(DataMinerManager.resources.removeAll());
|
||||
|
||||
removeAllButton.setToolTip(DELETE_ALL_BUTTON_TOOLTIP);
|
||||
// removeAllButton.setScale(ButtonScale.MEDIUM);
|
||||
removeAllButton.setEnabled(false);
|
||||
|
||||
toolBar.add(new LabelToolItem("Tools:"));
|
||||
toolBar.add(removeAllButton);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,295 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.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.data.analysis.dataminermanagercl.shared.data.output.TableResource;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.OutputDataEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.OutputDataRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.util.UtilsGXT3;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.widgets.FileViewer;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.widgets.ImageViewer;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.widgets.ResourceViewer;
|
||||
|
||||
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 email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,146 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.experiments;
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.DataMinerManager;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.ComputationReadyEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.ComputationReadyEvent.ComputationReadyEventHandler;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.ComputationReadyEvent.HasComputationReadyEventHandler;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.experiments.ComputationParametersPanel.ComputationParametersPanelHandler;
|
||||
|
||||
import com.google.gwt.event.shared.HandlerRegistration;
|
||||
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.FramedPanel;
|
||||
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.CenterLayoutContainer;
|
||||
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;
|
||||
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 email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
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 setToolBar() {
|
||||
toolBar = new ToolBar();
|
||||
toolBar.add(new LabelToolItem("Tools:"));
|
||||
|
||||
removeAllButton = new TextButton(DELETE_ALL_BUTTON_TOOLTIP);
|
||||
removeAllButton.setToolTip(DELETE_ALL_BUTTON_TOOLTIP);
|
||||
removeAllButton.setIcon(DataMinerManager.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(DataMinerManager.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();
|
||||
computationParametersPanel.updateOperatorParametersValues();
|
||||
Operator op = computationParametersPanel.getOperator();
|
||||
ComputationReadyEvent event = new ComputationReadyEvent(op);
|
||||
fireEvent(event);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
addComputationParametersPanel(computationParametersPanel);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,325 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.experiments;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.ColumnListParameter;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.ColumnParameter;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.ParameterType;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.DataMinerManager;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.SessionExpiredEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.parametersfield.AbstractFld;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.parametersfield.ColumnFld;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.parametersfield.ColumnListFld;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.parametersfield.OperatorFieldWidget;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.parametersfield.TabularFld;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.rpc.DataMinerPortletServiceAsync;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.util.UtilsGXT3;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.Constants;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.exception.SessionExpiredServiceException;
|
||||
|
||||
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.rpc.AsyncCallback;
|
||||
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 email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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 = DataMinerManager.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_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(DataMinerManager.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 parametersPanel
|
||||
*/
|
||||
private void loadOperatorParameters() {
|
||||
DataMinerPortletServiceAsync.INSTANCE.getParameters(operator,
|
||||
new AsyncCallback<List<Parameter>>() {
|
||||
@Override
|
||||
public void onSuccess(List<Parameter> result) {
|
||||
Log.debug("Retrieved Parameters!");
|
||||
operator.setOperatorParameters(result);
|
||||
vParameters.clear();
|
||||
showForm();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof SessionExpiredServiceException) {
|
||||
UtilsGXT3.alert("Error", "Expired Session!");
|
||||
EventBusProvider.INSTANCE
|
||||
.fireEvent(new SessionExpiredEvent());
|
||||
} else {
|
||||
|
||||
Log.error("Impossible to retrieve parameters. "
|
||||
+ caught.getLocalizedMessage());
|
||||
caught.printStackTrace();
|
||||
UtilsGXT3.alert("Error ",
|
||||
"Impossible to retrieve parameters. "
|
||||
+ caught.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
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)));
|
||||
}
|
||||
|
||||
for (Parameter p : operator.getOperatorParameters()) {
|
||||
if (p.getTypology().compareTo(ParameterType.COLUMN) == 0
|
||||
|| p.getTypology().compareTo(
|
||||
ParameterType.COLUMN_LIST) == 0) {
|
||||
// search for the table parameter which it depends
|
||||
String tabParamName = (p.getTypology().compareTo(
|
||||
ParameterType.COLUMN) == 0 ? ((ColumnParameter) p)
|
||||
.getReferredTabularParameterName()
|
||||
: ((ColumnListParameter) p)
|
||||
.getReferredTabularParameterName());
|
||||
|
||||
try {
|
||||
// get the column field and the tabular field referred
|
||||
TabularFld tabularField = (TabularFld) fieldWidgetsMap
|
||||
.get(tabParamName).getField();
|
||||
if (tabularField != null) {
|
||||
AbstractFld field = fieldWidgetsMap
|
||||
.get(p.getName()).getField();
|
||||
if (field instanceof ColumnFld) {
|
||||
ColumnFld columnField = (ColumnFld) field;
|
||||
tabularField
|
||||
.addTabularFldChangeEventHandler(columnField);
|
||||
} else {
|
||||
if (field instanceof ColumnListFld) {
|
||||
ColumnListFld columnListField = (ColumnListFld) field;
|
||||
tabularField
|
||||
.addTabularFldChangeEventHandler(columnListField);
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
UtilsGXT3
|
||||
.alert("Error",
|
||||
"Column parameter \""
|
||||
+ p.getName()
|
||||
+ " refers to a tabular parameter that doesn't exists ("
|
||||
+ tabParamName + ")\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
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.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateOperatorParametersValues() {
|
||||
for (Map.Entry<String, OperatorFieldWidget> entry : fieldWidgetsMap
|
||||
.entrySet()) {
|
||||
OperatorFieldWidget fieldWidget = entry.getValue();
|
||||
fieldWidget.updateOperatorParameterValue();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the operator
|
||||
*/
|
||||
public Operator getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
public void setHandler(ComputationParametersPanelHandler handler) {
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,316 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.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.widgets.dataminermanagerwidget.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.custom.progress.GreenProgressBar;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.custom.progress.OrangeProgressBar;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.custom.progress.RedProgressBar;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.CancelComputationExecutionRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.rpc.DataMinerPortletServiceAsync;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.util.UtilsGXT3;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.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 email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
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() + " [<a href='"
|
||||
+ computationId.getUrlId() + "' >link</a>]</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();
|
||||
}
|
||||
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 .....");
|
||||
DataMinerPortletServiceAsync.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();
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.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 email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.experiments;
|
||||
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ExperimentPanel extends SimpleContainer implements
|
||||
OperatorsPanelHandler {
|
||||
|
||||
private WorkflowPanel workflowPanel;
|
||||
private OperatorsPanel operatorsPanel;
|
||||
private OperatorPanel lastOperatorSelected = null;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public ExperimentPanel() {
|
||||
super();
|
||||
init();
|
||||
create();
|
||||
|
||||
}
|
||||
|
||||
private void init() {
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
// West
|
||||
|
||||
BorderLayoutData westData = new BorderLayoutData(320);
|
||||
westData.setCollapsible(true);
|
||||
westData.setSplit(true);
|
||||
westData.setFloatable(false);
|
||||
westData.setCollapseMini(false);
|
||||
westData.setMargins(new Margins(0, 5, 0, 0));
|
||||
westData.setCollapseHidden(false);
|
||||
|
||||
experimentPanelLayout.setWestWidget(operatorsPanel, westData);
|
||||
|
||||
add(experimentPanelLayout, new MarginData(0));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void addOperator(OperatorPanel operatorPanel, Operator operator) {
|
||||
if (lastOperatorSelected != null
|
||||
&& lastOperatorSelected != operatorPanel)
|
||||
lastOperatorSelected.toggleSelected(false);
|
||||
if (lastOperatorSelected != operatorPanel)
|
||||
operatorPanel.toggleSelected(true);
|
||||
lastOperatorSelected = operatorPanel;
|
||||
workflowPanel.addOperator(operator);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,177 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.experiments;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorCategory;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.sencha.gxt.core.client.Style.Side;
|
||||
import com.sencha.gxt.core.client.util.Format;
|
||||
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.tips.ToolTipConfig;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class OperatorCategoryPanel extends SimpleContainer {
|
||||
|
||||
private List<OperatorPanel> operatorPanelsList = null;
|
||||
private OperatorsPanelHandler handler;
|
||||
private static final int TOOLTIP_WIDTH = 300;
|
||||
private boolean isCollapsed = true;
|
||||
private OperatorCategory category;
|
||||
private HtmlLayoutContainer categoryHtml;
|
||||
private VerticalLayoutContainer v;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param handler
|
||||
* @param cat
|
||||
*/
|
||||
public OperatorCategoryPanel(OperatorsPanelHandler handler, OperatorCategory cat) {
|
||||
super();
|
||||
this.handler = handler;
|
||||
this.category = cat;
|
||||
create();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public OperatorCategory getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void create(){
|
||||
v=new VerticalLayoutContainer();
|
||||
add(v);
|
||||
// set category info
|
||||
categoryHtml = new HtmlLayoutContainer(category.getName() + " <span class='counter'>("+category.getOperators().size()+")</span>");
|
||||
categoryHtml.addStyleName("categoryItem");
|
||||
categoryHtml.addStyleName("categoryItem-Collapsed");
|
||||
ToolTipConfig tooltipConfig = createToolTip(category);
|
||||
categoryHtml.setToolTipConfig(tooltipConfig);
|
||||
|
||||
addDomHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
switchOpenClose();
|
||||
|
||||
}
|
||||
|
||||
}, ClickEvent.getType());
|
||||
|
||||
v.add(categoryHtml);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param cat
|
||||
* @return
|
||||
*/
|
||||
private ToolTipConfig createToolTip(OperatorCategory cat) {
|
||||
ToolTipConfig tooltipConfig = new ToolTipConfig();
|
||||
tooltipConfig.setTitleHtml("<br> "+cat.getName());
|
||||
tooltipConfig.setMouseOffsetX(0);
|
||||
tooltipConfig.setMouseOffsetY(0);
|
||||
tooltipConfig.setAnchor(Side.LEFT);
|
||||
tooltipConfig.setDismissDelay(5000);
|
||||
tooltipConfig.setBodyHtml(
|
||||
getTooltipTemplate(GWT.getModuleBaseURL(), cat.getId(), cat.hasImage(), cat.getDescription())
|
||||
);
|
||||
tooltipConfig.setMaxWidth(TOOLTIP_WIDTH);
|
||||
return tooltipConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param base
|
||||
* @param id
|
||||
* @param hasImage
|
||||
* @param description
|
||||
* @return
|
||||
*/
|
||||
private String getTooltipTemplate(String base, String id, boolean hasImage, String description){
|
||||
String html =
|
||||
"<div class='categoryItemTooltip'>"+
|
||||
"<img src='" + base + "../images/categories/"+(hasImage ? id : "DEFAULT_IMAGE")+".png' >"+
|
||||
Format.ellipse(description, 100)+
|
||||
"</div>";
|
||||
return html;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void switchOpenClose() {
|
||||
if (isCollapsed)
|
||||
expand();
|
||||
else
|
||||
collapse();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void collapse() {
|
||||
categoryHtml.removeStyleName("categoryItem-Expanded");
|
||||
categoryHtml.addStyleName("categoryItem-Collapsed");
|
||||
|
||||
for (OperatorPanel op: this.operatorPanelsList)
|
||||
v.remove(op);
|
||||
isCollapsed = true;
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void expand() {
|
||||
if (operatorPanelsList==null) {
|
||||
// init operator panels
|
||||
operatorPanelsList = new ArrayList<OperatorPanel>();
|
||||
for (Operator op : category.getOperators()) {
|
||||
OperatorPanel operatorPanel = new OperatorPanel(op, handler);
|
||||
operatorPanelsList.add(operatorPanel);
|
||||
}
|
||||
}
|
||||
|
||||
categoryHtml.removeStyleName("categoryItem-Collapsed");
|
||||
categoryHtml.addStyleName("categoryItem-Expanded");
|
||||
for (OperatorPanel op: this.operatorPanelsList)
|
||||
v.add(op);
|
||||
isCollapsed = false;
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
public void setDefaultOperator(){
|
||||
expand();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setOperatorDefault(Operator operatorDefault) {
|
||||
expand();
|
||||
for(OperatorPanel opPanel:operatorPanelsList){
|
||||
if(opPanel.getOperator().compareTo(operatorDefault)==0){
|
||||
opPanel.setAsTheDefaultOperator();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,136 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.experiments;
|
||||
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.sencha.gxt.core.client.Style.Side;
|
||||
import com.sencha.gxt.core.client.util.Format;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
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.tips.ToolTipConfig;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class OperatorPanel extends SimpleContainer {
|
||||
|
||||
private static final int TOOLTIP_DESCRIPTION_LENGHT = 435;
|
||||
private static final int OPERATOR_BRIEF_DESCRIPTION_LENGHT = 160;
|
||||
private static final int TOOLTIP_WIDTH = 500;
|
||||
private VerticalLayoutContainer vert;
|
||||
|
||||
private Operator operator;
|
||||
private OperatorsPanelHandler handler;
|
||||
private HTML titleHtml;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param operator
|
||||
* @param handler
|
||||
*/
|
||||
public OperatorPanel(Operator operator, OperatorsPanelHandler handler) {
|
||||
super();
|
||||
this.operator = operator;
|
||||
this.handler = handler;
|
||||
init();
|
||||
|
||||
}
|
||||
|
||||
private void init() {
|
||||
addStyleName("operatorPanel");
|
||||
addStyleName("opePanel");
|
||||
|
||||
addDomHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
event.stopPropagation();
|
||||
handler.addOperator(OperatorPanel.this, operator);
|
||||
|
||||
}
|
||||
|
||||
}, ClickEvent.getType());
|
||||
|
||||
titleHtml = new HTML(operator.getName());
|
||||
titleHtml.addStyleName("operatorPanel-title");
|
||||
|
||||
HTML descriptionHtml = new HTML(Format.ellipse(operator.getBriefDescription(),OPERATOR_BRIEF_DESCRIPTION_LENGHT));
|
||||
descriptionHtml.addStyleName("operatorPanel-briefDescription");
|
||||
|
||||
vert=new VerticalLayoutContainer();
|
||||
|
||||
vert.add(titleHtml, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
vert.add(descriptionHtml, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
add(vert);
|
||||
|
||||
ToolTipConfig tooltipConfig = createToolTip(operator);
|
||||
setToolTipConfig(tooltipConfig);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Operator getOperator() {
|
||||
return operator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
private ToolTipConfig createToolTip(Operator op) {
|
||||
ToolTipConfig tooltipConfig = new ToolTipConfig();
|
||||
tooltipConfig.setTitleHtml("<br> " + op.getName());
|
||||
tooltipConfig.setMouseOffsetX(0);
|
||||
tooltipConfig.setMouseOffsetY(0);
|
||||
tooltipConfig.setAnchor(Side.LEFT);
|
||||
tooltipConfig.setDismissDelay(5000);
|
||||
tooltipConfig.setBodyHtml(getTooltipTemplate(GWT.getModuleBaseURL(),
|
||||
op.getId(), op.hasImage(), op.getDescription()));
|
||||
// config.setCloseable(true);
|
||||
tooltipConfig.setMaxWidth(TOOLTIP_WIDTH);
|
||||
return tooltipConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param base
|
||||
* @param id
|
||||
* @param hasImage
|
||||
* @param description
|
||||
* @return
|
||||
*/
|
||||
private String getTooltipTemplate(String base, String id, boolean hasImage,
|
||||
String description) {
|
||||
String template = "<div class='categoryItemTooltip'>" + "<img src='"
|
||||
+ base + "../images/operators/"
|
||||
+ (hasImage ? id : "DEFAULT_IMAGE") + ".png' >" + Format.ellipse(description, TOOLTIP_DESCRIPTION_LENGHT)
|
||||
+ "</div>";
|
||||
|
||||
return template;
|
||||
};
|
||||
|
||||
public void toggleSelected(boolean isSelect) {
|
||||
if (isSelect)
|
||||
this.addStyleName("operatorPanel-selected");
|
||||
// titleHtml.addStyleName("operatorPanel-title-selected");
|
||||
else
|
||||
this.removeStyleName("operatorPanel-selected");
|
||||
// titleHtml.removeStyleName("operatorPanel-title-selected");
|
||||
}
|
||||
|
||||
public void setAsTheDefaultOperator(){
|
||||
handler.addOperator(OperatorPanel.this, operator);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,380 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.experiments;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorCategory;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.OperatorsClassification;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.DataMinerManager;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.OperatorsClassificationEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.OperatorsClassificationRequestEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.type.OperatorsClassificationRequestType;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.Constants;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.event.dom.client.KeyUpEvent;
|
||||
import com.google.gwt.event.dom.client.KeyUpHandler;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.data.shared.Store;
|
||||
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.form.StoreFilterField;
|
||||
import com.sencha.gxt.widget.core.client.menu.Item;
|
||||
import com.sencha.gxt.widget.core.client.menu.Menu;
|
||||
import com.sencha.gxt.widget.core.client.menu.MenuItem;
|
||||
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class OperatorsPanel extends FramedPanel {
|
||||
|
||||
private static final String LOADING_MESSAGE = "Loading Operators...";
|
||||
// private static final String ERROR_GET_OPERATORS =
|
||||
// "Operators not loaded.";
|
||||
private static final String SHOW_ALL_OPERATORS_TOOLTIP = "Show all Operators without category classification.";
|
||||
private static final String SHOW_CATEGORIES_TOOLTIP = "Show Operators by Categories";
|
||||
private OperatorsPanelHandler handler;
|
||||
private VerticalLayoutContainer topV;
|
||||
private ToolBar toolBar;
|
||||
private VerticalLayoutContainer v;
|
||||
private OperatorsClassification operatorsClassification;
|
||||
private List<Operator> operators;
|
||||
|
||||
// private ArrayList<OperatorCategoryPanel> categoryPanels;
|
||||
private Map<String, List<OperatorCategoryPanel>> mapCategoriesPanels = new HashMap<String, List<OperatorCategoryPanel>>();
|
||||
|
||||
private enum View {
|
||||
CATEGORIES, FILTER, ALL
|
||||
};
|
||||
|
||||
private View view = null;
|
||||
private String currentClassificationName = Constants.UserClassificationName;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public OperatorsPanel(OperatorsPanelHandler handler) {
|
||||
super();
|
||||
this.handler = handler;
|
||||
this.operators = new ArrayList<Operator>();
|
||||
init();
|
||||
bind();
|
||||
create();
|
||||
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setHeadingText("Operators");
|
||||
setBodyStyle("backgroundColor:white;");
|
||||
setCollapsible(true);
|
||||
}
|
||||
|
||||
private void bind() {
|
||||
EventBusProvider.INSTANCE
|
||||
.addHandler(
|
||||
OperatorsClassificationEvent.TYPE,
|
||||
new OperatorsClassificationEvent.OperatorsClassificationEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onOperatorsClassification(
|
||||
OperatorsClassificationEvent event) {
|
||||
Log.debug("OperatorsPanel catch OperatorsClassificationEvent: "
|
||||
+ event);
|
||||
manageOperatorsClassificationEvent(event);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void manageOperatorsClassificationEvent(
|
||||
OperatorsClassificationEvent event) {
|
||||
if (event.getOperatorsClassificationRequestType().compareTo(
|
||||
OperatorsClassificationRequestType.ByName) == 0) {
|
||||
if (currentClassificationName.compareTo(event
|
||||
.getClassificationName()) == 0) {
|
||||
waitMessage(false);
|
||||
if (event.getOperatorsClassification() != null) {
|
||||
operatorsClassification = event
|
||||
.getOperatorsClassification();
|
||||
operators.clear();
|
||||
operators.addAll(event.getOperatorsClassification()
|
||||
.getOperators());
|
||||
String operatorId = event.getOperatorId();
|
||||
|
||||
Log.debug("ShowCategoriesList");
|
||||
List<OperatorCategoryPanel> categoryPanels = mapCategoriesPanels
|
||||
.get(currentClassificationName);
|
||||
if (categoryPanels == null) {
|
||||
categoryPanels = new ArrayList<OperatorCategoryPanel>();
|
||||
if (operatorsClassification != null) {
|
||||
for (OperatorCategory cat : operatorsClassification
|
||||
.getOperatorCategories()) {
|
||||
categoryPanels.add(new OperatorCategoryPanel(
|
||||
handler, cat));
|
||||
}
|
||||
}
|
||||
mapCategoriesPanels.put(currentClassificationName,
|
||||
categoryPanels);
|
||||
}
|
||||
|
||||
v.clear();
|
||||
for (OperatorCategoryPanel panel : categoryPanels){
|
||||
v.add(panel);
|
||||
|
||||
}
|
||||
view = View.CATEGORIES;
|
||||
if(operatorId!=null&&!operatorId.isEmpty()){
|
||||
OperatorCategory operatorCategoryDefault=null;
|
||||
Operator operatorDefault=null;
|
||||
for(Operator op:operators){
|
||||
if(op.getId().compareTo(operatorId)==0){
|
||||
operatorDefault=op;
|
||||
operatorCategoryDefault=op.getCategory();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(operatorCategoryDefault!=null){
|
||||
for (OperatorCategoryPanel opCategoryPanel : categoryPanels){
|
||||
if(opCategoryPanel.getCategory().compareTo(operatorCategoryDefault)==0){
|
||||
opCategoryPanel.setOperatorDefault(operatorDefault);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void create() {
|
||||
topV = new VerticalLayoutContainer();
|
||||
initToolbar();
|
||||
topV.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
SimpleContainer operators = new SimpleContainer();
|
||||
v = new VerticalLayoutContainer();
|
||||
v.setScrollMode(ScrollMode.AUTO);
|
||||
operators.add(v);
|
||||
topV.add(operators, new VerticalLayoutData(1, 1, new Margins(0)));
|
||||
add(topV);
|
||||
waitMessage(true);
|
||||
OperatorsClassificationRequestEvent operatorsClassificationRequestEvent = new OperatorsClassificationRequestEvent(
|
||||
currentClassificationName, true);
|
||||
Log.debug("OperatorsPanel fire: " + operatorsClassificationRequestEvent);
|
||||
EventBusProvider.INSTANCE
|
||||
.fireEvent(operatorsClassificationRequestEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void initToolbar() {
|
||||
toolBar = new ToolBar();
|
||||
|
||||
final StoreFilterField<String> filterField = new StoreFilterField<String>() {
|
||||
|
||||
@Override
|
||||
protected boolean doSelect(Store<String> store, String parent,
|
||||
String item, String filter) {
|
||||
Log.debug("StoreFilterField: " + item + " " + filter);
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
filterField.addKeyUpHandler(new KeyUpHandler() {
|
||||
|
||||
@Override
|
||||
public void onKeyUp(KeyUpEvent event) {
|
||||
String searchText = filterField.getCurrentValue();
|
||||
if (searchText == null || searchText.isEmpty()) {
|
||||
showCategoriesList(false);
|
||||
} else {
|
||||
if (searchText.length() >= 2) {
|
||||
showFilteredList(searchText);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
filterField.setWidth(100);
|
||||
|
||||
TextButton showAllOperatorsButton = new TextButton();
|
||||
showAllOperatorsButton.setIcon(DataMinerManager.resources
|
||||
.sortAscending());
|
||||
showAllOperatorsButton
|
||||
.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
filterField.clear();
|
||||
showAllOperatorsList();
|
||||
|
||||
}
|
||||
});
|
||||
showAllOperatorsButton.setToolTip(SHOW_ALL_OPERATORS_TOOLTIP);
|
||||
|
||||
TextButton showCategoriesButton = new TextButton();
|
||||
showCategoriesButton.setIcon(DataMinerManager.resources.tree());
|
||||
showCategoriesButton.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
filterField.clear();
|
||||
showCategoriesList(false);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
showCategoriesButton.setToolTip(SHOW_CATEGORIES_TOOLTIP);
|
||||
|
||||
final TextButton btnMenuPerspective = new TextButton(
|
||||
currentClassificationName);
|
||||
btnMenuPerspective
|
||||
.setIcon(DataMinerManager.resources.userPerspective());
|
||||
|
||||
Menu menuPerspective = new Menu();
|
||||
|
||||
for (final String perspectiveName : Constants.ClassificationNames) {
|
||||
final ImageResource img = perspectiveName
|
||||
.equals(Constants.UserClassificationName) ? DataMinerManager.resources
|
||||
.userPerspective() : DataMinerManager.resources
|
||||
.computationPerspective();
|
||||
MenuItem perspectiveItem = new MenuItem(perspectiveName);
|
||||
perspectiveItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
filterField.clear();
|
||||
currentClassificationName = perspectiveName;
|
||||
btnMenuPerspective.setText(perspectiveName);
|
||||
btnMenuPerspective.setIcon(img);
|
||||
showCategoriesList(true);
|
||||
|
||||
}
|
||||
});
|
||||
perspectiveItem.setIcon(img);
|
||||
menuPerspective.add(perspectiveItem);
|
||||
}
|
||||
btnMenuPerspective.setMenu(menuPerspective);
|
||||
|
||||
toolBar.add(showCategoriesButton);
|
||||
toolBar.add(showAllOperatorsButton);
|
||||
toolBar.add(filterField);
|
||||
toolBar.add(btnMenuPerspective);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
private void waitMessage(boolean show) {
|
||||
if (show)
|
||||
this.mask(LOADING_MESSAGE);
|
||||
else
|
||||
this.unmask();
|
||||
}
|
||||
|
||||
private void showFilteredList(String searchText) {
|
||||
|
||||
List<Operator> filteredOperators = new ArrayList<Operator>();
|
||||
List<String> ids = new ArrayList<String>();
|
||||
for (Operator op : operators)
|
||||
// check for filtering and prevent duplicates
|
||||
if (op.getName().toLowerCase().contains(searchText.toLowerCase())
|
||||
&& !ids.contains(op.getId())) {
|
||||
filteredOperators.add(op);
|
||||
ids.add(op.getId());
|
||||
}
|
||||
|
||||
v.clear();
|
||||
|
||||
HTML html = new HTML("Filtered results <span class='counter'>("
|
||||
+ filteredOperators.size() + " item"
|
||||
+ (filteredOperators.size() == 1 ? "" : "s") + " found)</span>");
|
||||
html.addStyleName("filterResultText");
|
||||
v.add(html);
|
||||
|
||||
for (Operator op : filteredOperators)
|
||||
v.add(new OperatorPanel(op, handler));
|
||||
view = View.FILTER;
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
|
||||
private void showCategoriesList(boolean force) {
|
||||
|
||||
try {
|
||||
if (force || view != View.CATEGORIES) {
|
||||
Log.debug("ShowCategoriesList");
|
||||
List<OperatorCategoryPanel> categoryPanels = mapCategoriesPanels
|
||||
.get(currentClassificationName);
|
||||
if (categoryPanels == null) {
|
||||
categoryPanels = new ArrayList<OperatorCategoryPanel>();
|
||||
if (operatorsClassification != null) {
|
||||
for (OperatorCategory cat : operatorsClassification
|
||||
.getOperatorCategories()) {
|
||||
categoryPanels.add(new OperatorCategoryPanel(
|
||||
handler, cat));
|
||||
}
|
||||
}
|
||||
mapCategoriesPanels.put(currentClassificationName,
|
||||
categoryPanels);
|
||||
}
|
||||
|
||||
v.clear();
|
||||
for (OperatorCategoryPanel panel : categoryPanels)
|
||||
v.add(panel);
|
||||
view = View.CATEGORIES;
|
||||
forceLayout();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
Log.error(e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void showAllOperatorsList() {
|
||||
if (view != View.ALL) {
|
||||
v.clear();
|
||||
|
||||
HTML html = new HTML("All Operators <span class='counter'>("
|
||||
+ operators.size() + " item"
|
||||
+ (operators.size() == 1 ? "" : "s") + " found)</span>");
|
||||
html.addStyleName("filterResultText");
|
||||
v.add(html);
|
||||
|
||||
for (Operator op : operators)
|
||||
v.add(new OperatorPanel(op, handler));
|
||||
view = View.ALL;
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.experiments;
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public interface OperatorsPanelHandler {
|
||||
|
||||
/**
|
||||
* @param operatorPanel
|
||||
* @param operator
|
||||
*/
|
||||
void addOperator(OperatorPanel operatorPanel, Operator operator);
|
||||
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.experiments;
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.process.Operator;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.DataMinerManager;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.ComputationReadyEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.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 email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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(DataMinerManager.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(DataMinerManager.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);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.monitor;
|
||||
|
||||
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||
import com.sencha.gxt.widget.core.client.box.AutoProgressMessageBox;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class StatusMonitor extends AutoProgressMessageBox {
|
||||
|
||||
public StatusMonitor() {
|
||||
super("Waiting", "Please wait...");
|
||||
create();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param headingHtml
|
||||
* @param messageHtml
|
||||
*/
|
||||
public StatusMonitor(SafeHtml headingHtml, SafeHtml messageHtml) {
|
||||
super(headingHtml, messageHtml);
|
||||
create();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param headingHtml
|
||||
*/
|
||||
public StatusMonitor(SafeHtml headingHtml) {
|
||||
super(headingHtml);
|
||||
create();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param headingHtml
|
||||
* @param messageHtml
|
||||
*/
|
||||
public StatusMonitor(String headingHtml, String messageHtml) {
|
||||
super(headingHtml, messageHtml);
|
||||
create();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param headingHtml
|
||||
*/
|
||||
public StatusMonitor(String headingHtml) {
|
||||
super(headingHtml);
|
||||
create();
|
||||
}
|
||||
|
||||
private void create() {
|
||||
setProgressText("In progress...");
|
||||
auto();
|
||||
show();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.parametersfield;
|
||||
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
|
||||
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractFld {
|
||||
|
||||
protected Parameter parameter;
|
||||
public abstract String getValue();
|
||||
public abstract Widget getWidget();
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public AbstractFld(Parameter parameter) {
|
||||
this.parameter = parameter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the operator
|
||||
*/
|
||||
public Parameter getParameter() {
|
||||
return parameter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param operator the operator to set
|
||||
*/
|
||||
public void setParameter(Parameter parameter) {
|
||||
this.parameter = parameter;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isValid() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.parametersfield;
|
||||
|
||||
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.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.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.form.SimpleComboBox;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class BooleanFld extends AbstractFld {
|
||||
|
||||
private SimpleContainer fieldContainer;
|
||||
private SimpleComboBox<String> listBox;
|
||||
|
||||
/**
|
||||
* @param parameter
|
||||
*/
|
||||
public BooleanFld(Parameter parameter) {
|
||||
super(parameter);
|
||||
fieldContainer = new SimpleContainer();
|
||||
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
||||
horiz.setPack(BoxLayoutPack.START);
|
||||
horiz.setEnableOverflow(false);
|
||||
|
||||
ObjectParameter p = (ObjectParameter) parameter;
|
||||
|
||||
listBox = new SimpleComboBox<String>(new StringLabelProvider<>());
|
||||
listBox.add("true");
|
||||
listBox.add("false");
|
||||
listBox.setAllowBlank(false);
|
||||
listBox.setForceSelection(true);
|
||||
listBox.setEditable(false);
|
||||
listBox.setTriggerAction(TriggerAction.ALL);
|
||||
|
||||
if (p.getDefaultValue() != null&& !p.getDefaultValue().isEmpty()) {
|
||||
Boolean b=Boolean.valueOf(p.getDefaultValue());
|
||||
if(b){
|
||||
listBox.setValue("true");
|
||||
} else {
|
||||
listBox.setValue("false");
|
||||
}
|
||||
|
||||
} else {
|
||||
listBox.setValue("false");
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,184 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.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.widgets.dataminermanagerwidget.client.events.TabularFldChangeEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.TabularFldChangeEvent.TabularFldChangeEventHandler;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.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 email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,227 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.parametersfield;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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.ColumnListParameter;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.TabularFldChangeEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.TabularFldChangeEvent.TabularFldChangeEventHandler;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.properties.ColumnItemProperties;
|
||||
|
||||
import com.google.gwt.cell.client.AbstractCell;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sencha.gxt.core.client.IdentityValueProvider;
|
||||
import com.sencha.gxt.core.client.Style.SelectionMode;
|
||||
import com.sencha.gxt.core.client.XTemplates;
|
||||
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.grid.CheckBoxSelectionModel;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||
import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ColumnListFld extends AbstractFld implements
|
||||
TabularFldChangeEventHandler {
|
||||
|
||||
interface LabelTemplates extends XTemplates {
|
||||
@XTemplate("<span title=\"{value}\">{value}</span>")
|
||||
SafeHtml format(String value);
|
||||
}
|
||||
|
||||
// private VerticalLayoutContainer vp;
|
||||
private ColumnListParameter columnListParameter;
|
||||
private ListStore<ColumnItem> store;
|
||||
private Grid<ColumnItem> grid;
|
||||
private CheckBoxSelectionModel<ColumnItem> sm;
|
||||
private SimpleContainer fieldContainer;
|
||||
private SimpleContainer vContainer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param parameter
|
||||
*/
|
||||
public ColumnListFld(Parameter parameter) {
|
||||
super(parameter);
|
||||
|
||||
columnListParameter = (ColumnListParameter) parameter;
|
||||
// vp = new VerticalLayoutContainer();
|
||||
|
||||
fieldContainer = new SimpleContainer();
|
||||
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
||||
horiz.setPack(BoxLayoutPack.START);
|
||||
horiz.setEnableOverflow(false);
|
||||
|
||||
createGrid();
|
||||
|
||||
HtmlLayoutContainer descr;
|
||||
|
||||
if (columnListParameter.getDescription() == null) {
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
|
||||
} else {
|
||||
//grid.setToolTip(columnListParameter.getDescription());
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'>"
|
||||
+ columnListParameter.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 createGrid() {
|
||||
ColumnItemProperties props = GWT.create(ColumnItemProperties.class);
|
||||
|
||||
ColumnConfig<ColumnItem, String> labelCol = new ColumnConfig<ColumnItem, String>(
|
||||
props.label());
|
||||
|
||||
labelCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
LabelTemplates labelTemplates = GWT
|
||||
.create(LabelTemplates.class);
|
||||
sb.append(labelTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
IdentityValueProvider<ColumnItem> identity = new IdentityValueProvider<ColumnItem>();
|
||||
sm = new CheckBoxSelectionModel<ColumnItem>(identity);
|
||||
|
||||
List<ColumnConfig<ColumnItem, ?>> l = new ArrayList<ColumnConfig<ColumnItem, ?>>();
|
||||
l.add(sm.getColumn());
|
||||
l.add(labelCol);
|
||||
ColumnModel<ColumnItem> cm = new ColumnModel<ColumnItem>(l);
|
||||
|
||||
store = new ListStore<ColumnItem>(props.id());
|
||||
|
||||
grid = new Grid<ColumnItem>(store, cm);
|
||||
|
||||
sm.setSelectionMode(SelectionMode.MULTI);
|
||||
grid.setSelectionModel(sm);
|
||||
// grid.getView().setAutoExpandColumn(labelCol);
|
||||
grid.setSize("180px", "150px");
|
||||
grid.getView().setStripeRows(true);
|
||||
grid.getView().setColumnLines(true);
|
||||
grid.getView().setAutoFill(true);
|
||||
grid.setBorders(false);
|
||||
grid.setLoadMask(true);
|
||||
grid.setColumnReordering(true);
|
||||
grid.setColumnResize(false);
|
||||
grid.disable();
|
||||
|
||||
}
|
||||
|
||||
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(columnListParameter
|
||||
.getReferredTabularParameterName(), 30)
|
||||
+ "</p></div>");
|
||||
typeDescription.setStylePrimaryName("workflow-parameters-description");
|
||||
vField.add(grid, 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(grid, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
vField.add(typeDescription, new VerticalLayoutData(-1, -1, new Margins(
|
||||
0)));
|
||||
vContainer.add(vField);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public String getValue() {
|
||||
String separator = columnListParameter.getSeparator();
|
||||
String value = "";
|
||||
boolean first = true;
|
||||
|
||||
for (ColumnItem columnItem : sm.getSelection()) {
|
||||
String columnName = columnItem.getName();
|
||||
value += (first ? "" : separator) + columnName;
|
||||
first = false;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public Widget getWidget() {
|
||||
return fieldContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return (sm.getSelection() != null && sm.getSelection().size() > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChange(TabularFldChangeEvent event) {
|
||||
TableItemSimple tableItemSimple = event.getTableItemSimple();
|
||||
if (tableItemSimple == null) {
|
||||
store.clear();
|
||||
store.commitChanges();
|
||||
grid.disable();
|
||||
showNoSelectionField();
|
||||
} else {
|
||||
store.clear();
|
||||
store.commitChanges();
|
||||
store.addAll(tableItemSimple.getColumns());
|
||||
store.commitChanges();
|
||||
grid.enable();
|
||||
showFieldWithSelection(tableItemSimple);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.parametersfield;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.DateParameter;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
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.DateField;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class DateFld extends AbstractFld {
|
||||
|
||||
private SimpleContainer fieldContainer;
|
||||
private DateField dateField;
|
||||
private DateTimeFormat dateFormat;
|
||||
|
||||
/**
|
||||
* @param parameter
|
||||
*/
|
||||
public DateFld(Parameter parameter) {
|
||||
super(parameter);
|
||||
|
||||
DateParameter p = (DateParameter) parameter;
|
||||
|
||||
dateField = new DateField();
|
||||
dateFormat = DateTimeFormat.getFormat("yyyy-MM-dd");
|
||||
|
||||
try {
|
||||
Date defaultDate = dateFormat.parse(p.getDefaultValue());
|
||||
dateField.setValue(defaultDate);
|
||||
} catch (Throwable e) {
|
||||
Log.error("DateFld invalid default value" + p.getDefaultValue());
|
||||
}
|
||||
|
||||
if (p.getDefaultValue() == null || p.getDefaultValue().isEmpty())
|
||||
dateField.setAllowBlank(false);
|
||||
|
||||
HtmlLayoutContainer descr;
|
||||
|
||||
if (p.getDescription() == null) {
|
||||
descr = new HtmlLayoutContainer(
|
||||
"<p style='margin-left:5px !important;'></p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
|
||||
} else {
|
||||
// textField.setToolTip(p.getDescription());
|
||||
descr = new HtmlLayoutContainer(
|
||||
"<p style='margin-left:5px !important;'>"
|
||||
+ p.getDescription() + "</p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
}
|
||||
|
||||
SimpleContainer vContainer = new SimpleContainer();
|
||||
VerticalLayoutContainer vField = new VerticalLayoutContainer();
|
||||
HtmlLayoutContainer typeDescription = new HtmlLayoutContainer(
|
||||
"Date Value");
|
||||
typeDescription.setStylePrimaryName("workflow-parameters-description");
|
||||
vField.add(dateField, 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() {
|
||||
String dateS = dateFormat.format(dateField.getCurrentValue());
|
||||
return dateS;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public Widget getWidget() {
|
||||
return fieldContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return dateField.isValid();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.parametersfield;
|
||||
|
||||
|
||||
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.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.DoubleField;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class DoubleFld extends AbstractFld {
|
||||
|
||||
private SimpleContainer fieldContainer;
|
||||
private DoubleField numberField;
|
||||
|
||||
/**
|
||||
* @param operator
|
||||
*/
|
||||
public DoubleFld(Parameter parameter) {
|
||||
super(parameter);
|
||||
fieldContainer=new SimpleContainer();
|
||||
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
||||
horiz.setPack(BoxLayoutPack.START);
|
||||
horiz.setEnableOverflow(false);
|
||||
|
||||
ObjectParameter p = (ObjectParameter) parameter;
|
||||
|
||||
numberField = new DoubleField();
|
||||
|
||||
if (p.getDefaultValue() != null)
|
||||
numberField.setValue(Double.parseDouble(p.getDefaultValue()));
|
||||
numberField.setAllowBlank(false);
|
||||
|
||||
HtmlLayoutContainer descr;
|
||||
|
||||
if (p.getDescription() == null) {
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
|
||||
} else {
|
||||
//numberField.setToolTip(p.getDescription());
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'>"
|
||||
+ p.getDescription() + "</p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
}
|
||||
|
||||
SimpleContainer vContainer=new SimpleContainer();
|
||||
VerticalLayoutContainer vField = new VerticalLayoutContainer();
|
||||
HtmlLayoutContainer typeDescription = new HtmlLayoutContainer(
|
||||
"Double Value");
|
||||
typeDescription.setStylePrimaryName("workflow-parameters-description");
|
||||
vField.add(numberField, new VerticalLayoutData(-1,-1,new Margins(0)));
|
||||
vField.add(typeDescription, new VerticalLayoutData(-1,-1,new Margins(0)));
|
||||
vContainer.add(vField);
|
||||
|
||||
horiz.add(vContainer, new BoxLayoutData(new Margins()));
|
||||
horiz.add(descr, new BoxLayoutData(new Margins()));
|
||||
|
||||
fieldContainer.add(horiz);
|
||||
|
||||
fieldContainer.forceLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public String getValue() {
|
||||
return numberField.getCurrentValue().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public Widget getWidget() {
|
||||
return fieldContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return numberField.isValid();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.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 email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class EnumFld extends AbstractFld {
|
||||
|
||||
private SimpleContainer fieldContainer;
|
||||
private SimpleComboBox<String> listBox;
|
||||
|
||||
/**
|
||||
* @param 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();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,312 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.parametersfield;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.FileParameter;
|
||||
import org.gcube.data.analysis.dataminermanagercl.shared.parameters.Parameter;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.DataMinerManager;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.events.SessionExpiredEvent;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.rpc.DataMinerPortletServiceAsync;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.client.util.UtilsGXT3;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.exception.SessionExpiredServiceException;
|
||||
import org.gcube.portlets.widgets.dataminermanagerwidget.shared.workspace.ItemDescription;
|
||||
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.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
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.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.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class FileFld extends AbstractFld {
|
||||
|
||||
private VerticalLayoutContainer vp;
|
||||
|
||||
// FileSelector fileSelector;
|
||||
private WorkspaceExplorerSelectDialog wselectDialog;
|
||||
private TextButton selectButton, selectButton2, cancelButton;
|
||||
private ItemDescription selectedFileItem = null;
|
||||
|
||||
private FileParameter fileParameter;
|
||||
|
||||
private SimpleContainer fieldContainer;
|
||||
|
||||
private HBoxLayoutContainer horiz;
|
||||
|
||||
private TextButton downloadButton;
|
||||
|
||||
/**
|
||||
* @param parameter
|
||||
*/
|
||||
public FileFld(Parameter parameter) {
|
||||
super(parameter);
|
||||
fileParameter = (FileParameter) parameter;
|
||||
|
||||
SimpleContainer tabContainer = new SimpleContainer();
|
||||
vp = new VerticalLayoutContainer();
|
||||
init();
|
||||
tabContainer.add(vp, new MarginData(new Margins(0)));
|
||||
|
||||
fieldContainer = new SimpleContainer();
|
||||
horiz = new HBoxLayoutContainer();
|
||||
horiz.setPack(BoxLayoutPack.START);
|
||||
horiz.setEnableOverflow(false);
|
||||
|
||||
HtmlLayoutContainer descr;
|
||||
|
||||
if (fileParameter.getDescription() == null) {
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
|
||||
} else {
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'>"
|
||||
+ fileParameter.getDescription() + "</p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
}
|
||||
|
||||
horiz.add(tabContainer, new BoxLayoutData(new Margins()));
|
||||
horiz.add(descr, new BoxLayoutData(new Margins()));
|
||||
|
||||
fieldContainer.add(horiz);
|
||||
showNoSelectionField();
|
||||
|
||||
}
|
||||
|
||||
private void init() {
|
||||
|
||||
List<ItemType> selectableTypes = new ArrayList<ItemType>();
|
||||
selectableTypes.add(ItemType.EXTERNAL_FILE);
|
||||
List<ItemType> showableTypes = new ArrayList<ItemType>();
|
||||
showableTypes.addAll(Arrays.asList(ItemType.values()));
|
||||
|
||||
wselectDialog = new WorkspaceExplorerSelectDialog("Select File", false);
|
||||
// filterCriteria, selectableTypes);
|
||||
|
||||
WorskpaceExplorerSelectNotificationListener handler = new WorskpaceExplorerSelectNotificationListener() {
|
||||
|
||||
@Override
|
||||
public void onSelectedItem(Item item) {
|
||||
|
||||
if (item.isFolder() || item.isRoot()) {
|
||||
UtilsGXT3.info("Attention", "Select a valid file!");
|
||||
|
||||
} else {
|
||||
retrieveFileInformation(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 file!");
|
||||
}
|
||||
};
|
||||
|
||||
wselectDialog.addWorkspaceExplorerSelectNotificationListener(handler);
|
||||
wselectDialog.setZIndex(XDOM.getTopZIndex());
|
||||
|
||||
selectButton = new TextButton("Select File");
|
||||
selectButton.setIcon(DataMinerManager.resources.folderExplore());
|
||||
selectButton.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
wselectDialog.show();
|
||||
|
||||
}
|
||||
});
|
||||
selectButton.setToolTip("Select File");
|
||||
|
||||
selectButton2 = new TextButton("");
|
||||
selectButton2.setIcon(DataMinerManager.resources.folderExplore());
|
||||
selectButton2.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
wselectDialog.show();
|
||||
}
|
||||
});
|
||||
selectButton2.setToolTip("Select Another File");
|
||||
|
||||
cancelButton = new TextButton("");
|
||||
cancelButton.setIcon(DataMinerManager.resources.cancel());
|
||||
cancelButton.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
selectedFileItem = null;
|
||||
showNoSelectionField();
|
||||
}
|
||||
});
|
||||
|
||||
downloadButton = new TextButton("");
|
||||
downloadButton.setIcon(DataMinerManager.resources.download());
|
||||
downloadButton.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
downloadFile();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void retrieveFileInformation(final Item item) {
|
||||
Log.debug("Retrieved: " + item);
|
||||
final ItemDescription itemDescription = new ItemDescription(
|
||||
item.getId(), item.getName(), item.getOwner(), item.getPath(),
|
||||
item.getType().name());
|
||||
|
||||
DataMinerPortletServiceAsync.INSTANCE.getPublicLink(itemDescription,
|
||||
new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.error("Error in retrieveFileInformation: "
|
||||
+ caught.getMessage());
|
||||
if (caught instanceof SessionExpiredServiceException) {
|
||||
UtilsGXT3.alert("Error", "Expired Session");
|
||||
|
||||
} else {
|
||||
UtilsGXT3.alert("Error",
|
||||
"Error retrieving file informations: "
|
||||
+ caught.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
itemDescription.setPublicLink(result);
|
||||
selectedFileItem = itemDescription;
|
||||
Log.debug("SelectedFileItem: " + selectedFileItem);
|
||||
showFieldWithSelection();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void downloadFile() {
|
||||
if (selectedFileItem != null) {
|
||||
DataMinerPortletServiceAsync.INSTANCE.getPublicLink(
|
||||
selectedFileItem, new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof SessionExpiredServiceException) {
|
||||
EventBusProvider.INSTANCE
|
||||
.fireEvent(new SessionExpiredEvent());
|
||||
} else {
|
||||
Log.error("Error downloading file: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String link) {
|
||||
Log.debug("Retrieved link: " + link);
|
||||
Window.open(link, selectedFileItem.getName(), "");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
} else {
|
||||
UtilsGXT3.info("Attention", "Select a file!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void showNoSelectionField() {
|
||||
vp.clear();
|
||||
vp.add(selectButton);
|
||||
vp.forceLayout();
|
||||
fieldContainer.forceLayout();
|
||||
}
|
||||
|
||||
private void showFieldWithSelection() {
|
||||
String fileName = selectedFileItem.getName();
|
||||
|
||||
if (fileName == null || fileName.isEmpty()) {
|
||||
fileName = "NoName";
|
||||
}
|
||||
|
||||
TextField tableDescription = new TextField();
|
||||
tableDescription.setValue(fileName);
|
||||
tableDescription.setReadOnly(true);
|
||||
|
||||
HBoxLayoutContainer h = new HBoxLayoutContainer();
|
||||
h.add(tableDescription, new BoxLayoutData(new Margins()));
|
||||
h.add(selectButton2, new BoxLayoutData(new Margins()));
|
||||
h.add(downloadButton, new BoxLayoutData(new Margins()));
|
||||
h.add(cancelButton, new BoxLayoutData(new Margins()));
|
||||
vp.clear();
|
||||
vp.add(h);
|
||||
vp.forceLayout();
|
||||
fieldContainer.forceLayout();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return (selectedFileItem != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getWidget() {
|
||||
return fieldContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return (selectedFileItem == null) ? null : selectedFileItem
|
||||
.getPublicLink();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.parametersfield;
|
||||
|
||||
|
||||
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.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.FloatField;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class FloatFld extends AbstractFld {
|
||||
|
||||
private SimpleContainer fieldContainer;
|
||||
private FloatField numberField;
|
||||
|
||||
/**
|
||||
* @param operator
|
||||
*/
|
||||
public FloatFld(Parameter parameter) {
|
||||
super(parameter);
|
||||
fieldContainer = new SimpleContainer();
|
||||
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
||||
horiz.setPack(BoxLayoutPack.START);
|
||||
horiz.setEnableOverflow(false);
|
||||
|
||||
ObjectParameter p = (ObjectParameter) parameter;
|
||||
|
||||
numberField = new FloatField();
|
||||
|
||||
if (p.getDefaultValue() != null)
|
||||
numberField.setValue(Float.parseFloat(p.getDefaultValue()));
|
||||
numberField.setAllowBlank(false);
|
||||
|
||||
HtmlLayoutContainer descr;
|
||||
|
||||
if (p.getDescription() == null) {
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
|
||||
} else {
|
||||
//numberField.setToolTip(p.getDescription());
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'>"
|
||||
+ p.getDescription() + "</p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
}
|
||||
|
||||
SimpleContainer vContainer = new SimpleContainer();
|
||||
VerticalLayoutContainer vField = new VerticalLayoutContainer();
|
||||
HtmlLayoutContainer typeDescription = new HtmlLayoutContainer(
|
||||
"Float Value");
|
||||
typeDescription.setStylePrimaryName("workflow-parameters-description");
|
||||
vField.add(numberField, new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
vField.add(typeDescription, new VerticalLayoutData(-1, -1, new Margins(
|
||||
0)));
|
||||
vContainer.add(vField);
|
||||
|
||||
horiz.add(vContainer, new BoxLayoutData(new Margins()));
|
||||
horiz.add(descr, new BoxLayoutData(new Margins()));
|
||||
|
||||
fieldContainer.add(horiz);
|
||||
fieldContainer.forceLayout();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public String getValue() {
|
||||
Float f = numberField.getCurrentValue();
|
||||
return f.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public Widget getWidget() {
|
||||
return fieldContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return numberField.isValid();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.parametersfield;
|
||||
|
||||
|
||||
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.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.IntegerField;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class IntFld extends AbstractFld {
|
||||
|
||||
private SimpleContainer fieldContainer;
|
||||
private IntegerField numberField;
|
||||
|
||||
/**
|
||||
* @param operator
|
||||
*/
|
||||
public IntFld(Parameter parameter) {
|
||||
super(parameter);
|
||||
fieldContainer = new SimpleContainer();
|
||||
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
||||
horiz.setPack(BoxLayoutPack.START);
|
||||
horiz.setEnableOverflow(false);
|
||||
|
||||
ObjectParameter p = (ObjectParameter) parameter;
|
||||
|
||||
numberField = new IntegerField();
|
||||
|
||||
if (p.getDefaultValue() != null)
|
||||
numberField.setValue(Integer.parseInt(p.getDefaultValue()));
|
||||
numberField.setAllowBlank(false);
|
||||
|
||||
HtmlLayoutContainer descr;
|
||||
|
||||
if (p.getDescription() == null) {
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
|
||||
} else {
|
||||
//numberField.setToolTip(p.getDescription());
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'>"
|
||||
+ p.getDescription() + "</p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
}
|
||||
|
||||
SimpleContainer vContainer=new SimpleContainer();
|
||||
VerticalLayoutContainer vField = new VerticalLayoutContainer();
|
||||
HtmlLayoutContainer typeDescription = new HtmlLayoutContainer(
|
||||
"Integer Value");
|
||||
typeDescription.setStylePrimaryName("workflow-parameters-description");
|
||||
vField.add(numberField, new VerticalLayoutData(-1,-1,new Margins(0)));
|
||||
vField.add(typeDescription, new VerticalLayoutData(-1,-1,new Margins(0)));
|
||||
vContainer.add(vField);
|
||||
|
||||
horiz.add(vContainer, new BoxLayoutData(new Margins()));
|
||||
horiz.add(descr, new BoxLayoutData(new Margins()));
|
||||
|
||||
fieldContainer.add(horiz);
|
||||
fieldContainer.forceLayout();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public String getValue() {
|
||||
Integer i = numberField.getCurrentValue();
|
||||
return i.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public Widget getWidget() {
|
||||
return fieldContainer;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return numberField.isValid();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,238 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.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.widgets.dataminermanagerwidget.client.DataMinerManager;
|
||||
|
||||
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
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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(DataMinerManager.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(DataMinerManager.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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,173 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.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 email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param item
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,173 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.dataminermanagerwidget.client.parametersfield;
|
||||
|
||||
|
||||
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.allen_sauer.gwt.log.client.Log;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class OperatorFieldWidget {
|
||||
|
||||
private Parameter parameter;
|
||||
private AbstractFld field;
|
||||
private FieldLabel parameterLabel;
|
||||
|
||||
/**
|
||||
*/
|
||||
public OperatorFieldWidget(Parameter p) {
|
||||
super();
|
||||
this.parameter = p;
|
||||
|
||||
try {
|
||||
if (p.getTypology() != null) {
|
||||
switch (p.getTypology()) {
|
||||
case COLUMN:
|
||||
field = new ColumnFld(p);
|
||||
break;
|
||||
case COLUMN_LIST:
|
||||
field = new ColumnListFld(p);
|
||||
break;
|
||||
case ENUM:
|
||||
field = new EnumFld(p);
|
||||
break;
|
||||
case FILE:
|
||||
field = new FileFld(p);
|
||||
break;
|
||||
case LIST:
|
||||
field = createListField(p);
|
||||
break;
|
||||
case OBJECT:
|
||||
field = createObjectField(p);
|
||||
break;
|
||||
case TABULAR:
|
||||
field = new TabularFld(p);
|
||||
break;
|
||||
case TABULAR_LIST:
|
||||
field = new TabularListFld(p);
|
||||
break;
|
||||
case WKT:
|
||||
field = new WKTFld(p);
|
||||
break;
|
||||
case DATE:
|
||||
field = new DateFld(p);
|
||||
break;
|
||||
case TIME:
|
||||
field = new TimeFld(p);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (field == null) {
|
||||
parameterLabel = new FieldLabel(null, p.getName());
|
||||
parameterLabel.setLabelWidth(200);
|
||||
parameterLabel.setLabelWordWrap(true);
|
||||
|
||||
} else {
|
||||
parameterLabel = new FieldLabel(field.getWidget(), p.getName());
|
||||
parameterLabel.setLabelWidth(200);
|
||||
parameterLabel.setLabelWordWrap(true);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
Log.error("Error: " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the parameter
|
||||
*/
|
||||
public Parameter getParameter() {
|
||||
return parameter;
|
||||
}
|
||||
|
||||
public String getFieldValue() {
|
||||
return field.getValue();
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return getFieldValue();
|
||||
}
|
||||
|
||||
public FieldLabel getParameterLabel() {
|
||||
return parameterLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param p
|
||||
* @return
|
||||
*/
|
||||
private AbstractFld createObjectField(Parameter p) {
|
||||
ObjectParameter objectParameter = (ObjectParameter) p;
|
||||
String type = objectParameter.getType();
|
||||
if (type.contentEquals(Integer.class.getName())) {
|
||||
return new IntFld(objectParameter);
|
||||
} else if (type.contentEquals(String.class.getName())) {
|
||||
return new StringFld(objectParameter);
|
||||
} else if (type.contentEquals(Boolean.class.getName())) {
|
||||
return new BooleanFld(objectParameter);
|
||||
} else if (type.contentEquals(Double.class.getName())) {
|
||||
return new DoubleFld(objectParameter);
|
||||
} else if (type.contentEquals(Float.class.getName())) {
|
||||
return new FloatFld(objectParameter);
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private AbstractFld createListField(Parameter p) {
|
||||
ListParameter listParameter = (ListParameter) p;
|
||||
String type = listParameter.getType();
|
||||
|
||||
if (type.contentEquals(String.class.getName())
|
||||
|| type.contentEquals("STRING")) { // TODO REMOVE "STRING"
|
||||
return new ListStringFld(listParameter);
|
||||
} else if (type.contentEquals(Integer.class.getName())
|
||||
|| type.contentEquals("NUMBER")) {
|
||||
return new ListIntFld(listParameter);
|
||||
}
|
||||
// } else if (type.contentEquals(Boolean.class.getName())) {
|
||||
// return new ListBooleanField(p);
|
||||
// } else if (type.contentEquals(Double.class.getName())) {
|
||||
// return new ListDoubleField(p);
|
||||
// } else if (type.contentEquals(Float.class.getName())) {
|
||||
// return new ListFloatField(p);
|
||||
// }
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void updateOperatorParameterValue() {
|
||||
this.parameter.setValue(this.getFieldValue());
|
||||
}
|
||||
|
||||
public AbstractFld getField() {
|
||||
return field;
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
if (field != null)
|
||||
return field.isValid();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue