Initial import.

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/reports@68941 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-02-06 22:25:43 +00:00
parent 70d1bc243e
commit c56faea785
886 changed files with 25119 additions and 0 deletions

36
.classpath Normal file
View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/reports-4.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" output="src/main/webapp/WEB-INF/classes" 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="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<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.jdt.USER_LIBRARY/ASL_LIBS"/>
<classpathentry kind="output" path="target/reports-4.0.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

59
.project Normal file
View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>reports</name>
<comment>reports project</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</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.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.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
</natures>
</projectDescription>

15
.settings/.jsdtscope Normal file
View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/webapp" />
<classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER" />
<classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true" />
</attributes>
</classpathentry>
<classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary" />
<classpathentry kind="output" path="" />
</classpath>

View File

@ -0,0 +1,3 @@
#Thu Jun 16 10:18:26 CEST 2011
eclipse.preferences.version=1
filesCopiedToWebInfLib=

View File

@ -0,0 +1,6 @@
#Wed Feb 06 12:30:01 CET 2013
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
lastWarOutDir=/Users/massi/Documents/workspace/reports/target/reports-4.0.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -0,0 +1,5 @@
#Thu Jun 16 11:14:17 CEST 2011
eclipse.preferences.version=1
entryPointModules=
filesCopiedToWebInfLib=gwt-servlet.jar
gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBWy13YXIgc3JjL21haW4vd2ViYXBwXV0+PC9leHRyYS1hcmdzPjx2bS1hcmdzPjwhW0NEQVRBWy1YbXg1MTJtXV0+PC92bS1hcmdzPjxlbnRyeS1wb2ludC1tb2R1bGU+Y29tLmNvbXBhbnkuU29tZU1vZHVsZTwvZW50cnktcG9pbnQtbW9kdWxlPjwvZ3d0LWNvbXBpbGUtc2V0dGluZ3M+

View File

@ -0,0 +1,7 @@
#Wed Feb 06 12:30:01 CET 2013
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View File

@ -0,0 +1,9 @@
#Wed Feb 06 16:46:46 CET 2013
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
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.6

View File

@ -0,0 +1,5 @@
#Wed Feb 06 12:30:01 CET 2013
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="${module}">
<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="/target/generated-sources/gwt"/>
<dependent-module archiveName="gcube-docx-generator-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-docx-generator/gcube-docx-generator">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="reports"/>
</wb-module>
</project-modules>

View File

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

View File

@ -0,0 +1 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary

View File

@ -0,0 +1,9 @@
#Thu Sep 02 10:42:12 CEST 2010
activeProfiles=
eclipse.preferences.version=1
fullBuildGoals=process-test-resources
includeModules=false
resolveWorkspaceProjects=true
resourceFilterGoals=process-resources resources\:testResources
skipCompilerPlugin=true
version=1

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.google.gwt.eclipse.core.launch.gwtJUnit">
<stringAttribute key="com.google.gwt.eclipse.core.LOG_LEVEL" value="INFO"/>
<booleanAttribute key="com.google.gwt.eclipse.core.NOT_HEADLESS" value="false"/>
<stringAttribute key="com.google.gwt.eclipse.core.OUT_DIR" value="www-test"/>
<booleanAttribute key="com.google.gwt.eclipse.core.STANDARDS_MODE" value="false"/>
<stringAttribute key="com.google.gwt.eclipse.core.STYLE" value="OBFUSCATED"/>
<stringAttribute key="com.google.gwt.eclipse.core.WEB_MODE" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/reports/src/test/java/org/gcube/portlets/user/reportgenerator/client/GwtTestReportGenerator.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gdt.eclipse.maven.mavenClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.gcube.portlets.user.reportgenerator.client.GwtTestReportGenerator"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="reports"/>
</launchConfiguration>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.google.gwt.eclipse.core.launch.gwtJUnit">
<stringAttribute key="com.google.gwt.eclipse.core.LOG_LEVEL" value="INFO"/>
<booleanAttribute key="com.google.gwt.eclipse.core.NOT_HEADLESS" value="false"/>
<stringAttribute key="com.google.gwt.eclipse.core.OUT_DIR" value="www-test"/>
<booleanAttribute key="com.google.gwt.eclipse.core.STANDARDS_MODE" value="false"/>
<stringAttribute key="com.google.gwt.eclipse.core.STYLE" value="OBFUSCATED"/>
<stringAttribute key="com.google.gwt.eclipse.core.WEB_MODE" value="true"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/reports/src/test/java/org/gcube/portlets/user/reportgenerator/client/GwtTestReportGenerator.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gdt.eclipse.maven.mavenClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.gcube.portlets.user.reportgenerator.client.GwtTestReportGenerator"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="reports"/>
</launchConfiguration>

8
distro/INSTALL Normal file
View File

@ -0,0 +1,8 @@
To install the Template Creator portlet you need the following requirements:
* The Portlet WAR.
* The Dependecies JARs as declared in the Service Profile.
First of all you need a Portal properly configured and running.

6
distro/LICENSE Normal file
View File

@ -0,0 +1,6 @@
gCube System - License
------------------------------------------------------------
The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
The software and documentation is provided by its authors/distributors "as is" and no expressed or
implied warranty is given for its use, quality or fitness for a particular case.

5
distro/MAINTAINERS Normal file
View File

@ -0,0 +1,5 @@
Mantainers
-------
* Massimiliano Assante (massimiliano.assante@isti.cnr.it), CNR Pisa,
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".

55
distro/README Normal file
View File

@ -0,0 +1,55 @@
The gCube System - Template Creator portlet
------------------------------------------------------------
This work has been partially supported by the following European projects:
DILIGENT (FP6-2003-IST-2), D4Science (FP7-INFRA-2007-1.2.2), D4Science-II (FP7-INFRA-2008-1.2.2),
iMarine (FP7-INFRASTRUCTURES-2011-2), and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil).
Authors
-------
* Massimiliano Assante (massimiliano.assante@isti.cnr.it), CNR Pisa,
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".
Version and Release Date
------------------------
v. 1.0.0, 15/12/2008
Description
-----------
Download information
--------------------
Source code is available from SVN:
http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/ReportGenerator-portlet
Binaries can be downloaded from:
http://software.d4science.research-infrastructures.eu/
Documentation
-------------
Documentation is available on-line from the Projects Documentation Wiki:
https://gcube.wiki.gcube-system.org/gcube/index.php/Common_Functionality#Report_Generation
Licensing
---------
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.

7
distro/changelog.xml Normal file
View File

@ -0,0 +1,7 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets-user.report-generator-portlet.3-4-0" date="2012-05-04">
<Change>Top menu restyled</Change>
<Change>adapted to new Workspace Tree</Change>
<Change>adapted to new Home Library</Change>
</Changeset>
</ReleaseNotes>

48
distro/descriptor.xml Normal file
View File

@ -0,0 +1,48 @@
<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>INSTALL</include>
<include>MAINTAINERS</include>
<include>changelog.xml</include>
</includes>
<fileMode>755</fileMode>
<filtered>true</filtered>
</fileSet>
<fileSet>
<directory>target/apidocs</directory>
<outputDirectory>/${artifactId}/doc/api</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<fileMode>755</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>${distroDirectory}/profile.xml</source>
<outputDirectory>./</outputDirectory>
<filtered>true</filtered>
</file>
<file>
<source>target/${build.finalName}.war</source>
<outputDirectory>/${artifactId}</outputDirectory>
</file>
<file>
<source>${distroDirectory}/svnpath.txt</source>
<outputDirectory>/${artifactId}</outputDirectory>
<filtered>true</filtered>
</file>
</files>
</assembly>

25
distro/profile.xml Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ID></ID>
<Type>Service</Type>
<Profile>
<Description>${description}</Description>
<Class>PortletUser</Class>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<Packages>
<Software>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<MavenCoordinates>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
</MavenCoordinates>
<Files>
<File>target/${build.finalName}.war</File>
</Files>
</Software>
</Packages>
</Profile>
</Resource>

1
distro/svnpath.txt Normal file
View File

@ -0,0 +1 @@
${scm.url}

309
pom.xml Normal file
View File

@ -0,0 +1,309 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.0.0</version>
<relativePath />
</parent>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>reports</artifactId>
<packaging>war</packaging>
<version>4.0.0-SNAPSHOT</version>
<name>gCube Reports Portlet</name>
<description>
gCube Reports Portlet.
</description>
<scm>
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</connection>
<developerConnection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</developerConnection>
<url>http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</url>
</scm>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.4.0</gwtVersion>
<distroDirectory>distro</distroDirectory>
<!-- GWT needs at least java 1.6 -->
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<!-- This dependency is needed and is need on TOP to use GWT UI BInder
without old Xerces version of gCore complaining -->
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
<scope>provided</scope>
</dependency>
<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>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslsocial</artifactId>
<version>[0.1.0-SNAPSHOT, 1.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-widgets</artifactId>
<version>[1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>guided-tour-widget</artifactId>
<version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>custom-portal-handler</artifactId>
<version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sencha.gxt</groupId>
<artifactId>gxt</artifactId>
<version>2.2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>csv4j</artifactId>
<version>1.2.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>workspace-light-tree</artifactId>
<version>[2.9.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.admin</groupId>
<artifactId>document-workflow-library</artifactId>
<version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-docx-generator</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>gcube-reporting-library</artifactId>
<version>[3.0.0-SNAPSHOT, 4.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>workspace-tree-widget</artifactId>
<version>[6.0.0-SNAPSHOT, 7.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>home-library</artifactId>
<version>[4.3.0-SNAPSHOT, 5.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>home-library-jcr</artifactId>
<version>[1.3.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>accesslogger</artifactId>
<version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.8.2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<version>6.0.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.allen-sauer.gwt.log</groupId>
<artifactId>gwt-log</artifactId>
<version>3.1.8</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<!-- <goal>test</goal> -->
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<runTarget>Messages.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
</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>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<!-- SA Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-profile</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>target</outputDirectory>
<resources>
<resource>
<directory>${distroDirectory}</directory>
<filtering>true</filtering>
<includes>
<include>profile.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,695 @@
package org.gcube.portlets.user.reportgenerator.client;
import java.util.List;
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
import org.gcube.portlets.user.gcubewidgets.client.popup.GCubeDialog;
import org.gcube.portlets.user.reportgenerator.client.Presenter.CommonCommands;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.dialog.ImporterDialog;
import org.gcube.portlets.user.reportgenerator.client.dialog.PagePropertiesDialog;
import org.gcube.portlets.user.reportgenerator.client.model.ExportManifestationType;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateModel;
import org.gcube.portlets.user.workspace.lighttree.client.ItemType;
import org.gcube.portlets.user.workspace.lighttree.client.event.PopupEvent;
import org.gcube.portlets.user.workspace.lighttree.client.event.PopupHandler;
import org.gcube.portlets.user.workspace.lighttree.client.load.WorkspaceLightTreeLoadPopup;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.CellPanel;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.ui.MenuItemSeparator;
import com.google.gwt.user.client.ui.RichTextArea;
/**
* <code> Headerbar </code> class is the top bar component of the UI
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
*
* @version July 2011 (3.0)
*/
public class Headerbar extends Composite{
private static final String ADD_BIBLIO_ENTRY = "Add citation";
private static final String VIEW_BIBLIO = "View Bibliography";
private static final String MANAGE_BIBLIO = "Delete citation(s)";
private static final String EXPORT_OPENXML = "Export to OpenXML (docx)";
private static final String EXPORT_HTML = "Export to HTML";
private static final String EXPORT_FIMES = "Export to FiMES XML";
private static final String VIEW_USER_COMMENTS = "View user comments";
String location;
private Presenter presenter;
/**
* the template Model
*/
private TemplateModel templateModel;
/**
* mainLayout Panel
*/
private CellPanel mainLayout = new HorizontalPanel();
//private MenuItem optionPDF;
private MenuItem importModel;
private MenuItem addBiblioEntry;
private MenuItem viewBiblio;
private MenuItem manageBiblio;
private MenuItem optionHTML;
private MenuItem optionDOCX;
private MenuItem optionFimes;
private MenuItem viewMetadata;
private MenuItem viewComments;
private MenuItem discardSection;
MenuBar menuBar = new MenuBar();
MenuItem fileMenu;
MenuItem viewMenu;
MenuItem sectionsMenu;
MenuItem biblioMenu;
MenuItem exportMenu;
MenuItemSeparator separator1;
MenuItemSeparator separator2;
MenuItemSeparator separator3;
MenuItemSeparator separator4;
/**
* Constructor
* @param c the controller instance for this UI component
*/
public Headerbar(Presenter c) {
this.presenter = c;
this.templateModel = presenter.getModel();
menuBar.setAutoOpen(false);
// menuBar.setWidth("100px");
menuBar.setAnimationEnabled(true);
fileMenu = getFileMenu();
menuBar.addItem(fileMenu);
separator1 = menuBar.addSeparator();
viewMenu = getViewMenu();
menuBar.addItem(viewMenu);
separator2 = menuBar.addSeparator();
sectionsMenu = getSectionMenu();
menuBar.addItem(sectionsMenu);
separator3 = menuBar.addSeparator();
biblioMenu = getBiblioMenu();
menuBar.addItem(biblioMenu);
separator4 = menuBar.addSeparator();
exportMenu = getExportsMenu();
menuBar.addItem(exportMenu);
mainLayout.setSize("100%", "24px");
mainLayout.setStyleName("menubar");
mainLayout.add(menuBar);
//design the part for the template name and the pages handling
HorizontalPanel captionPanel = new HorizontalPanel();
captionPanel.setWidth("100%");
HorizontalPanel pageHandlerPanel = new HorizontalPanel();
pageHandlerPanel.setHeight("24");
pageHandlerPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
captionPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
mainLayout.add(captionPanel);
mainLayout.add(pageHandlerPanel);
mainLayout.setCellHorizontalAlignment(menuBar, HasHorizontalAlignment.ALIGN_LEFT);
mainLayout.setCellHorizontalAlignment(captionPanel, HasHorizontalAlignment.ALIGN_LEFT);
mainLayout.setCellWidth(menuBar, "200");
mainLayout.setCellWidth(pageHandlerPanel, "200");
initWidget(mainLayout);
}
public void setMenuForWorkflowDocument(boolean canUpdate) {
presenter.setMenuForWorkflowDocument(true);
menuBar.removeItem(fileMenu);
menuBar.removeItem(viewMenu);
menuBar.removeItem(sectionsMenu);
menuBar.removeItem(biblioMenu);
menuBar.removeSeparator(separator1);
menuBar.removeSeparator(separator2);
menuBar.removeItem(exportMenu);
MenuBar workflowMenu = new MenuBar(true);
workflowMenu.setAnimationEnabled(true);
MenuItem menu = new MenuItem("<nobr>Workflow Document Options</nobr>", true, workflowMenu);
menu.setWidth("400px");
Command updateWfDocument = new Command() {
public void execute() {
presenter.updateWorkflowDocument(true);
}
};
Command backCommand = new Command() {
public void execute() {
presenter.updateWorkflowDocument(false);
}
};
Command showChanges = new Command() {
public void execute() {
presenter.showLastChangesPopup();
}
};
if (canUpdate)
workflowMenu.addItem("Update this document", updateWfDocument);
//workflowMenu.addItem("Show previous changes", showChanges);
workflowMenu.addSeparator();
workflowMenu.addItem("Back to My Workflow Documents", backCommand);
menuBar.addItem(menu);
separator1 = menuBar.addSeparator();
viewMenu = getViewMenu();
menuBar.addItem(viewMenu);
separator2 = menuBar.addSeparator();
sectionsMenu = getSectionMenu();
menuBar.addItem(sectionsMenu);
separator3 = menuBar.addSeparator();
biblioMenu = getBiblioMenu();
menuBar.addItem(biblioMenu);
separator4 = menuBar.addSeparator();
exportMenu = getExportsMenu();
menuBar.addItem(exportMenu);
ReportGenerator.get().getToolbarPanel().clear();
ReportGenerator.get().getToolbarPanel().add(new HTML("&nbsp;&nbsp;", true));
enableExports();
}
/**
* Redirect to VRE Deployer Portlet
*/
private void loadWorkflowLibraryApp(){
getUrl();
location += "/../my-workflow-documents";
Window.open(location, "_self", "");
}
/**
* Get URL from browser
*/
public native void getUrl()/*-{
this.@org.gcube.portlets.user.reportgenerator.client.Headerbar::location = $wnd.location.href;
}-*/;
/**
* temporary command
* @return the command instance
*/
public Command getNullCommand() {
Command openNothing = new Command() {
public void execute() { }
};
return openNothing;
}
/**
* temporary command
* @return the command instance
*/
public Command getBiblioCommand() {
Command openNothing = new Command() {
public void execute() {
MessageBox.alert("Warning ","A textarea must be selected to add an entry", null);
}
};
return openNothing;
}
Command addCitationCmd = new Command() {
public void execute() {
presenter.openAddCitationDialog();
}
};
Command viewBiblioCmd = new Command() {
public void execute() {
if (presenter.hasBibliography()) {
presenter.seekLastPage();
}
else {
MessageBox.alert("Warning", "No bibliography found, to add bibliography start adding citations:<br />Bibliography > Add citation (from within a text area)", null);
}
}
};
Command manageBiblioCmd = new Command() {
public void execute() {
if (presenter.hasBibliography()) {
presenter.openManageCitationsDialog();
}
else {
MessageBox.alert("Warning", "No bibliography found, to add bibliography start adding citations:<br />Bibliography > Add citation (from within a text area)", null);
}
}
};
/**
*
* @return
*/
private MenuItem getBiblioMenu() {
// Create the Options menu
MenuBar biblioMenu = new MenuBar(true);
MenuItem toReturn = new MenuItem("Bibliography", biblioMenu);
biblioMenu.setAnimationEnabled(true);
addBiblioEntry = new MenuItem("<font color=\"gray\">"+ ADD_BIBLIO_ENTRY +"</font>", true, getBiblioCommand());
biblioMenu.addItem(addBiblioEntry);
viewBiblio = new MenuItem(VIEW_BIBLIO, true, viewBiblioCmd);
manageBiblio = new MenuItem(MANAGE_BIBLIO, true, manageBiblioCmd);
biblioMenu.addSeparator();
biblioMenu.addItem(manageBiblio);
biblioMenu.addItem(viewBiblio);
return toReturn;
}
/**
*
* @return
*/
private MenuItem getSectionMenu() {
// Create the Options menu
MenuBar insertsMenu = new MenuBar(true);
MenuItem toReturn = new MenuItem("Section", insertsMenu);
insertsMenu.setAnimationEnabled(true);
importModel = new MenuItem("<font color=\"gray\">Import from Template or Report</font>", true, getNullCommand());
insertsMenu.addItem(importModel);
viewMetadata = new MenuItem("<font color=\"gray\">View Metadata</font>", true, getNullCommand());
discardSection = new MenuItem("<font color=\"gray\">Discard current</font>", true, getNullCommand());
viewComments = new MenuItem("<font color=\"gray\">"+ VIEW_USER_COMMENTS+"</font>", true, getNullCommand());
insertsMenu.addItem(discardSection);
insertsMenu.addSeparator();
insertsMenu.addItem(viewMetadata);
insertsMenu.addItem(viewComments);
return toReturn;
}
private MenuItem getExportsMenu() {
MenuBar exportsMenu = new MenuBar(true);
exportsMenu.setAnimationEnabled(true);
MenuItem toReturn = new MenuItem("Export", exportsMenu);
optionDOCX = new MenuItem("<font color=\"gray\">"+ EXPORT_OPENXML +"</font>", true, getNullCommand());
// optionPDF = new MenuItem("<font color=\"gray\">Export to PDF</font>", true, getNullCommand());
optionHTML = new MenuItem("<font color=\"gray\">"+ EXPORT_HTML +"</font>", true, getNullCommand());
optionFimes = new MenuItem("<font color=\"gray\">"+ EXPORT_FIMES +"</font>", true, getNullCommand());
exportsMenu.addItem(optionDOCX);
exportsMenu.addItem(optionHTML);
//optionsMenu.addItem(optionPDF);
//exportsMenu.addItem(optionFimes);
return toReturn;
}
private MenuItem getViewMenu() {
Command openPageProperties = new Command() {
public void execute() {
int left = mainLayout.getAbsoluteLeft() + 50;
int top = mainLayout.getAbsoluteTop() + 25;
PagePropertiesDialog dlg = new PagePropertiesDialog(templateModel, presenter);
dlg.setPopupPosition(left, top);
dlg.setAnimationEnabled(true);
dlg.show();
}
};
Command showReportStructure = new Command() {
public void execute() {
presenter.showReportStructure();
}
};
// Create the Options menu
MenuBar optionsMenu = new MenuBar(true);
optionsMenu.setAnimationEnabled(true);
MenuItem toReturn = new MenuItem("View", optionsMenu);
optionsMenu.addItem("View Properties", openPageProperties);
optionsMenu.addItem("View Structure", showReportStructure);
optionsMenu.addSeparator();
return toReturn;
}
/**
* rewrite with setHTML to remove the gray color
*/
public void enableExports() {
optionDOCX.setHTML(EXPORT_OPENXML);
optionDOCX.setCommand(generateDOCX);
// optionPDF.setHTML("Export to PDF");
// optionPDF.setCommand(generatePDF);
optionHTML.setHTML(EXPORT_HTML);
optionHTML.setCommand(generateHTML);
optionFimes.setHTML(EXPORT_FIMES);
optionFimes.setCommand(generateFimes);
//
importModel.setHTML("Import from Template or Report");
importModel.setCommand(importModelOrReport);
viewMetadata.setHTML("View Metadata");
viewMetadata.setCommand(openMetadata);
viewComments.setHTML(VIEW_USER_COMMENTS);
viewComments.setCommand(showUserComments);
discardSection.setHTML("Discard current");
discardSection.setCommand(discardSectionCom);
}
/**
*
*/
Command showUserComments = new Command() {
public void execute() {
presenter.showSectionUserCommentsTooltips();
}
};
/**
* rewrite with setHTML to remove the gray color
* @param d4sArea
*/
public void enableBiblioEntry(RichTextArea d4sArea) {
addBiblioEntry.setHTML(ADD_BIBLIO_ENTRY);
addBiblioEntry.setCommand(addBiblioEntryCommand);
presenter.setAreaForBiblio(d4sArea);
}
/**
* build the File Menu
* @return
*/
private MenuItem getFileMenu() {
Command newTemplate = new Command() {
public void execute() {
presenter.changeTemplateName(TemplateModel.DEFAULT_NAME);
presenter.cleanAll();
}
};
Command openTemplate = new Command() {
public void execute() {
GWT.runAsync(WorkspaceLightTreeLoadPopup.class, new RunAsyncCallback() {
public void onSuccess() {
int left = mainLayout.getAbsoluteLeft() + 50;
int top = mainLayout.getAbsoluteTop() + 25;
WorkspaceLightTreeLoadPopup wpTreepopup = new WorkspaceLightTreeLoadPopup("Open Template", true, true);
wpTreepopup.setShowableTypes(ItemType.REPORT_TEMPLATE);
wpTreepopup.setSelectableTypes(ItemType.REPORT_TEMPLATE);
wpTreepopup.addPopupHandler(new PopupHandler() {
public void onPopup(PopupEvent event) {
if (! event.isCanceled()) {
if (event.getSelectedItem() != null) {
presenter.openTemplate(event.getSelectedItem().getName(), event.getSelectedItem().getId(), true);
}
presenter.getHeader().enableExports();
}
}
});
wpTreepopup.setPopupPosition(left, top);
wpTreepopup.show();
}
public void onFailure(Throwable reason) {
Window.alert("There are networks problem, please check your connection.");
}
});
}
};
Command openHelp = new Command() {
public void execute() {
if (! ReportConstants.isDeployed) {
presenter.openTemplate("", "", true);
enableExports();
}
else {
String url = "https://gcube.wiki.gcube-system.org/gcube/index.php/Common_Functionality#Report_Management";
int width = Window.getClientWidth();
int height = Window.getClientHeight();
int winWidth = (int) (Window.getClientWidth() * 0.8);
int winHeight = (int) (Window.getClientHeight() * 0.7);
int left = (width - winWidth) / 2;
int top = (height - winHeight) / 2;
Window.open(url, null,"left=" + left + "top" + top + ", width=" + winWidth + ", height=" + winHeight + ", resizable=yes, scrollbars=yes, status=yes");
}
}
};
Command openReport = new Command() {
public void execute() {
GWT.runAsync(WorkspaceLightTreeLoadPopup.class, new RunAsyncCallback() {
public void onSuccess() {
int left = mainLayout.getAbsoluteLeft() + 50;
int top = mainLayout.getAbsoluteTop() + 25;
WorkspaceLightTreeLoadPopup wpTreepopup = new WorkspaceLightTreeLoadPopup("Open Report", true, true);
wpTreepopup.setShowableTypes(ItemType.REPORT);
wpTreepopup.setSelectableTypes(ItemType.REPORT);
wpTreepopup.addPopupHandler(new PopupHandler() {
public void onPopup(PopupEvent event) {
if (! event.isCanceled()) {
if (event.getSelectedItem() != null) {
presenter.openTemplate(event.getSelectedItem().getName(), event.getSelectedItem().getId(), false);
}
presenter.getHeader().enableExports();
}
}
});
wpTreepopup.setPopupPosition(left, top);
wpTreepopup.show();
}
public void onFailure(Throwable reason) {
Window.alert("There are networks problem, please check your connection.");
}
});
}
};
Command saveReportAs = new Command() {
public void execute() {
CommonCommands cmd = new CommonCommands(presenter);
cmd.saveReportAsDialog();
}
};
Command saveReport = new Command() {
public void execute() {
if (templateModel.getTemplateName().endsWith("d4sR"))
presenter.saveReport();
else {
CommonCommands cmd = new CommonCommands(presenter);
cmd.saveReportAsDialog();
}
}
};
Command importFimes = new Command() {
public void execute() {
presenter.showImportPopup();
}
};
// Create the file menu
MenuBar fileMenu = new MenuBar(true);
fileMenu.setAnimationEnabled(true);
MenuItem toReturn = new MenuItem("File", fileMenu);
fileMenu.addItem("Open template...", openTemplate);
// fileMenu.addSeparator();
// fileMenu.addItem("Open saved Report", getNullCommand());
fileMenu.addSeparator();
fileMenu.addItem("Open Report", openReport);
fileMenu.addItem("Save", saveReport);
fileMenu.addItem("Save As ..", saveReportAs);
fileMenu.addSeparator();
// fileMenu.addItem("Import from FiMES XML", importFimes);
fileMenu.addItem("Close Report", newTemplate);
fileMenu.addSeparator();
fileMenu.addItem("? Open User's Guide", openHelp);
return toReturn;
}
/**
*
* @param model .
*/
public void setModel(TemplateModel model ) {
this.templateModel = model;
}
//************** COMMANDS ********************************////
Command generateFimes = new Command() {
public void execute() {
presenter.generateFiMES(templateModel);
}
};
Command generateDOCX = new Command() {
public void execute() {
presenter.generateManifestation(templateModel, ExportManifestationType.DOCX);
}
};
Command generatePDF = new Command() {
public void execute() {
Window.alert("PDF Exporting may not be fully working, you can also generate a PDF using your Word Processor application starting from the docx exported file");
presenter.generateManifestation(templateModel, ExportManifestationType.PDF);
}
};
Command generateHTML = new Command() {
public void execute() {
presenter.generateManifestation(templateModel, ExportManifestationType.HTML);
}
};
Command discardSectionCom = new Command() {
public void execute() {
presenter.discardCurrentSection();
}
};
//************** COMMANDS ********************************////
Command addBiblioEntryCommand = new Command() {
public void execute() {
presenter.openAddCitationDialog();
}
};
/**
*
*/
Command openMetadata = new Command() {
public void execute() {
int left = mainLayout.getAbsoluteLeft() + 50;
int top = mainLayout.getAbsoluteTop() + 25;
GCubeDialog dlg = new GCubeDialog(true);
dlg.setText("Report Metadata:");
int pageNo = presenter.getModel().getCurrentPage();
List<Metadata> metadatas = presenter.getModel().getSection(pageNo).getAllMetadata();
int nRows = metadatas.size();
Grid metadataGrid = new Grid(nRows, 2);
int i = 0;
for (Metadata md : metadatas) {
metadataGrid.setWidget(i, 0, new HTML("<b>" + md.getAttribute() + ": </b>"));
metadataGrid.setWidget(i, 1, new HTML(md.getValue()));
i++;
}
dlg.setWidget(metadataGrid);
dlg.setPopupPosition(left, top);
dlg.setAnimationEnabled(true);
dlg.show();
}
};
Command importModelOrReport = new Command() {
public void execute() {
if (! ReportConstants.isDeployed) {
int left = mainLayout.getAbsoluteLeft() + 50;
int top = mainLayout.getAbsoluteTop() + 25;
ImporterDialog dlg = new ImporterDialog(null, presenter);
dlg.setPopupPosition(left, top);
dlg.setAnimationEnabled(true);
dlg.show();
}
else {
int left = mainLayout.getAbsoluteLeft() + 50;
int top = mainLayout.getAbsoluteTop() + 25;
WorkspaceLightTreeLoadPopup wpTreepopup = new WorkspaceLightTreeLoadPopup("Pick the item you want to import from", true, true);
wpTreepopup.setShowableTypes(ItemType.REPORT_TEMPLATE, ItemType.REPORT);
wpTreepopup.addPopupHandler(new PopupHandler() {
public void onPopup(PopupEvent event) {
if (! event.isCanceled()) {
if (event.getSelectedItem() != null) {
int left = mainLayout.getAbsoluteLeft() + 50;
int top = mainLayout.getAbsoluteTop() + 25;
ImporterDialog dlg = new ImporterDialog(event.getSelectedItem(), presenter);
dlg.setPopupPosition(left, top);
dlg.setAnimationEnabled(true);
dlg.show();
}
presenter.getHeader().enableExports();
}
}
});
wpTreepopup.setPopupPosition(left, top);
wpTreepopup.show();
}
}
};
/**
*
* @return .
*/
public CellPanel getMainLayout() {
return mainLayout;
}
}

View File

@ -0,0 +1,225 @@
package org.gcube.portlets.user.reportgenerator.client.Presenter;
import org.gcube.portlets.user.reportgenerator.client.ReportConstants;
import org.gcube.portlets.user.reportgenerator.client.dialog.ImageUploaderDialog;
import org.gcube.portlets.user.reportgenerator.client.dialog.ImporterDialog;
import org.gcube.portlets.user.workspace.lighttree.client.ItemType;
import org.gcube.portlets.user.workspace.lighttree.client.event.PopupEvent;
import org.gcube.portlets.user.workspace.lighttree.client.event.PopupHandler;
import org.gcube.portlets.user.workspace.lighttree.client.load.WorkspaceLightTreeLoadPopup;
import org.gcube.portlets.user.workspace.lighttree.client.save.WorkspaceLightTreeSavePopup;
import com.extjs.gxt.ui.client.event.ColorPaletteEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.widget.ColorPalette;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.PopupPanel;
/**
* *
* /**
* <code> CommonCommands </code> class contains the menu commands for the UI
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
*
* @version December 2012 (2.7)
*/
public class CommonCommands {
/**
*
*/
public Command openTemplate;
/**
*
*/
public Command importTemplateCommand;
/**
*
*/
public Command insertImage;
/**
*
*/
public Command saveTemplate;
/**
*
*/
public Command pickColor;
private Presenter presenter;
/**
*
* @param presenter .
*/
public CommonCommands(final Presenter presenter) {
this.presenter = presenter;
openTemplate = new Command() {
public void execute() {
final int left = presenter.getHeader().getMainLayout().getAbsoluteLeft() + 50;
final int top = presenter.getHeader().getMainLayout().getAbsoluteTop() + 25;
GWT.runAsync(WorkspaceLightTreeLoadPopup.class, new RunAsyncCallback() {
public void onSuccess() {
WorkspaceLightTreeLoadPopup wpTreepopup = new WorkspaceLightTreeLoadPopup("Open Template", true, true);
wpTreepopup.setShowableTypes(ItemType.REPORT_TEMPLATE);
wpTreepopup.setSelectableTypes(ItemType.REPORT_TEMPLATE);
wpTreepopup.addPopupHandler(new PopupHandler() {
public void onPopup(PopupEvent event) {
if (! event.isCanceled()) {
if (event.getSelectedItem() != null) {
presenter.openTemplate(event.getSelectedItem().getName(), event.getSelectedItem().getId(), true);
}
}
}
});
wpTreepopup.setPopupPosition(left, top);
wpTreepopup.show();
}
public void onFailure(Throwable reason) {
Window.alert("There are networks problem, please check your connection.");
}
});
}
};
insertImage = new Command() {
public void execute() {
int left = presenter.getHeader().getMainLayout().getAbsoluteLeft() + 50;
int top = presenter.getHeader().getMainLayout().getAbsoluteTop() + 25;
ImageUploaderDialog dlg = new ImageUploaderDialog(presenter);
dlg.setAnimationEnabled(true);
dlg.setPopupPosition(left, top);
dlg.show();
}
};
pickColor = new Command() {
public void execute() {
int left = presenter.getHeader().getMainLayout().getAbsoluteLeft() + 600;
int top = presenter.getHeader().getMainLayout().getAbsoluteTop() + 50;
final PopupPanel pp = new PopupPanel(true);
ColorPalette colorPalette = new ColorPalette();
colorPalette.addListener(Events.Select, new Listener<ColorPaletteEvent>() {
@SuppressWarnings("deprecation")
public void handleEvent(ColorPaletteEvent be) {
presenter.getCurrentSelected().getExtendedFormatter().setForeColor(be.getColor());
pp.hide();
}
});
pp.add(colorPalette);
pp.setAnimationEnabled(false);
pp.setPopupPosition(left, top);
pp.show();
}
};
importTemplateCommand = new Command() {
public void execute() {
if (! ReportConstants.isDeployed) {
int left = presenter.getHeader().getMainLayout().getAbsoluteLeft() + 50;
int top = presenter.getHeader().getMainLayout().getAbsoluteTop() + 25;
ImporterDialog dlg = new ImporterDialog(null, presenter);
dlg.setPopupPosition(left, top);
dlg.setAnimationEnabled(true);
dlg.show();
}
else {
GWT.runAsync(WorkspaceLightTreeLoadPopup.class, new RunAsyncCallback() {
public void onSuccess() {
WorkspaceLightTreeLoadPopup wpTreepopup = new WorkspaceLightTreeLoadPopup("Pick the item you want to import from", true, true);
wpTreepopup.setShowableTypes(ItemType.REPORT_TEMPLATE);
wpTreepopup.addPopupHandler(new PopupHandler() {
public void onPopup(PopupEvent event) {
if (! event.isCanceled()) {
if (event.getSelectedItem() != null) {
int left = presenter.getHeader().getMainLayout().getAbsoluteLeft() + 50;
int top = presenter.getHeader().getMainLayout().getAbsoluteTop() + 25;
ImporterDialog dlg = new ImporterDialog(event.getSelectedItem(), presenter);
dlg.setPopupPosition(left, top);
dlg.setAnimationEnabled(true);
dlg.show();
}
}
}
});
int left = presenter.getHeader().getMainLayout().getAbsoluteLeft() + 50;
int top = presenter.getHeader().getMainLayout().getAbsoluteTop() + 25;
wpTreepopup.setPopupPosition(left, top);
wpTreepopup.show();
}
public void onFailure(Throwable reason) {
Window.alert("There are networks problem, please check your connection.");
}
});
}
}
};
saveTemplate = new Command() {
public void execute() {
if (presenter.getModel().getTemplateName().endsWith("d4sR"))
presenter.saveReport();
else
saveReportAsDialog();
}
};
} //end constructor
public void saveReportAsDialog() {
final int left = presenter.getHeader().getMainLayout().getAbsoluteLeft() + 50;
final int top = presenter.getHeader().getMainLayout().getAbsoluteTop() + 25;
GWT.runAsync(WorkspaceLightTreeSavePopup.class, new RunAsyncCallback() {
public void onSuccess() {
WorkspaceLightTreeSavePopup wpTreepopup = new WorkspaceLightTreeSavePopup("Save Template, choose folder please:", true);
wpTreepopup.setSelectableTypes( ItemType.FOLDER, ItemType.ROOT);
wpTreepopup.setShowEmptyFolders(true);
wpTreepopup.addPopupHandler(new PopupHandler() {
public void onPopup(PopupEvent event) {
//checking user input
String inputUser = event.getName();
String newTemplateName = inputUser;
if (presenter.getModel().getTemplateName().compareTo(newTemplateName) != 0) {
newTemplateName = newTemplateName.trim();
presenter.getModel().setTemplateName(newTemplateName+".d4sR");
}
presenter.changeTemplateName(newTemplateName);
presenter.saveReport(event.getSelectedItem().getId(), newTemplateName);
}
});
wpTreepopup.setPopupPosition(left, top);
wpTreepopup.show();
}
public void onFailure(Throwable reason) {
Window.alert("There are networks problem, please check your connection.");
}
});
}
}

View File

@ -0,0 +1,32 @@
package org.gcube.portlets.user.reportgenerator.client;
import com.google.gwt.core.client.GWT;
/**
* Simply a class containing Static Constants
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version november 2008 (0.1)
*/
public class ReportConstants {
/**
* tell if you running in eclipse or not
*/
public static final boolean isDeployed = true;
/**
*
*/
public static final String LOADING_BAR = GWT.getModuleBaseURL() + "../images/loading-bar.gif";
/**
*
*/
public static final String IMAGE_NEXT_PAGE = GWT.getModuleBaseURL() + "../images/next_p.gif";
/**
*
*/
public static final String IMAGE_PREV_PAGE = GWT.getModuleBaseURL() + "../images/prev_p.gif";
}

View File

@ -0,0 +1,403 @@
package org.gcube.portlets.user.reportgenerator.client;
import org.gcube.portlets.user.guidedtour.client.GCUBEGuidedTour;
import org.gcube.portlets.user.guidedtour.client.steps.GCUBETemplate1Text1Image;
import org.gcube.portlets.user.guidedtour.client.steps.GCUBETemplate2Text2Image;
import org.gcube.portlets.user.guidedtour.client.steps.TourStep;
import org.gcube.portlets.user.guidedtour.client.types.ThemeColor;
import org.gcube.portlets.user.guidedtour.client.types.VerticalAlignment;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.toursteps.Intro;
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
import org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceServiceAsync;
import org.gcube.portlets.user.workspace.lighttree.client.ItemType;
import org.gcube.portlets.user.workspace.lighttree.client.event.PopupEvent;
import org.gcube.portlets.user.workspace.lighttree.client.event.PopupHandler;
import org.gcube.portlets.user.workspace.lighttree.client.load.WorkspaceLightTreeLoadPopup;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
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.ui.CellPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*
*
* <code> ReportGen </code> class is the Entry point class, defines the main layout of the UI
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
*
* @version June 2011 (3.0)
*/
public class ReportGenerator implements EntryPoint {
/**
*
*/
public static final int HEADER_HEIGHT = 25;
/**
*
*/
public static final int PAGE_LEFT = 5;
/**
*
*/
public static final int TOOLBOX_LEFT = 15;
/**
*
*/
public static final int TEMPLATE_LEFT = 230;
/**
*
*/
public static final int TEMPLATE_TOP = HEADER_HEIGHT + 60;
/**
*
*/
public static ReportGenerator singleton = null;
/**
*
* @return .
*/
public static ReportGenerator get() {
return singleton;
}
/**
* the controller
*/
private Presenter presenter;
private VerticalPanel mainLayout = new VerticalPanel();
private ToolboxPanel toolBoxPanel;
private Headerbar header;
private TitleBar titlebar;
private WorkspacePanel workSpacePanel;
private VerticalPanel eastPanel = new VerticalPanel();
private VerticalPanel toolbarPanel = new VerticalPanel();
private ScrollPanel bottomScrollerPanel = new ScrollPanel();
private AppControllerExplorer treeController;
private HTML divHidden = new HTML();
/**
* This is the entry point method.
*/
public void onModuleLoad() {
singleton = this;
presenter = new Presenter();
treeController = new AppControllerExplorer();
mainLayout.setWidth("100%");
mainLayout.setHeight("100%");
//
workSpacePanel = new WorkspacePanel(presenter);
titlebar = new TitleBar(presenter);
header = new Headerbar(presenter);
toolBoxPanel = new ToolboxPanel(treeController);
presenter.setHeader(header);
presenter.setTitleBar(titlebar);
presenter.setWp(workSpacePanel);
presenter.setToolBoxPanel(toolBoxPanel);
mainLayout.add(titlebar);
mainLayout.add(header);
mainLayout.add(toolbarPanel);
toolbarPanel.setWidth("100%");
toolbarPanel.setHeight("40");
CellPanel cellPanel = new HorizontalPanel();
cellPanel.setStyleName("cella");
cellPanel.add(toolBoxPanel);
cellPanel.add(bottomScrollerPanel);
cellPanel.setCellWidth(toolBoxPanel, "230");
mainLayout.add(cellPanel);
divHidden.setStyleName("d4sFrame");
divHidden.setWidth("500");
divHidden.setStyleName("d4sRichTextArea");
divHidden.addStyleName("setVisibilityOff");
divHidden.addStyleName("hasRichTextToolbar");
eastPanel.add(workSpacePanel);
eastPanel.add(divHidden);
bottomScrollerPanel.add(eastPanel);
presenter.addTextToolBar();
// Add image and button to the RootPanel
RootPanel.get("ReportGeneratorDIV").add(mainLayout);
int scrollerWidth = Window.getClientWidth()- TEMPLATE_LEFT - 30;
bottomScrollerPanel.setPixelSize(scrollerWidth, 1000);
if ( Window.getClientWidth() < 1070 ) {
int scrollerWidth2 = Window.getClientWidth()- TEMPLATE_LEFT;
bottomScrollerPanel.setPixelSize(scrollerWidth2, 1000);
}
Window.addResizeHandler(new ResizeHandler() {
public void onResize(ResizeEvent event) {
int scrollerHeight = event.getHeight() - bottomScrollerPanel.getAbsoluteTop();
if (scrollerHeight < toolBoxPanel.getTreePanelHeight())
scrollerHeight = toolBoxPanel.getTreePanelHeight();
int scrollerWidth = Window.getClientWidth()- TEMPLATE_LEFT - 30;
bottomScrollerPanel.setPixelSize(scrollerWidth , 1000);
if ( Window.getClientWidth() < 1060 ) {
int scrollerWidth2 = Window.getClientWidth()- TEMPLATE_LEFT;
bottomScrollerPanel.setPixelSize(scrollerWidth2, 1000);
}
}
});
showGuidedTour() ;
}
private void showGuidedTour() {
GWT.runAsync(GCUBEGuidedTour.class, new RunAsyncCallback() {
public void onSuccess() {
TourStep step1 = new GCUBETemplate1Text1Image(true) {
@Override
public String setStepTitle() {
return "gCube Reporting";
}
@Override
public String setStepImage() {
return "images/tour/tour1.jpg";
}
@Override
public String setStepBody() {
return new Intro().getHTML();
}
};
TourStep step2 = new GCUBETemplate1Text1Image(false) {
@Override
public String setStepTitle() {
return "Structure View";
}
@Override
public String setStepImage() {
return "images/tour/tour2.jpg";
}
@Override
public String setStepBody() {
return "<div style=\"line-height: 19px; font-size: 16px; padding: 10px;\">" +
"<div style=\"padding-bottom: 90px;\">" +
"Use the <b>Report Structure View</b> to see your report structure. (View > Structure)" +
"</div>" +
"<div style=\"padding-bottom: 80px;\">" +
"Use the <b>Report Structure View</b> to navigate through your report." +
"</div>" +
"</div>";
}
};
TourStep step3 = new GCUBETemplate2Text2Image(false) {
@Override
public String setStepTitle() {
return "User Comments";
}
@Override
public String setStepImage() {
return "images/tour/tourComment.jpg";
}
@Override
public String setStepBody() {
return "<div style=\"line-height: 19px; padding: 10px; font-size: 16px; \">" +
"<div style=\"padding-bottom: 10px;\">" +
"Use comments to collaborate with your colleagues." +
"</div>" +
"</div>";
}
@Override
public String setStepOtherImage() {
return "images/tour/tourFormat.jpg";
}
@Override
public String setStepOtherBody() {
return "<div style=\"line-height: 19px; padding: 10px; font-size: 16px; \">" +
"<div style=\"padding-bottom: 10px;\">" +
"<b>Format text</b> as you would in a word processor using the Formatting Bar." +
"</div>" +
"</div>";
}
};
TourStep step4 = new GCUBETemplate1Text1Image(false) {
@Override
public String setStepTitle() {
return "Bibliography";
}
@Override
public String setStepImage() {
return "images/tour/tourBiblio.jpg";
}
@Override
public String setStepBody() {
return "<div style=\"line-height: 19px; padding: 10px; font-size: 16px; \">" +
"<div style=\"padding-bottom: 80px;\">" +
"Use the <b>Bibliography to add references</b>" +
"</div>" +
"</div>";
}
};
TourStep step5 = new GCUBETemplate1Text1Image(false) {
@Override
public String setStepTitle() {
return "Export";
}
@Override
public String setStepImage() {
return "images/tour/tourExports.jpg";
}
@Override
public String setStepBody() {
return "<div style=\"line-height: 19px; padding: 10px; font-size: 16px; \">" +
"<div style=\"padding-bottom: 50px;\">" +
"Generate <b>different export formats</b> such as OpenXML (docx) or HTML." +
"</div>" +
"</div>";
}
};
//step1.setTextVerticalAlignment(VerticalAlignment.ALIGN_MIDDLE);
step2.setTextVerticalAlignment(VerticalAlignment.ALIGN_MIDDLE);
step3.setTextVerticalAlignment(VerticalAlignment.ALIGN_MIDDLE);
step4.setTextVerticalAlignment(VerticalAlignment.ALIGN_MIDDLE);
step5.setTextVerticalAlignment(VerticalAlignment.ALIGN_MIDDLE);
String guideUrl = "https://gcube.wiki.gcube-system.org/gcube/index.php/Common_Functionality#Report_Generation";
GCUBEGuidedTour gt = new GCUBEGuidedTour("gCube Reports Generator", ReportGenerator.class.getName(), guideUrl, 780, 450, false);
gt.addStep(step1);
gt.addStep(step2);
gt.addStep(step3);
gt.addStep(step4);
gt.addStep(step5);
gt.openTour();
}
public void onFailure(Throwable reason) {
Window.alert("There are networks problem, please check your connection.");
}
});
}
/**
*
* @return .
*/
public VerticalPanel getMainLayout() {
return mainLayout;
}
/**
*
* @return .
*/
public Headerbar getHeader() {
return header;
}
/**
*
* @return .
*/
public WorkspacePanel getWorkSpacePanel() {
return workSpacePanel;
}
/**
*
* @return .
*/
public ToolboxPanel getToolBoxPanel() {
return toolBoxPanel;
}
public GWTWorkspaceServiceAsync getWSTreeService() {
return treeController.getRpcWorkspaceService();
}
/**
*
* @return .
*/
public VerticalPanel getToolbarPanel() {
return toolbarPanel;
}
/**
*
* @param toolbarPanel .
*/
public void setToolbarPanel(VerticalPanel toolbarPanel) {
this.toolbarPanel = toolbarPanel;
}
/**
*
* @return .
*/
public TitleBar getTitleHeader() {
return titlebar;
}
/**
*
* @return .
*/
public HTML getDivHidden() {
return divHidden;
}
/**
*
* @param divHidden .
*/
public void setDivHidden(HTML divHidden) {
this.divHidden = divHidden;
}
public ScrollPanel getScrollerPanel() {
return bottomScrollerPanel;
}
}

View File

@ -0,0 +1,91 @@
package org.gcube.portlets.user.reportgenerator.client;
import org.gcube.portlets.d4sreporting.common.shared.SerializableModel;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTable;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTimeSeries;
import org.gcube.portlets.user.reportgenerator.client.model.ExportManifestationType;
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
import com.google.gwt.user.client.rpc.RemoteService;
/**
* Service interface for server communication
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version november 2008 (0.1)
*/
public interface ReportService extends RemoteService{
/**
* return the first ten records of the timeseries having id as param
* @param sTS .
* @return .
*/
SerializableTable getSampleTimeSeries(SerializableTimeSeries sTS);
/**
*
* @return .
*/
String[] getUserTemplateNames();
/**
* @param templateName .
* @param templateObjectID .
* @param isTemplate says if you're opening a template or a report
* @param isImporting says if your importing or youre loading a template in the UI
* @return .
*/
SerializableModel readModel(String templateName, String templateObjectID, boolean isTemplate, boolean isImporting);
/**
*
* @param model .
* @param type .
* @return .
*/
boolean generateManifestation(SerializableModel model, ExportManifestationType type);
/**
* each portlet instance runs in a scope
* each portlet instance is used by a unique username from within the portal
* @param currentHost .
* @return a SessionInfo bean containing the username the scope andis opening a workflow document or not
*/
SessionInfo getSessionInfo(String currentHost);
/**
*
* @param model .
*/
void storeTemplateInSession(SerializableModel model);
/**
*
* @return the model previously stored in the session
*/
SerializableModel readTemplateFromSession();
/**
* the report model is taken from the session
* @param folderid the basket id where to save the report
*/
void saveReport(String folderid, String newname);
/**
* the report model is taken from the session, the id also
*/
void saveReport();
SerializableModel getWorkflowDocumentFromDocumentLibrary();
void updateWorkflowDocument(boolean update);
void renewLock();
String generateTempDocx(SerializableModel model);
/**
*
* @param tempPath
* @return
*/
SerializableModel readImportedModel(String tempPath);
}

View File

@ -0,0 +1,87 @@
package org.gcube.portlets.user.reportgenerator.client;
import org.gcube.portlets.d4sreporting.common.shared.SerializableModel;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTable;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTimeSeries;
import org.gcube.portlets.user.reportgenerator.client.model.ExportManifestationType;
import org.gcube.portlets.user.reportgenerator.shared.SessionInfo;
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
* * Service interface for server Async communication
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
*
* @version november 2011 (3.0)
*/
public interface ReportServiceAsync {
/**
* return the first ten records of the timeseries having id as param
* @param sTS .
* @param callback .
*/
void getSampleTimeSeries(SerializableTimeSeries sTS, AsyncCallback<SerializableTable> callback);
/**
*
* @param callback .
*/
void getUserTemplateNames(AsyncCallback<String[]> callback);
/**
*
* @param templateName .
* @param templateObjectID .
* @param isTemplate says if you're opening a template or a report
* @param isImporting says if your importing or youre loading a template in the UI
* @param callback .
*/
void readModel(String templateName, String templateObjectID, boolean isTemplate, boolean isImporting, AsyncCallback<SerializableModel> callback);
/**
* @param model .
* @param type .
* @param callback .
*/
void generateManifestation(SerializableModel model, ExportManifestationType type, AsyncCallback<Boolean> callback);
/**
*
* @param model .
* @param callback .
*/
void storeTemplateInSession(SerializableModel model, AsyncCallback<Void> callback);
/**
*
* call for the model previously stored in the session
* @param callback .
*/
void readTemplateFromSession( AsyncCallback<SerializableModel> callback);
/**
* @param callback .
* @param folderid .
*/
void saveReport(String folderid, String newname, AsyncCallback<Void> callback);
/**
*
* @param callback .
*/
void saveReport(AsyncCallback<Void> callback);
/**
*
* @param currentHost
* @param callback
*/
void getSessionInfo(String currentHost, AsyncCallback<SessionInfo> callback);
void getWorkflowDocumentFromDocumentLibrary(
AsyncCallback<SerializableModel> callback);
void updateWorkflowDocument(boolean update, AsyncCallback<Void> callback);
void renewLock(AsyncCallback<Void> callback);
void generateTempDocx(SerializableModel model,
AsyncCallback<String> callback);
void readImportedModel(String tempPath,
AsyncCallback<SerializableModel> callback);
}

View File

@ -0,0 +1,202 @@
package org.gcube.portlets.user.reportgenerator.client;
import java.util.Date;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateModel;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.CellPanel;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasAlignment;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
/**
* <code> TitleBar </code> class is the top top bar component of the UI
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
*
* @version July 2011 (3.0)
*/
public class TitleBar extends Composite{
private Presenter presenter;
/**
* the template Model
*/
private TemplateModel templateModel;
/**
* mainLayout Panel
*/
private CellPanel mainLayout = new HorizontalPanel();
/**
* contains the current template name
*/
private HTML templateNameBox = new HTML();
/**
* contains the last edit date and the the last edit person username
*/
private HTML editedOn = new HTML();
/**
* contains the page displayer
*/
private HTML pageDisplayer = new HTML();
private HTML prevButton = new HTML("<img src=\"" + ReportConstants.IMAGE_PREV_PAGE + "\" />&nbsp;", true);
private HTML nextButton = new HTML("&nbsp;&nbsp;&nbsp;&nbsp;<img src=\"" + ReportConstants.IMAGE_NEXT_PAGE + "\" />", true);
/**
* Constructor
* @param c the controller instance for this UI component
*/
public TitleBar(Presenter c) {
this.presenter = c;
this.templateModel = presenter.getModel();
//initialize the template
setTemplateName(templateModel.getTemplateName());
setPageDisplayer(1, 1);
mainLayout.setSize("90%", "24px");
// mainLayout.setStyleName("newresultset-header");
//design the part for the template name and the pages handling
HorizontalPanel captionPanel = new HorizontalPanel();
HorizontalPanel innerCaptionPanel = new HorizontalPanel();
captionPanel.setWidth("100%");
//hide the buttons at the beginning
nextButton.addStyleName("setVisibilityOff");
prevButton.addStyleName("setVisibilityOff");
HorizontalPanel pageHandlerPanel = new HorizontalPanel();
pageHandlerPanel.setHeight("24");
pageHandlerPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
pageHandlerPanel.add(prevButton);
pageHandlerPanel.add(pageDisplayer);
pageHandlerPanel.add(nextButton);
pageHandlerPanel.setWidth("100%");
templateNameBox.setStyleName("menubar-font");
captionPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
innerCaptionPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
innerCaptionPanel.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM);
innerCaptionPanel.add(templateNameBox);
innerCaptionPanel.add(editedOn);
captionPanel.add(innerCaptionPanel);
mainLayout.add(captionPanel);
mainLayout.add(pageHandlerPanel);
editedOn.setStyleName("docEditedBy");
mainLayout.setCellHorizontalAlignment(captionPanel, HasHorizontalAlignment.ALIGN_LEFT);
mainLayout.setCellWidth(pageHandlerPanel, "200");
initWidget(mainLayout);
nextButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) { presenter.nextPageButtonClicked();
}
});
prevButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) { presenter.prevPageButtonClicked(); }
});
}
/**
* changes the pages label in the UI : e.g. Page x of y
* @param currentPage .
* @param totalPages .
*/
public void setPageDisplayer(int currentPage, int totalPages) {
pageDisplayer.setHTML("Section "+ currentPage + " of " + totalPages);
}
/**
* changes the template name label in the UI
* @param name .
*/
public void setTemplateName(String name) {
templateNameBox.setHTML("&nbsp;&nbsp;" + name);
}
/**
* changes the template name label in the UI
* @param username .
* @param date .
*/
public void setEditedOnBy(Date date, String username) {
String dt = DateTimeFormat.getShortDateFormat().format(date);
editedOn.setHTML("&nbsp;&nbsp;edited on " + dt + "&nbsp;&nbsp;by " + username);
}
/**
* Shows the previous botton in the UI
*/
public void showPrevButton() {
prevButton.removeStyleName("setVisibilityOff");
prevButton.addStyleName("setVisibilityOn");
}
/**
* Shows the next botton in the UI
*/
public void showNextButton() {
nextButton.removeStyleName("setVisibilityOff");
nextButton.addStyleName("setVisibilityOn");
}
/**
* Hide the previous botton in the UI
*/
public void hidePrevButton() {
prevButton.removeStyleName("setVisibilityOn");
prevButton.addStyleName("setVisibilityOff");
}
/**
* Hide the next botton in the UI
*/
public void hideNextButton() {
nextButton.removeStyleName("setVisibilityOn");
nextButton.addStyleName("setVisibilityOff");
}
/**
* temporary command
* @return the command instance
*/
public Command getNullCommand() {
Command openNothing = new Command() {
public void execute() {
Window.alert("Feature not supported yet");
}
};
return openNothing;
}
}

View File

@ -0,0 +1,53 @@
package org.gcube.portlets.user.reportgenerator.client;
//
//import org.gcube.portlets.user.workspace.client.tree.WorkspaceTreePanel;
//import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspace;
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
import org.gcube.portlets.user.workspace.client.view.tree.AsyncTreePanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.SimplePanel;
/**
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
*
* @version April 2012 (1.1)
*/
public class ToolboxPanel extends SimplePanel {
private AppControllerExplorer appController;
/**
*
*/
public static final int TOOLBOX_WIDTH = 235;
/**
*
*/
public static final int TOOLBOX_HEIGHT= 800;
/**
* constructor
*/
public ToolboxPanel(AppControllerExplorer appController) {
this.appController = appController;
AsyncTreePanel tp = appController.getTree(TOOLBOX_WIDTH, TOOLBOX_HEIGHT);
add(tp);
}
/**
* refresh the root
*/
public void refreshRoot() {
appController.refreshRoot();
}
/**
* lalala
* @return the toolbox height
*/
public int getTreePanelHeight() {
return TOOLBOX_HEIGHT;
}
}

View File

@ -0,0 +1,160 @@
package org.gcube.portlets.user.reportgenerator.client;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateModel;
import org.gcube.portlets.user.reportgenerator.client.targets.DoubleColumnPanel;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* <code> WorkspacePanel </code> class is the UI Component for displaying the template
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version October 2008 (0.2)
*/
public class WorkspacePanel extends Composite {
/**
* the model
*/
private TemplateModel templateModel;
/**
* the controller
*/
private Presenter presenter;
/**
*
*/
public static WorkspacePanel singleton = null;
/**
* used to place two compoenents on the same Y
*/
private boolean waitForNextOne = false;
/**
* elements arrive one by one, to place two on the same Y this bufferedWidget is used;
*/
private Widget bufferedWidget;
/**
*
* @return .
*/
public static WorkspacePanel get() {
return singleton;
}
/**
* the panel for the layout of the working space
*/
private FlowPanel mainLayout = new FlowPanel();
/**
*
* @param c the controller instance
*/
public WorkspacePanel(Presenter c) {
singleton = this;
presenter = c;
templateModel = presenter.getModel();
mainLayout.setSize(""+templateModel.getPageWidth(), ""+templateModel.getPageHeight());
//mainLayout.setStyleName("wpFlow");
//mainLayout.addStyleName("position-relative");
initWidget(mainLayout);
}
/**
*
* @param w .
* @param isDoubleColumnLayout .
*/
public void addComponentToLayout(Widget w, boolean isDoubleColumnLayout) {
waitForNextOne = isDoubleColumnLayout;
if (! waitForNextOne) {
mainLayout.add(w);
bufferedWidget = null;
}
else {
if (bufferedWidget == null)
bufferedWidget = w;
else {
DoubleColumnPanel toAdd = new DoubleColumnPanel(bufferedWidget, w);
mainLayout.add(toAdd);
bufferedWidget = null;
}
}
//mainLayout.add(w, x, y);
}
/**
*
* @param w the widget to remove
* @return true if the romove is successfull
*/
public boolean removeComponentFromLayout(Widget w) {
return mainLayout.remove(w);
}
/**
*
* @param model .
*/
public void setModel(TemplateModel model ) {
this.templateModel = model;
}
/**
* resizes the workspace panel
* @param width .
* @param height .
*/
public void resizeWorkspace(int width, int height) {
mainLayout.setPixelSize(width, height);
}
/**
*
* @param toMove .
* @param left .
* @param top .
*/
public void moveWidget(Widget toMove, int left, int top) {
// mainLayout.setWidgetPosition(toMove, left, top);
// GWT.log("MOVED? " + top, null);
}
/**
*
* @param toResize the widget to resize
* @param newWidth .
* @param newHeight .
*/
public void resizeWidget(Widget toResize, int newWidth, int newHeight) {
toResize.setPixelSize(newWidth, newHeight);
}
/**
*
* @return .
*/
public FlowPanel getMainLayout() {
return mainLayout;
}
}

View File

@ -0,0 +1,492 @@
package org.gcube.portlets.user.reportgenerator.client.components;
import org.gcube.portlets.user.reportgenerator.client.dialog.ImageUploaderDialog;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ChangeListener;
import com.google.gwt.user.client.ui.ChangeListenerCollection;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FileUpload;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.FormHandler;
import com.google.gwt.user.client.ui.FormPanel;
import com.google.gwt.user.client.ui.FormSubmitCompleteEvent;
import com.google.gwt.user.client.ui.FormSubmitEvent;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.HasWordWrap;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.SourcesChangeEvents;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* <code> FancyFileUpload </code> class is use to upload images from client in the UI
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version October 2008 (0.2)
*/
public class FancyFileUpload extends Composite implements HasText, HasWordWrap, SourcesChangeEvents{
/**
* State definitions
*/
public final int EMPTY_STATE = 1;
/**
*
*/
public final int PENDING_STATE = 2;
/**
*
*/
public final int UPLOADING_STATE = 3;
/**
*
*/
public final int UPLOADED_STATE = 4;
/**
*
*/
public final int DELETED_STATE = 5;
/**
*
*/
public final int FAILED_STATE = 6;
/**
* Initial State of the widget.
*/
private int widgetState = EMPTY_STATE;
/**
* Default delay to check an empty FileUpload widget for
* arrival of a filename.
*
*/
private int searchUpdateDelay = 500;
/**
* Default delay for pending state, when delay over the form is
submitted.
*/
private int pendingUpdateDelay = 5000;
/**
* the panel where this widget is in
*/
private ImageUploaderDialog theOwner;
/**
* OK message expected from file upload servlet to indicate successful
upload.
*/
//private String retursOKMessage = "<pre>OK</pre>";
private FormPanel uploadForm = new FormPanel();
private VerticalPanel mainPanel = new VerticalPanel();
/**
* Internal timer for checking fileupload text for a value.
*/
private Timer t;
/**
* Internal timer for checking if pending delay is over.
*/
private Timer p;
/**
* Widget representing file to be uploaded.
*/
private UploadDisplay uploadItem;
/**
* FileName to be uploaded
*/
String fileName = "";
/**
* Class used for the display of filename to be uploaded,
* and handling the update of the display states.
*
*
*/
protected class UploadDisplay extends Composite{
/**
* FileUpload Widget
*/
FileUpload uploadFileWidget = new FileUpload();
/**
* Label to display after file widget is filled with a filename
*/
Label uploadFileName = new Label();
/**
* Panel to hold the widget
*/
FlowPanel mainPanel = new FlowPanel();
/**
* Panel to hold pending, loading, loaded or failed state details.
*/
HorizontalPanel pendingPanel = new HorizontalPanel();
/**
* Constructor
*
*/
public UploadDisplay(){
mainPanel.add(uploadFileWidget);
pendingPanel.add(uploadFileName);
uploadFileName.setStyleName("HTMLObjectStyle-font");
uploadFileName.setWordWrap(true);
uploadFileWidget.setWidth("100%");
mainPanel.add(pendingPanel);
pendingPanel.setVisible(false);
initWidget(mainPanel);
}
/**
* Set the widget into pending mode by altering style
* of pending panel and displaying it. Hide the FileUpload
* widget and finally set the state to Pending.
*
*/
private void setPending(){
uploadFileName.setText("Please wait, fetching image from your file system.. ");//uploadFileWidget.getFilename());
uploadFileWidget.setVisible(false);
pendingPanel.setVisible(true);
pendingPanel.setStyleName("fancyfileupload-pending");
widgetState = PENDING_STATE;
}
/**
* Set the widget into Loading mode by changing the style name
* and updating the widget State to Uploading.
*
*/
private void setLoading(){
pendingPanel.setStyleName("fancyfileupload-loading");
widgetState = UPLOADING_STATE;
}
/**
* Set the widget to Loaded mode by changing the style name
* and updating the widget State to Loaded.
*
*/
private void setLoaded(){
pendingPanel.setStyleName("fancyfileupload-loaded");
uploadFileName.setText("Image Successfully uploaded");
widgetState = UPLOADED_STATE;
}
/**
* Set the widget to Failed mode by changing the style name
* and updating the widget State to Failed.
* Additionally, hide the pending panel and display the FileUpload
* widget.
*
*/
private void setFailed(){
widgetState = FAILED_STATE;
uploadFileName.setText("Operation Failed");
}
}
/**
* Perform the uploading of a file by changing state of display widget
* and then calling form.submit() method.
*
*/
private void uploadFiles(){
fileName = uploadItem.uploadFileWidget.getFilename();
uploadItem.setLoading();
uploadForm.submit();
}
/**
* Put the widget into a Pending state, set the Pending delay timer
* to call the upload file method when ran out.
*
*/
private void pendingUpload(){
// Fire an onChange event to anyone who is listening
uploadItem.setPending();
p = new Timer(){
public void run() {
uploadFiles();
}
};
p.schedule(pendingUpdateDelay);
}
/**
* Method to check if FileUpload Widget has a filename within it.
* If so, cancel the timer that was set to call this method and then
* call the pendingUpload() method.
* If not, do nothing.
*
*/
private void checkForFileName(){
// GWT.log(uploadItem.uploadFileWidget.getFilename()+" :"+fileName,null);
// if (!uploadItem.uploadFileWidget.getFilename().equals("")){
// if (!uploadItem.uploadFileWidget.getFilename().equals(fileName)){
// t.cancel();
// pendingUpload();
// }
// }
}
/**
* This method sets up a repeating schedule to call the
checkforfilename
* method to see if the FileUpload widget has any text in it.
*
*/
private void startWaiting(){
t = null;
t = new Timer(){
public void run() {
checkForFileName();
}
};
t.scheduleRepeating(searchUpdateDelay);
}
/**
*
* @param owner the caller
* @param templateName .
*/
public FancyFileUpload(ImageUploaderDialog owner, String templateName){
this.theOwner = owner;
// Set Form details
// Set the action to call on submit
uploadForm.setAction(GWT.getModuleBaseURL() + "ImagesUploadServlet?currTemplateName=" + templateName);
// Set the form encoding to multipart to indicate a file upload
uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART);
// Set the method to Post
uploadForm.setMethod(FormPanel.METHOD_POST);
uploadForm.setWidget(mainPanel);
// Create a new upload display widget
uploadItem = new UploadDisplay();
// Set the name of the upload file form element
uploadItem.uploadFileWidget.setName("uploadFormElement");
// Add the new widget to the panel.
mainPanel.add(uploadItem);
HorizontalPanel wrapper = new HorizontalPanel();
wrapper.setSpacing(4);
// Add a 'submit' button.
wrapper.add(new Button("Submit", new ClickListener() {
public void onClick(Widget sender) {
String fName = uploadItem.uploadFileWidget.getFilename();
int slashPosition = fName.lastIndexOf("/");
String fileNameToCheck = "" ;
if (slashPosition == -1) //it is windows
slashPosition = fName.lastIndexOf("\\");
if (slashPosition != -1)
fileNameToCheck = fName.substring(slashPosition+1, fName.length());
if (fName.equals("")) {
Window.alert("The text box must not be empty");
}
else if (fileNameToCheck.indexOf(" ") > -1) {
Window.alert("File name cannot contain empty spaces");
}
else {
t.cancel();
pendingUpload();
}
}
}));
// Add a 'close' button.
wrapper.add(new Button("Cancel", new ClickListener() {
public void onClick(Widget sender) {
theOwner.hide();
}
}));
mainPanel.add(wrapper);
// Start the waiting for a name to appear in the file upload widget.
startWaiting();
// Initialise the widget.
initWidget(uploadForm);
// Add an event handler to the form.
uploadForm.addFormHandler(new FormHandler() {
public void onSubmitComplete(FormSubmitCompleteEvent event) {
// Fire an onChange Event
fireChangeEvent();
// Cancel all timers to be absolutely sure nothing is going on.
t.cancel();
p.cancel();
// Ensure that the form encoding is set correctly.
uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART);
// Check the result to see if an OK message is returned from the server.
if(event.getResults().toString().contains("OK") || event.getResults().toString().startsWith("OK")) {
uploadItem.setLoaded();
String fName = uploadItem.uploadFileWidget.getFilename();
String nameToPass = "";
if (fName.lastIndexOf("/") == -1) //windows
nameToPass = fName.substring(fName.lastIndexOf("\\")+1);
else
nameToPass = fName.substring(fName.lastIndexOf("/")+1);
theOwner.insertImage(nameToPass);
theOwner.hide();
} else {
// If no, set the widget to failed state.
uploadItem.setFailed();
Window.alert("There were some errors during File Uploading processing,Please try again");
}
}
public void onSubmit(FormSubmitEvent event) {
//No validation in this version.
}
});
}
/**
* Fire a change event to anyone listening to us.
*
*/
private void fireChangeEvent(){
if (changeListeners != null)
changeListeners.fireChange(this);
}
/**
* Get the text from the widget - which in reality will be retrieving any
* value set in the Label element of the display widget.
* @return .
*/
public String getText() {
return uploadItem.uploadFileName.getText();
}
/**
* Cannot set the text of a File Upload Widget, so raise an exception.
* @param text .
*/
public void setText(String text) {
throw new RuntimeException("Cannot set text of a FileUpload Widget");
}
/**
* Retrieve the status of the upload widget.
* @return Status of upload widget.
*
*/
public int getUploadState(){
return widgetState;
}
/**
* Set the delay for checking for a filename to appear in the FileUpload widget
* Might be useful if there are performance issues.
* @param newDelay .
*/
public void setCheckForFileNameDelay(int newDelay){
searchUpdateDelay = newDelay;
}
/**
* Set the delay value indicating how long a file will remain in
pending mode
* prior to the upload action taking place.
* @param newDelay .
*/
public void setPendingDelay(int newDelay){
pendingUpdateDelay = newDelay;
}
/**
* Return the delay value set for checking a file.
* @return .
*/
public int getCheckForFileNameDelay(){
return searchUpdateDelay;
}
/**
* Return value set for pending delay.
* @return .
*/
public int getPendingDelay(){
return pendingUpdateDelay;
}
/**
* Return if the label in the display widget is wordwrapped or not.
* @return .
*/
public boolean getWordWrap() {
return uploadItem.uploadFileName.getWordWrap();
}
/**
* Set the word wrap value of the label in the display widget.
* @param wrap .
*/
public void setWordWrap(boolean wrap) {
uploadItem.uploadFileName.setWordWrap(wrap);
}
/**
*
*/
private ChangeListenerCollection changeListeners;
/**
* Add a change listener
* @param listener ,
*/
public void addChangeListener(ChangeListener listener) {
if (changeListeners == null)
changeListeners = new ChangeListenerCollection();
changeListeners.add(listener);
}
/**
* Remove a change listener
* @param listener .
*/
public void removeChangeListener(ChangeListener listener) {
if (changeListeners != null)
changeListeners.remove(listener);
}
}

View File

@ -0,0 +1,70 @@
package org.gcube.portlets.user.reportgenerator.client.dialog;
import org.gcube.portlets.user.reportgenerator.client.events.AddBiblioEvent;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.widget.Dialog;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.form.TextArea;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.google.gwt.event.shared.HandlerManager;
/**
* The <code> AddBiblioEntryDialog </code> class
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version July 2011 (3.0)
*/
public class AddBiblioEntryDialog extends Window {
public AddBiblioEntryDialog(final HandlerManager eventBus) {
setHeading("Add Citation");
setClosable(true);
setWidth(400);
setHeight(250);
setPlain(true);
setLayout(new FitLayout());
final TextField<String> citekey = new TextField<String>();
citekey.setFieldLabel("Cite key");
citekey.setAllowBlank(false);
final TextArea textArea = new TextArea();
textArea.setFieldLabel("Citation");
textArea.setAllowBlank(false);
textArea.setHeight(130);
Button addButton = new Button("Add") {
@Override
protected void onClick(final ComponentEvent ce) {
if (citekey.isValid()) {
eventBus.fireEvent(new AddBiblioEvent(citekey.getValue(), textArea.getValue()));
close();
}
}
};
Button cancelButton = new Button("Cancel") {
@Override
protected void onClick(final ComponentEvent ce) {
close();
}
};
addButton(addButton);
addButton(cancelButton);
FormData formData = new FormData("-10");
FormPanel formPanel = new FormPanel();
formPanel.setAutoWidth(true);
formPanel.getHeader().setStyleName("x-hide-panel-header");
formPanel.setHeaderVisible(false);
formPanel.setLabelWidth(55);
formPanel.setWidth(400);
formPanel.setHeight(250);
formPanel.add(citekey, formData);
formPanel.add(textArea, formData);
add(formPanel);
}
}

View File

@ -0,0 +1,86 @@
package org.gcube.portlets.user.reportgenerator.client.dialog;
import org.gcube.portlets.d4sreporting.common.client.ImageConstants;
import org.gcube.portlets.user.reportgenerator.client.events.AddCommentEvent;
import org.gcube.portlets.user.reportgenerator.client.events.RemovedUserCommentEvent;
import org.gcube.portlets.user.reportgenerator.client.targets.ReportTextArea;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.VerticalPanel;
public class CommentDialog extends DialogBox {
private static final int PANEL_WIDTH = 200;
VerticalPanel mainPanel = new VerticalPanel();
AbsolutePanel header = new AbsolutePanel();
TextArea area;
public CommentDialog(final HandlerManager eventBus, final ReportTextArea source, final String username, final String previousComment, int areaHeight) {
super(true);
setStyleName("comment-popup");
area = new TextArea();
if (previousComment != null && !(previousComment.compareTo("") == 0)) {
area.setText(previousComment);
} else {
area.setText(" - " + username+":\n");
}
if (areaHeight > 0) {
area.setPixelSize(PANEL_WIDTH, areaHeight);
} else {
area.setPixelSize(PANEL_WIDTH, 85);
}
setSize(PANEL_WIDTH+"px", "100px");
header.setPixelSize(PANEL_WIDTH, 15);
final Image enterImage = new Image(ImageConstants.IMAGE_ARROW_ENTER);
final Image closeImage = new Image(ImageConstants.IMAGE_CLOSE_15x15);
final Image binImage = new Image(ImageConstants.IMAGE_BIN);
closeImage.setStyleName("selectable");
binImage.setStyleName("selectable");
enterImage.setStyleName("selectable");
header.add(enterImage, PANEL_WIDTH-46, -2);
header.add(binImage, PANEL_WIDTH-27, 0);
header.add(closeImage, PANEL_WIDTH-12, 3);
binImage.setTitle("Discard this comment");
closeImage.setTitle("Close and save");
enterImage.setTitle("Add another comment");
area.setStyleName("comment-popup-textarea");
header.setStyleName("comment-popup-header");
mainPanel.add(header);
mainPanel.add(area);
add(mainPanel);
enterImage.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
area.setText(area.getText() + "\n______\n"+username+":\n");
area.setPixelSize(PANEL_WIDTH, area.getOffsetHeight()+70);
}
});
closeImage.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
eventBus.fireEvent(new AddCommentEvent(source, area.getText(), area.getOffsetHeight()));
source.addCommentView();
hide();
}
});
binImage.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
eventBus.fireEvent(new RemovedUserCommentEvent(source));
source.removeCommentView();
hide();
}
});
}
}

View File

@ -0,0 +1,92 @@
package org.gcube.portlets.user.reportgenerator.client.dialog;
import java.util.ArrayList;
import org.gcube.portlets.d4sreporting.common.client.ComponentType;
import org.gcube.portlets.d4sreporting.common.shared.SerializableComponent;
import org.gcube.portlets.user.reportgenerator.client.events.RemovedCitationEvent;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateComponent;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateSection;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.widget.Component;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.HTML;
import com.extjs.gxt.ui.client.widget.button.Button;
/**
* The <code> ManageBiblioDialog </code> class
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version July 2011 (3.0)
*/
public class DeleteCitationsDialog extends Window {
TabPanel tabPanel = new TabPanel();
//
public DeleteCitationsDialog(final HandlerManager eventBus, TemplateSection bibliosection) {
setTitle("Delete Citations");
setClosable(true);
setWidth(400);
setHeight(250);
setPlain(true);
setLayout(new FitLayout());
Button deleteButton = new Button("Delete") {
@Override
protected void onClick(final ComponentEvent ce) {
if (tabPanel.getItemCount() > 1) {
eventBus.fireEvent(new RemovedCitationEvent(tabPanel.getSelectedItem().getTitle()));
tabPanel.remove(tabPanel.getSelectedItem());
}
else {
MessageBox.alert("","You cannot have a Bibliography with no citations, if you want to remove it use Section > Discard current", null);
}
}
};
//
Button cancelButton = new Button("Close") {
@Override
protected void onClick(final ComponentEvent ce) {
close();
}
};
addButton(deleteButton);
addButton(cancelButton);
//
ArrayList<String> citations = new ArrayList<String>();
for (TemplateComponent tc : bibliosection.getAllComponents()) {
if (tc.getType() == ComponentType.BODY) {
SerializableComponent sc = tc.getSerializable();
citations.add(sc.getPossibleContent().toString());
}
}
for (String cite : citations) {
TabItem tabI = new TabItem();
HTML html = new HTML(cite.split("&nbsp;")[0], true);
String citekey = html.getText();
if (citekey.endsWith(".")) //remove dot
citekey = citekey.substring(0, citekey.length()-1);
tabI.setTitle(citekey);
String citation = cite.split("&nbsp;")[1];
tabI.setText(citekey);
tabI.add(new HTML(citation));
tabI.setClosable(false);
tabPanel.add(tabI);
//TODO:
}
add(tabPanel);
}
}

View File

@ -0,0 +1,195 @@
package org.gcube.portlets.user.reportgenerator.client.dialog;
import java.util.HashMap;
import java.util.List;
import java.util.Vector;
import org.gcube.portlets.d4sreporting.common.shared.SerializableComponent;
import org.gcube.portlets.d4sreporting.common.shared.SerializableModel;
import org.gcube.portlets.d4sreporting.common.shared.SerializableSection;
import org.gcube.portlets.user.reportgenerator.client.events.ItemSelectionEvent;
import org.gcube.portlets.user.reportgenerator.client.resources.FimesReportTreeStructureResources;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.Tree;
import com.google.gwt.user.client.ui.TreeItem;
import com.google.gwt.user.client.ui.Widget;
public class FimesReportTreePanel extends ScrollPanel{
public FimesReportTreePanel(final HandlerManager eventBus, final SerializableModel report,
final String height, final String width) {
this.setWidth(width);
this.setHeight(height);
Tree t = new Tree();
t.setAnimationEnabled(true);
t.addItem(loadReportRootTree(report));
t.addSelectionHandler(new SelectionHandler<TreeItem>() {
@SuppressWarnings("unchecked")
public void onSelection(SelectionEvent<TreeItem> event) {
// TODO Auto-generated method stub
TreeItem item = event.getSelectedItem();
HashMap<String,Object> map = (HashMap<String, Object>)item.getUserObject();
eventBus.fireEvent(new ItemSelectionEvent(map));
}
});
this.add(t);
}
private TreeItem loadReportRootTree(final SerializableModel report) {
// Add root node
ImageResource image = FimesReportTreeStructureResources.INSTANCE.root();
HorizontalPanel node = createNodeWidget(image, report.getTemplateName(),"gwt-label-rootTree");
TreeItem root = new TreeItem(node);
Vector<SerializableSection> sections = report.getSections();
for(int i = 1; i <= sections.size(); i++) {
SerializableSection s = sections.get(i - 1);
// Add section item
image = FimesReportTreeStructureResources.INSTANCE.section();
node = createNodeWidget(image, "Section" + i,"gwt-label-sectionTree");
TreeItem sectionItem = addChildItemToParentItem(root, "Section", Integer.toString(i -1), node);
addItemsComponent(sectionItem, s);
}
return root;
}
private void addItemsComponent(final TreeItem sectionItem,final SerializableSection sectionModel) {
List<SerializableComponent> components = sectionModel.getComponents();
for(int i = 0; i < components.size(); i++) {
SerializableComponent c = components.get(i);
HorizontalPanel node = null;
switch (c.getType()) {
case TITLE: {
ImageResource image = FimesReportTreeStructureResources.INSTANCE.heading1();
node = createNodeWidget(image, (String)c.getPossibleContent(),"gwt-label-componentTree");
break;
}
case HEADING_1: {
ImageResource image = FimesReportTreeStructureResources.INSTANCE.heading1();
node = createNodeWidget(image, (String)c.getPossibleContent(),"gwt-label-componentTree");
break;
}
case HEADING_2: {
ImageResource image = FimesReportTreeStructureResources.INSTANCE.heading2();
node = createNodeWidget(image, (String)c.getPossibleContent(),"gwt-label-componentTree");
break;
}
case HEADING_3: {
ImageResource image = FimesReportTreeStructureResources.INSTANCE.heading3();
node = createNodeWidget(image, (String)c.getPossibleContent(),"gwt-label-componentTree");
break;
}
case HEADING_4: {
ImageResource image = FimesReportTreeStructureResources.INSTANCE.heading4();
node = createNodeWidget(image, (String)c.getPossibleContent(),"gwt-label-componentTree");
break;
}
case INSTRUCTION: {
ImageResource image = FimesReportTreeStructureResources.INSTANCE.instructions();
node = createNodeWidget(image, "Instruction","gwt-label-componentTree");
break;
}
case COMMENT: {
ImageResource image = FimesReportTreeStructureResources.INSTANCE.comments();
node = createNodeWidget(image, "Comment","gwt-label-componentTree");
break;
}
case BODY: {
ImageResource image = FimesReportTreeStructureResources.INSTANCE.text();
node = createNodeWidget(image, "Text","gwt-label-componentTree");
break;
}
case DYNA_IMAGE: {
ImageResource image = FimesReportTreeStructureResources.INSTANCE.image();
node = createNodeWidget(image, "Image","gwt-label-componentTree");
break;
}
case FLEX_TABLE: {
ImageResource image = FimesReportTreeStructureResources.INSTANCE.table();
node = createNodeWidget(image, "Table","gwt-label-componentTree");
break;
}
case ATTRIBUTE: {
// TODO
ImageResource image = FimesReportTreeStructureResources.INSTANCE.comments();
node = createNodeWidget(image, "Attribute","gwt-label-componentTree");
break;
}
case TOC:
// TODO
// componentItem = new TreeItem("TOC");
break;
case PAGEBREAK:
// TODO
// componentItem = new TreeItem("Pagebreak");
break;
case TIME_SERIES:
// TODO
//componentItem = new TreeItem("Time_Series");
break;
}
if (node != null)
addChildItemToParentItem(sectionItem, "Component",
Integer.toString(i), node);
}
}
private TreeItem addChildItemToParentItem(final TreeItem root, final String typeItem,
final String indexList, final Widget content) {
TreeItem item = new TreeItem(content);
// Create userObjet
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("item",typeItem );
map.put("index", indexList);
map.put("parent", root.getUserObject());
item.setUserObject(map);
root.addItem(item);
return item;
}
/**
* Generates HTML for a tree item with an attached icon.
* @param imageResource the image resource to use
* @param title the title of the item
* @return the resultant HTML
*/
private HorizontalPanel createNodeWidget(ImageResource imageResource, String title,
String cssStyle) {
HorizontalPanel node = new HorizontalPanel();
node.setSpacing(0);
Image image = new Image(imageResource);
image.setPixelSize(image.getWidth() + 5, image.getHeight());
node.add(image);
String shortTitle = title;
if (shortTitle.length() > 25)
shortTitle = shortTitle.substring(0,25) + "...";
Label text = new Label(shortTitle);
text.setStyleName(cssStyle);
node.add(text);
return node;
}
}

View File

@ -0,0 +1,210 @@
package org.gcube.portlets.user.reportgenerator.client.dialog;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.components.FancyFileUpload;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ChangeListener;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.RadioButton;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* <code> ImageUploaderDialog </code> class is the Dialog for uploading images
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version October 2008 (0.2)
*/
public class ImageUploaderDialog extends DialogBox {
private int width;
private int height;
private Presenter presenter;
private String currTemplateName = "";
private HorizontalPanel topLabel = new HorizontalPanel();
private EventListener listener = new EventListener();
private RadioButton local = new RadioButton("");
private RadioButton web = new RadioButton("");
/**
* the container panel
*/
private VerticalPanel mainLayout = new VerticalPanel();
private VerticalPanel dialogPanel = new VerticalPanel();
/**
* Creates the dialog
* @param presenter my controller
*/
public ImageUploaderDialog(Presenter presenter) {
// Create a dialog box and set the caption text
this.width = 400;
this.height = 200;
this.presenter = presenter;
setText("Insert Image");
local.setHTML(" From this computer");
topLabel.add(local);
local.setChecked(true);
web.setHTML(" From the web (URL)");
topLabel.add(web);
web.addClickListener(listener);
local.addClickListener(listener);
currTemplateName = presenter.getModel().getTemplateName();
dialogPanel.add(getFromLocalPanel());
dialogPanel.setPixelSize(this.width, this.height);
mainLayout.add(topLabel);
mainLayout.add(dialogPanel);
setWidget(mainLayout);
}
private VerticalPanel getFromLocalPanel() {
VerticalPanel toReturn = new VerticalPanel();
FancyFileUpload uploader = new FancyFileUpload(this, currTemplateName);
HTML theLabel = new HTML("<strong>Browse your computer for the image file to upload:</strong>");
toReturn.add(theLabel);
toReturn.add(uploader);
toReturn.setSpacing(4);
toReturn.setStyleName("uploadDialog");
toReturn.setPixelSize(this.width, this.height);
return toReturn;
}
private VerticalPanel getFromURLPanel() {
VerticalPanel toReturn = new VerticalPanel();
toReturn.setSpacing(5);
HTML theLabel = new HTML("<strong>Enter image web address:</strong>");
final TextBox urlTextbox = new TextBox();
urlTextbox.setWidth("90%");
final HTML previewBox = new HTML("<div style=\"text-align:center;\"><font style=\"color: rgb(136, 136, 136);\"><br /> Image preview will be displayed here. <br><br> *Remember: Using others' images on the web without their permission may be bad manners, or worse, copyright infringement. <br><br></font></div>", true);
previewBox.setStyleName("imagePreviewBox");
toReturn.add(theLabel);
toReturn.add(urlTextbox);
toReturn.add(previewBox);
urlTextbox.addChangeListener(new ChangeListener() {
public void onChange(Widget sender) {
previewBox.setHTML("<img height=\"75\" width=\"120\" src=\"" + urlTextbox.getText()+ "\" >");
previewBox.removeStyleName("imagePreviewBox");
}
});
HorizontalPanel buttonsPanel = new HorizontalPanel();
buttonsPanel.add(new Button("Insert", new ClickListener() {
public void onClick(Widget sender) {
hide();
presenter.getCurrentSelected().getExtendedFormatter().insertImage(urlTextbox.getText());
presenter.getModel().storeInSession();
}
}));
buttonsPanel.add(new Button("Cancel", new ClickListener() {
public void onClick(Widget sender) {
hide();
}
}));
buttonsPanel.setSpacing(5);
toReturn.add(buttonsPanel);
return toReturn;
}
/**
*
* @param imageName .
*/
public void insertImage(String imageName) {
String imgURL = getImageURL(imageName, "CURRENT_OPEN");
presenter.getCurrentSelected().getExtendedFormatter().insertImage(imgURL);
presenter.getModel().storeInSession();
}
/**
* use an inner EventListener class to avoid exposing event methods on the dialog class itself.
*/
private class EventListener implements ClickListener {
public void onClick(Widget sender) {
if (sender == web && web.isChecked()) {
dialogPanel.clear();
dialogPanel.add(getFromURLPanel());
} else if (sender == local && local.isChecked()) {
dialogPanel.clear();
dialogPanel.add(getFromLocalPanel());
}
}
}
/**
* return a URL which is lookable for on the web
* @param imageName .
* @param templateName .
* @return .
*/
public String getImageURL(String imageName, String templateName) {
String currentUser = presenter.getCurrentUser();
String currentScope = presenter.getCurrentScope();
/**
* Images will be stored under webapps/usersArea...
* GWT.getModuleBaseURL() returns * e.g. http://dlib28.isti.cnr.it/templatecreator/html/
* need to get just http://dlib28.isti.cnr.it/
*/
//remove "/html/" and get e.g. http://dlib28.isti.cnr.it/templatecreator
String host = GWT.getModuleBaseURL().substring(0, GWT.getModuleBaseURL().length()-6);
//loog for last slash
int lastSlash = host.lastIndexOf("/");
//get what i need : e.g. http://dlib28.isti.cnr.it/ or host = "http://localhost:8080/";
host = host.substring(0, lastSlash +1 );
//host = "http://localhost:8080/";
String imgURL = host + "usersArea/" + currentScope + "/templates/"
+ currentUser + "/" + "CURRENT_OPEN" + "/images/" + imageName;
return imgURL;
}
}

View File

@ -0,0 +1,180 @@
package org.gcube.portlets.user.reportgenerator.client.dialog;
import org.gcube.portlets.d4sreporting.common.shared.SerializableModel;
import org.gcube.portlets.user.reportgenerator.client.ReportConstants;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.workspace.lighttree.client.Item;
import org.gcube.portlets.user.workspace.lighttree.client.ItemType;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* <code> ImporterDialog </code> class is is the Dialog for importing template or report sections
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version October 2009 (1.4)
*/
public class ImporterDialog extends DialogBox {
/**
* this layout panel
*/
private VerticalPanel dialogPanel = new VerticalPanel();
Image loading = new Image(ReportConstants.LOADING_BAR);
VerticalPanel toReplace = new VerticalPanel();
SerializableModel toimportFrom = null;
ListBox listbox = new ListBox();
ListBox listboxCurr = new ListBox();
CheckBox lastSection = new CheckBox();
Presenter presenter;
/**
*
* @param item the item to import
* @param presenter the c
*/
public ImporterDialog(Item item, final Presenter presenter) {
this.presenter = presenter;
dialogPanel.setSpacing(4);
setText("Import from Template or Report");
toReplace.setWidth("100%");
HTML templateNameLabel = new HTML("Importing Template, please hold ...");
toReplace.add(templateNameLabel);
toReplace.add(loading);
HorizontalPanel buttonsPanel = new HorizontalPanel();
HorizontalPanel buttonsContainer = new HorizontalPanel();
// Add a cancel button at the bottom of the dialog
Button cancelButton = new Button("Close",new ClickListener() {
public void onClick(Widget sender) { hide(); }
});
Button applyButton = new Button("Import",new ClickListener() {
public void onClick(Widget sender) {
boolean result = false;
if (lastSection.isChecked())
result = Window.confirm("You are about to import section " + (listbox.getSelectedIndex()+1) + " as last section in the current document");
else
result = Window.confirm("You are about to import section " + (listbox.getSelectedIndex()+1) + " before section " + (listboxCurr.getSelectedIndex()+1) + " of the current document");
if (result)
presenter.importSection(toimportFrom, listbox.getSelectedIndex()+1, listboxCurr.getSelectedIndex()+1, lastSection.isChecked());
hide();
}
});
buttonsPanel.setWidth("100%");
buttonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
buttonsContainer.setSpacing(10);
buttonsContainer.add(applyButton);
buttonsContainer.add(cancelButton);
buttonsPanel.add(buttonsContainer);
dialogPanel.add(toReplace);
dialogPanel.add(buttonsPanel);
dialogPanel.setPixelSize(350, 275);
setWidget(dialogPanel);
AsyncCallback<SerializableModel> callback = new AsyncCallback<SerializableModel>() {
public void onFailure(Throwable caught) {
Window.alert("Could not Import template, please try again later: " + caught.getMessage());
}
public void onSuccess(SerializableModel toLoad) {
importFinished(toLoad);
}
};
//then is not deployed mode
if (item == null) {
presenter.getModel().getModelService().readModel("", "", true, true, callback);
}
else {
boolean isTemplate = (item.getType() == ItemType.REPORT_TEMPLATE) ? true : false;
//will asyncrously return a SerializableModel instance read from disk
presenter.getModel().getModelService().readModel(item.getName(), item.getId(), isTemplate, true, callback);
}
}
private void importFinished(SerializableModel toLoad) {
HTML label = new HTML("Importing Complete...");
Grid grid = new Grid(4, 2);
grid.setWidget(0, 0, new HTML("<b>Name: </b>"));
grid.setWidget(0, 1, new HTML(toLoad.getTemplateName()));
grid.setWidget(1, 0, new HTML("<b>Author: </b>"));
grid.setWidget(1, 1, new HTML(toLoad.getAuthor()));
grid.setWidget(2, 0, new HTML("<b>Last Edit: </b>"));
grid.setWidget(2, 1, new HTML(""+toLoad.getLastEdit()));
grid.setWidget(3, 0, new HTML("<b>Total Sections: </b>"));
grid.setWidget(3, 1, new HTML(""+toLoad.getTotalPages()));
toReplace.clear();
toReplace.add(label);
toReplace.add(grid);
toReplace.add(new HTML("<hr color=\"#DDDDDD\" height=\"1px\" width=\"100%\" />"));
for (int i = 1; i <= toLoad.getTotalPages(); i++) {
listbox.addItem("Section " + i, ""+(i-1));
}
Grid grid2 = new Grid(1, 2);
grid2.setWidget(0, 0, new HTML("<b>Choose the section to import: </b>&nbsp;&nbsp;"));
grid2.setWidget(0, 1, listbox);
grid2.setCellPadding(5);
for (int i = 1; i <= presenter.getModel().getTotalPages(); i++) {
listboxCurr.addItem("Section " + i, ""+(i-1));
}
lastSection.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
CheckBox cb = (CheckBox) sender;
listboxCurr.setEnabled(! cb.isChecked());
}
});
Grid grid3 = new Grid(2, 2);
grid3.setWidget(0, 0, new HTML("<b>Import Section before: </b>&nbsp;&nbsp;"));
grid3.setWidget(0, 1, listboxCurr);
grid3.setWidget(1, 0, new HTML("<b>As last section: </b>&nbsp;&nbsp;"));
grid3.setWidget(1, 1, lastSection);
grid3.setCellPadding(5);
toReplace.add(grid2);
toReplace.add(new HTML("<hr color=\"#DDDDDD\" height=\"1px\" width=\"100%\" />"));
toReplace.add(grid3);
toimportFrom = toLoad;
}
}

View File

@ -0,0 +1,45 @@
package org.gcube.portlets.user.reportgenerator.client.dialog;
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.ClickListener;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;
/**
* @author massimiliano.assante@isti.cnr.it
*
*/
public class LoadingPopup extends DialogBox implements ClickHandler {
/**
* @param autoHide auto hide
*/
public LoadingPopup(boolean autoHide) {
super(false);
HTML msg = new HTML(setToDisplay(), true);
setWidget(msg);
}
/**
* @return inner html
*/
protected static String setToDisplay() {
return
"<center><table border=\"0\">"+
"<tr>"+
"<td>"+
"<img src=\""+GWT.getModuleBaseURL()+"../images/book_load.gif\" >"+
"</td></tr>"+
"</table></center>" ;
}
public void onClick(ClickEvent event) {
hide();
}
}

View File

@ -0,0 +1,110 @@
package org.gcube.portlets.user.reportgenerator.client.dialog;
import java.util.List;
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
import org.gcube.portlets.user.gcubewidgets.client.popup.GCubeDialog;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.model.TemplateModel;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.CellPanel;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
* <code> OpenTemplateDialog </code> class is is the Dialog for showing template properties
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version October 2008 (0.2)
*/
public class PagePropertiesDialog extends GCubeDialog {
/**
* this layout panel
*/
private VerticalPanel dialogPanel = new VerticalPanel();
private TextBox templateNameLabelBox = new TextBox();
/**
*
* @param templateModel .
* @param presenter .
*/
public PagePropertiesDialog(final TemplateModel templateModel, final Presenter presenter) {
setText("Report Properties");
dialogPanel.setSpacing(4);
HTML spacer = new HTML("<hr width=\"100%\" />");
spacer.setHeight("30");
/*
* template name part
*/
HTML templateNameLabel = new HTML("Template Name: ");
templateNameLabelBox.setText(templateModel.getTemplateName());
templateNameLabelBox.setReadOnly(true);
templateNameLabelBox.setWidth("200");
CellPanel templateNamaPanel = new HorizontalPanel();
templateNamaPanel.add(templateNameLabel);
templateNamaPanel.add(templateNameLabelBox);
templateNamaPanel.setCellWidth(templateNameLabel, "120");
dialogPanel.add(templateNamaPanel);
dialogPanel.add(new HTML("<hr color=\"#DDDDDD\" height=\"1px\" width=\"100%\" />"));
List<Metadata> metadatas = presenter.getModel().getMetadata();
int nRows = metadatas.size();
Grid metadataGrid = new Grid(nRows, 2);
int i = 0;
for (Metadata md : metadatas) {
metadataGrid.setWidget(i, 0, new HTML("<b>" + md.getAttribute() + ": </b>"));
metadataGrid.setWidget(i, 1, new HTML(md.getValue()));
i++;
}
dialogPanel.add(templateNamaPanel);
dialogPanel.add(new HTML("<hr color=\"#DDDDDD\" height=\"1px\" width=\"100%\" />"));
dialogPanel.add(metadataGrid);
HorizontalPanel buttonsPanel = new HorizontalPanel();
HorizontalPanel buttonsContainer = new HorizontalPanel();
// Add a cancel button at the bottom of the dialog
Button cancelButton = new Button("Close",new ClickHandler() {
public void onClick(ClickEvent event) {
hide();
}
});
buttonsPanel.setWidth("100%");
buttonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
buttonsContainer.setSpacing(10);
buttonsContainer.add(cancelButton);
buttonsPanel.add(buttonsContainer);
dialogPanel.add(buttonsPanel);
dialogPanel.setPixelSize(350, 275);
setWidget(dialogPanel);
}
}

View File

@ -0,0 +1,112 @@
package org.gcube.portlets.user.reportgenerator.client.dialog;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
*
* @author massi
*
*/
public class TSHeader extends HorizontalPanel {
private CheckBox myCB;
private HTML myHeader;
private int myColNo;
private FlexTable myTable;
TimeSeriesFilter caller;
TSHeader myinstance;
/**
* @param tsf -
* @param myTable .
* @param cb .
* @param myColNo .
* @param myHeader .
*/
public TSHeader(TimeSeriesFilter tsf, FlexTable myTable, CheckBox cb, int myColNo, HTML myHeader) {
super();
myinstance = this;
caller = tsf;
this.myTable = myTable;
this.myCB = cb;
this.myColNo = myColNo;
this.myHeader = myHeader;
setVerticalAlignment(ALIGN_MIDDLE);
myHeader.setStyleName("timeSeries_header_font");
add(myHeader);
add(myCB);
myCB.addClickListener(cbListener);
}
private void removeEmptyHeaders( FlexTable myTable) {
for (int i = 0; i < myTable.getCellCount(0); i++) {
if (myTable.getWidget(0, i) == null) {
myTable.removeCell(0, i);
myTable.removeCell(1, i);
}
}
}
ClickListener cbListener = new ClickListener() {
public void onClick(Widget sender) {
caller.removeHeader(myinstance);
myTable.remove(sender.getParent());
removeEmptyHeaders(myTable);
}
};
/**
*
* @return .
*/
public CheckBox getMyCB() {
return myCB;
}
/**
*
* @param myCB .
*/
public void setMyCB(CheckBox myCB) {
this.myCB = myCB;
}
/**
*
* @return .
* */
public HTML getMyHeader() {
return myHeader;
}
/**
*
* @param myHeader .
*/
public void setMyHeader(HTML myHeader) {
this.myHeader = myHeader;
}
/**
*
* @return .
*/
public int getMyColNo() {
return myColNo;
}
/**
*
* @param myColNo .
*/
public void setMyColNo(int myColNo) {
this.myColNo = myColNo;
}
}

View File

@ -0,0 +1,81 @@
package org.gcube.portlets.user.reportgenerator.client.dialog;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTSinfo;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
*
* @author massi
*
*/
public class TimeSeriesDialog extends DialogBox {
/**
*
* @param droppedTS .
*/
public TimeSeriesDialog(SerializableTSinfo droppedTS) {
setText(droppedTS.getTitle() + " Details");
String name = droppedTS.getTitle();
String description = droppedTS.getTimeSeriesDescription();
String creator = droppedTS.getCreator();
String date = droppedTS.getTimeSeriesCreationDate();
long rowsNo = droppedTS.getDimension();
String publisher = droppedTS.getPublisher();
String rights = droppedTS.getRights();
Grid metadata = new Grid(7, 2);
metadata.setWidget(0, 0, new HTML("Name:", true));
metadata.setWidget(0, 1, new HTML(name));
metadata.setWidget(1, 0, new HTML("Creation Date: ", true));
metadata.setWidget(1, 1, new HTML(date));
metadata.setWidget(2, 0, new HTML("Total rows number: ", true));
metadata.setWidget(2, 1, new HTML(""+rowsNo));
metadata.setWidget(3, 0, new HTML("Description:", true));
metadata.setWidget(3, 1, new HTML(description));
metadata.setWidget(4, 0, new HTML("Creator: ", true));
metadata.setWidget(4, 1, new HTML(creator));
metadata.setWidget(5, 0, new HTML("publisher: ", true));
metadata.setWidget(5, 1, new HTML(""+publisher));
metadata.setWidget(5, 0, new HTML("rights: ", true));
metadata.setWidget(5, 1, new HTML(""+rights));
ScrollPanel scroller = new ScrollPanel();
VerticalPanel main_panel = null;
main_panel = new VerticalPanel();
main_panel.addStyleName("bgBlank p8 font_family font_12");
scroller.add(metadata);
// PopupPanel is a SimplePanel, so you have to set it's widget property to
// whatever you want its contents to be.
Button close = new Button("Close");
close.addClickListener(new ClickListener() {
public void onClick(Widget arg0) {
hide();
}
});
main_panel.add(scroller);
main_panel.add(new HTML("<hr align=\"left\" size=\"1\" width=\"100%\" color=\"gray\" noshade>"));
main_panel.add(close);
scroller.setPixelSize(350, 200);
main_panel.setPixelSize(350, 200);
setWidget(main_panel);
}
/**
*
*/
public void show() {
super.show();
center();
}
}

View File

@ -0,0 +1,217 @@
package org.gcube.portlets.user.reportgenerator.client.dialog;
import java.util.LinkedList;
import java.util.List;
import org.gcube.portlets.d4sreporting.common.client.CommonConstants;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTSFilter;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTSinfo;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTimeSeries;
import org.gcube.portlets.user.reportgenerator.client.targets.TSArea;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ChangeListener;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
*
* @author massi
*
*/
public class TimeSeriesFilter extends DialogBox {
ScrollPanel scroller = new ScrollPanel();
TextBox from = new TextBox();
TextBox to = new TextBox();
FlexTable flexTable = new FlexTable();
List<TSHeader> compoundHeaders = new LinkedList<TSHeader>();
/**
*
* @param sts a ts
* @param caller .
*/
public TimeSeriesFilter(final TSArea caller, final SerializableTimeSeries sts) {
final SerializableTSinfo droppedTS = sts.getTsMetadata();
setText(droppedTS.getTitle() + " Filter");
String name = droppedTS.getTitle();
long rowsNo = droppedTS.getDimension();
Grid metadata = new Grid(2, 2);
metadata.setWidget(0, 0, new HTML("Name:", true));
metadata.setWidget(0, 1, new HTML(name));
metadata.setWidget(1, 0, new HTML("Total rows : ", true));
metadata.setWidget(1, 1, new HTML(""+rowsNo));
final VerticalPanel main_panel = new VerticalPanel();
main_panel.addStyleName("bgBlank p8 font_family font_12");
main_panel.add(metadata);
List<String> headersString = droppedTS.getHeaderLabels();
/**
*/
for (int i = 0; i < headersString.size(); i++) {
CheckBox toAdd = new CheckBox();
toAdd.setChecked(true);
compoundHeaders.add(new TSHeader(this, flexTable, toAdd, i, new HTML(headersString.get(i) )));
}
main_panel.add(new HTML("Selected fields: (click to remove)"));
flexTable = getTableHeader(compoundHeaders);
main_panel.add(flexTable);
main_panel.add(new HTML("Select rows interval:"));
from.setText("1");
to.setText("10");
to.setMaxLength(6);
from.setMaxLength(6);
from.addChangeListener(textBoxListener);
to.addChangeListener(textBoxListener);
Grid rowsInterval = new Grid(1, 4);
rowsInterval.setWidget(0, 0, new HTML("From row:"));
rowsInterval.setWidget(0, 1, from);
rowsInterval.setWidget(0, 2, new HTML("&nbsp;&nbsp;To row:"));
rowsInterval.setWidget(0, 3, to);
main_panel.add(rowsInterval);
main_panel.add(new HTML("<hr align=\"left\" size=\"1\" width=\"100%\" color=\"gray\" noshade>"));
HorizontalPanel buttonspanel = new HorizontalPanel();
buttonspanel.setHeight("50");
buttonspanel.setSpacing(3);
// PopupPanel is a SimplePanel, so you have to set it's widget property to
// whatever you want its contents to be.
Button close = new Button("Close");
close.addClickListener(new ClickListener() {
public void onClick(Widget arg0) {
hide();
}
});
Button apply = new Button("Apply");
apply.addClickListener(new ClickListener() {
public void onClick(Widget arg0) {
List<TSHeader> selectedCols = compoundHeaders;
List<Integer> colsToShow = new LinkedList<Integer>();
for (TSHeader head : selectedCols) {
colsToShow.add(new Integer(head.getMyColNo()));
}
int fromInt = Integer.parseInt(from.getText());
int toInt = Integer.parseInt(to.getText());
SerializableTSFilter toSet = new SerializableTSFilter(colsToShow, null, null, fromInt, toInt);
caller.setNewFilter(toSet);
caller.refreshHeaders();
hide();
}
});
// Button reset = new Button("Reset");
// close.addClickListener(new ClickListener() {
// public void onClick(Widget arg0) {
// hide();
// show();
// }
// });
//buttonspanel.add(reset);
buttonspanel.add(close);
buttonspanel.add(apply);
main_panel.add(buttonspanel);
scroller.setPixelSize(550, 280);
main_panel.setPixelSize(550, 260);
scroller.add(main_panel);
setWidget(scroller);
}
/**
*
* @param toRemove .
* @return .
*/
public boolean removeHeader(TSHeader toRemove) {
return compoundHeaders.remove(toRemove);
}
/**
* display the header of the ts
* @param droppedTS
* @return
*/
private FlexTable getTableHeader(List<TSHeader> headers) {
flexTable.clear();
int n = headers.size();
for (int i = 0; i < n ; i++) {
flexTable.getCellFormatter().setStyleName(0, i, "timeSeries_header");
flexTable.setWidget(0, i, headers.get(i));
flexTable.getCellFormatter().setStyleName(1, i, "timeSeries_td");
flexTable.setWidget(1, i, new HTML("..."));
}
return flexTable;
}
ChangeListener textBoxListener = new ChangeListener() {
public void onChange(Widget sender) {
TextBox tb = (TextBox) sender;
String text = tb.getText();
String checkedText = text;
text = text.replaceAll(CommonConstants.ACCEPTED_CHARS_JUST_NUM, "");
if (! text.equals(checkedText) ) {
Window.alert("Only numbers are accepted");
tb.setText(text);
}
int start = Integer.parseInt(from.getText());
int end = Integer.parseInt(to.getText());
if (start >= end) {
Window.alert("From must be greater than to");
to.setText(""+(start+10));
}
}
};
/**
*
*/
public void show() {
super.show();
center();
}
}

View File

@ -0,0 +1,75 @@
package org.gcube.portlets.user.reportgenerator.client.dialog;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTable;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
*
* @author massi
*
*/
public class TimeSeriesSampleDialog extends DialogBox {
/**
*
* @param table .
*/
public TimeSeriesSampleDialog(SerializableTable table) {
super(true);
setText("TS Sample");
FlexTable flexTable = new FlexTable();
VerticalPanel main_panel = null;
main_panel = new VerticalPanel();
main_panel.addStyleName("bgBlank p8 font_family font_12");
for (int i = 0; i < table.getRowCount(); i++) {
for (int j= 0; j < table.getColsNo(); j++){
if (i == 0) {
flexTable.getCellFormatter().setStyleName(i, j, "timeSeries_header");
flexTable.setWidget(i, j, new HTML(table.getValue(i, j).getContent()));
}
else {
flexTable.getCellFormatter().setStyleName(i, j, "timeSeries_td");
flexTable.setWidget(i, j, new HTML(table.getValue(i, j).getContent()));
}
}
}
main_panel.add(flexTable);
// PopupPanel is a SimplePanel, so you have to set it's widget property to
// whatever you want its contents to be.
Button close = new Button("Close");
close.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
hide();
}
});
main_panel.add(new HTML("<hr align=\"left\" size=\"1\" width=\"100%\" color=\"gray\" noshade>"));
main_panel.add(close);
ScrollPanel scroller = new ScrollPanel();
main_panel.setPixelSize(550, 340);
scroller.setPixelSize(550, 360);
scroller.add(main_panel);
setWidget(scroller);
}
/**
*
*/
public void show() {
super.show();
center();
}
}

View File

@ -0,0 +1,32 @@
package org.gcube.portlets.user.reportgenerator.client.events;
import com.google.gwt.event.shared.GwtEvent;
public class AddBiblioEvent extends GwtEvent<AddBiblioEventHandler>{
public static Type<AddBiblioEventHandler> TYPE = new Type<AddBiblioEventHandler>();
private final String citekey;
private final String citetext;
public AddBiblioEvent(String key, String text) {
citekey = key;
citetext = text;
}
public String getCitekey() {
return citekey;
}
public String getCitetext() {
return citetext;
}
@Override
public Type<AddBiblioEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(AddBiblioEventHandler handler) {
handler.onAddCitation(this);
}
}

View File

@ -0,0 +1,7 @@
package org.gcube.portlets.user.reportgenerator.client.events;
import com.google.gwt.event.shared.EventHandler;
public interface AddBiblioEventHandler extends EventHandler {
void onAddCitation(AddBiblioEvent event);
}

View File

@ -0,0 +1,43 @@
package org.gcube.portlets.user.reportgenerator.client.events;
import org.gcube.portlets.user.reportgenerator.client.targets.ReportTextArea;
import com.google.gwt.event.shared.GwtEvent;
public class AddCommentEvent extends GwtEvent<AddCommentEventHandler>{
public static Type<AddCommentEventHandler> TYPE = new Type<AddCommentEventHandler>();
private final ReportTextArea source;
private final String comment;
private final int areaHeight;
public AddCommentEvent(ReportTextArea sourceComponent, String comment, int areaHeight) {
super();
this.source = sourceComponent;
this.comment = comment;
this.areaHeight = areaHeight;
}
public int getAreaHeight() {
return areaHeight;
}
public ReportTextArea getSourceComponent() {
return source;
}
public String getComment() {
return comment;
}
@Override
public Type<AddCommentEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(AddCommentEventHandler handler) {
handler.onAddComment(this);
}
}

View File

@ -0,0 +1,7 @@
package org.gcube.portlets.user.reportgenerator.client.events;
import com.google.gwt.event.shared.EventHandler;
public interface AddCommentEventHandler extends EventHandler {
void onAddComment(AddCommentEvent event);
}

View File

@ -0,0 +1,34 @@
package org.gcube.portlets.user.reportgenerator.client.events;
import java.util.HashMap;
import com.google.gwt.event.shared.GwtEvent;
public class ItemSelectionEvent extends GwtEvent<ItemSelectionEventHandler>{
private HashMap<String,Object> map;
public static Type<ItemSelectionEventHandler> TYPE = new Type<ItemSelectionEventHandler>();
public ItemSelectionEvent(HashMap<String,Object> map) {
this.map = map;
}
public HashMap<String, Object> getItemSelected() {
return this.map;
}
@Override
protected void dispatch(ItemSelectionEventHandler handler) {
// TODO Auto-generated method stub
handler.onItemSelected(this);
}
@Override
public Type<ItemSelectionEventHandler> getAssociatedType() {
// TODO Auto-generated method stub
return TYPE;
}
}

View File

@ -0,0 +1,8 @@
package org.gcube.portlets.user.reportgenerator.client.events;
import com.google.gwt.event.shared.EventHandler;
public interface ItemSelectionEventHandler extends EventHandler {
void onItemSelected(ItemSelectionEvent event);
}

View File

@ -0,0 +1,26 @@
package org.gcube.portlets.user.reportgenerator.client.events;
import com.google.gwt.event.shared.GwtEvent;
public class RemovedCitationEvent extends GwtEvent<RemovedCitationEventHandler>{
public static Type<RemovedCitationEventHandler> TYPE = new Type<RemovedCitationEventHandler>();
private final String citekey;
public RemovedCitationEvent(String citekey) {
this.citekey = citekey;
}
public String getCitekey() {
return citekey;
}
@Override
public Type<RemovedCitationEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(RemovedCitationEventHandler handler) {
handler.onRemovedCitation(this);
}
}

View File

@ -0,0 +1,7 @@
package org.gcube.portlets.user.reportgenerator.client.events;
import com.google.gwt.event.shared.EventHandler;
public interface RemovedCitationEventHandler extends EventHandler {
void onRemovedCitation(RemovedCitationEvent event);
}

View File

@ -0,0 +1,30 @@
package org.gcube.portlets.user.reportgenerator.client.events;
import org.gcube.portlets.user.reportgenerator.client.targets.ReportTextArea;
import com.google.gwt.event.shared.GwtEvent;
public class RemovedUserCommentEvent extends GwtEvent<RemovedUserCommentEventHandler>{
public static Type<RemovedUserCommentEventHandler> TYPE = new Type<RemovedUserCommentEventHandler>();
private final ReportTextArea source;
public RemovedUserCommentEvent(ReportTextArea source) {
super();
this.source = source;
}
public ReportTextArea getSourceComponent() {
return source;
}
@Override
public Type<RemovedUserCommentEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(RemovedUserCommentEventHandler handler) {
handler.onRemovedComment(this);
}
}

View File

@ -0,0 +1,7 @@
package org.gcube.portlets.user.reportgenerator.client.events;
import com.google.gwt.event.shared.EventHandler;
public interface RemovedUserCommentEventHandler extends EventHandler {
void onRemovedComment(RemovedUserCommentEvent event);
}

View File

@ -0,0 +1,31 @@
package org.gcube.portlets.user.reportgenerator.client.model;
/**
*
* @author massi
*
*/
public enum ExportManifestationType {
/**
* DOCX
*/
DOCX,
/**
* PDF
*/
PDF,
/**
* XML
*/
XML,
/**
* HTML
*/
HTML,
/**
* FiMES FAO Schema
*/
FIMES;
}

View File

@ -0,0 +1,534 @@
package org.gcube.portlets.user.reportgenerator.client.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import org.gcube.portlets.d4sreporting.common.client.ComponentType;
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
import org.gcube.portlets.d4sreporting.common.shared.SerializableAttribute;
import org.gcube.portlets.d4sreporting.common.shared.SerializableAttributeArea;
import org.gcube.portlets.d4sreporting.common.shared.SerializableComponent;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTable;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTimeSeries;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.targets.AttributeArea;
import org.gcube.portlets.user.reportgenerator.client.targets.BasicTextArea;
import org.gcube.portlets.user.reportgenerator.client.targets.D4sRichTextarea;
import org.gcube.portlets.user.reportgenerator.client.targets.DropImageListener;
import org.gcube.portlets.user.reportgenerator.client.targets.DropTSListener;
import org.gcube.portlets.user.reportgenerator.client.targets.DroppingArea;
import org.gcube.portlets.user.reportgenerator.client.targets.GenericTable;
import org.gcube.portlets.user.reportgenerator.client.targets.ImageArea;
import org.gcube.portlets.user.reportgenerator.client.targets.ReportTextArea;
import org.gcube.portlets.user.reportgenerator.client.targets.TSArea;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;
/**
*
* This class represent all the possible template components IN THE MODEL
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version July 2011 (3.0)
*/
public class TemplateComponent {
/**
*
*/
public final static String DEFAULT_IMAGE_PATH= GWT.getModuleBaseURL() + "../images/organization_logo.jpg";
private int x;
private int y;
private int width;
private int height;
private TemplateModel myModel;
private int templatePage;
private String idInBasket = null;
private ComponentType type;
private boolean locked;
private boolean doubleColLayout;
/**
* holds the metadata(s) for the sections
*/
private List<Metadata> metadata;
/**
* the paramName for assigning it a value when exporting to pdf, valid only for Dynamic Content
*/
private String paramName;
//what is in the template component may vary depending on its type
private Widget content;
/**
* Creates a empty TemplateComponent
*/
public TemplateComponent() {
super();
}
/**
* Creates a TemplateComponent with the given charactheristics in double column
*
* @param myModel .
* @param x .
* @param y .
* @param width .
* @param height .
* @param templatePage .
* @param content the inserted widget
* @param type the type of the inserted widget
* @param paramName for assigning it a value when exporting to pdf, valid only for Dynamic Content
* @param doubleColLayout to specify that its layout is double columned
*/
public TemplateComponent(TemplateModel myModel, int x, int y, int width, int height, int templatePage, ComponentType type, String paramName, Widget content, boolean doubleColLayout) {
this.myModel = myModel;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.templatePage = templatePage;
this.content = content;
this.type = type;
this.paramName = paramName;
this.doubleColLayout = doubleColLayout;
this.metadata = new LinkedList<Metadata>();
}
/**
*
* Creates a TemplateComponent with the given charactheristics and single column
*
* @param myModel .
* @param x .
* @param y .
* @param width .
* @param height .
* @param templatePage .
* @param content the inserted widget
* @param type the type of the inserted widget
* @param paramName for assigning it a value when exporting to pdf, valid only for Dynamic Content
*/
public TemplateComponent(TemplateModel myModel, int x, int y, int width, int height, int templatePage, ComponentType type, String paramName, Widget content) {
this.myModel = myModel;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.templatePage = templatePage;
this.content = content;
this.type = type;
this.paramName = paramName;
this.doubleColLayout = false;
this.metadata = new LinkedList<Metadata>();
}
/**
* create a template component which is displayable (create an actual Widget in the content field)
* @param myModel the model
* @param sc the serialiazble to convert
* @param presenter .
*/
public TemplateComponent(TemplateModel myModel, SerializableComponent sc, Presenter presenter) {
this.myModel = myModel;
//
//Coords start = new Coords(x, y);
int width = sc.getWidth();
int height = sc.getHeight();
this.x = sc.getX();
this.y = sc.getY();
this.width = sc.getWidth();
this.height = sc.getHeight();
this.templatePage = sc.getTemplatePage();
this.type = sc.getType();
this.paramName = sc.getParamName();
this.doubleColLayout = sc.isDoubleColLayout();
this.locked = sc.isLocked();
this.metadata = sc.getMetadata();
switch (sc.getType()) {
case DYNA_IMAGE:
DroppingArea dp;
String possibelContent = ((String) sc.getPossibleContent());
if (possibelContent.startsWith("http")) {
dp = new DroppingArea(presenter, width, height,possibelContent);
dp.showImage(new Image(possibelContent));
}
else if (possibelContent.startsWith("/"))
dp = new DroppingArea(presenter, width, height, "");
else if (sc.getPossibleContent().equals(DEFAULT_IMAGE_PATH)) {
dp = new DroppingArea(presenter, width, height, "");
} else {
dp = new DroppingArea(presenter, width, height, possibelContent);
}
dp.setPixelSize(width, height);
@SuppressWarnings("unused")
DropImageListener dropListener = new DropImageListener(dp);
this.content = dp;
break;
case STATIC_IMAGE:
String imagePath = (String) sc.getPossibleContent();
ImageArea img = new ImageArea(presenter, imagePath, myModel.getTemplateName(), true, width, height);
img.setPixelSize(width, height);
this.content = img;
break;
case HEADING_1:
case HEADING_2:
case HEADING_3:
case TITLE:
if (sc.isLocked()) {
HTML area = new HTML();
area.setStyleName(getStyle(sc.getType()));
area.getElement().getStyle().setMarginLeft(25, Unit.PX);
area.getElement().getStyle().setMarginTop(15, Unit.PX);
area.setPixelSize(width, height);
area.setText((String) sc.getPossibleContent());
this.content = area;
}
else {
BasicTextArea bToAdd = new BasicTextArea(sc.getType(), presenter, sc.getX(), sc.getY(), width, height, getUserComments() != null);
bToAdd.setText((String) sc.getPossibleContent());
this.content = bToAdd;
}
break;
case BODY:
if (sc.isLocked()) {
HTML area = new HTML();
area.setStyleName("d4sFrame");
area.addStyleName("fixedTextArea");
area.addStyleName("hasRichTextToolbar");
area.setPixelSize(width, height);
area.setHTML((String) sc.getPossibleContent());
this.content = area;
}
else {
D4sRichTextarea ta = new D4sRichTextarea(sc.getType(), presenter, sc.getX(), sc.getY(),width, height, getUserComments() != null);
ta.setHTML((String) sc.getPossibleContent());
//ta.setStyleName("cw-RichText");
ta.setPixelSize(width, height);
this.content = ta;
}
this.setLocked(sc.isLocked());
break;
case TOC:
ReportTextArea dp2 = new ReportTextArea(sc.getType(), presenter, sc.getX(), sc.getY(), width, height, getUserComments() != null);
dp2.addStyleName("tocArea");
this.content = dp2;
break;
case BIBLIO:
ReportTextArea dp3 = new ReportTextArea(sc.getType(), presenter, sc.getX(), sc.getY(), width, height, getUserComments() != null);
dp3.addStyleName("biblioArea");
this.content = dp3;
break;
case PAGEBREAK:
ReportTextArea dp4 = new ReportTextArea(sc.getType(), presenter, sc.getX(), sc.getY(), width, height, getUserComments() != null);
dp4.addStyleName("pagebreak");
this.content = dp4;
break;
case FLEX_TABLE:
SerializableTable st = (SerializableTable) sc.getPossibleContent();
GenericTable table = new GenericTable(st, presenter, sc.getX(), sc.getY(), TemplateModel.TEMPLATE_WIDTH - 50, 200);
this.content = table;
break;
case ATTRIBUTE:
AttributeArea ta = null;
if (sc.getPossibleContent() instanceof SerializableAttributeArea) {
SerializableAttributeArea sata = (SerializableAttributeArea) sc.getPossibleContent();
ta = new AttributeArea(presenter, sc.getX(), sc.getY(), width, height, sata);
}
else {
ta = new AttributeArea(presenter, sc.getX(), sc.getY(), width, height, sc.getPossibleContent().toString());
}
this.content = ta;
break;
case COMMENT:
HTML comment = new HTML();
comment.setStyleName("commentArea");
comment.setHTML((String) sc.getPossibleContent());
this.content = comment;
break;
case INSTRUCTION:
HTML instr = new HTML();
instr.setStyleName("instructionArea");
instr.setHTML((String) sc.getPossibleContent());
this.content = instr;
break;
case TIME_SERIES:
TSArea tsa;
SerializableTimeSeries sts = null;
try {
sts = ((SerializableTimeSeries) sc.getPossibleContent());
} catch (ClassCastException e) {
}
//need to reset the filter when loading a TS
sts.setFilter(null);
tsa = new TSArea(presenter, width, 155, sts);
tsa.setPixelSize(width, 155);
@SuppressWarnings("unused")
DropTSListener dropTSListener = new DropTSListener(tsa);
this.content = tsa;
break;
}
}
/**
*
* @param type
* @return
*/
private String getStyle(ComponentType type) {
switch (type) {
case TITLE:
return "titleArea";
case HEADING_1:
return "headgin1Area";
case HEADING_2:
return "headgin2Area";
case HEADING_3:
return "headgin3Area";
default:
return "";
}
}
/**
* return a template Component which is serializable
* @return .
*/
public SerializableComponent getSerializable() {
Serializable content = "";
String id = "";
switch (this.getType()) {
case DYNA_IMAGE:
DroppingArea da = (DroppingArea) this.content;
content = da.getDroppedImage().getUrl();
id = da.getIdInBasket();
idInBasket = id;
if (((String) content).compareTo("") == 0)
content = DEFAULT_IMAGE_PATH;
break;
case STATIC_IMAGE:
ImageArea tmp = ((ImageArea) this.content);
String imageName = tmp.getImageName();
content = tmp.getUrl();
break;
case BODY:
if (this.isLocked()) {
content = ((HTML) this.content).getHTML();
}
else {
content = ((D4sRichTextarea) this.content).getHTML();
}
break;
case HEADING_1:
case HEADING_2:
case HEADING_3:
case TITLE:
if (this.isLocked()) {
content = ((HTML) this.content).getText();
}
else
content = ((BasicTextArea) this.content).getText();
break;
case TIME_SERIES:
GWT.log("Found Time Series", null);
TSArea tsa = (TSArea) this.content;
content = tsa.getSts();
break;
case FLEX_TABLE:
GenericTable gt = (GenericTable) this.content;
SerializableTable st = gt.getSerializable();
content = st;
break;
case ATTRIBUTE:
AttributeArea att = (AttributeArea) this.content;
ArrayList<SerializableAttribute> values = new ArrayList<SerializableAttribute>();
for (CheckBox box : att.getBoxes()) {
values.add(new SerializableAttribute(box.getText().trim(), box.getValue()));
}
SerializableAttributeArea sat= new SerializableAttributeArea(att.getAttrName().trim(), values);
content = sat;
break;
case COMMENT:
content = ((HTML) this.content).getHTML();
break;
case INSTRUCTION:
content = ((HTML) this.content).getHTML();
break;
}
return new SerializableComponent(x, y, width, height, templatePage, type, idInBasket, "param empty", content, this.doubleColLayout, isLocked(), metadata);
}
/**
* @return .
*/
public int getHeight() {return height;}
/**
* @param height .
*/
public void setHeight(int height) { this.height = height; }
/**
* @return .
*/
public ComponentType getType() {return type;}
/**
* @param type .
*/
public void setType(ComponentType type) { this.type = type;}
/**
* @return .
*/
public int getWidth() { return width;}
/**
* @param width .
*/
public void setWidth(int width) {this.width = width;}
/**
* @return .
*/
public int getX() { return x;}
/**
* @param x .
*/
public void setX(int x) {this.x = x;}
/**
* @return .
*/
public int getY() {return y;}
/**
* @param y .
*/
public void setY(int y) {this.y = y;}
/**
* @return .
*/
public int getTemplatePage() { return templatePage; }
/**
* @param templatePage .
*/
public void setTemplatePage(int templatePage) { this.templatePage = templatePage;}
/**
* @return .
*/
public Widget getContent() {return content; }
/**
* @param content .
*/
public void setContent(Widget content) {
this.content = content;
}
/**
*
* @return .
*/
public String getParamName() {
return paramName;
}
/**
*
* @param paramName .
*/
public void setParamName(String paramName) {
this.paramName = paramName;
}
/**
*
* @return .
*/
public boolean isLocked() {
return locked;
}
/**
*
* @param locked .
*/
public void setLocked(boolean locked) {
this.locked = locked;
}
/**
*
* @param attr .
* @param value .
*/
public void addMetadata(String attr, String value) {
if (attr != null && value != null) {
metadata.add(new Metadata(attr, value));
}
else
throw new NullPointerException();
}
/**
*
* @return .
*/
public List<Metadata> getAllMetadata() {
if (metadata == null) {
new LinkedList<Metadata>();
}
return metadata;
}
/**
*
* @return
*/
public String getUserComments() {
if (metadata == null) return null;
for (Metadata md : metadata) {
if (md.getAttribute().equals(TemplateModel.USER_COMMENT))
return md.getValue();
}
return null;
}
/**
*
* @return .
*/
public String getIdInBasket() {
return idInBasket;
}
/**
*
* @param idInBasket .
*/
public void setIdInBasket(String idInBasket) {
this.idInBasket = idInBasket;
}
/**
*
* @return .
*/
public boolean isDoubleColLayout() {
return doubleColLayout;
}
}

View File

@ -0,0 +1,697 @@
package org.gcube.portlets.user.reportgenerator.client.model;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Vector;
import java.util.Map.Entry;
import org.gcube.portlets.d4sreporting.common.client.ComponentType;
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
import org.gcube.portlets.d4sreporting.common.shared.SerializableComponent;
import org.gcube.portlets.d4sreporting.common.shared.SerializableModel;
import org.gcube.portlets.d4sreporting.common.shared.SerializableSection;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTimeSeries;
import org.gcube.portlets.user.reportgenerator.client.ReportService;
import org.gcube.portlets.user.reportgenerator.client.ReportServiceAsync;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;
/**
* The <code> TemplateModel </code> class represents the current Template state, the model in the the MVC pattern
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version July 2011 (3.0)
*/
public class TemplateModel {
private ReportServiceAsync modelService = (ReportServiceAsync) GWT.create(ReportService.class);
private ServiceDefTarget endpoint = (ServiceDefTarget) modelService;
/**
* default w and h
*/
public static final int OLD_TEMPLATE_WIDTH = 950;
/**
*
*/
public static final int TEMPLATE_WIDTH = 750;
/**
* TEMPLATE_HEIGHT
*/
public static final int TEMPLATE_HEIGHT= 1000;
/**
* DEFAULT_NAME
*/
public static final String DEFAULT_NAME = "No template loaded";
public static final String BIBLIO_SECTION = "isBibliography";
public static final String USER_COMMENT = "isComment";
public static final String USER_COMMENT_HEIGHT = "isCommentHeight";
/**
* The name of the template
*/
private String templateName;
/**
*
*/
private int pageWidth;
/**
*
*/
private int pageHeight;
/**
*
*/
private int currentPage;
/**
* Total number of template pages
*/
private int totalPages;
/**
* Template left margin
*/
private int marginLeft;
/**
* Template right margin
*/
private int marginRight;
/**
* Template top margin
*/
private int marginTop;
/**
* Template bottom margin
*/
private int marginBottom;
/**
* columnWidth is the actual page width without margins, when columns is equal to 1 (which is always true in my case, since UI doesn't allow multi columns)
*/
private int columnWidth;
/**
* each object of this Hahsmap its a <class>TemplateSection</class> containing all the TemplateComponent of a template section
*
* object: a <class>TemplateSection</class> of Component containing all the TemplateComponent of the section
*/
private HashMap<String, TemplateSection> sections;
/**
* holds the metadata(s) for the model
*/
private List<Metadata> metadata;
/**
* The name of the author
*/
private String author;
/**
* The name of the author
*/
private String lastEditBy;
/**
* The name of the author
*/
private Date dateCreated;
/**
* The name of the author
*/
private Date lastEdit;
private Presenter presenter;
/**
* Constructs a Default Template Model
* @param presenter .
*/
public TemplateModel(Presenter presenter) {
super();
this.templateName = DEFAULT_NAME;
this.pageWidth = TEMPLATE_WIDTH;
this.pageHeight = TEMPLATE_HEIGHT;
this.currentPage = 1;
this.totalPages = 1;
this.marginLeft = 25;
this.marginRight = 25;
this.marginTop = 20;
this.marginBottom = 20;
this.columnWidth = pageWidth - (marginLeft + marginRight);
this.author = "";
this.lastEdit = null;
this.lastEditBy = "";
this.dateCreated = null;
this.sections = new HashMap<String, TemplateSection>();
this.metadata = new LinkedList<Metadata>();
this.presenter = presenter;
String moduleRelativeURL = GWT.getModuleBaseURL() + "ReportServiceImpl";
endpoint.setServiceEntryPoint(moduleRelativeURL);
}
/**
* @param pageNo .
* @return .
*/
public List<TemplateComponent> getSectionComponent(int pageNo) {
List<TemplateComponent> toReturn = new LinkedList<TemplateComponent>();
toReturn = sections.get(""+pageNo).getAllComponents();
return toReturn;
}
/**
* look for the model in the current page and edits its size
* @param toResize .
* @param newWidth .
* @param newHeight .
*/
public void addCommentToComponent(Widget component, String comment2Add, int visibleHeight) {
String tcPage = ""+currentPage;
TemplateSection singleSection = sections.get(tcPage);
singleSection.addCommentToComponent(component, comment2Add, visibleHeight);
storeInSession();
}
public void removeComment(Widget toRemove) {
String tcPage = ""+currentPage;
TemplateSection singleSection = sections.get(tcPage);
singleSection.discardComments(toRemove);
storeInSession();
}
/**
*
*/
public void insertBiblioSection() {
totalPages++;
TemplateSection singleSection = new TemplateSection();
singleSection.addMetadata(BIBLIO_SECTION, "true");
SerializableComponent references = new SerializableComponent(0, 0,TEMPLATE_WIDTH - 50, 35,
totalPages, ComponentType.HEADING_2, "", "REFERENCES", false, true, singleSection.getAllMetadata());
TemplateComponent referencesTC = new TemplateComponent(this, references, presenter);
singleSection.addComponent(referencesTC);
sections.put(""+totalPages, singleSection);
storeInSession();
}
/**
*
* @param citeKey -
* @param citeText -
*/
public void addCitation(String citeKey, String citeText) {
String citation ="<b>" + citeKey + ".</b>&nbsp;" + citeText;
TemplateSection singleSection = getSection(totalPages);
SerializableComponent entry = new SerializableComponent(0, 0,TEMPLATE_WIDTH - 50, 35,
totalPages, ComponentType.HEADING_2, "", "Bibliographic Entry", false, true, singleSection.getAllMetadata());
TemplateComponent entryTC = new TemplateComponent(this, entry, presenter);
singleSection.addComponent(entryTC);
SerializableComponent entryText = new SerializableComponent(0, 0,TEMPLATE_WIDTH - 50, 35,
totalPages, ComponentType.BODY, "", citation, false, false, singleSection.getAllMetadata());
TemplateComponent entryTextTC = new TemplateComponent(this, entryText, presenter);
singleSection.addComponent(entryTextTC);
storeInSession();
}
/**
* remove a Citation from the model
* @param citeKey .
*/
public boolean removeCitation(String citeKey) {
TemplateSection singleSection = getSection(totalPages);
List<TemplateComponent> components = singleSection.getAllComponents();
for (int i = 0; i < components.size(); i++) {
TemplateComponent tc = components.get(i);
if (tc.getType() == ComponentType.BODY) {
SerializableComponent sc = tc.getSerializable();
HTML citationHTML = new HTML(sc.getPossibleContent().toString(), true); ///to clean the HTML
String citation = citationHTML.getText();
if (citation.startsWith(citeKey)) {
if (singleSection.removeComponent(tc)) { //removes also the previous heading 2
TemplateComponent h2 = components.get(i-1);
singleSection.removeComponent(h2);
storeInSession();
return true;
}
}
}
}
return false;
}
/**
* @param pageNo .
* @return .
*/
public TemplateSection getSection(int pageNo) {
return sections.get(""+pageNo);
}
/**
* generally used when reaing a model form disk
* @param toLoad the SerializableModel instance to load in the model
* @param presenter .
*/
public void loadModel(SerializableModel toLoad, Presenter presenter) {
//loading template from disk
this.author = toLoad.getAuthor();
this.dateCreated = toLoad.getDateCreated();
this.lastEdit = toLoad.getLastEdit();
this.lastEditBy = toLoad.getLastEditBy();
this.templateName = toLoad.getTemplateName();
this.pageWidth = toLoad.getPageWidth();
this.pageHeight = toLoad.getPageHeight();
this.currentPage = toLoad.getCurrPage();
this.totalPages = toLoad.getTotalPages();
this.marginLeft = toLoad.getMarginLeft();
this.marginRight = toLoad.getMarginRight();
this.marginTop = toLoad.getMarginTop();
this.marginBottom = toLoad.getMarginBottom();
this.metadata = toLoad.getMetadata();
this.columnWidth = pageWidth - (marginLeft + marginRight);
//the sections to be transferred
Vector<SerializableSection> sectionsSerialized = toLoad.getSections();
//reset current sections container
this.sections = new HashMap<String, TemplateSection>();
//page Number, this model uses a HashMap for each page, the key is the page number
int pageNo = 1;
for (SerializableSection serialazableSection : sectionsSerialized) { //for each section
List<TemplateComponent> myTemplateSection = new Vector<TemplateComponent>();
for (SerializableComponent sc : serialazableSection.getComponents()) { //for each page component
myTemplateSection.add(new TemplateComponent(this, sc, presenter));
}
//TODO: load also metadata
GWT.log("Section Metadata:"+serialazableSection.getMetadata().size(), null);
this.sections.put(""+pageNo, new TemplateSection(myTemplateSection, serialazableSection.getMetadata()));
pageNo++;
}
}
/**
* generally used when reaing a model form disk
* @param toLoad the SerializableModel instance where toget the section
* @param sectionNoToimport section to import 0 -> n-1
* @param beforeSection say where to import this section (before)
* @param asLastSection say to import this section as last section in the curren template / report
*/
public void importSectionInModel(SerializableModel toLoad, int sectionNoToimport, int beforeSection, boolean asLastSection) {
int pageNo = totalPages+1;
//the section to be imported -1 beacuse it stays in a vector
SerializableSection toImport = toLoad.getSections().get(sectionNoToimport-1);
List<TemplateComponent> myTemplateSection = new Vector<TemplateComponent>();
for (SerializableComponent sc : toImport.getComponents()) { //for each page component
myTemplateSection.add(new TemplateComponent(this, sc, presenter));
}
//TODO: load also metadata
GWT.log("Section Metadata:"+toImport.getMetadata().size(), null);
if (asLastSection)
this.sections.put(""+pageNo, new TemplateSection(myTemplateSection, toImport.getMetadata()));
else {
//insertin gnew section
HashMap<String, TemplateSection> newSections = new HashMap<String, TemplateSection>();
boolean isAdded = false;
for (int i = 1; i <= totalPages+1; i++) {
if (beforeSection == i) {
newSections.put(""+i, new TemplateSection(myTemplateSection, toImport.getMetadata()));
isAdded = true;
}
else {
int insertIn = (isAdded) ? (i-1): i;
newSections.put(""+i, sections.get(""+insertIn));
GWT.log("Inserting " + insertIn + " into section " + i + " isAdded =" + (isAdded) , null);
}
}
this.sections = newSections;
GWT.log("NEW SECTION SIZE"+sections.size(), null);
}
totalPages++;
}
/**
*
* @param sectNo the section to discard
* @return the removed element
*/
public TemplateSection discardSection(int sectNo) {
TemplateSection toRemove = sections.remove(""+sectNo);
for (int i = sectNo+1; i <= totalPages; i++) {
sections.put(""+(i-1), sections.get(""+i));
}
totalPages--;
return toRemove;
}
/**
*
* @return a serialized version od the model
*/
public SerializableModel getSerializableModel() {
Vector<SerializableSection> serializedsections = new Vector<SerializableSection>();
for (int i = 1; i <= sections.size(); i++) {
//the pages
String pageNo = ""+i;
if (sections.get(pageNo) != null) {
TemplateSection singleSection = sections.get(pageNo);
List<TemplateComponent> templateElements = singleSection.getAllComponents();
List<SerializableComponent> serialazableComponents = new LinkedList<SerializableComponent>();
//construct the serialized section
SerializableSection aSection = new SerializableSection();
//copy the components
for (TemplateComponent tc : templateElements)
serialazableComponents.add(tc.getSerializable());
aSection.setComponents(serialazableComponents);
aSection.setMetadata(singleSection.getAllMetadata());
//add the serialized section
serializedsections.add(aSection);
}
}
SerializableModel toReturn =
new SerializableModel("UniqueID", author, dateCreated, lastEdit, lastEditBy, templateName, columnWidth, currentPage, marginBottom, marginLeft, marginRight, marginTop,
pageHeight, pageWidth, serializedsections, totalPages, metadata);
return toReturn;
}
/**
*
* @param folderid .
* @param name .
*/
public void saveReport (String folderid, String name) {
modelService.saveReport(folderid, name, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
Window.alert("Report Not Saved: " + caught.getMessage());
}
public void onSuccess(Void result) {
Window.alert("Report Saved Successfully");
presenter.refreshWorkspace();
}
});
}
/**
*
*
*/
public void saveReport () {
modelService.saveReport(new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
MessageBox.alert("Warning","Report Not Saved: " + caught.getMessage(), null);
}
public void onSuccess(Void result) {
MessageBox.alert("Warning","Report Saved Successfully", null);
presenter.refreshWorkspace();
}
});
}
/**
* look for the model in the current page and edits its size
* @param toResize .
* @param newWidth .
* @param newHeight .
*/
public void resizeModelComponent(Widget toResize, int newWidth, int newHeight) {
GWT.log("LOOKING CORRESPONDANCE", null);
String tcPage = ""+currentPage;
TemplateSection singleSection = sections.get(tcPage);
singleSection.resizeModelComponent(toResize, newWidth, newHeight);
storeInSession();
}
/**
*
* @param type a
* @param templateName a
* return a URL which is lookable for on the web
*
* @return .
*/
public String getExportedFileURL(ExportManifestationType type, String templateName) {
/**
* PDFs will be stored under webapps/usersArea...
*/
// get e.g. http://dlib28.isti.cnr.it:9090/
String host = Window.Location.getProtocol()+"//"+Window.Location.getHost()+"/";
String exportedURL = "";
switch (type) {
case DOCX:
exportedURL = host + "usersArea/" + presenter.getCurrentScope() + "/templates/"
+ presenter.getCurrentUser() + "/EXPORTS/" + templateName + ".docx";
break;
case PDF:
exportedURL = host + "usersArea/" + presenter.getCurrentScope() + "/templates/"
+ presenter.getCurrentUser() + "/EXPORTS/" + templateName + ".pdf";
break;
case HTML:
exportedURL = host + "usersArea/" + presenter.getCurrentScope() + "/templates/"
+ presenter.getCurrentUser() + "/EXPORTS/" + templateName + ".html";
}
return exportedURL;
}
/**
* stores the current model in the session
*/
public void storeInSession() {
AsyncCallback callback = new AsyncCallback() {
public void onFailure(Throwable caught) { }
public void onSuccess(Object result) { }
};
SerializableModel modelToSend = getSerializableModel();
GWT.log("Storing in session: currpage = " + modelToSend.getCurrPage(), null);
modelService.storeTemplateInSession(modelToSend, callback);
}
//****** GETTERS n SETTERS
/**
* @return .
*/
public int getCurrentPage() {return currentPage;}
/**
* @param currentPage .
*/
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
storeInSession();
}
/**
* @return .
*/
public int getMarginBottom() {return marginBottom;}
/**
* @param marginBottom .
*/
public void setMarginBottom(int marginBottom) {this.marginBottom = marginBottom;}
/**
* @return .
*/
public int getMarginLeft() {return marginLeft; }
/**
* @param marginLeft .
*/
public void setMarginLeft(int marginLeft) {
this.marginLeft = marginLeft;
this.columnWidth = pageWidth - (marginLeft + marginRight);
}
/**
* @return .
*/
public int getMarginRight() {return marginRight;}
/**
* @param marginRight .
*/
public void setMarginRight(int marginRight) {
this.marginRight = marginRight;
this.columnWidth = pageWidth - (marginLeft + marginRight);
}
/**
* @return .
*/
public int getMarginTop() {return marginTop;}
/**
* @param marginTop .
*/
public void setMarginTop(int marginTop) {this.marginTop = marginTop;}
/**
* @return .
*/
public int getPageHeight() {return pageHeight; }
/**
* @param pageHeight .
*/
public void setPageHeight(int pageHeight) { this.pageHeight = pageHeight;}
/**
* @return .
*/
public int getPageWidth() { return pageWidth;}
/**
* @param pageWidth .
*/
public void setPageWidth(int pageWidth) {
this.pageWidth = pageWidth;
this.columnWidth = pageWidth - (marginLeft + marginRight);
}
/**
* @return .
*/
public String getTemplateName() {return templateName;}
/**
* @param templateName .
*/
public void setTemplateName(String templateName) {
this.templateName = templateName;
storeInSession();
}
/**
* @return totalPages .
*/
public int getTotalPages() {return totalPages; }
/**
* @param totalPages .
*/
public void setTotalPages(int totalPages) { this.totalPages = totalPages;}
/**
* @return .
*/
public int getColumnWidth() {return columnWidth;}
/**
* @param columnWidth .
*/
public void setColumnWidth(int columnWidth) {this.columnWidth = columnWidth;}
/**
* @return .
*/
public ReportServiceAsync getModelService() {return modelService;}
/**
* metadata .
* @return .
*/
public List<Metadata> getMetadata() {
return metadata;
}
/**
*
* @return .
*
*/
public String getLastEditBy() {
return lastEditBy;
}
/**
*
* @param lastEditBy .
*/
public void setLastEditBy(String lastEditBy) {
this.lastEditBy = lastEditBy;
}
/**
*
* @return .
*/
public boolean containsLargeTS() {
sections.entrySet();
for (Entry entry : sections.entrySet()) {
TemplateSection section = (TemplateSection) entry.getValue();
for (TemplateComponent tc : section.getAllComponents()) {
if (tc.getType() == ComponentType.TIME_SERIES) {
SerializableComponent sc = tc.getSerializable();
SerializableTimeSeries sts = (SerializableTimeSeries) sc.getPossibleContent();
if (sts.getFilter() != null) {
int from = sts.getFilter().getFrom();
int to = sts.getFilter().getTo();
if (to - from > 200)
return true;
}
}
}
}
return false;
}
public void updateWorkflowDocument(boolean update) {
modelService.updateWorkflowDocument(update, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
Window.alert("failed to update workflow document");
}
public void onSuccess(Void result) {
loadWorkflowLibraryApp();
}
});
}
private String location;
/**
* Redirect to VRE Deployer Portlet
*/
private void loadWorkflowLibraryApp(){
getUrl();
location += "/../my-workflow-documents";
Window.open(location, "_self", "");
}
/**
* Get URL from browser
*/
public native void getUrl()/*-{
this.@org.gcube.portlets.user.reportgenerator.client.model.TemplateModel::location = $wnd.location.href;
}-*/;
}

View File

@ -0,0 +1,254 @@
package org.gcube.portlets.user.reportgenerator.client.model;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import org.gcube.portlets.d4sreporting.common.shared.Metadata;
import org.gcube.portlets.user.reportgenerator.client.events.AddCommentEvent;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Widget;
/**
* The <code> TemplateSection </code> class represents a Template Section that can be associated to any Template
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version October 2009 (1.4)
*/
public class TemplateSection {
/**
* holds the metadata(s) for the sections
*/
private List<Metadata> metadata;
/**
* holds the TemplateComponents for the sections
*/
private List<TemplateComponent> components;
/**
*
* @param components
* @param metadata
*/
public TemplateSection() {
this.components = new LinkedList<TemplateComponent>();
this.metadata = new LinkedList<Metadata>();
}
/**
*
* @param components .
* @param metadata .
*/
public TemplateSection(List<TemplateComponent> components, List<Metadata> metadata) {
this.components = components;
this.metadata = metadata;
}
///*** GETTERS N SETTERS
/**
* enqueue a component
*/
public void addComponent(TemplateComponent tc) {
if (tc != null)
components.add(tc);
else {
throw new NullPointerException();
}
}
public boolean removeComponent(TemplateComponent tc) {
if (tc != null)
return components.remove(tc);
else {
throw new NullPointerException();
}
}
public ArrayList<String> getSectionComments() {
ArrayList<String> toRet = new ArrayList<String>();
for (int i = 0; i < components.size(); i++) {
TemplateComponent tc = components.get(i);
if (tc.getUserComments() != null) {
//toRet.
}
}
return toRet;
}
/**
* look for the model in the current page and edits its size
* @param toResize .
* @param newWidth .
* @param newHeight .
*/
public void resizeModelComponent(Widget toResize, int newWidth, int newHeight) {
for (int i = 0; i < components.size(); i++) {
TemplateComponent tc = components.get(i);
if (tc.getContent() != null && tc.getContent().equals(toResize)) {
GWT.log("FOUND CORRESPONDANCE");
tc.setWidth(newWidth);
tc.setHeight(newHeight);
tc.setContent(toResize);
break;
}
}
}
public void discardComments(Widget component) {
for (int i = 0; i < components.size(); i++) {
TemplateComponent tc = components.get(i);
if (tc.getContent() != null && tc.getContent().equals(component)) {
//removes previous comment is exists
for (Metadata metadata : tc.getAllMetadata()) {
if (metadata.getAttribute().equals(TemplateModel.USER_COMMENT)) {
tc.getAllMetadata().remove(metadata);
GWT.log("FOUND and REMOVED");
break;
}
}
for (Metadata metadata : tc.getAllMetadata()) {
if (metadata.getAttribute().equals(TemplateModel.USER_COMMENT_HEIGHT)) {
tc.getAllMetadata().remove(metadata);
break;
}
}
}
}
}
/**
* look for the model in the current page and edits its size
*/
public void addCommentToComponent(Widget component, String comment2Add, int visibleHeight) {
for (int i = 0; i < components.size(); i++) {
TemplateComponent tc = components.get(i);
if (tc.getContent() != null && tc.getContent().equals(component)) {
//removes previous comment is exists
for (Metadata metadata : tc.getAllMetadata()) {
if (metadata.getAttribute().equals(TemplateModel.USER_COMMENT)) {
tc.getAllMetadata().remove(metadata);
break;
}
}
for (Metadata metadata : tc.getAllMetadata()) {
if (metadata.getAttribute().equals(TemplateModel.USER_COMMENT_HEIGHT)) {
tc.getAllMetadata().remove(metadata);
break;
}
}
//add the comment
tc.addMetadata(TemplateModel.USER_COMMENT, comment2Add);
tc.addMetadata(TemplateModel.USER_COMMENT_HEIGHT, ""+visibleHeight);
GWT.log("Comment Added: " + comment2Add);
break;
}
}
}
/**
* look if a comment with a specific metadata (that indicate sit is a comment)
* exists in the current report model:
* @return true if comment is present yet false otherwise
*/
public boolean hasComments(Widget component) {
for (int i = 0; i < components.size(); i++) {
TemplateComponent tc = components.get(i);
if (tc.getContent() != null && tc.getContent().equals(component)) {
for (Metadata metadata : tc.getAllMetadata())
if (metadata.getAttribute().equals(TemplateModel.USER_COMMENT)) return true;
}
}
return false;
}
/**
* look if a comment with a specific metadata (that indicate sit is a comment)
* exists in the current report model:
* @return true if comment is present yet false otherwise
*/
public AddCommentEvent getComponentComments(Widget component) {
String commentText = "";
int commentHeight = -1;
for (int i = 0; i < components.size(); i++) {
TemplateComponent tc = components.get(i);
if (tc.getContent() != null && tc.getContent().equals(component)) {
for (Metadata metadata : tc.getAllMetadata()) {
if (metadata.getAttribute().equals(TemplateModel.USER_COMMENT))
commentText = metadata.getValue();
if (metadata.getAttribute().equals(TemplateModel.USER_COMMENT_HEIGHT))
commentHeight = Integer.parseInt(metadata.getValue());
}
}
}
return new AddCommentEvent(null, commentText, commentHeight);
}
/**
* look for the model in the current section and edits its position
* @param toRepos .
* @param newX .
* @param newY .
*/
public void repositionModelComponent(Widget toRepos, int newX, int newY) {
for (int i = 0; i < components.size(); i++) {
TemplateComponent tc = components.get(i);
if (tc.getContent().equals(toRepos)) {
GWT.log("FOUND CORRESPONDANCE", null);
tc.setX(newX);
tc.setY(newY);
tc.setContent(toRepos);
break;
}
}
}
/**
*
* @param index .
* @return .
*/
public TemplateComponent getComponent(int index) {
return components.get(index);
}
/**
*
* @param attr .
* @param value .
*/
public void addMetadata(String attr, String value) {
if (attr != null && value != null) {
metadata.add(new Metadata(attr, value));
}
else
throw new NullPointerException();
}
/**
*
* @return .
*/
public List<Metadata> getAllMetadata() {
if (metadata == null) {
new LinkedList<Metadata>();
}
return metadata;
}
/**
*
* @return .
*/
public List<TemplateComponent> getAllComponents() {
if (components == null) {
new TemplateSection();
}
return components;
}
}

View File

@ -0,0 +1,45 @@
package org.gcube.portlets.user.reportgenerator.client.resources;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.ClientBundle.Source;
public interface FimesReportTreeStructureResources extends ClientBundle {
public static final FimesReportTreeStructureResources INSTANCE = GWT.create(FimesReportTreeStructureResources.class);
@Source("report.png")
ImageResource root();
@Source("page.png")
ImageResource section();
@Source("text_heading_1.png")
ImageResource heading1();
@Source("text_heading_2.png")
ImageResource heading2();
@Source("text_heading_3.png")
ImageResource heading3();
@Source("text_heading_4.png")
ImageResource heading4();
@Source("text_dropcaps.png")
ImageResource text();
@Source("table.png")
ImageResource table();
@Source("image.png")
ImageResource image();
@Source("information.png")
ImageResource instructions();
@Source("comments.png")
ImageResource comments();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

View File

@ -0,0 +1,142 @@
package org.gcube.portlets.user.reportgenerator.client.targets;
import org.gcube.portlets.d4sreporting.common.client.ComponentType;
import org.gcube.portlets.d4sreporting.common.shared.SerializableAttribute;
import org.gcube.portlets.d4sreporting.common.shared.SerializableAttributeArea;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
/**
* <code> AttributeArea </code> class
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version April 2011 (1.0)
*/
public class AttributeArea extends Composite {
private HorizontalPanel myPanel;
private HTML attrName;
private CheckBox[] boxes;
/**
* Coming form a template constructor
*/
public AttributeArea(final Presenter presenter, int left, int top, int width, final int height, String textToDisplay) {
myPanel = new HorizontalPanel();
myPanel.setTitle("Attribute Area");
myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
myPanel.setPixelSize(width, 20);
myPanel.addStyleName("attributeArea");
attrName = new HTML(getAttributeName(textToDisplay));
attrName.getElement().getStyle().setMarginLeft(10, Unit.PX);
attrName.getElement().getStyle().setMarginRight(5, Unit.PX);
HorizontalPanel boxesPanel = new HorizontalPanel();
boxesPanel.add(attrName);
myPanel.add(boxesPanel);
myPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
boxes = getCheckboxes(textToDisplay);
for (int i = 0; i < boxes.length; i++) {
boxesPanel.add(boxes[i]);
}
initWidget(myPanel);
}
/**
* Coming form a report constructor
*/
public AttributeArea(final Presenter presenter, int left, int top, int width, final int height, SerializableAttributeArea sata) {
myPanel = new HorizontalPanel();
myPanel.setTitle("Attribute Area");
myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
myPanel.setPixelSize(width, 20);
myPanel.addStyleName("attributeArea");
attrName = new HTML(sata.getAttrName(), true);
attrName.getElement().getStyle().setMarginLeft(10, Unit.PX);
attrName.getElement().getStyle().setMarginRight(5, Unit.PX);
HorizontalPanel boxesPanel = new HorizontalPanel();
boxesPanel.add(attrName);
myPanel.add(boxesPanel);
myPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
int values = sata.getValues().size();
boxes = new CheckBox[values];
int j = 0;
for (SerializableAttribute attr: sata.getValues()) {
CheckBox toAdd = new CheckBox(attr.getName());
toAdd.setStyleName("checkAttribute");
toAdd.setValue(attr.getValue());
boxes[j] = toAdd;
j++;
}
//adding it to the panel
for (int i = 0; i < boxes.length; i++) {
boxesPanel.add(boxes[i]);
}
initWidget(myPanel);
}
/**
*
* @param toParse
* @return
*/
private String getAttributeName(String toParse) {
if (toParse == null)
return "";
String toReturn = "";
try {
toReturn = toParse.substring(0, toParse.indexOf(":"));
} catch (StringIndexOutOfBoundsException e) {
GWT.log("Could not find : returning empty");
}
return toReturn;
}
/**
*
* @param toParse
* @return
*/
private CheckBox[] getCheckboxes(String toParse) {
String toSplit = toParse.substring(toParse.indexOf(":")+1, toParse.length());
String[] values = toSplit.split("\\|");
GWT.log("toSplit" + toSplit);
GWT.log("values" + values.length);
CheckBox[] boxes = new CheckBox[values.length];
for (int i = 0; i < values.length; i++) {
boxes[i] = new CheckBox();
boxes[i].setStyleName("checkAttribute");
boxes[i].setText(" " + values[i].trim());
}
return boxes;
}
/**
*
* @return
*/
public ComponentType getType() {
return ComponentType.ATTRIBUTE;
}
/**
*
* @return
*/
public CheckBox[] getBoxes() {
return boxes;
}
/**
*
* @return
*/
public String getAttrName() {
return attrName.getText();
}
}

View File

@ -0,0 +1,111 @@
package org.gcube.portlets.user.reportgenerator.client.targets;
import org.gcube.portlets.d4sreporting.common.client.ComponentType;
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.event.dom.client.MouseOutHandler;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* <code> BasicTextArea </code>
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version July 2011 (3.0)
*/
public class BasicTextArea extends ReportTextArea {
private TextArea textArea = new TextArea();
private VerticalPanel myPanel;
private Presenter presenter;
int currHeight = 0;
public BasicTextArea(ComponentType type, final Presenter presenter, int left, int top, int width, final int height, boolean hasComments) {
super(type, presenter, left, top, width, height, hasComments);
this.presenter = presenter;
myPanel = getResizablePanel();
textArea.setPixelSize(width, height);
textArea.addMouseOutHandler(new MouseOutHandler() {
public void onMouseOut(MouseOutEvent event) {
presenter.storeChangeInSession((Widget) event.getSource());
}
});
switch (type) {
case TITLE:
textArea.setStyleName("titleArea");
myPanel.setTitle("Title");
break;
case HEADING_1:
textArea.setStyleName("headgin1Area");
myPanel.setTitle("Heading: Level 1");
break;
case HEADING_2:
textArea.setStyleName("headgin2Area");
myPanel.setTitle("Heading Level 2");
break;
case HEADING_3:
textArea.setStyleName("headgin3Area");
myPanel.setTitle("Heading: Level 3");
break;
default:
break;
}
myPanel.add(textArea);
myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
myPanel.setPixelSize(width, height);
textArea.addMouseOutHandler(new MouseOutHandler() {
public void onMouseOut(MouseOutEvent event) {
presenter.storeChangeInSession((Widget) event.getSource());
}
});
textArea.addKeyUpHandler(new KeyUpHandler() {
public void onKeyUp(KeyUpEvent event) {
HTML div = ReportGenerator.get().getDivHidden();
GWT.log("element.getHTML():\n" + textArea.getText(), null);
div.setHTML(textArea.getText());
int newHeight = div.getOffsetHeight();
if (newHeight > height-10 && newHeight != currHeight) {
resizeMe(myPanel.getOffsetWidth(), newHeight);
}
}
});
}
/**
* resize the panel
* @param w
* @param h
*/
private void resizeMe(int w, int h) {
resizePanel(w, h);
//Window.alert("myInstance.top: " + myInstance.top);
presenter.resizeTemplateComponentInModel(this, myPanel.getOffsetWidth(), h+5);
}
public String getText() {
return textArea.getText();
}
public void setText(String text) {
textArea.setText(text);
}
}

View File

@ -0,0 +1,26 @@
package org.gcube.portlets.user.reportgenerator.client.targets;
public class Coords {
private int X;
private int Y;
public Coords(int x, int y) {
super();
X = x;
Y = y;
}
public int getX() {
return X;
}
public void setX(int x) {
X = x;
}
public int getY() {
return Y;
}
public void setY(int y) {
Y = y;
}
}

View File

@ -0,0 +1,227 @@
package org.gcube.portlets.user.reportgenerator.client.targets;
import org.gcube.portlets.d4sreporting.common.client.ComponentType;
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.event.dom.client.KeyDownHandler;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.event.dom.client.MouseDownEvent;
import com.google.gwt.event.dom.client.MouseDownHandler;
import com.google.gwt.event.dom.client.MouseOutEvent;
import com.google.gwt.event.dom.client.MouseOutHandler;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.RichTextArea;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* <code> D4sRichTextArea </code> class is a template component that goes into the workspace
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version October 2008 (0.2)
*/
public class D4sRichTextarea extends ReportTextArea {
/**
* the text area
*/
private RichTextArea area = new RichTextArea();
TextArea text = new TextArea();
/**
* a flag
*/
boolean firstClick = true;
int currHeight = 0;
VerticalPanel myPanel;
/**
*
*
*/
public D4sRichTextarea() {}
/**
*
* @param presenter .
* @param left left
* @param top top
* @param width .
* @param height .
* @param type .
*/
public D4sRichTextarea(ComponentType type, final Presenter presenter, int left, int top, int width, final int height, boolean hasComments) {
super(type, presenter, left, top, width, height, hasComments);
currHeight = height;
myPanel = getResizablePanel();
area.setPixelSize(width-6, height-2);
area.setStyleName("d4sRichTextArea");
switch (type) {
case TITLE:
area.addStyleName("");
break;
case HEADING_1:
area.addStyleName("");
break;
case HEADING_2:
area.addStyleName("");
break;
case HEADING_3:
area.addStyleName("");
break;
case BODY:
area.addStyleName("bodyArea");
break;
default:
break;
}
myPanel.add(area);
//repositionMyPanel(0, 15);
myPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
myPanel.setPixelSize(width, height-15);
setStyleName("d4sFrame");
area.addMouseDownHandler(new MouseDownHandler() {
public void onMouseDown(MouseDownEvent event) {
if (event.getNativeButton() == Event.BUTTON_RIGHT) {
event.preventDefault();
event.stopPropagation();
MessageBox.alert("Warning","Please, use CTRL+V (CMD+V) for pasting into this area", null);
}
if (firstClick) {
presenter.enableTextToolBar(area);
presenter.enableBiblioEntry(area);
firstClick = false;
ReportGenerator.get().getDivHidden().setPixelSize(area.getOffsetWidth(), -1);
}
HTML div = ReportGenerator.get().getDivHidden();
div.setHTML(area.getHTML());
int newHeight = div.getOffsetHeight()+20 ;
if (newHeight > height-10 && newHeight != currHeight) {
presenter.shiftComponentsByTextArea(myInstance.top, newHeight - currHeight);
resizePanel(myPanel.getOffsetWidth(), div.getOffsetHeight());
//Window.alert("myInstance.top: " + myInstance.top);
presenter.resizeTemplateComponentInModel(myInstance, myPanel.getOffsetWidth(), newHeight);
}
}
});
area.addMouseOutHandler(new MouseOutHandler() {
public void onMouseOut(MouseOutEvent event) {
firstClick = true;
presenter.storeChangeInSession((Widget) event.getSource());
}
});
//TODO: aggiorna
// area.addKeyDownHandler(new KeyDownHandler() {
// public void onKeyDown(KeyDownEvent event) {
//// if (event.isAnyModifierKeyDown() && event.getNativeKeyCode() == 86) { //event.getNativeKeyCode() == 86 is the V (to avoid ctrl V or cmd V)
//// MessageBox.show(new MessageBoxConfig() {
//// {
//// setTitle("Paste operation");
//// setMsg("Please enter your text here (PLAIN)");
//// setWidth(500);
//// setButtons(MessageBox.OKCANCEL);
//// setMultiline(true);
//// setCallback(new MessageBox.PromptCallback() {
//// public void execute(String btnID, String text) {
//// if (btnID.compareTo("ok") == 0) {
//// area.setText(text);
////
//// //resize if needed
//// HTML div = ReportGenerator.get().getDivHidden();
//// //GWT.log("element.getHTML():\n" + area.getHTML(), null);
//// div.setHTML(area.getHTML());
//// int newHeight = div.getOffsetHeight()+20 ;
//// if (newHeight > height-10 && newHeight != currHeight) {
//// resizePanel(myPanel.getOffsetWidth(), div.getOffsetHeight());
//// }
//// }
////
//// }
//// });
//// }
//// });
// event.stopPropagation();
// event.preventDefault();
// }
//
// }
// });
area.addKeyUpHandler(new KeyUpHandler() {
public void onKeyUp(KeyUpEvent event) {
HTML div = ReportGenerator.get().getDivHidden();
div.setHTML(area.getHTML());
int newHeight = div.getOffsetHeight()+20 ;
if (newHeight > height-10 && newHeight != currHeight) {
presenter.shiftComponentsByTextArea(myInstance.top, newHeight - currHeight);
resizePanel(myPanel.getOffsetWidth(), div.getOffsetHeight());
//Window.alert("myInstance.top: " + myInstance.top);
presenter.resizeTemplateComponentInModel(myInstance, myPanel.getOffsetWidth(), newHeight);
}
}
});
}
/**
* used to resize the panel
* @param width w
* @param height h
*/
@Override
public void resizePanel(int width, int height) {
if (height > 15 && width > 15) {
mainPanel.setPixelSize(width, height+20);
resizablePanel.setPixelSize(width, height+20);
mainPanel.setWidgetPosition(topPanel, width-30 , 0);
area.setPixelSize(width-4, height+20);
currHeight = height + 20;
}
}
/**
*
* @return .
*/
public String getHTML() {
return area.getHTML();
}
/**
* @param html the html
*/
public void setHTML(String html) {
area.setHTML(html);
}
/**
*
* @return .
*/
public RichTextArea getArea() {
return area;
}
/**
*
* @param firstClick .
*/
public void setFirstClick(boolean firstClick) {
this.firstClick = firstClick;
}
}

View File

@ -0,0 +1,42 @@
package org.gcube.portlets.user.reportgenerator.client.targets;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* <code> DoubleColumnPanel </code> class is a Widget that places to widget in the same y
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version October 2009 (1.4)
*/
public class DoubleColumnPanel extends Composite {
private Widget left;
private Widget right;
private HorizontalPanel mainPanel = new HorizontalPanel();
/**
*
* @param left .
* @param right .
*/
public DoubleColumnPanel(Widget left, Widget right) {
super();
this.left = left;
this.right = right;
mainPanel.add(left);
mainPanel.add(right);
mainPanel.setWidth("800");
initWidget(mainPanel);
}
}

View File

@ -0,0 +1,122 @@
/**
*
*/
package org.gcube.portlets.user.reportgenerator.client.targets;
import java.util.List;
import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItemType;
import org.gcube.portlets.user.workspace.client.workspace.folder.GWTFolderItem;
import org.gcube.portlets.user.workspace.client.workspace.folder.GWTFolderItemType;
import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTExternalImage;
import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTImageDocument;
import com.extjs.gxt.ui.client.dnd.DropTarget;
import com.extjs.gxt.ui.client.dnd.Insert;
import com.extjs.gxt.ui.client.dnd.DND.Operation;
import com.extjs.gxt.ui.client.event.DNDEvent;
import com.extjs.gxt.ui.client.store.TreeStoreModel;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel;
import com.google.gwt.core.client.GWT;
/**
* @author Massimiliano Assante assante@isti.cnr.it
*
*/
public class DropImageListener extends DropTarget {
/**
*
*/
public static final String TIFF = "image/tiff";
protected DroppingArea panel;
/**
*
* @param panel .
* @param config .
*/
public DropImageListener(DroppingArea panel) {
super(panel);
this.panel = panel;
//IMPORTANT
setOperation(Operation.COPY);
}
@Override
protected void showFeedback(DNDEvent event) {
if (!isValidDropTarget(event)) {
Insert.get().hide();
event.getStatus().setStatus(false);
return;
}
super.showFeedback(event);
}
@SuppressWarnings("unchecked")
private boolean isValidDropTarget(DNDEvent event) {
GWT.log("isValidDropTarget");
TreePanel<FileModel> source = (TreePanel<FileModel>) event.getDragSource().getComponent();
List<FileModel> selection = source.getSelectionModel().getSelection();
for (FileModel model : selection) {
GWT.log("selection: " + model.getGXTFolderItemType());
if(model.getGXTFolderItemType()!=null){
if (model.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.EXTERNAL_IMAGE) || model.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT))
return true;
//
// if (model.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.TIME_SERIES))
// return true;
// if(source.getStore().getParent(model) == target.getModel())
// return false;
}
}
return false;
}
/**
* @param source .
* @param e .
* @param data .
* @return .
*/
protected void onDragDrop(DNDEvent event) {
super.onDragDrop(event);
if(event.getData() != null){
List<TreeStoreModel> listItemsSource = event.getData();
GWT.log("Number of move " + listItemsSource.size());
FileModel sourceFileModel = null; //for print
for(TreeStoreModel itemSource : listItemsSource){
sourceFileModel = (FileModel) itemSource.getModel();
if(sourceFileModel.getParentFileModel()!=null)
GWT.log("Source Name " + sourceFileModel.getName() + " id " + sourceFileModel.getIdentifier() + " end drag " + " Parent Name: " + sourceFileModel.getParentFileModel().getName() + "id " + sourceFileModel.getParentFileModel().getIdentifier());
else
GWT.log("Source Name " + sourceFileModel.getName() + " id " + sourceFileModel.getIdentifier() + " end drag ");
GWT.log("Child count: " + itemSource.getChildCount());
panel.fetchImage(sourceFileModel.getIdentifier(), false , true);
}
}
}
}

View File

@ -0,0 +1,115 @@
/**
*
*/
package org.gcube.portlets.user.reportgenerator.client.targets;
import java.util.List;
import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import com.extjs.gxt.ui.client.dnd.DND.Operation;
import com.extjs.gxt.ui.client.dnd.DropTarget;
import com.extjs.gxt.ui.client.dnd.Insert;
import com.extjs.gxt.ui.client.event.DNDEvent;
import com.extjs.gxt.ui.client.store.TreeStoreModel;
import com.extjs.gxt.ui.client.widget.treepanel.TreePanel;
import com.google.gwt.core.client.GWT;
/**
* @author Federico De Faveri defaveri@isti.cnr.it
*
*/
public class DropTSListener extends DropTarget {
/**
*
*/
public static final String NO_DROP = "x-dd-drop-nodrop";
/**
*
*/
public static final String OK_DROP = "x-dd-drop-ok";
/**
*
*/
public static final String OK_DROP_ADD = "x-dd-drop-ok-add";
protected TSArea panel;
/**
*
* @param panel .
* @param config .
*/
public DropTSListener(TSArea panel) {
super(panel);
this.panel = panel;
//IMPORTANT
setOperation(Operation.COPY);
}
@Override
protected void showFeedback(DNDEvent event) {
if (!isValidDropTarget(event)) {
Insert.get().hide();
event.getStatus().setStatus(false);
return;
}
super.showFeedback(event);
}
@SuppressWarnings("unchecked")
private boolean isValidDropTarget(DNDEvent event) {
GWT.log("isValidDropTarget");
TreePanel<FileModel> source = (TreePanel<FileModel>) event.getDragSource().getComponent();
List<FileModel> selection = source.getSelectionModel().getSelection();
for (FileModel model : selection) {
GWT.log("selection: " + model.getGXTFolderItemType());
if(model.getGXTFolderItemType()!=null){
if (model.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.TIME_SERIES))
return true;
}
}
return false;
}
/**
* @param source .
* @param e .
* @param data .
* @return .
*/
protected void onDragDrop(DNDEvent event) {
super.onDragDrop(event);
if(event.getData() != null){
List<TreeStoreModel> listItemsSource = event.getData();
GWT.log("Number of move " + listItemsSource.size());
FileModel sourceFileModel = null; //for print
for(TreeStoreModel itemSource : listItemsSource){
sourceFileModel = (FileModel) itemSource.getModel();
if(sourceFileModel.getParentFileModel()!=null)
GWT.log("Source Name " + sourceFileModel.getName() + " id " + sourceFileModel.getIdentifier() + " end drag " + " Parent Name: " + sourceFileModel.getParentFileModel().getName() + "id " + sourceFileModel.getParentFileModel().getIdentifier());
else
GWT.log("Source Name " + sourceFileModel.getName() + " id " + sourceFileModel.getIdentifier() + " end drag ");
GWT.log("Child count: " + itemSource.getChildCount());
panel.fetchTS(sourceFileModel.getIdentifier(), false , true);
}
}
}
}

View File

@ -0,0 +1,214 @@
package org.gcube.portlets.user.reportgenerator.client.targets;
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTExternalImage;
import com.extjs.gxt.ui.client.widget.Component;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* <code> DroppingArea </code> class is a Widget you can drop image on
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version May 20012 (3.5)
*/
public class DroppingArea extends Component {
private String expectedContent = "";
private VerticalPanel mainPanel;
private Image droppedImage;
private Presenter presenter;
private String idInBasket;
private String currentUser;
private String currentScope;
Label label;
private int width, height;
/**
* @param presenter .
* @param width .
* @param height .
* @param tag the label to display
*/
public DroppingArea(Presenter presenter, int width, int height, String tag) {
if (tag.equals("")) {
tag = "No suggestions available";
}
this.width = width;
this.height = height;
this.presenter = presenter;
mainPanel = new VerticalPanel();
super.setWidth(width+"px");
super.setHeight(height+"px");
mainPanel.setWidth(width+"px");
mainPanel.setHeight(height+"px");
setElement(mainPanel.getElement());
addStyleName("droppingArea-Image");
mainPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
mainPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
label = new Label(tag);
label.addStyleName("label");
mainPanel.add(label);
droppedImage = null;
}
public void add(Widget w) {
mainPanel.add(w);
}
/**
* called when dropped an image on the area
* @param toShow the image to show
*/
public void showImage(Image toShow) {
//mainPanel.remove(label);
mainPanel.clear();
this.droppedImage = toShow;
toShow.setPixelSize(width, height);
mainPanel.add(toShow);
presenter.storeChangeInSession(this);
}
/**
*
* @param url .
* @param id the id in the folder
*/
public void dropImage(String url, String id)
{
GWT.log("URL:" + url, null);
idInBasket = id;
showImage(new Image(url));
}
public void fetchImage(String identifier, boolean isInteralImage, boolean fullDetails) {
this.mask("fetching image, pleas wait", "loading-indicator");
ReportGenerator.get().getWSTreeService().getImageById(identifier, isInteralImage, fullDetails, new AsyncCallback<GWTWorkspaceItem>() {
public void onSuccess(GWTWorkspaceItem result) {
unmask();
GWTExternalImage image = (GWTExternalImage) result;
dropImage(image.getImageUrl(), image.getId());
}
public void onFailure(Throwable caught) {
unmask();
Window.alert("Could not fetch image from infrastructure " + caught.getCause());
}
});
}
/**
*
* @return the image
*/
public Image getDroppedImage() {
if (droppedImage == null)
return new Image();
return droppedImage;
}
/**
*
* @return the possible content
*/
public Label getLabel() {
return label;
}
/**
*
* @param label set the label
*/
public void setLabel(Label label) {
this.label = label;
}
/**
* return a URL which is lookable for on the web
* @param imageName .
* @param templateName .
* @return .
*/
public String getImageURL(String imageName, String templateName) {
currentUser = presenter.getCurrentUser();
currentScope = presenter.getCurrentScope();
/**
* Images will be stored under webapps/usersArea...
* GWT.getModuleBaseURL() returns * e.g. http://dlib28.isti.cnr.it/templatecreator/html/
* need to get just http://dlib28.isti.cnr.it/
*/
//remove "/html/" and get e.g. http://dlib28.isti.cnr.it/templatecreator
String host = GWT.getModuleBaseURL().substring(0, GWT.getModuleBaseURL().length()-6);
//loog for last slash
int lastSlash = host.lastIndexOf("/");
//get what i need : e.g. http://dlib28.isti.cnr.it/ or host = "http://localhost:8080/";
host = host.substring(0, lastSlash +1 );
//host = "http://localhost:8080/";
String imgURL = host + "usersArea/" + currentScope + "/templates/"
+ currentUser + "/CURRENT_OPEN/images/" + imageName;
return imgURL;
}
/**
*
* @return .
*/
public String getIdInBasket() {
return idInBasket;
}
/**
*
* @param idInBasket .
*/
public void setIdInBasket(String idInBasket) {
this.idInBasket = idInBasket;
}
/**
*
* @return expectedContent
*/
public String getExpectedContent() {
return expectedContent;
}
/**
*
* @param expectedContent .
*/
public void setExpectedContent(String expectedContent) {
this.expectedContent = expectedContent;
if (expectedContent.compareTo("") != 0)
label.setText(expectedContent);
}
}

View File

@ -0,0 +1,158 @@
package org.gcube.portlets.user.reportgenerator.client.targets;
import com.google.gwt.user.client.ui.TextArea;
/**
*
* @author massi
*
*/
public class GenTableCell extends TextArea {
/**
*
*/
private int cellWidth;
/**
*
*/
private int cellHeight;
/**
*
*/
private int rowindex;
/**
*
*/
private int colindex;
/**
*
*/
private int colspan;
/**
*
*/
boolean selected = false;
/**
*
* @param rowindex
* @param colindex
*/
public GenTableCell() {
super();
this.rowindex = 0;
this.colindex = 0;
this.colspan = 1;
}
/**
*
* @param rowindex
* @param colindex
*/
public GenTableCell(int rowindex, int colindex, int cellWidth, int colspan) {
super();
this.rowindex = rowindex;
this.colindex = colindex;
this.colspan = colspan;
this.cellWidth = cellWidth;
}
/**
*
* @return
*/
public int getWidth() {
return cellWidth;
}
/**
*
* @param width
*/
public void setWidth(int width) {
this.cellWidth = width;
}
/**
*
* @return
*/
public int getHeight() {
return cellHeight;
}
/**
*
* @param height
*/
public void setHeight(int height) {
this.cellHeight = height;
}
/**
*
* @return
*/
public int getRowindex() {
return rowindex;
}
/**
*
* @param rowindex
*/
public void setRowindex(int rowindex) {
this.rowindex = rowindex;
}
/**
*
* @return
*/
public int getColindex() {
return colindex;
}
/**
*
* @param colindex
*/
public void setColindex(int colindex) {
this.colindex = colindex;
}
/**
*
* @return
*/
public boolean isSelected() {
return selected;
}
/**
*
* @param selected
*/
public void setSelected(boolean selected) {
this.selected = selected;
}
/**
*
* @return
*/
public int getColspan() {
return colspan;
}
/**
*
* @param colspan
*/
public void setColspan(int colspan) {
this.colspan = colspan;
}
public int getCellWidth() {
return cellWidth;
}
public void setCellWidth(int cellWidth) {
this.cellWidth = cellWidth;
}
public int getCellHeight() {
return cellHeight;
}
public void setCellHeight(int cellHeight) {
this.cellHeight = cellHeight;
}
}

View File

@ -0,0 +1,145 @@
package org.gcube.portlets.user.reportgenerator.client.targets;
import java.util.ArrayList;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTable;
import org.gcube.portlets.d4sreporting.common.shared.TableCell;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
*
* @author Massimiliano Assante ISTI-CNR
* @version 1.0
*
*/
public class GenericTable extends Composite {
private VerticalPanel myPanel;
private FlexTable myTable;
Presenter presenter;
private int rows;
private int cols;
private int cellWidth;
private int cellSpacing = 1;
private int cellPadding = 0;
private GenTableCell selectedCell = null;
/**
* constructor called when reading the model
* @param sTable
*/
public GenericTable(SerializableTable sTable, Presenter presenter, int top, int left, int width, int height) {
commonConstructorCode(presenter);
this.rows = sTable.getRowCount();
this.cols = sTable.getColsNo();
/**
* construct the table
*/
for (int i = 0; i < rows; i++) {
for (int j = 0; j < sTable.getCellCount(i); j++) {
TableCell toPut = sTable.getValue(i, j);
int cellWidth = toPut.getCellWidth();
int cellHeight = toPut.getCellHeight();
int colspan = toPut.getColspan();
GenTableCell toAdd = new GenTableCell(i, j, cellWidth, colspan);
toAdd.setText(toPut.getContent());
toAdd.setStyleName("tableBorder");
toAdd.setWidth(""+cellWidth+"px");
myTable.setWidget(i, j, toAdd);
myTable.getFlexCellFormatter().setColSpan(i, j, colspan);
}
}
myPanel = new VerticalPanel();
myPanel.setWidth(width+"px");
myPanel.setStyleName("d4sFrame");
myPanel.add(myTable);
initWidget(myPanel);
}
/**
* common Constructors Code
*/
private void commonConstructorCode(Presenter presenter) {
this.presenter = presenter;
myTable= new FlexTable();
myTable.setWidth("90%");
myTable.setCellSpacing(cellSpacing);
myTable.setCellPadding(cellPadding);
}
public FlexTable getMyTable() {
return myTable;
}
public void setMyTable(FlexTable myTable) {
this.myTable = myTable;
}
public int getRowsNo() {
return rows;
}
public void setRows(int rows) {
this.rows = rows;
}
public int getCols() {
return cols;
}
public void setCols(int cols) {
this.cols = cols;
}
/**
*
* @return
*/
public SerializableTable getSerializable() {
SerializableTable toReturn = new SerializableTable(this.cols);
for (int i = 0; i < myTable.getRowCount(); i++) {
toReturn.addRow(getRow(i));
}
return toReturn;
}
public ArrayList<TableCell> getRow(int i) {
ArrayList<TableCell> toReturn = new ArrayList<TableCell>();
for (int j = 0; j < myTable.getCellCount(i); j++) {
GenTableCell tb = (GenTableCell) myTable.getWidget(i, j);
int colspan = tb.getColspan();
toReturn.add(new TableCell(tb.getText(), colspan, tb.getWidth(), tb.getHeight()));
}
return toReturn;
}
public GenTableCell getSelectedCell() {
return selectedCell;
}
/**
* adda a column at the left of the selected cell of the selected table
* TODO: next version
*/
public void addColumnLeft(int colindex) {
// myTable.insertCell(beforeRow, beforeColumn)
}
}

View File

@ -0,0 +1,158 @@
package org.gcube.portlets.user.reportgenerator.client.targets;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
* <code> ImageArea </code> class is the Widget that goes into the workspace
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version October 2008 (0.2)
*/
public class ImageArea extends Composite {
private String templateName;
private String imageName;
private String currentUser;
private String currentScope;
VerticalPanel myPanel;
Image myImage = new Image();
/**
* Creates an image with a specified URL. The load event will be fired once
* the image at the given URL has been retrieved by the browser.
*
* @param presenter .
* @param param the imageName of the image to be displayed or the URL to be displayed depending on the isURL param
* @param myTemplate the template name that owns the image, useful when template it's saved with another name
* to eventually copy the images in the new template images folder
* @param isURL true if passing a URL, false is passing image name
* @param w width
* @param h height
*/
public ImageArea(Presenter presenter, String param, String myTemplate, boolean isURL, int w, int h) {
myPanel = new VerticalPanel();
currentUser = presenter.getCurrentUser();
currentScope = presenter.getCurrentScope();
//Window.alert("Image Area");
if (isURL) {
//need to get the name from the URL
int lastSlash = param.lastIndexOf("/");
if (lastSlash > -1) {
imageName = param.substring(lastSlash+1, param.length());
}
else
imageName = param;
this.templateName = "CURRENT_OPEN";
//Window.alert(param);
myImage.setUrl(param);
} else {
imageName = param;
this.templateName = myTemplate;
String imgURL = getImageURL(imageName, "CURRENT_OPEN");
myImage.setUrl(imgURL);
}
myImage.setPixelSize(w, h);
myPanel.setStyleName("d4sFrame");
myPanel.add(myImage);
initWidget(myPanel);
}
/**
*
* @return .
*/
public String getUrl() {
return myImage.getUrl();
}
/**
* return a URL which is lookable for on the web
* @param imageName .
* @param templateName .
* @return .
*/
public String getImageURL(String imageName, String templateName) {
/**
* Images will be stored under webapps/usersArea...
* GWT.getModuleBaseURL() returns * e.g. http://dlib28.isti.cnr.it/templatecreator/html/
* need to get just http://dlib28.isti.cnr.it/
*/
//remove "/html/" and get e.g. http://dlib28.isti.cnr.it/templatecreator
String host = GWT.getModuleBaseURL().substring(0, GWT.getModuleBaseURL().length()-6);
//loog for last slash
int lastSlash = host.lastIndexOf("/");
//get what i need : e.g. http://dlib28.isti.cnr.it/ or host = "http://localhost:8080/";
host = host.substring(0, lastSlash +1 );
//host = "http://localhost:8080/";
String imgURL = host + "usersArea/" + currentScope + "/templates/"
+ currentUser + "/" + "CURRENT_OPEN" + "/images/" + imageName;
GWT.log(imgURL);
return imgURL;
}
/**
*
* @return a string containing the owner template name
*/
public String getTemplateName() {
return templateName;
}
/**
*
* @param myTemplate the template owner
*/
public void setTemplateName(String myTemplate) {
this.templateName = myTemplate;
}
/**
*
* @return .
*/
public String getImageName() {
return imageName;
}
/**
*
* @param imageName .
*/
public void setImageName(String imageName) {
this.imageName = imageName;
}
/**
*
* @return the scope in which the application is running on
*/
public String getCurrentScope() {
return currentScope;
}
/**
*
* @return the user username who is using the application
*/
public String getCurrentUser() {
return currentUser;
}
}

View File

@ -0,0 +1,260 @@
package org.gcube.portlets.user.reportgenerator.client.targets;
import org.gcube.portlets.d4sreporting.common.client.ComponentType;
import org.gcube.portlets.d4sreporting.common.client.ImageConstants;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.dialog.CommentDialog;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
* <code> ReportTextArea </code> class represent the generic Widget that can be placed in the UI Component
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version July 2011 (3.0)
*/
public class ReportTextArea extends Composite {
/**
* the allowance when mouse cursor is on borders
*/
public final int DELTA = 7;
/**
* variables of the components
*/
protected int left, top, width, height;
/**
* the controller instance of the widget
*/
private Presenter presenter;
private ComponentType type;
protected AbsolutePanel mainPanel;
protected HorizontalPanel topPanel;
protected VerticalPanel resizablePanel;
protected Image commentImage;
/**
*
* @return .
*/
public VerticalPanel getResizablePanel() {
return resizablePanel;
}
protected ReportTextArea myInstance;
/**
* default constructor
*
*/
public ReportTextArea() {
super();
}
/**
*
* @param presenter .
* @param left left
* @param top top
* @param width .
* @param height .
* @param type a
*/
public ReportTextArea(ComponentType type, final Presenter presenter, int left, int top, int width, int height, boolean hasComments) {
myInstance = this;
this.type = type;
this.presenter = presenter;
this.left = left;
this.top = top;
this.width = width;
this.height = height;
mainPanel = new AbsolutePanel();
topPanel = new HorizontalPanel();
resizablePanel = new VerticalPanel();
mainPanel.setPixelSize(width, height);
topPanel.setPixelSize(30, 15);
resizablePanel.setPixelSize(width, height);
commentImage = new Image((hasComments) ? ImageConstants.IMAGE_COMMENTS : ImageConstants.IMAGE_COMMENTS_GRAY);
commentImage.setTitle("Show user comments");
topPanel.add(commentImage);
commentImage.setStyleName("selectable");
commentImage.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
String previousComments = "";
int commentHeight = -1;
previousComments = presenter.getComponentComments(myInstance).getComment();
commentHeight = presenter.getComponentComments(myInstance).getAreaHeight();
CommentDialog dlg = new CommentDialog(presenter.getEventBus(), myInstance, presenter.getCurrentUser(), previousComments, commentHeight);
dlg.setPopupPosition(commentImage.getAbsoluteLeft()+20, commentImage.getAbsoluteTop());
dlg.show();
}
});
topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
mainPanel.add(resizablePanel, 0, 0);
mainPanel.add(topPanel, width-18, 0);
mainPanel.setStyleName("d4sFrame");
initWidget(mainPanel);
}
/**
*
* @return .
*/
public ComponentType getType() {
return type;
}
/**
*
* @param type .
*/
public void setType(ComponentType type) {
this.type = type;
}
/**
* used to resize the panel
* @param width w
* @param height h
*/
public void resizePanel(int width, int height) {
if (height > 15 && width > 15) {
mainPanel.setPixelSize(width, height);
resizablePanel.setPixelSize(width, height);
mainPanel.setWidgetPosition(topPanel, width-15, 0);
}
}
/***
*
* @param height g
*/
public void setHeight(int height) {
if (height > this.height) {
mainPanel.setHeight(""+(height+20));
resizablePanel.setHeight(""+(height+20));
mainPanel.setWidgetPosition(topPanel, width-15, 0);
}
}
/**
*
* @param left .
* @param top .
*/
public void repositionMyPanel(int left, int top) {
//mainPanel.setWidgetPosition(resizablePanel, left, top);
}
/**
* @return .
*/
public int getLeft() {
return left;
}
/**
*
* @param left .
*/
public void setLeft(int left) {
this.left = left;
}
/**
*
* @return -.
*/
public int getTop() {
return top;
}
/**
*
* @param top .
*/
public void setTop(int top) {
this.top = top;
}
/**
*
* @return the controller instance of the widget
*/
public Presenter getController() {
return presenter;
}
/**
*
* @return .
*/
public ReportTextArea getMyInstance() {
return myInstance;
}
/**
*
* @param myInstance .
*/
public void setMyInstance(ReportTextArea myInstance) {
this.myInstance = myInstance;
}
public void removeCommentView() {
commentImage.setUrl(ImageConstants.IMAGE_COMMENTS_GRAY);
}
public void addCommentView() {
commentImage.setUrl(ImageConstants.IMAGE_COMMENTS);
}
public void showComment(String comment) {
// final Window window = new Window();
// window.setTitle("");
// window.setMaximizable(true);
// window.setResizable(true);
// window.setLayout(new FitLayout());
// window.setWidth(200);
// window.setHeight(100);
// window.setModal(false);
//
// Panel windowPanel = new Panel();
// windowPanel.setBaseCls("comment-popup");
// windowPanel.setHtml(comment);
// windowPanel.setShadow(true);
// window.add(windowPanel);
// window.setPosition(commentImage.getAbsoluteLeft()+25, commentImage.getAbsoluteTop());
// window.show();
}
}

View File

@ -0,0 +1,314 @@
package org.gcube.portlets.user.reportgenerator.client.targets;
import java.util.LinkedList;
import java.util.List;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTSFilter;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTSinfo;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTable;
import org.gcube.portlets.d4sreporting.common.shared.SerializableTimeSeries;
import org.gcube.portlets.user.reportgenerator.client.ReportGenerator;
import org.gcube.portlets.user.reportgenerator.client.Presenter.Presenter;
import org.gcube.portlets.user.reportgenerator.client.dialog.TimeSeriesDialog;
import org.gcube.portlets.user.reportgenerator.client.dialog.TimeSeriesFilter;
import org.gcube.portlets.user.reportgenerator.client.dialog.TimeSeriesSampleDialog;
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTTimeSeries;
import com.extjs.gxt.ui.client.widget.Composite;
import com.extjs.gxt.ui.client.widget.VerticalPanel;
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.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
/**
* <code> TSArea </code> class is a Widget you can drop a Workspace Time Series on
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version July 2011 (3.0)
*/
public class TSArea extends Composite {
private VerticalPanel mainPanel;
private SerializableTimeSeries sts = new SerializableTimeSeries();
private String idInBasket;
private Presenter presenter;
private FlexTable flexTable;
private TSArea singleton;
VerticalPanel tableContainer = new VerticalPanel();
Grid metadata = new Grid(3, 2);
Label label;
/**
* @param presenter .
* @param width .
* @param height .
* @param sts the time series
*/
public TSArea(Presenter presenter, int width, int height, SerializableTimeSeries sts) {
singleton = this;
this.presenter = presenter;
mainPanel = new VerticalPanel();
//setElement(mainPanel.getElement());
mainPanel.setStyleName("timeseriesArea");
mainPanel.addStyleName("timeseriesArea_bg");
mainPanel.setWidth(width);
mainPanel.setHeight(height);
mainPanel.add(new HTML("&nbsp;", true));
this.sts = sts;
if (sts != null) {
if (sts.getTsMetadata() != null) {
showTS(sts.getTsMetadata());
}
}
initComponent(mainPanel);
mainPanel.layout(true);
}
/**
* called when dropped a TS on the area
* @param toShow the TS to show
*/
public void showTS(SerializableTSinfo toShow) {
mainPanel.removeAll();
mainPanel.removeStyleName("timeseriesArea_bg");
tableContainer.removeAll();
metadata.setWidget(0, 0, new HTML("<b>TS name:</b>", true));
metadata.setWidget(0, 1, new HTML(toShow.getTitle()));
metadata.setWidget(1, 0, new HTML("<b>Creation Date:</b> ", true));
metadata.setWidget(1, 1, new HTML(toShow.getTimeSeriesCreationDate()));
metadata.setWidget(2, 0, new HTML("<b>Total rows:</b>", true));
metadata.setWidget(2, 1, new HTML(""+toShow.getDimension()));
List<String> headers = toShow.getHeaderLabels();
flexTable = new FlexTable();
int n = (headers.size() > 10) ? 10 : headers.size();
for (int i = 0; i < n ; i++) {
flexTable.getCellFormatter().setStyleName(0, i, "timeSeries_header");
flexTable.setWidget(0, i, new HTML(headers.get(i)));
flexTable.setWidget(1, i, new HTML(".."));
flexTable.getCellFormatter().setStyleName(1, i, "timeSeries_td");
}
if (headers.size() > 10) {
flexTable.setWidget(0, 11, new HTML(" more .."));
flexTable.setWidget(1, 11, new HTML(".."));
flexTable.getCellFormatter().setStyleName(0, 11, "timeSeries_header");
flexTable.getCellFormatter().setStyleName(1, 11, "timeSeries_td");
}
tableContainer.add(flexTable);
mainPanel.add(metadata);
mainPanel.add(tableContainer);
Button moreDetails = new Button("View Timeseries Metadata");
Button filter = new Button("Filter Table");
Button showSample = new Button("Show Sample");
HorizontalPanel buttonsPanel = new HorizontalPanel();
buttonsPanel.setSpacing(5);
buttonsPanel.add(moreDetails);
buttonsPanel.add(filter);
buttonsPanel.add(showSample);
mainPanel.add(buttonsPanel);
moreDetails.addClickHandler(viewMetadataTS);
showSample.addClickHandler(showTSSample);
filter.addClickHandler(applyFilterTs);
//TODO: check this
presenter.storeChangeInSession(this);
mainPanel.layout(true);
}
ClickHandler viewMetadataTS = new ClickHandler() {
public void onClick(ClickEvent event) {
TimeSeriesDialog dlg = new TimeSeriesDialog(sts.getTsMetadata());
dlg.setAnimationEnabled(true);
dlg.show();
}
};
ClickHandler applyFilterTs = new ClickHandler() {
public void onClick(ClickEvent event) {
TimeSeriesFilter dlg = new TimeSeriesFilter(singleton, sts);
//dlg.setPopupPosition(sender.getAbsoluteLeft(), sender.getAbsoluteTop());
dlg.setAnimationEnabled(true);
dlg.show();
}
};
ClickHandler showTSSample = new ClickHandler() {
public void onClick(ClickEvent event) {
presenter.getModel().getModelService().getSampleTimeSeries(sts, new AsyncCallback<SerializableTable>() {
public void onFailure(Throwable caught) { Window.alert("There were Problem contacting Server, please try later");}
public void onSuccess(SerializableTable result) {
SerializableTable toPass = result;
TimeSeriesSampleDialog dlg = new TimeSeriesSampleDialog(toPass);
dlg.setAnimationEnabled(true);
dlg.show();
}
});
}
};
/**
*
* @param droppedTS the dropped timeseries
*/
public void dropTS(GWTTimeSeries droppedTS) {
idInBasket = droppedTS.getId();
SerializableTSinfo tsMetadata = convertWSTS2SerialazableTS(droppedTS);
sts = new SerializableTimeSeries(null, tsMetadata);
GWT.log("showTS TS");
showTS(tsMetadata);
}
public void fetchTS(String identifier, boolean isInteralImage, boolean fullDetails) {
GWT.log("FETCH TS");
this.mask("fetching TimeSeries, pleas wait", "loading-indicator");
ReportGenerator.get().getWSTreeService().getTimeSeriesById(identifier, new AsyncCallback<GWTWorkspaceItem>() {
public void onSuccess(GWTWorkspaceItem result) {
unmask();
GWTTimeSeries ts = (GWTTimeSeries) result;
dropTS(ts);
}
public void onFailure(Throwable caught) {
unmask();
Window.alert("Could not fetch Time Series from infrastructure " + caught.getCause());
}
});
}
/**
* converts the WorkSpace TS Object into a Report TS Object
* @param md the TS metadata to convert
* @return
*/
private SerializableTSinfo convertWSTS2SerialazableTS(GWTTimeSeries md) {
SerializableTSinfo tsMetadata = new SerializableTSinfo(md.getId(), md.getName(), md.getDescription(), md.getOwner(),
md.getCreationTime(), md.getLastModificationTime(), md.getTimeSeriesId(), md.getTitle(), md.getCreator(),
md.getTimeSeriesDescription(), md.getTimeSeriesCreationDate(),
md.getPublisher(), md.getSourceId(), md.getSourceName(), md.getRights(), md.getDimension(), md.getHeaderLabels());
return tsMetadata;
}
/**
* refresh the headers once the TS has been filtered
*/
public void refreshHeaders() {
tableContainer.removeAll();
flexTable = new FlexTable();
List<String> filteredHeaders = new LinkedList<String>();
SerializableTSFilter tf = sts.getFilter();
for (Integer colNo : tf.getColsNumberToShow()) {
String toAdd = sts.getTsMetadata().getHeaderLabels().get(colNo);
filteredHeaders.add(toAdd);
}
int n = (filteredHeaders.size() > 10) ? 10 : filteredHeaders.size();
for (int i = 0; i < n ; i++) {
flexTable.getCellFormatter().setStyleName(0, i, "timeSeries_header");
flexTable.setWidget(0, i, new HTML(filteredHeaders.get(i)));
flexTable.setWidget(1, i, new HTML(".."));
flexTable.getCellFormatter().setStyleName(1, i, "timeSeries_td");
}
if (filteredHeaders.size() > 10) {
flexTable.setWidget(0, 11, new HTML(" more .."));
flexTable.setWidget(1, 11, new HTML(".."));
flexTable.getCellFormatter().setStyleName(0, 11, "timeSeries_header");
flexTable.getCellFormatter().setStyleName(1, 11, "timeSeries_td");
}
tableContainer.add(flexTable);
Grid newGrid = new Grid(1, 2);
newGrid.setWidget(0, 0, new HTML("<b>Selected Interval:</b> ", true));
newGrid.setWidget(0, 1, new HTML(tf.getFrom() + " - " + tf.getTo() ));
tableContainer.add(newGrid);
}
/**
*
* @return the possible content
*/
public Label getLabel() {
return label;
}
/**
*
* @param label set the label
*/
public void setLabel(Label label) {
this.label = label;
}
/**
*
* @return .
*/
public String getIdInBasket() {
return idInBasket;
}
/**
*
* @param idInBasket .
*/
public void setIdInBasket(String idInBasket) {
this.idInBasket = idInBasket;
}
/**
*
* @return .
*/
public SerializableTimeSeries getSts() {
return sts;
}
/**
*
* @param sts .
*/
public void setSts(SerializableTimeSeries sts) {
this.sts = sts;
}
/**
*
* @param tsf the new ts filter
*/
public void setNewFilter(SerializableTSFilter tsf) {
this.sts.setFilter(tsf);
}
}

View File

@ -0,0 +1,26 @@
/**
*
*/
package org.gcube.portlets.user.reportgenerator.client.toursteps;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.user.client.ui.HTML;
/**
* @author massi
*
*/
public class Intro extends HTML {
private static IntroUiBinder uiBinder = GWT.create(IntroUiBinder.class);
interface IntroUiBinder extends UiBinder<Element, Intro> {
}
public Intro() {
setHTML(uiBinder.createAndBindUi(this).getInnerHTML());
}
}

View File

@ -0,0 +1,31 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder">
<ui:style>
/* Add CSS here. See the GWT docs on UI Binder for more details */
.important {
font-weight: bold;
}
</ui:style>
<div>
<!-- Add HTML content here. The ui:field attribute binds an element to
a field in the owner class. See the GWT docs on UI Binder for more details. -->
<div style="line-height: 19px; padding: 10px; font-size: 14px; ">
<div style="padding-bottom: 70px;">
<b>gCube Reporting</b>
allows users to create Reports and generate different
export formats
(OpenXML, HTML, PDF) based on results retrieved from the
infrastructure.
</div>
<div style="padding-bottom: 70px;">
gCube Templates are loaded by this
<b>gCube Report Generator</b>
to produce actual reports.
</div>
<div style="padding-bottom: 10px;">
<b>Discover</b>
gCube Reporting features through this quick tour.
</div>
</div>
</div>
</ui:UiBinder>

View File

@ -0,0 +1,44 @@
package org.gcube.portlets.user.reportgenerator.server.portlet;
import javax.portlet.GenericPortlet;
import javax.portlet.ActionRequest;
import javax.portlet.PortletSession;
import javax.portlet.RenderRequest;
import javax.portlet.ActionResponse;
import javax.portlet.RenderResponse;
import javax.portlet.PortletException;
import java.io.IOException;
import javax.portlet.PortletRequestDispatcher;
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
import com.liferay.portal.PortalException;
import com.liferay.portal.SystemException;
import com.liferay.portal.model.User;
import com.liferay.portal.service.UserLocalServiceUtil;
/**
* ReportGeneratorPortlet Portlet Class
* @author massi
*/
public class ReportGeneratorPortlet extends GenericPortlet {
public void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
ScopeHelper.setContext(request);
PortletRequestDispatcher dispatcher =
getPortletContext().getRequestDispatcher("/WEB-INF/jsp/ReportGeneratorPortlet_view.jsp");
dispatcher.include(request, response);
}
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException {
}
}

View File

@ -0,0 +1,311 @@
package org.gcube.portlets.user.reportgenerator.server.servlet;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.common.core.utils.logging.GCUBELog;
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
import org.gcube.portlets.admin.wfdocslibrary.shared.PermissionType;
import org.gcube.portlets.admin.wfdocslibrary.shared.Step;
import org.gcube.portlets.admin.wfdocslibrary.shared.WfRole;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.model.Organization;
import com.liferay.portal.model.ResourceConstants;
import com.liferay.portal.model.Role;
import com.liferay.portal.model.User;
import com.liferay.portal.service.CompanyLocalServiceUtil;
import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.service.PermissionLocalServiceUtil;
import com.liferay.portal.service.ResourceLocalServiceUtil;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portlet.documentlibrary.NoSuchFolderException;
import com.liferay.portlet.documentlibrary.model.DLFileEntry;
import com.liferay.portlet.documentlibrary.model.DLFolder;
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLFolderLocalServiceUtil;
public class DocLibraryUtil {
public static final String WORKFLOWS_FOLDER = "Workflow Documents";
/**
*
*/
private static GCUBELog log = new GCUBELog(DocLibraryUtil.class);
/**
* write the Report File (payload) into Liferay DocLibrary in the workflowdocs folder
* @param roles
* @param start each Step contains a Map<WfRole, ArrayList<PermissionType>> that is needed in the writeFileIntoDocLibrary
* @param fileName
* @param buffer the payload as byte array
*/
public static boolean writeFileIntoDocLibrary(ASLSession session, List<Role> roles, Step start, String fileName, byte[] buffer) {
long docfolderid = -1;
try {
docfolderid = getWfFolder(session);
long userId = getUserId(session);
//write the file into doclib
DLFileEntry fileEntry = DLFileEntryLocalServiceUtil.addFileEntry(
userId,
getGroupID(session),
docfolderid,
fileName,
fileName,
"workflow document",
"",
"",
buffer,
new ServiceContext());
log.debug("Wrote file into DocumentLibrary");
//get the file entry resource id
long resourceId = ResourceLocalServiceUtil.getResource(fileEntry.getCompanyId(),
DLFileEntry.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, String.valueOf(fileEntry.getFileEntryId())).getResourceId();
//set the permission on the file for each role
for (Role role : roles) {
String[] actionIds = getPermissionsFromWfStep(role, start);
PermissionLocalServiceUtil.setRolePermissions(role.getRoleId(), actionIds, resourceId);
log.debug("set the permissions for Role: " + role.getName());
}
} catch (Exception e) {
e.printStackTrace();
return false;
}
log.debug(" WROTE INTO DOCsLib and ADDING permissions for name: " + fileName);
return true;
}
public static DLFileEntry updateFileIntoDocLibrary(ASLSession session, String workflowid, byte[] buffer) {
long docfolderid = -1;
DLFileEntry fileEntry = null;
try {
fileEntry = getFileEntry(session, workflowid);
docfolderid = getWfFolder(session);
long userId = getUserId(session);
String fileName = fileEntry.getTitle();
log.debug("Update file into DocumentLibrary with Name: " + fileName);
DLFileEntryLocalServiceUtil.updateFileEntry(
userId,
getGroupID(session),
docfolderid,
fileEntry.getName(),
fileEntry.getName(),
fileName,
fileEntry.getDescription(),
"",
true,
"",
buffer,
new ServiceContext());
log.debug("Update file into DocumentLibrary");
} catch (Exception e) {
e.printStackTrace();
return null;
}
return fileEntry;
}
public static boolean deleteFileFromDocLibrary(ASLSession session, String workflowid) {
DLFileEntry fileEntry = null;
try {
fileEntry = getFileEntry(session, workflowid);
DLFileEntryLocalServiceUtil.deleteDLFileEntry(fileEntry);
log.debug("Deleted");
} catch (Exception e) {
e.printStackTrace();
return false;
}
return true;
}
/**
*
* @param session
* @param workflowid
* @return
* @throws Exception
* @throws SystemException
* @throws PortalException
*/
public static InputStream getFileEntryAsStream(ASLSession session, String workflowid) throws Exception {
String titleWithExtension = workflowid+".zip";
DLFileEntry fileEntry = DLFileEntryLocalServiceUtil.getFileEntryByTitle(getGroupID(session), getWfFolder(session),
titleWithExtension);
return DLFileEntryLocalServiceUtil.getFileAsStream(fileEntry.getCompanyId(),
getUserId(session), getGroupID(session), getWfFolder(session), fileEntry.getName());
}
public static DLFileEntry getFileEntry(ASLSession session, String workflowid) throws PortalException, SystemException, Exception {
String titleWithExtension = workflowid+".zip";
return DLFileEntryLocalServiceUtil.getFileEntryByTitle(getGroupID(session), getWfFolder(session),
titleWithExtension);
}
/**
*
* @param role is the liferay role, for convention is created as ROLENAME_WFID e.g. EDITOR_123
* @param step containts the permissions attached to each role (just the name, e.g. EDITOR)
* @return the permissions to apply
*/
public static String[] getPermissionsFromWfStep(Role role, Step step) {
ArrayList<PermissionType> toConvert = new ArrayList<PermissionType>();
for (WfRole steprole : step.getPermissions().keySet()) {
System.out.println("Steprole: "+ steprole.getRolename());
String name = role.getName().split("_")[0]; //e.g. EDITOR <- EDITOR_123
System.out.println("role Name: "+ name);
if (steprole.getRolename().equals(name)) {
toConvert = step.getPermissions().get(steprole);
}
}
String[] toReturn = new String[toConvert.size()];
int i = 0;
for (PermissionType p : toConvert) {
toReturn[i] = getLRActionIdFromWfPermissionType(p);
i++;
}
return toReturn;
}
/**
* check the existence of the WFFolder or create it if not exists
* @param session
* @return true is everything goes ok
* @throws PortalException
* @throws SystemException
*/
public static long getWfFolder(ASLSession session) throws Exception {
long parentFolderId = 0;
DLFolder folder = null;
if (! wfFolderExists(session)) {
folder = DLFolderLocalServiceUtil.addFolder(getUserId(session), getGroupID(session), parentFolderId, WORKFLOWS_FOLDER, "Folder for Workflow Documents", new ServiceContext());
log.debug("Folder for WorkflowDocs created: /" + WORKFLOWS_FOLDER);
} else
folder = DLFolderLocalServiceUtil.getFolder( getGroupID(session), parentFolderId, WORKFLOWS_FOLDER);
return folder.getFolderId();
}
/**
*
* @param session the ASL Session instance
* @return true if the workflow docs exists
*/
public static boolean wfFolderExists(ASLSession session) {
try {
long groupid = getGroupID(session);
long parentfolder = 0;
if (DLFolderLocalServiceUtil.getFolder(groupid, parentfolder, "Workflow Documents") != null)
return true;
else
return false;
}
catch (NoSuchFolderException ex) {
log.debug("Folder does not exists");
return false;
}
catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
*
* @param session
* @return
* @throws PortalException
* @throws SystemException
*/
public static long getGroupID(ASLSession session) throws PortalException, SystemException {
long organizationid = session.getGroupId();
Organization myOrg = OrganizationLocalServiceUtil.getOrganization(organizationid);
return myOrg.getGroup().getGroupId();
}
/**
*
* @return the company webid
* @throws PortalException
* @throws SystemException
*/
public static long getCompanyID() throws PortalException, SystemException {
return OrganizationsUtil.getCompany().getCompanyId();
}
/**
*
* @param session the ASL Session instance
* @return the list of the root folders
* @throws SystemException .
* @throws PortalException .
*/
public static List<DLFolder> getFolders(ASLSession session) throws SystemException, PortalException {
long companyid = getCompanyID();
List<DLFolder> folders = null;
folders = DLFolderLocalServiceUtil.getFolders(companyid);
for (DLFolder folder : folders) {
log.debug("Folder name: " + folder.getName() + " ID: " + folder.getFolderId() + " Parent: " + folder.getParentFolderId() + " Groupid: " + folder.getGroupId());
}
return folders;
}
/**
*
* @param session the ASL Session instance
* @return the userid in the liferay system
*/
public static long getUserId(ASLSession session) {
List<User> users = null;
long userId = 0;
try {
users = UserLocalServiceUtil.getUsers(0, UserLocalServiceUtil.getUsersCount());
} catch (SystemException e) {
e.printStackTrace();
}
for(User user: users){
if(user.getScreenName().equalsIgnoreCase(session.getUsername())){
userId = user.getUserId();
break;
}
}
return userId;
}
/**
* needed to convert Workflows permission into Lifearay permissions (ActionIDs)
* @param type
* @return
*/
private static String getLRActionIdFromWfPermissionType(PermissionType type) {
switch (type) {
case EDIT_PERMISSIONS:
return "PERMISSIONS";
case VIEW:
return "VIEW";
case UPDATE:
return "UPDATE";
case DELETE:
return "DELETE";
case ADD_DISCUSSION:
return "ADD_DISCUSSION";
case DELETE_DISCUSSION:
return "DELETE_DISCUSSION";
case UPDATE_DISCUSSION:
return "UPDATE_DISCUSSION";
default:
return "";
}
}
}

View File

@ -0,0 +1,181 @@
package org.gcube.portlets.user.reportgenerator.server.servlet;
import java.io.File;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.common.core.utils.logging.GCUBEClientLog;
/**
* <code> ImagesUploadServlet </code> class is the server code delgated to receinve the byte stream and store i
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
* @version October 2008 (0.2)
*/
public class ImagesUploadServlet extends HttpServlet {
static GCUBEClientLog _log = new GCUBEClientLog(ImagesUploadServlet.class);
final String returnOKMessage = "OK";
private static final long serialVersionUID = 1L;
private String currentUser;
private String currentScope;
/**
*
* @param message the msg
*/
public static void logger (String message) {
System.out.println("***" + message);
}
/**
* return the user template folder
* @param templateName
* @param currentDL .
* @param currentUser .
* @return .
*/
private String getTemplateFolder(String currentDL, String currentUser) {
_log.debug("getTemplateFolder Method called");
// platform indipendent slash
String sl = File.separator;
//e.g. /home/massi/workspace/templategen/tomcat/webapps/ROOT
String path = System.getenv("CATALINA_HOME");
path += sl + "webapps" + sl +"usersArea" + sl + currentDL +
sl + "templates" + sl + currentUser + sl ;
_log.debug("Returning Path= " + path);
return path;
}
/**
* file upload handler
* @param request .
* @param response .
* @throws ServletException .
* @throws IOException .
*/
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// logger("ImagesUploadServlet received:");
//
// currentUser = getUsername(request);
// currentScope = getVreName(request);
//
// String currTemplateName = request.getParameter("currTemplateName");
//
// logger("currentUser: "+currentUser);
// logger("currentVRE: "+currentScope);
// logger("currTemplateName: "+currTemplateName);
// logger("CALLING :getTemplateFolder ");
// logger("RETURNED :getTemplateFolder ");
// //platform indipendent slash
// String sl = File.separator;
// String startDirectory = getTemplateFolder(currentScope, currentUser); //e.g. /home/massi/workspace/templategen/tomcat/webapps/ROOT
// int lastSlash = startDirectory.lastIndexOf(sl);
// startDirectory = startDirectory.substring(0, lastSlash);
//
// startDirectory += sl + "CURRENT_OPEN" + sl + "images";
//
// logger("RETURNED : " + startDirectory);
// logger("WRITING... :");
//
// String fileName = "";
// PrintWriter out = response.getWriter();
//
// if (!ServletFileUpload.isMultipartContent(request))
// return;
//
// FileItemFactory factory = new DiskFileItemFactory();
// ServletFileUpload upload = new ServletFileUpload(factory);
//
// List items = null;
// try {
// items = upload.parseRequest(request);
// }
// catch (FileUploadException e) {
// e.printStackTrace();
// return;
// }
// File uploadedFile = null;
// for (Iterator i = items.iterator(); i.hasNext();) {
// FileItem item = (FileItem) i.next();
//
// if (item.isFormField())
// continue;
// fileName = item.getName();
// if (fileName != null && fileName.compareTo("")!=0) {
// fileName = FilenameUtils.getName(fileName);
//
// uploadedFile = new File(startDirectory + File.separator + fileName);
// try {
// if(!uploadedFile.exists()){
// File toCreate = new File(startDirectory);
// boolean success = toCreate.mkdirs();
// if (success)
// Logger.debug("New file \"" + uploadedFile + "\" has been created ");
// }
// item.write(uploadedFile);
// }
// catch (Exception e) { e.printStackTrace(); }
//
// }
// }
//
// out.print(returnOKMessage);
// out.close();
} //end service
/**
*
* @param httpServletRequest .
* @return .
*/
public String getUsername(HttpServletRequest httpServletRequest) {
HttpSession session = httpServletRequest.getSession();
String user = (String) session.getAttribute("username");
if(session.getAttribute("username")== null)
{
user = "massi";
logger("D4ScienceSession user NULL set to: " + user);
}
logger("D4ScienceSession user: " + user);
ASLSession d4session = SessionManager.getInstance().getASLSession(session.getId(), user);
d4session.setAttribute("username", user);
return user;
}
/**
* @param httpServletRequest .
* @return the shared session
*/
public String getVreName(HttpServletRequest httpServletRequest) {
HttpSession session = httpServletRequest.getSession();
ASLSession d4session = SessionManager.getInstance().getASLSession(session.getId(), getUsername(httpServletRequest));
String scope = d4session.getScopeName();
//need to remove the initial / of the scope
if (scope.charAt(0) == '/')
scope = scope.substring(1, scope.length());
logger("ImagesUploadServlet SCOPE: " + scope);
//String scope = "gcube/devsec";
return scope;
}
}

View File

@ -0,0 +1,130 @@
package org.gcube.portlets.user.reportgenerator.server.servlet;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
import org.apache.commons.io.IOUtils;
import org.gcube.common.core.utils.logging.GCUBELog;
/**
*
* @author massi
*
*/
public class ZipUtil {
public static GCUBELog logger = new GCUBELog(ZipUtil.class);
/**
* @param zipFileName zipFileName
* @param dir the dir to compress
* @throws IOException .
*/
public static void zipDir(String zipFileName, String dir) throws IOException {
File dirObj = new File(dir);
if(!dirObj.isDirectory())
{
System.err.println(dir + " is not a directory");
System.exit(1);
}
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFileName));
logger.debug("Creating : " + zipFileName);
addDir(dirObj, out);
// Complete the ZIP file
out.close();
}
private static void addDir(File dirObj, ZipOutputStream out) throws IOException
{
File[] files = dirObj.listFiles();
byte[] tmpBuf = new byte[1024];
for (int i=0; i<files.length; i++)
{
if(files[i].isDirectory())
{
addDir(files[i], out);
continue;
}
FileInputStream in = new FileInputStream(files[i].getAbsolutePath());
System.out.println(" Adding: " + files[i].getAbsolutePath());
String filename = files[i].getName();
if (filename.endsWith("jpeg") || filename.endsWith("jpg") || filename.endsWith("gif") || filename.endsWith("png"))
filename = "images/" + filename;
out.putNextEntry(new ZipEntry(filename));
// Transfer from the file to the ZIP file
int len;
while((len = in.read(tmpBuf)) > 0)
{
out.write(tmpBuf, 0, len);
}
// Complete the entry
out.closeEntry();
in.close();
}
}
/**
*
* @param archive .
* @param outputDir .
*/
public static void unzipArchive(File archive, File outputDir) {
try {
ZipFile zipfile = new ZipFile(archive);
for (Enumeration e = zipfile.entries(); e.hasMoreElements(); ) {
ZipEntry entry = (ZipEntry) e.nextElement();
unzipEntry(zipfile, entry, outputDir);
}
} catch (Exception e) {
logger.error("while extracting file " + archive);
e.printStackTrace();
}
}
private static void unzipEntry(ZipFile zipfile, ZipEntry entry, File outputDir) throws IOException {
if (entry.isDirectory()) {
createDir(new File(outputDir, entry.getName()));
return;
}
File outputFile = new File(outputDir, entry.getName());
if (!outputFile.getParentFile().exists()){
createDir(outputFile.getParentFile());
}
logger.debug("Extracting: " + entry);
BufferedInputStream inputStream = new BufferedInputStream(zipfile.getInputStream(entry));
BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(outputFile));
try {
IOUtils.copy(inputStream, outputStream);
} finally {
outputStream.close();
inputStream.close();
}
}
private static void createDir(File dir) {
logger.info("Creating dir "+dir.getName());
if(!dir.mkdirs()) throw new RuntimeException("Can not create dir "+dir);
}
}

View File

@ -0,0 +1,26 @@
package org.gcube.portlets.user.reportgenerator.server.servlet.loggers;
import org.gcube.application.framework.accesslogger.model.AccessLogEntry;
/**
* Represents an access log entry for creating a new Template
*/
public class CreateReportLogEntry extends AccessLogEntry{
private String templateName;
private String templateId;
public CreateReportLogEntry(String templateName, String templateId) {
super("Create_Report");
this.templateName = replaceReservedChars(templateName);
this.templateId = replaceReservedChars(templateId);
}
@Override
public String getLogMessage() {
String message = "Name = " + templateName + "|ID = " + templateId;
return message;
}
}

View File

@ -0,0 +1,28 @@
package org.gcube.portlets.user.reportgenerator.server.servlet.loggers;
import org.gcube.application.framework.accesslogger.model.AccessLogEntry;
/**
* Represents an access log entry for creating a new Template
*/
public class GenerateReportLogEntry extends AccessLogEntry{
private String name;
private String mimetype;
private String type;
public GenerateReportLogEntry(String name, String mimetype, String type) {
super("Generate_Report_Output");
this.name = replaceReservedChars(name);
this.mimetype = replaceReservedChars(mimetype);
}
@Override
public String getLogMessage() {
String message = "Name = " + name + "|MIMETYPE = " + mimetype+ "|TYPE = " + type;
return message;
}
}

View File

@ -0,0 +1,27 @@
package org.gcube.portlets.user.reportgenerator.server.servlet.loggers;
import org.gcube.application.framework.accesslogger.model.AccessLogEntry;
/**
* Represents an access log entry for creating a new Template
*/
public class OpenReportLogEntry extends AccessLogEntry{
private String templateName;
private String templateId;
public OpenReportLogEntry(String templateName, String templateId) {
super("Open_Report");
this.templateName = replaceReservedChars(templateName);
this.templateId = replaceReservedChars(templateId);
}
@Override
public String getLogMessage() {
String message = "Name = " + templateName + "|ID = " + templateId;
return message;
}
}

View File

@ -0,0 +1,28 @@
package org.gcube.portlets.user.reportgenerator.server.servlet.loggers;
import org.gcube.application.framework.accesslogger.model.AccessLogEntry;
/**
* Represents an access log entry for creating a new Template
*/
public class OpenWorkflowLogEntry extends AccessLogEntry{
private String templateName;
private String author;
private String templateId;
public OpenWorkflowLogEntry(String templateName, String templateId, String author) {
super("Open_Workflow_Report");
this.author = author;
this.templateName = replaceReservedChars(templateName);
this.templateId = replaceReservedChars(templateId);
}
@Override
public String getLogMessage() {
String message = "Name = " + templateName + "|ID = " + templateId+ "|AUTHOR = " + author;
return message;
}
}

View File

@ -0,0 +1,28 @@
package org.gcube.portlets.user.reportgenerator.server.servlet.loggers;
import org.gcube.application.framework.accesslogger.model.AccessLogEntry;
/**
* Represents an access log entry for creating a new Template
*/
public class SaveWorkflowLogEntry extends AccessLogEntry{
private String templateName;
private String author;
private String templateId;
public SaveWorkflowLogEntry(String templateName, String templateId, String author) {
super("Save_Workflow_Report");
this.author = author;
this.templateName = replaceReservedChars(templateName);
this.templateId = replaceReservedChars(templateId);
}
@Override
public String getLogMessage() {
String message = "Name = " + templateName + "|ID = " + templateId+ "|AUTHOR = " + author;
return message;
}
}

View File

@ -0,0 +1,57 @@
package org.gcube.portlets.user.reportgenerator.shared;
import java.io.Serializable;
@SuppressWarnings("serial")
public class SessionInfo implements Serializable {
private String username;
private String scope;
private Boolean isWorkflowDocument;
private Boolean isEditable;
public SessionInfo() { }
public SessionInfo(String username, String scope,
Boolean isWorkflowDocument, Boolean canEdit) {
super();
this.username = username;
this.scope = scope;
this.isWorkflowDocument = isWorkflowDocument;
this.isEditable = canEdit;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getScope() {
return scope;
}
public void setScope(String scope) {
this.scope = scope;
}
public Boolean isWorkflowDocument() {
return isWorkflowDocument;
}
public void setIsWorkflowDocument(Boolean isWorkflowDocument) {
this.isWorkflowDocument = isWorkflowDocument;
}
public Boolean isEditable() {
return isEditable;
}
public void setEditable(Boolean canEdit) {
this.isEditable = canEdit;
}
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='reports'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<inherits name='org.gcube.portlets.user.workspace.WorkspaceTree' />
<inherits name='org.gcube.portlets.d4sreporting.common.Reporting' />
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
<!-- inherits name='org.gube.portlets.user.reporting.fimesexporter.Fimesexporter' /-->
<inherits name='org.gcube.portlets.user.guidedtour.GuidedTour' />
<!-- To Comment out -->
<set-property name="user.agent" value="gecko1_8" />
<inherits name='org.gcube.portlets.user.workspace.lighttree.WorkspacePortletLightTree' />
<!-- Specify the app entry point class. -->
<entry-point
class='org.gcube.portlets.user.reportgenerator.client.ReportGenerator' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>

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