81: Allow the creation and use of expressions on multi column in TDM portlet
Task-Url: https://support.d4science.org/issues/81 Updated Rules Widget to create expression on multi column git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-rule-widget@114781 82a268e6-3cf1-43bd-a215-b396298e98cfmaster
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/tabular-data-rule-widget-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/tabular-data-rule-widget-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/giancarlo/gwt/gwt-2.6.1/gwt-user.jar">
|
||||
<attributes>
|
||||
<attribute name="javadoc_location" value="file:/home/giancarlo/gwt/gwt-2.6.1/doc/javadoc/"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/giancarlo/gwt/gwt-2.6.1/gwt-dev.jar">
|
||||
<attributes>
|
||||
<attribute name="javadoc_location" value="file:/home/giancarlo/gwt/gwt-2.6.1/doc/javadoc/"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="/home/giancarlo/gwt/gwt-2.6.1/validation-api-1.0.0.GA.jar" sourcepath="/home/giancarlo/gwt/gwt-2.6.1/validation-api-1.0.0.GA-sources.jar"/>
|
||||
<classpathentry kind="lib" path="/home/giancarlo/gwt/gwt-2.6.1/validation-api-1.0.0.GA-sources.jar"/>
|
||||
<classpathentry kind="output" path="target/tabular-data-rule-widget-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>tabular-data-rule-widget</name>
|
||||
<comment></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>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.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</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>
|
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="com.google.gdt.eclipse.suite.webapp">
|
||||
<stringAttribute key="com.google.gdt.eclipse.suiteMainTypeProcessor.PREVIOUSLY_SET_MAIN_TYPE_NAME" value="com.google.gwt.dev.DevMode"/>
|
||||
<booleanAttribute key="com.google.gdt.eclipse.suiteWarArgumentProcessor.IS_WAR_FROM_PROJECT_PROPERTIES" value="false"/>
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.URL" value="RuleWidget.html"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/tabular-data-rule-widget"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gdt.eclipse.maven.mavenClasspathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-startupUrl RuleWidget.html -war -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -codeServerPort 9997 -port 8888 org.gcube.portlets.user.td.rulewidget.RuleWidget"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="tabular-data-rule-widget"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx512m -Dgwt.nowarn.legacy.tools"/>
|
||||
</launchConfiguration>
|
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Resource>
|
||||
<ID></ID>
|
||||
<Type>Service</Type>
|
||||
<Profile>
|
||||
<Description>tabular-data-rule-widget allows to manage rules</Description>
|
||||
<Class>PortletsUser</Class>
|
||||
<Name>tabular-data-rule-widget</Name>
|
||||
<Version>1.0.0-SNAPSHOT</Version>
|
||||
<Packages>
|
||||
<Software>
|
||||
<Description>tabular-data-rule-widget allows to manage rules</Description>
|
||||
<Name>tabular-data-rule-widget</Name>
|
||||
<Version>1.0.0-SNAPSHOT</Version>
|
||||
<MavenCoordinates>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-rule-widget</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</MavenCoordinates>
|
||||
<Type>library</Type>
|
||||
<Files>
|
||||
<File>tabular-data-rule-widget-1.0.0-SNAPSHOT.jar</File>
|
||||
</Files>
|
||||
</Software>
|
||||
</Packages>
|
||||
</Profile>
|
||||
</Resource>
|
||||
|
||||
|
@ -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.
|
@ -0,0 +1 @@
|
||||
Giancarlo Panichi (giancarlo.panichi@isti.cnr.it), CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"
|
@ -0,0 +1,48 @@
|
||||
The gCube System - tabular-data-rule-widget
|
||||
------------------------------------------------------------
|
||||
|
||||
This work has been supported by the following European projects: iMarine (FP7-INFRASTRUCTURES-2011-2)
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
Giancarlo Panichi (giancarlo.panichi@isti.cnr.it), CNR Pisa,
|
||||
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"
|
||||
|
||||
|
||||
Version and Release Date
|
||||
------------------------
|
||||
|
||||
v. 1.0.0-SNAPSHOT (2015-04-30)
|
||||
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
tabular-data-rule-widget allows to manage rules
|
||||
|
||||
|
||||
Download information
|
||||
--------------------
|
||||
Source code is available from SVN:
|
||||
https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-rule-widget
|
||||
|
||||
Binaries can be downloaded from:
|
||||
http://software.d4science.research-infrastructures.eu/
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
tabular-data-rule-widget allows to manage rules
|
||||
|
||||
Documentation is available on-line from the Projects Documentation Wiki:
|
||||
https://gcube.wiki.gcube-system.org/gcube/index.php/Tabular_Data_Manager
|
||||
|
||||
|
||||
Licensing
|
||||
---------
|
||||
|
||||
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
|
||||
|
||||
|
@ -0,0 +1,6 @@
|
||||
<ReleaseNotes>
|
||||
<Changeset component="org.gcube.portlets.user.tabular-data-rule-widget.1-0-0"
|
||||
date="2015-05-01">
|
||||
<Change>First Release</Change>
|
||||
</Changeset>
|
||||
</ReleaseNotes>
|
@ -0,0 +1 @@
|
||||
https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-rule-widget
|
@ -0,0 +1,360 @@
|
||||
<?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">
|
||||
|
||||
<parent>
|
||||
<artifactId>maven-parent</artifactId>
|
||||
<groupId>org.gcube.tools</groupId>
|
||||
<version>1.0.0</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
<!-- POM file generated with GWT webAppCreator -->
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-rule-widget</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
|
||||
|
||||
<name>tabular-data-rule-widget</name>
|
||||
<description>tabular-data-rule-widget allows to manage rules</description>
|
||||
|
||||
<scm>
|
||||
<url>https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-rule-widget</url>
|
||||
</scm>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>Giancarlo Panichi</name>
|
||||
<email>g.panichi@isti.cnr.it</email>
|
||||
<organization>CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"</organization>
|
||||
<roles>
|
||||
<role>architect</role>
|
||||
<role>developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<properties>
|
||||
<distroDirectory>${project.basedir}/distro</distroDirectory>
|
||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||
<release.date>2015-04-30</release.date>
|
||||
<wikiurl>https://gcube.wiki.gcube-system.org/gcube/index.php/Tabular_Data_Manager</wikiurl>
|
||||
<templatesDirectory>templates</templatesDirectory>
|
||||
<distroDirectory>distro</distroDirectory>
|
||||
<configDirectory>config</configDirectory>
|
||||
|
||||
|
||||
<gwtVersion>2.6.1</gwtVersion>
|
||||
<gwtLogVersion>3.3.2</gwtLogVersion>
|
||||
<gxtVersion>3.1.1</gxtVersion>
|
||||
|
||||
<KEYS>${env.KEYS}</KEYS>
|
||||
|
||||
<!-- GWT needs at least java 1.5 -->
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
|
||||
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>localRun</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<!-- service-client-impl -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.data.analysis.tabulardata</groupId>
|
||||
<artifactId>service-client-impl</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.core</groupId>
|
||||
<artifactId>common-scope-maps</artifactId>
|
||||
<version>[1.0.2-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslsocial</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portal</groupId>
|
||||
<artifactId>custom-portal-handler</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>aslcore</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||
<artifactId>accesslogger</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-servlet</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-user</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sencha.gxt</groupId>
|
||||
<artifactId>gxt</artifactId>
|
||||
<version>${gxtVersion}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- tabular-data-widget-common-event -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-widget-common-event</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- tabular-data-gwt-service -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-gwt-service</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- TD Expression -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-expression-widget</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- tabular-data-monitor-widget -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-monitor-widget</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- tabular-data-wizard-widget -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-wizard-widget</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- tabular-data-share-widget -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-share-widget</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- LOGGING -->
|
||||
<dependency>
|
||||
<groupId>com.allen-sauer.gwt.log</groupId>
|
||||
<artifactId>gwt-log</artifactId>
|
||||
<version>${gwtLogVersion}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JUNIT -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
<build>
|
||||
<!-- Generate compiled stuff in the folder used for developing mode -->
|
||||
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.16</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
<!-- TODO check if needed -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.surefire</groupId>
|
||||
<artifactId>surefire-junit47</artifactId>
|
||||
<version>2.16</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
||||
<!-- GWT Maven Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>gwt-maven-plugin</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>resources</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<runTarget>RuleWidget.html</runTarget>
|
||||
<hostedWebapp>${webappDirectory}</hostedWebapp>
|
||||
<module>org.gcube.portlets.user.td.rulewidget.RuleWidget</module>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Maven -->
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-profile</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${configDirectory}</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${templatesDirectory}</directory>
|
||||
<includes>
|
||||
<include>profile.xml</include>
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-distro-resources</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${distroDirectory}</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${templatesDirectory}</directory>
|
||||
<excludes>
|
||||
<exclude>profile.xml</exclude>
|
||||
<exclude>descriptor.xml</exclude>
|
||||
</excludes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<configuration>
|
||||
<filesets>
|
||||
<fileset>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
<followSymlinks>false</followSymlinks>
|
||||
</fileset>
|
||||
<fileset>
|
||||
<directory>${configDirectory}</directory>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
<followSymlinks>false</followSymlinks>
|
||||
</fileset>
|
||||
</filesets>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>${templatesDirectory}/descriptor.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>servicearchive</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-portal-bom</artifactId>
|
||||
<version>LATEST</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
</project>
|
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to='RuleWidget'>
|
||||
<inherits name='com.google.gwt.user.User' />
|
||||
<inherits name="com.google.gwt.http.HTTP" />
|
||||
<!-- <inherits name="com.google.gwt.i18n.I18N" /> -->
|
||||
|
||||
<!-- We need the JUnit module in the main module, -->
|
||||
<!-- otherwise eclipse complains (Google plugin bug?) -->
|
||||
<inherits name='com.google.gwt.junit.JUnit' />
|
||||
|
||||
<!-- Other module inherits -->
|
||||
<inherits name='com.sencha.gxt.ui.GXT' />
|
||||
|
||||
<!-- GXT Theme -->
|
||||
<!-- <inherits name='com.sencha.gxt.theme.blue.Blue' /> -->
|
||||
<!-- <inherits name='com.sencha.gxt.theme.gray.Gray' /> -->
|
||||
<!-- Be sure to include Neptunes gxt-theme-neptune.jar in the classpath -->
|
||||
<!-- <inherits name='com.sencha.gxt.theme.neptune.Theme' /> -->
|
||||
|
||||
<inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" />
|
||||
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
|
||||
<inherits
|
||||
name='org.gcube.portlets.user.td.expressionwidget.ExpressionWidget' />
|
||||
<inherits name='org.gcube.portlets.user.td.monitorwidget.MonitorWidgetTD' />
|
||||
<inherits name='org.gcube.portlets.user.td.wizardwidget.Wizard' />
|
||||
<inherits name='org.gcube.portlets.user.td.sharewidget.ShareWidget' />
|
||||
|
||||
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<!-- <entry-point class='org.gcube.portlets.user.td.rulewidget.client.RuleWidgetEntry'
|
||||
/> -->
|
||||
|
||||
|
||||
<!-- <set-configuration-property name="locale.cookie" value="TDLangCookie"
|
||||
/> <set-configuration-property name="locale.queryparam" value="TDLang" />
|
||||
<set-configuration-property name="locale.usemeta" value="Y" /> <set-configuration-property
|
||||
name="locale.useragent" value="Y" /> <set-configuration-property name="locale.searchorder"
|
||||
value="cookie,queryparam,meta,useragent" /> <extend-property name="locale"
|
||||
values="en" /> <extend-property name="locale" values="it" /> <extend-property
|
||||
name="locale" values="es" /> <set-property name="locale" value="en, it, es"
|
||||
/> <set-property-fallback name="locale" value="en" /> -->
|
||||
|
||||
<!--
|
||||
<set-property name="log_ConsoleLogger" value="ENABLED" />
|
||||
<set-property name="log_DivLogger" value="ENABLED" />
|
||||
<set-property name="log_GWTLogger" value="ENABLED" />
|
||||
<set-property name="log_SystemLogger" value="ENABLED" /> -->
|
||||
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="ENABLED"
|
||||
/> -->
|
||||
|
||||
|
||||
<set-property name="log_ConsoleLogger" value="DISABLED" />
|
||||
<set-property name="log_DivLogger" value="DISABLED" />
|
||||
<set-property name="log_GWTLogger" value="DISABLED" />
|
||||
<set-property name="log_SystemLogger" value="DISABLED" />
|
||||
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="DISABLED"
|
||||
/> -->
|
||||
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
|
||||
|
||||
</module>
|
@ -0,0 +1,63 @@
|
||||
package org.gcube.portlets.user.td.rulewidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.widget.core.client.Window;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class RuleActiveDialog extends Window {
|
||||
private static final String WIDTH = "720px";
|
||||
private static final String HEIGHT = "428px";
|
||||
public RuleActiveDialog(TRId trId, EventBus eventBus) {
|
||||
initWindow();
|
||||
|
||||
RuleActivePanel ruleActivePanel = new RuleActivePanel(this,
|
||||
trId, eventBus);
|
||||
add(ruleActivePanel);
|
||||
}
|
||||
|
||||
protected void initWindow() {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(false);
|
||||
setHeadingText("Active Rules On TabularResource");
|
||||
setClosable(true);
|
||||
setModal(true);
|
||||
forceLayoutOnResize = true;
|
||||
getHeader().setIcon(ResourceBundle.INSTANCE.ruleTabularResource());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void initTools() {
|
||||
super.initTools();
|
||||
|
||||
closeBtn.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void close() {
|
||||
hide();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,481 @@
|
||||
package org.gcube.portlets.user.td.rulewidget.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionDataProperties;
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.AppliedRulesResponseData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.DetachColumnRulesSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
|
||||
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.cell.client.AbstractCell;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||
import com.sencha.gxt.core.client.XTemplates;
|
||||
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.data.shared.ListStore;
|
||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldSet;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||
import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||
import com.sencha.gxt.widget.core.client.grid.filters.GridFilters;
|
||||
import com.sencha.gxt.widget.core.client.grid.filters.StringFilter;
|
||||
import com.sencha.gxt.widget.core.client.menu.Item;
|
||||
import com.sencha.gxt.widget.core.client.menu.Menu;
|
||||
import com.sencha.gxt.widget.core.client.menu.MenuItem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class RuleActivePanel extends FramedPanel {
|
||||
private static final int RULE_ON_COLUMN_FIELDSET_HEIGHT = 348;
|
||||
private static final String RULES_GRID_HEIGHT = "102px";
|
||||
private static final String WIDTH = "630px";
|
||||
private static final String HEIGHT = "418px";
|
||||
|
||||
interface RuleApplyTemplates extends XTemplates {
|
||||
@XTemplate("<span title=\"{value}\">{value}</span>")
|
||||
SafeHtml format(String value);
|
||||
}
|
||||
|
||||
private EventBus eventBus;
|
||||
private RuleActiveDialog parent;
|
||||
private TRId trId;
|
||||
private ArrayList<ColumnData> columns;
|
||||
|
||||
private AppliedRulesResponseData appliedRuleResponseData;
|
||||
|
||||
private TextButton btnClose;
|
||||
private VerticalLayoutContainer mainLayoutContainer;
|
||||
|
||||
public RuleActivePanel(RuleActiveDialog parent, TRId trId,
|
||||
EventBus eventBus) {
|
||||
this.parent = parent;
|
||||
this.trId = trId;
|
||||
|
||||
Log.debug("RuleActivePanel");
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setHeaderVisible(false);
|
||||
setBodyBorder(false);
|
||||
this.eventBus = eventBus;
|
||||
retrieveColumns();
|
||||
|
||||
}
|
||||
|
||||
protected void retrieveColumns() {
|
||||
TDGWTServiceAsync.INSTANCE.getColumns(trId,
|
||||
new AsyncCallback<ArrayList<ColumnData>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsLockedException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Locked",
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsFinalException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Final",
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
Log.debug("Error retrieving columns: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3
|
||||
.alert("Error retrieving columns",
|
||||
"Error retrieving column on server!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ArrayList<ColumnData> result) {
|
||||
Log.debug("Retrieved Columns");
|
||||
if (result == null) {
|
||||
UtilsGXT3.alert("Error",
|
||||
"The requested columns is null");
|
||||
}
|
||||
columns = result;
|
||||
|
||||
getActiveRulesOnColumn();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void create() {
|
||||
|
||||
Log.debug("Create RuleActivePanel(): " + trId);
|
||||
|
||||
// SimpleContainer rulesOnColumnContainer=new SimpleContainer();
|
||||
FieldSet columnRulesFieldSet = new FieldSet();
|
||||
columnRulesFieldSet.setHeadingText("Rules On Column");
|
||||
columnRulesFieldSet.setCollapsible(false);
|
||||
|
||||
VerticalLayoutContainer columnRulesFieldSetLayout = new VerticalLayoutContainer();
|
||||
columnRulesFieldSetLayout.setScrollMode(ScrollMode.AUTO);
|
||||
columnRulesFieldSetLayout.setAdjustForScroll(true);
|
||||
|
||||
columnRulesFieldSet.add(columnRulesFieldSetLayout);
|
||||
|
||||
HashMap<String, ArrayList<RuleDescriptionData>> columnRuleMapping = appliedRuleResponseData
|
||||
.getColumnRuleMapping();
|
||||
if (columnRuleMapping != null && columnRuleMapping.size() > 0) {
|
||||
|
||||
for (ColumnData column : columns) {
|
||||
ArrayList<RuleDescriptionData> columnAppliedRules = columnRuleMapping
|
||||
.get(column.getColumnId());
|
||||
if (columnAppliedRules != null && columnAppliedRules.size() > 0) {
|
||||
FieldLabel columnLabel = createColumnRules(column,
|
||||
columnAppliedRules);
|
||||
columnRulesFieldSetLayout.add(columnLabel,
|
||||
new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
FieldLabel noRulesLabel = new FieldLabel(null, "No rules applied!");
|
||||
noRulesLabel.setLabelSeparator("");
|
||||
columnRulesFieldSetLayout.add(noRulesLabel, new VerticalLayoutData(
|
||||
1, -1, new Margins(0)));
|
||||
|
||||
}
|
||||
|
||||
btnClose = new TextButton("Close");
|
||||
btnClose.setIcon(ResourceBundle.INSTANCE.close());
|
||||
btnClose.setIconAlign(IconAlign.RIGHT);
|
||||
btnClose.setToolTip("Close");
|
||||
btnClose.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
Log.debug("Pressed Close");
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
||||
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||
flowButton.setPack(BoxLayoutPack.CENTER);
|
||||
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||
|
||||
mainLayoutContainer = new VerticalLayoutContainer();
|
||||
mainLayoutContainer.add(columnRulesFieldSet, new VerticalLayoutData(-1,
|
||||
RULE_ON_COLUMN_FIELDSET_HEIGHT, new Margins(0)));
|
||||
mainLayoutContainer.add(flowButton,
|
||||
new VerticalLayoutData(1, 36, new Margins(5, 2, 5, 2)));
|
||||
add(mainLayoutContainer);
|
||||
|
||||
}
|
||||
|
||||
private FieldLabel createColumnRules(ColumnData column,
|
||||
ArrayList<RuleDescriptionData> columnAppliedRules) {
|
||||
// Rules
|
||||
|
||||
RuleDescriptionDataProperties propsRules = GWT
|
||||
.create(RuleDescriptionDataProperties.class);
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
propsRules.name(), 120, "Name");
|
||||
|
||||
nameCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleApplyTemplates ruleApplyTemplates = GWT
|
||||
.create(RuleApplyTemplates.class);
|
||||
sb.append(ruleApplyTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
propsRules.description(), 120, "Description");
|
||||
descriptionCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleApplyTemplates ruleApplyTemplates = GWT
|
||||
.create(RuleApplyTemplates.class);
|
||||
sb.append(ruleApplyTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
propsRules.ownerLogin(), 70, "Owner");
|
||||
ownerCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleApplyTemplates ruleApplyTemplates = GWT
|
||||
.create(RuleApplyTemplates.class);
|
||||
sb.append(ruleApplyTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
ColumnConfig<RuleDescriptionData, String> readableExpressionCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
propsRules.readableExpression(), 160, "Expression");
|
||||
|
||||
|
||||
readableExpressionCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleApplyTemplates ruleApplyTemplates = GWT
|
||||
.create(RuleApplyTemplates.class);
|
||||
sb.append(ruleApplyTemplates.format(value));
|
||||
}
|
||||
});*/
|
||||
|
||||
List<ColumnConfig<RuleDescriptionData, ?>> l = new ArrayList<ColumnConfig<RuleDescriptionData, ?>>();
|
||||
l.add(nameCol);
|
||||
l.add(descriptionCol);
|
||||
l.add(ownerCol);
|
||||
//l.add(readableExpressionCol);
|
||||
|
||||
ColumnModel<RuleDescriptionData> cm = new ColumnModel<RuleDescriptionData>(
|
||||
l);
|
||||
|
||||
StringFilter<RuleDescriptionData> nameFilter = new StringFilter<RuleDescriptionData>(
|
||||
propsRules.name());
|
||||
StringFilter<RuleDescriptionData> descriptionFilter = new StringFilter<RuleDescriptionData>(
|
||||
propsRules.description());
|
||||
|
||||
// Applies Rules
|
||||
ListStore<RuleDescriptionData> appliedRulesStore = new ListStore<RuleDescriptionData>(
|
||||
propsRules.id());
|
||||
|
||||
if (columnAppliedRules != null && columnAppliedRules.size() > 0) {
|
||||
appliedRulesStore.addAll(columnAppliedRules);
|
||||
}
|
||||
|
||||
final Grid<RuleDescriptionData> gridAppliedRules = new Grid<RuleDescriptionData>(
|
||||
appliedRulesStore, cm);
|
||||
gridAppliedRules.setItemId(column.getColumnId());
|
||||
gridAppliedRules.setHeight(RULES_GRID_HEIGHT);
|
||||
gridAppliedRules.getView().setStripeRows(true);
|
||||
gridAppliedRules.getView().setColumnLines(true);
|
||||
gridAppliedRules.getView().setAutoFill(true);
|
||||
gridAppliedRules.setBorders(false);
|
||||
gridAppliedRules.setLoadMask(true);
|
||||
gridAppliedRules.setColumnReordering(true);
|
||||
gridAppliedRules.setColumnResize(true);
|
||||
gridAppliedRules.getView().setAutoExpandColumn(descriptionCol);
|
||||
|
||||
GridFilters<RuleDescriptionData> filtersAppliesRules = new GridFilters<RuleDescriptionData>();
|
||||
filtersAppliesRules.initPlugin(gridAppliedRules);
|
||||
filtersAppliesRules.setLocal(true);
|
||||
filtersAppliesRules.addFilter(nameFilter);
|
||||
filtersAppliesRules.addFilter(descriptionFilter);
|
||||
|
||||
createContextMenu(gridAppliedRules);
|
||||
|
||||
FieldLabel rulesAppliedLabel = new FieldLabel(gridAppliedRules,
|
||||
column.getLabel());
|
||||
|
||||
return rulesAppliedLabel;
|
||||
}
|
||||
|
||||
protected void getActiveRulesOnColumn() {
|
||||
|
||||
ExpressionServiceAsync.INSTANCE.getActiveRulesByTabularResourceId(
|
||||
trId, new AsyncCallback<AppliedRulesResponseData>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error retrieving active rules",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(AppliedRulesResponseData result) {
|
||||
Log.trace("AppliedRuleResponseData: " + result);
|
||||
appliedRuleResponseData = result;
|
||||
create();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void updateActiveRulesOnColumn() {
|
||||
|
||||
ExpressionServiceAsync.INSTANCE.getActiveRulesByTabularResourceId(
|
||||
trId, new AsyncCallback<AppliedRulesResponseData>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error retrieving applied rules",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(AppliedRulesResponseData result) {
|
||||
Log.trace("AppliedRuleResponseData: " + result);
|
||||
appliedRuleResponseData = result;
|
||||
recreate();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void close() {
|
||||
parent.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected void requestInfo(RuleDescriptionData rule) {
|
||||
final RuleInfoDialog infoRuleDialog = new RuleInfoDialog(rule);
|
||||
infoRuleDialog.show();
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void createContextMenu(final Grid<RuleDescriptionData> grid) {
|
||||
Menu contextMenu = new Menu();
|
||||
|
||||
MenuItem infoItem = new MenuItem();
|
||||
infoItem.setText("Info");
|
||||
infoItem.setToolTip("Info");
|
||||
infoItem.setIcon(ResourceBundle.INSTANCE.information());
|
||||
infoItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
RuleDescriptionData selected = grid.getSelectionModel()
|
||||
.getSelectedItem();
|
||||
Log.debug(selected.toString());
|
||||
requestInfo(selected);
|
||||
}
|
||||
});
|
||||
|
||||
MenuItem detachItem = new MenuItem();
|
||||
detachItem.setText("Detach");
|
||||
detachItem.setToolTip("Detach rule");
|
||||
detachItem.setIcon(ResourceBundle.INSTANCE.ruleColumnDetach());
|
||||
detachItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
RuleDescriptionData selected = grid.getSelectionModel()
|
||||
.getSelectedItem();
|
||||
Log.debug(selected.toString());
|
||||
requestDetach(selected, grid);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
contextMenu.add(infoItem);
|
||||
contextMenu.add(detachItem);
|
||||
|
||||
grid.setContextMenu(contextMenu);
|
||||
|
||||
}
|
||||
|
||||
protected void requestDetach(RuleDescriptionData selected,
|
||||
final Grid<RuleDescriptionData> grid) {
|
||||
|
||||
String columnLocalId=grid.getItemId();
|
||||
ColumnData columnData=new ColumnData();
|
||||
columnData.setColumnId(columnLocalId);
|
||||
ArrayList<RuleDescriptionData> detachRules=new ArrayList<RuleDescriptionData>();
|
||||
detachRules.add(selected);
|
||||
|
||||
DetachColumnRulesSession detachColumnRulesSession=new DetachColumnRulesSession(trId, columnData, detachRules);
|
||||
|
||||
ExpressionServiceAsync.INSTANCE.setDetachColumnRules(detachColumnRulesSession,
|
||||
new AsyncCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error in detach rules",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
updateActiveRulesOnColumn();
|
||||
Log.debug("The rule is detached!");
|
||||
UtilsGXT3.info("Detach Rule",
|
||||
"The rule is detached!");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void recreate(){
|
||||
remove(mainLayoutContainer);
|
||||
create();
|
||||
forceLayout();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,172 @@
|
||||
package org.gcube.portlets.user.td.rulewidget.client;
|
||||
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyAndDetachColumnRulesSession;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
||||
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.OperationResult;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.widget.core.client.Window;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class RuleApplyDialog extends Window implements
|
||||
MonitorDialogListener {
|
||||
private static final String WIDTH = "720px";
|
||||
private static final String HEIGHT = "530px";
|
||||
private EventBus eventBus;
|
||||
|
||||
public RuleApplyDialog(TRId trId, EventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
initWindow();
|
||||
|
||||
RuleApplyPanel ruleApplyPanel = new RuleApplyPanel(this,
|
||||
trId, eventBus);
|
||||
add(ruleApplyPanel);
|
||||
}
|
||||
|
||||
protected void initWindow() {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(false);
|
||||
setHeadingText("Apply Rules On Column");
|
||||
setClosable(true);
|
||||
setModal(true);
|
||||
forceLayoutOnResize = true;
|
||||
getHeader().setIcon(ResourceBundle.INSTANCE.ruleColumnApply());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void initTools() {
|
||||
super.initTools();
|
||||
|
||||
closeBtn.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void close() {
|
||||
hide();
|
||||
}
|
||||
|
||||
protected void applyRules(ApplyAndDetachColumnRulesSession applyColumnRulesSession) {
|
||||
ExpressionServiceAsync.INSTANCE.startApplyAndDetachColumnRules(applyColumnRulesSession, new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsLockedException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Locked",
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsFinalException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Is Final",
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
Log.debug("Apply Rules On Column Error: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3
|
||||
.alert("Apply Rules On Column",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String taskId) {
|
||||
if(taskId!=null){
|
||||
openMonitorDialog(taskId);
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void openMonitorDialog(String taskId) {
|
||||
MonitorDialog monitorDialog = new MonitorDialog(taskId, eventBus);
|
||||
monitorDialog.addProgressDialogListener(this);
|
||||
monitorDialog.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationComplete(OperationResult operationResult) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.RULESONCOLUMNAPPLY, operationResult.getTrId(), why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationFailed(Throwable caught, String reason, String details) {
|
||||
UtilsGXT3.alert(reason, details);
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationStopped(OperationResult operationResult, String reason, String details) {
|
||||
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
||||
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||
ChangeTableRequestType.RULESONCOLUMNAPPLY, operationResult.getTrId(), why);
|
||||
eventBus.fireEvent(changeTableRequestEvent);
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationAborted() {
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationPutInBackground() {
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,602 @@
|
||||
package org.gcube.portlets.user.td.rulewidget.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.properties.ColumnDataPropertiesCombo;
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionDataProperties;
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.AppliedRulesResponseData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyAndDetachColumnRulesSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
|
||||
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.cell.client.AbstractCell;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||
import com.sencha.gxt.core.client.XTemplates;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.data.shared.LabelProvider;
|
||||
import com.sencha.gxt.data.shared.ListStore;
|
||||
import com.sencha.gxt.dnd.core.client.GridDragSource;
|
||||
import com.sencha.gxt.dnd.core.client.GridDropTarget;
|
||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldSet;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||
import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||
import com.sencha.gxt.widget.core.client.grid.filters.GridFilters;
|
||||
import com.sencha.gxt.widget.core.client.grid.filters.StringFilter;
|
||||
import com.sencha.gxt.widget.core.client.info.Info;
|
||||
import com.sencha.gxt.widget.core.client.menu.Item;
|
||||
import com.sencha.gxt.widget.core.client.menu.Menu;
|
||||
import com.sencha.gxt.widget.core.client.menu.MenuItem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class RuleApplyPanel extends FramedPanel {
|
||||
private static final String RULE_TIP = "<p>Tip.: Use drag and drop in order to change selected rules.</p>";
|
||||
private static final String RULES_GRID_HEIGHT = "184px";
|
||||
private static final String SET_RULES = "SetRules";
|
||||
|
||||
interface RuleApplyTemplates extends XTemplates {
|
||||
@XTemplate("<span title=\"{value}\">{value}</span>")
|
||||
SafeHtml format(String value);
|
||||
}
|
||||
|
||||
private static final String WIDTH = "630px";
|
||||
private static final String HEIGHT = "520px";
|
||||
|
||||
private EventBus eventBus;
|
||||
private RuleApplyDialog parent;
|
||||
private TRId trId;
|
||||
private ArrayList<ColumnData> columns;
|
||||
private ColumnData column;
|
||||
private AppliedRulesResponseData appliedRuleResponseData;
|
||||
private ArrayList<RuleDescriptionData> applicableRules;
|
||||
private ArrayList<RuleDescriptionData> appliedRules;
|
||||
|
||||
private TextButton btnApply;
|
||||
private TextButton btnClose;
|
||||
|
||||
private ComboBox<ColumnData> comboColumns;
|
||||
private ListStore<RuleDescriptionData> applicableRulesStore;
|
||||
private Grid<RuleDescriptionData> gridApplicableRules;
|
||||
private ListStore<RuleDescriptionData> selectedRulesStore;
|
||||
private Grid<RuleDescriptionData> gridSelectedRules;
|
||||
|
||||
public RuleApplyPanel(RuleApplyDialog parent, TRId trId, EventBus eventBus) {
|
||||
this.parent = parent;
|
||||
this.trId = trId;
|
||||
applicableRules = new ArrayList<RuleDescriptionData>();
|
||||
|
||||
Log.debug("RuleApplyPanel");
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setHeaderVisible(false);
|
||||
setBodyBorder(false);
|
||||
this.eventBus = eventBus;
|
||||
retrieveColumns();
|
||||
|
||||
}
|
||||
|
||||
protected void retrieveColumns() {
|
||||
TDGWTServiceAsync.INSTANCE.getColumns(trId,
|
||||
new AsyncCallback<ArrayList<ColumnData>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsLockedException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Locked",
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
if (caught instanceof TDGWTIsFinalException) {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error Final",
|
||||
caught.getLocalizedMessage());
|
||||
} else {
|
||||
Log.debug("Error retrieving columns: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3
|
||||
.alert("Error retrieving columns",
|
||||
"Error retrieving column on server!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ArrayList<ColumnData> result) {
|
||||
Log.debug("Retrieved Columns");
|
||||
if (result == null) {
|
||||
UtilsGXT3.alert("Error",
|
||||
"The requested columns is null");
|
||||
}
|
||||
columns = result;
|
||||
|
||||
getAppliedBaseColumnRules();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void create() {
|
||||
|
||||
Log.debug("Create RuleApplyPanel(): " + trId);
|
||||
|
||||
FieldSet configurationFieldSet = new FieldSet();
|
||||
configurationFieldSet.setHeadingText("Configuration");
|
||||
configurationFieldSet.setCollapsible(false);
|
||||
|
||||
VerticalLayoutContainer configurationFieldSetLayout = new VerticalLayoutContainer();
|
||||
configurationFieldSet.add(configurationFieldSetLayout);
|
||||
|
||||
// Column Data
|
||||
ColumnDataPropertiesCombo propsColumnData = GWT
|
||||
.create(ColumnDataPropertiesCombo.class);
|
||||
ListStore<ColumnData> storeCombo = new ListStore<ColumnData>(
|
||||
propsColumnData.id());
|
||||
storeCombo.addAll(columns);
|
||||
|
||||
Log.trace("StoreCombo created");
|
||||
comboColumns = new ComboBox<ColumnData>(storeCombo,
|
||||
propsColumnData.label());
|
||||
|
||||
Log.trace("Combo ColumnData created");
|
||||
|
||||
addHandlersForComboColumn(propsColumnData.label());
|
||||
comboColumns.setEmptyText("Select a column...");
|
||||
comboColumns.setWidth(191);
|
||||
comboColumns.setTypeAhead(false);
|
||||
comboColumns.setEditable(false);
|
||||
comboColumns.setTriggerAction(TriggerAction.ALL);
|
||||
|
||||
FieldLabel comboColumnsLabel = new FieldLabel(comboColumns, "Column");
|
||||
configurationFieldSetLayout.add(comboColumnsLabel,
|
||||
new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
|
||||
// Rules
|
||||
|
||||
RuleDescriptionDataProperties propsRules = GWT
|
||||
.create(RuleDescriptionDataProperties.class);
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
propsRules.name(), 120, "Name");
|
||||
|
||||
nameCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleApplyTemplates ruleApplyTemplates = GWT
|
||||
.create(RuleApplyTemplates.class);
|
||||
sb.append(ruleApplyTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
propsRules.description(), 120, "Description");
|
||||
descriptionCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleApplyTemplates ruleApplyTemplates = GWT
|
||||
.create(RuleApplyTemplates.class);
|
||||
sb.append(ruleApplyTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
propsRules.ownerLogin(), 70, "Owner");
|
||||
ownerCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleApplyTemplates ruleApplyTemplates = GWT
|
||||
.create(RuleApplyTemplates.class);
|
||||
sb.append(ruleApplyTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
List<ColumnConfig<RuleDescriptionData, ?>> l = new ArrayList<ColumnConfig<RuleDescriptionData, ?>>();
|
||||
l.add(nameCol);
|
||||
l.add(descriptionCol);
|
||||
l.add(ownerCol);
|
||||
// l.add(readableExpressionCol);
|
||||
|
||||
ColumnModel<RuleDescriptionData> cm = new ColumnModel<RuleDescriptionData>(
|
||||
l);
|
||||
|
||||
StringFilter<RuleDescriptionData> nameFilter = new StringFilter<RuleDescriptionData>(
|
||||
propsRules.name());
|
||||
StringFilter<RuleDescriptionData> descriptionFilter = new StringFilter<RuleDescriptionData>(
|
||||
propsRules.description());
|
||||
|
||||
// Applicable Rules
|
||||
applicableRulesStore = new ListStore<RuleDescriptionData>(
|
||||
propsRules.id());
|
||||
|
||||
gridApplicableRules = new Grid<RuleDescriptionData>(
|
||||
applicableRulesStore, cm);
|
||||
gridApplicableRules.setHeight(RULES_GRID_HEIGHT);
|
||||
gridApplicableRules.getView().setStripeRows(true);
|
||||
gridApplicableRules.getView().setColumnLines(true);
|
||||
gridApplicableRules.getView().setAutoFill(true);
|
||||
gridApplicableRules.setBorders(false);
|
||||
gridApplicableRules.setLoadMask(true);
|
||||
gridApplicableRules.setColumnReordering(true);
|
||||
gridApplicableRules.setColumnResize(true);
|
||||
gridApplicableRules.getView().setAutoExpandColumn(descriptionCol);
|
||||
|
||||
GridFilters<RuleDescriptionData> filtersApplicableRules = new GridFilters<RuleDescriptionData>();
|
||||
filtersApplicableRules.initPlugin(gridApplicableRules);
|
||||
filtersApplicableRules.setLocal(true);
|
||||
filtersApplicableRules.addFilter(nameFilter);
|
||||
filtersApplicableRules.addFilter(descriptionFilter);
|
||||
|
||||
createContextMenu(gridApplicableRules);
|
||||
|
||||
// Selected Rules
|
||||
selectedRulesStore = new ListStore<RuleDescriptionData>(propsRules.id());
|
||||
|
||||
gridSelectedRules = new Grid<RuleDescriptionData>(selectedRulesStore,
|
||||
cm);
|
||||
gridSelectedRules.setHeight(RULES_GRID_HEIGHT);
|
||||
gridSelectedRules.getView().setStripeRows(true);
|
||||
gridSelectedRules.getView().setColumnLines(true);
|
||||
gridSelectedRules.getView().setAutoFill(true);
|
||||
gridSelectedRules.setBorders(false);
|
||||
gridSelectedRules.setLoadMask(true);
|
||||
gridSelectedRules.setColumnReordering(true);
|
||||
gridSelectedRules.setColumnResize(true);
|
||||
gridSelectedRules.getView().setAutoExpandColumn(descriptionCol);
|
||||
|
||||
GridFilters<RuleDescriptionData> filtersSelectedRules = new GridFilters<RuleDescriptionData>();
|
||||
filtersSelectedRules.initPlugin(gridSelectedRules);
|
||||
filtersSelectedRules.setLocal(true);
|
||||
filtersSelectedRules.addFilter(nameFilter);
|
||||
filtersSelectedRules.addFilter(descriptionFilter);
|
||||
|
||||
createContextMenu(gridSelectedRules);
|
||||
|
||||
//
|
||||
|
||||
new GridDragSource<RuleDescriptionData>(gridApplicableRules)
|
||||
.setGroup(SET_RULES);
|
||||
new GridDragSource<RuleDescriptionData>(gridSelectedRules)
|
||||
.setGroup(SET_RULES);
|
||||
|
||||
new GridDropTarget<RuleDescriptionData>(gridApplicableRules)
|
||||
.setGroup(SET_RULES);
|
||||
new GridDropTarget<RuleDescriptionData>(gridSelectedRules)
|
||||
.setGroup(SET_RULES);
|
||||
|
||||
//
|
||||
FieldLabel rulesApplicableLabel = new FieldLabel(gridApplicableRules,
|
||||
"Applicable Rules");
|
||||
|
||||
configurationFieldSetLayout.add(rulesApplicableLabel,
|
||||
new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
|
||||
FieldLabel rulesSelectedLabel = new FieldLabel(gridSelectedRules,
|
||||
"Selected Rules");
|
||||
|
||||
configurationFieldSetLayout.add(rulesSelectedLabel,
|
||||
new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
|
||||
//
|
||||
HTML rulesNote = new HTML(RULE_TIP);
|
||||
configurationFieldSetLayout.add(rulesNote,
|
||||
new VerticalLayoutData(-1, -1, new Margins(0)));
|
||||
// Button
|
||||
btnApply = new TextButton("Apply");
|
||||
btnApply.setIcon(ResourceBundle.INSTANCE.ruleColumnApply());
|
||||
btnApply.setIconAlign(IconAlign.RIGHT);
|
||||
btnApply.setToolTip("Apply Rule");
|
||||
btnApply.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
Log.debug("Pressed Apply");
|
||||
apply();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
btnClose = new TextButton("Close");
|
||||
btnClose.setIcon(ResourceBundle.INSTANCE.close());
|
||||
btnClose.setIconAlign(IconAlign.RIGHT);
|
||||
btnClose.setToolTip("Close");
|
||||
btnClose.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
Log.debug("Pressed Close");
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
||||
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||
flowButton.setPack(BoxLayoutPack.CENTER);
|
||||
|
||||
flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||
|
||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||
v.add(configurationFieldSet, new VerticalLayoutData(-1, -1,
|
||||
new Margins(0)));
|
||||
v.add(flowButton,
|
||||
new VerticalLayoutData(1, 36, new Margins(5, 2, 5, 2)));
|
||||
add(v);
|
||||
|
||||
}
|
||||
|
||||
private void addHandlersForComboColumn(
|
||||
final LabelProvider<ColumnData> labelProvider) {
|
||||
comboColumns.addSelectionHandler(new SelectionHandler<ColumnData>() {
|
||||
public void onSelection(SelectionEvent<ColumnData> event) {
|
||||
Info.display(
|
||||
"Column Selected",
|
||||
"You selected "
|
||||
+ (event.getSelectedItem() == null ? "nothing"
|
||||
: labelProvider.getLabel(event
|
||||
.getSelectedItem()) + "!"));
|
||||
Log.debug("ComboColumn selected: " + event.getSelectedItem());
|
||||
ColumnData columnData = event.getSelectedItem();
|
||||
updateRulesInGrids(columnData);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void updateRulesInGrids(ColumnData columnData) {
|
||||
column = columnData;
|
||||
applicableRulesStore.clear();
|
||||
selectedRulesStore.clear();
|
||||
HashMap<String, ArrayList<RuleDescriptionData>> columnRuleMapping = appliedRuleResponseData
|
||||
.getColumnRuleMapping();
|
||||
|
||||
if (columnRuleMapping != null) {
|
||||
ArrayList<RuleDescriptionData> applied = columnRuleMapping
|
||||
.get(columnData.getColumnId());
|
||||
|
||||
if (applied != null) {
|
||||
appliedRules = applied;
|
||||
selectedRulesStore.addAll(new ArrayList<RuleDescriptionData>(
|
||||
applied));
|
||||
|
||||
}
|
||||
}
|
||||
getApplicableBaseColumnRules();
|
||||
|
||||
}
|
||||
|
||||
protected void getApplicableBaseColumnRules() {
|
||||
ExpressionServiceAsync.INSTANCE.getApplicableBaseColumnRules(column,
|
||||
new AsyncCallback<ArrayList<RuleDescriptionData>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert(
|
||||
"Error retrieving applicable rules",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ArrayList<RuleDescriptionData> result) {
|
||||
Log.trace("loaded " + result.size() + " Rules");
|
||||
if (appliedRules != null && appliedRules.size() > 0) {
|
||||
ArrayList<RuleDescriptionData> removableRules = new ArrayList<RuleDescriptionData>();
|
||||
for (RuleDescriptionData ruleApplied : appliedRules) {
|
||||
for (RuleDescriptionData ruleApplicable : result) {
|
||||
if (ruleApplicable.equals(ruleApplied)) {
|
||||
removableRules.add(ruleApplicable);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
result.removeAll(removableRules);
|
||||
|
||||
}
|
||||
applicableRules = result;
|
||||
applicableRulesStore
|
||||
.addAll(new ArrayList<RuleDescriptionData>(
|
||||
applicableRules));
|
||||
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void getAppliedBaseColumnRules() {
|
||||
|
||||
ExpressionServiceAsync.INSTANCE.getActiveRulesByTabularResourceId(trId,
|
||||
new AsyncCallback<AppliedRulesResponseData>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error(caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error retrieving selected rules",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(AppliedRulesResponseData result) {
|
||||
Log.trace("AppliedRuleResponseData: " + result);
|
||||
appliedRuleResponseData = result;
|
||||
create();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected ArrayList<RuleDescriptionData> getSelectedItems() {
|
||||
List<RuleDescriptionData> selectedItems = selectedRulesStore.getAll();
|
||||
ArrayList<RuleDescriptionData> rulesSelected = new ArrayList<RuleDescriptionData>(
|
||||
selectedItems);
|
||||
return rulesSelected;
|
||||
}
|
||||
|
||||
protected void apply() {
|
||||
ColumnData column = comboColumns.getCurrentValue();
|
||||
if (column != null) {
|
||||
ArrayList<RuleDescriptionData> selectedRules = getSelectedItems();
|
||||
if(selectedRules==null){
|
||||
selectedRules=new ArrayList<RuleDescriptionData>();
|
||||
}
|
||||
ArrayList<RuleDescriptionData> rulesThatWillBeDetach = new ArrayList<RuleDescriptionData>();
|
||||
ArrayList<RuleDescriptionData> rulesThatWillBeApplied = new ArrayList<RuleDescriptionData>();
|
||||
HashMap<String, ArrayList<RuleDescriptionData>> columnRuleMapping = appliedRuleResponseData
|
||||
.getColumnRuleMapping();
|
||||
if (columnRuleMapping != null) {
|
||||
ArrayList<RuleDescriptionData> rulesApplied = columnRuleMapping
|
||||
.get(column.getColumnId());
|
||||
if (rulesApplied != null && rulesApplied.size() > 0) {
|
||||
for (RuleDescriptionData ruleApplied : rulesApplied) {
|
||||
boolean ruleStillApplied = false;
|
||||
for (RuleDescriptionData ruleSelected : selectedRules) {
|
||||
if (ruleSelected.getId() == ruleApplied.getId()) {
|
||||
ruleStillApplied = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ruleStillApplied) {
|
||||
rulesThatWillBeDetach.add(ruleApplied);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (RuleDescriptionData ruleSelected : selectedRules) {
|
||||
boolean ruleApplied = false;
|
||||
|
||||
if (columnRuleMapping != null) {
|
||||
ArrayList<RuleDescriptionData> rulesApplied = columnRuleMapping
|
||||
.get(column.getColumnId());
|
||||
if (rulesApplied != null) {
|
||||
for (RuleDescriptionData ruleAlreadyApplied : rulesApplied) {
|
||||
if (ruleSelected.getId() == ruleAlreadyApplied
|
||||
.getId()) {
|
||||
ruleApplied = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
if (ruleApplied == false) {
|
||||
rulesThatWillBeApplied.add(ruleSelected);
|
||||
}
|
||||
}
|
||||
|
||||
if(rulesThatWillBeApplied.size()<=0&&rulesThatWillBeDetach.size()<=0){
|
||||
Log.error("Select a rule!");
|
||||
UtilsGXT3.alert("Attention", "Select a rule!");
|
||||
return;
|
||||
}
|
||||
|
||||
ApplyAndDetachColumnRulesSession applyColumnRulesSession = new ApplyAndDetachColumnRulesSession(
|
||||
trId, column, rulesThatWillBeApplied, rulesThatWillBeDetach);
|
||||
parent.applyRules(applyColumnRulesSession);
|
||||
|
||||
} else {
|
||||
Log.error("No column selected");
|
||||
UtilsGXT3.alert("Attention", "Select a column");
|
||||
}
|
||||
}
|
||||
|
||||
protected void close() {
|
||||
parent.close();
|
||||
}
|
||||
|
||||
protected void requestInfo(RuleDescriptionData rule) {
|
||||
final RuleInfoDialog infoRuleDialog = new RuleInfoDialog(rule);
|
||||
infoRuleDialog.show();
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void createContextMenu(final Grid<RuleDescriptionData> grid) {
|
||||
Menu contextMenu = new Menu();
|
||||
|
||||
MenuItem infoItem = new MenuItem();
|
||||
infoItem.setText("Info");
|
||||
infoItem.setIcon(ResourceBundle.INSTANCE.information());
|
||||
infoItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
RuleDescriptionData selected = grid.getSelectionModel()
|
||||
.getSelectedItem();
|
||||
Log.debug(selected.toString());
|
||||
requestInfo(selected);
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(infoItem);
|
||||
|
||||
grid.setContextMenu(contextMenu);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
package org.gcube.portlets.user.td.rulewidget.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
|
||||
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.widget.core.client.Window;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class RuleDeleteDialog extends Window {
|
||||
private static final String WIDTH = "720px";
|
||||
private static final String HEIGHT = "530px";
|
||||
private EventBus eventBus;
|
||||
private RuleDeletePanel ruleDeletePanel;
|
||||
|
||||
public RuleDeleteDialog(EventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
initWindow();
|
||||
|
||||
ruleDeletePanel = new RuleDeletePanel(this, eventBus);
|
||||
add(ruleDeletePanel);
|
||||
}
|
||||
|
||||
protected void initWindow() {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(false);
|
||||
setHeadingText("Delete Rule");
|
||||
setClosable(true);
|
||||
setModal(true);
|
||||
forceLayoutOnResize = true;
|
||||
getHeader().setIcon(ResourceBundle.INSTANCE.ruleDelete());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void initTools() {
|
||||
super.initTools();
|
||||
|
||||
closeBtn.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void close() {
|
||||
hide();
|
||||
}
|
||||
|
||||
protected void removeRule(ArrayList<RuleDescriptionData> rules) {
|
||||
|
||||
ExpressionServiceAsync.INSTANCE.removeRulesById(rules,
|
||||
new AsyncCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void v) {
|
||||
Log.debug("Rule is deleted!");
|
||||
UtilsGXT3.info("Delete Rule", "The rule is deleted!");
|
||||
ruleDeletePanel.gridReload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Error deleting column rule: "
|
||||
+ caught.getLocalizedMessage());
|
||||
caught.printStackTrace();
|
||||
UtilsGXT3.alert("Error deleting column rule",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
ruleDeletePanel.gridReload();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,430 @@
|
||||
package org.gcube.portlets.user.td.rulewidget.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionDataProperties;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType;
|
||||
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.cell.client.AbstractCell;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.event.dom.client.KeyUpEvent;
|
||||
import com.google.gwt.event.dom.client.KeyUpHandler;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||
import com.sencha.gxt.core.client.IdentityValueProvider;
|
||||
import com.sencha.gxt.core.client.Style.SelectionMode;
|
||||
import com.sencha.gxt.core.client.XTemplates;
|
||||
import com.sencha.gxt.core.client.resources.ThemeStyles;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.data.client.loader.RpcProxy;
|
||||
import com.sencha.gxt.data.shared.ListStore;
|
||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||
import com.sencha.gxt.data.shared.Store;
|
||||
import com.sencha.gxt.data.shared.Store.StoreFilter;
|
||||
import com.sencha.gxt.data.shared.loader.ListLoadConfig;
|
||||
import com.sencha.gxt.data.shared.loader.ListLoadResult;
|
||||
import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
|
||||
import com.sencha.gxt.data.shared.loader.ListLoader;
|
||||
import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
|
||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||
import com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||
import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||
import com.sencha.gxt.widget.core.client.menu.Item;
|
||||
import com.sencha.gxt.widget.core.client.menu.Menu;
|
||||
import com.sencha.gxt.widget.core.client.menu.MenuItem;
|
||||
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
|
||||
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||
|
||||
public class RuleDeletePanel extends FramedPanel {
|
||||
private static final String WIDTH = "630px";
|
||||
private static final String HEIGHT = "520px";
|
||||
|
||||
interface RuleDeleteTemplates extends XTemplates {
|
||||
@XTemplate("<span title=\"{value}\">{value}</span>")
|
||||
SafeHtml format(String value);
|
||||
}
|
||||
|
||||
private EventBus eventBus;
|
||||
private RuleDeleteDialog parent;
|
||||
|
||||
private TextButton btnDelete;
|
||||
private TextButton btnClose;
|
||||
|
||||
private ListLoader<ListLoadConfig, ListLoadResult<RuleDescriptionData>> loader;
|
||||
private Grid<RuleDescriptionData> grid;
|
||||
private ExtendedListStore<RuleDescriptionData> store;
|
||||
|
||||
public RuleDeletePanel(RuleDeleteDialog parent, EventBus eventBus) {
|
||||
this.parent = parent;
|
||||
Log.debug("RuleDeletePanel");
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setHeaderVisible(false);
|
||||
setBodyBorder(false);
|
||||
this.eventBus = eventBus;
|
||||
|
||||
create();
|
||||
|
||||
}
|
||||
|
||||
protected void create() {
|
||||
ToolBar toolBarHead = new ToolBar();
|
||||
toolBarHead.add(new LabelToolItem("Search: "));
|
||||
final TextField searchField = new TextField();
|
||||
toolBarHead.add(searchField);
|
||||
|
||||
TextButton btnReload = new TextButton();
|
||||
// btnReload.setText("Reload");
|
||||
btnReload.setIcon(ResourceBundle.INSTANCE.refresh());
|
||||
btnReload.setToolTip("Reload");
|
||||
toolBarHead.add(btnReload);
|
||||
|
||||
IdentityValueProvider<RuleDescriptionData> identity = new IdentityValueProvider<RuleDescriptionData>();
|
||||
CheckBoxSelectionModel<RuleDescriptionData> sm = new CheckBoxSelectionModel<RuleDescriptionData>(
|
||||
identity);
|
||||
|
||||
RuleDescriptionDataProperties props = GWT
|
||||
.create(RuleDescriptionDataProperties.class);
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.name(), 120, "Name");
|
||||
|
||||
nameCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleDeleteTemplates ruleDeleteTemplates = GWT
|
||||
.create(RuleDeleteTemplates.class);
|
||||
sb.append(ruleDeleteTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> scopeCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.scopeLabel(), 40, "Scope");
|
||||
|
||||
nameCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleDeleteTemplates ruleDeleteTemplates = GWT
|
||||
.create(RuleDeleteTemplates.class);
|
||||
sb.append(ruleDeleteTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.description(), 120, "Description");
|
||||
descriptionCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleDeleteTemplates ruleDeleteTemplates = GWT
|
||||
.create(RuleDeleteTemplates.class);
|
||||
sb.append(ruleDeleteTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.ownerLogin(), 70, "Owner");
|
||||
ownerCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleDeleteTemplates ruleDeleteTemplates = GWT
|
||||
.create(RuleDeleteTemplates.class);
|
||||
sb.append(ruleDeleteTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
ColumnConfig<RuleDescriptionData, String> readableExpressionCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.readableExpression(), 160, "Expression");
|
||||
|
||||
readableExpressionCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleDeleteTemplates ruleDeleteTemplates = GWT
|
||||
.create(RuleDeleteTemplates.class);
|
||||
sb.append(ruleDeleteTemplates.format(value));
|
||||
}
|
||||
});*/
|
||||
|
||||
List<ColumnConfig<RuleDescriptionData, ?>> l = new ArrayList<ColumnConfig<RuleDescriptionData, ?>>();
|
||||
l.add(nameCol);
|
||||
l.add(scopeCol);
|
||||
l.add(descriptionCol);
|
||||
l.add(ownerCol);
|
||||
//l.add(readableExpressionCol);
|
||||
|
||||
ColumnModel<RuleDescriptionData> cm = new ColumnModel<RuleDescriptionData>(
|
||||
l);
|
||||
|
||||
store = new ExtendedListStore<RuleDescriptionData>(props.id());
|
||||
|
||||
searchField.addKeyUpHandler(new KeyUpHandler() {
|
||||
|
||||
public void onKeyUp(KeyUpEvent event) {
|
||||
Log.trace("searchTerm: " + searchField.getCurrentValue());
|
||||
store.applyFilters();
|
||||
}
|
||||
});
|
||||
|
||||
store.addFilter(new StoreFilter<RuleDescriptionData>() {
|
||||
|
||||
@Override
|
||||
public boolean select(Store<RuleDescriptionData> store,
|
||||
RuleDescriptionData parent, RuleDescriptionData item) {
|
||||
String searchTerm = searchField.getCurrentValue();
|
||||
if (searchTerm == null)
|
||||
return true;
|
||||
return RuleDeletePanel.this.select(item, searchTerm);
|
||||
}
|
||||
});
|
||||
|
||||
store.setEnableFilters(true);
|
||||
|
||||
RpcProxy<ListLoadConfig, ListLoadResult<RuleDescriptionData>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<RuleDescriptionData>>() {
|
||||
|
||||
public void load(
|
||||
ListLoadConfig loadConfig,
|
||||
final AsyncCallback<ListLoadResult<RuleDescriptionData>> callback) {
|
||||
loadData(loadConfig, callback);
|
||||
}
|
||||
};
|
||||
loader = new ListLoader<ListLoadConfig, ListLoadResult<RuleDescriptionData>>(
|
||||
proxy);
|
||||
|
||||
loader.setRemoteSort(false);
|
||||
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, RuleDescriptionData, ListLoadResult<RuleDescriptionData>>(
|
||||
store) {
|
||||
});
|
||||
|
||||
SelectHandler sh = new SelectHandler() {
|
||||
public void onSelect(SelectEvent event) {
|
||||
loader.load();
|
||||
}
|
||||
};
|
||||
|
||||
btnReload.addSelectHandler(sh);
|
||||
|
||||
grid = new Grid<RuleDescriptionData>(store, cm) {
|
||||
@Override
|
||||
protected void onAfterFirstAttach() {
|
||||
super.onAfterFirstAttach();
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
public void execute() {
|
||||
loader.load();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
sm.setSelectionMode(SelectionMode.MULTI);
|
||||
grid.setLoader(loader);
|
||||
grid.setSelectionModel(sm);
|
||||
grid.setHeight("384px");
|
||||
grid.getView().setStripeRows(true);
|
||||
grid.getView().setColumnLines(true);
|
||||
grid.getView().setAutoFill(true);
|
||||
grid.setBorders(false);
|
||||
grid.setLoadMask(true);
|
||||
grid.setColumnReordering(true);
|
||||
grid.setColumnResize(true);
|
||||
grid.getView().setAutoExpandColumn(descriptionCol);
|
||||
|
||||
createContextMenu();
|
||||
|
||||
ToolBar toolBar = new ToolBar();
|
||||
toolBar.add(grid);
|
||||
toolBar.addStyleName(ThemeStyles.get().style().borderTop());
|
||||
toolBar.getElement().getStyle().setProperty("borderBottom", "none");
|
||||
|
||||
btnDelete = new TextButton("Delete");
|
||||
btnDelete.setIcon(ResourceBundle.INSTANCE.ruleDelete());
|
||||
btnDelete.setIconAlign(IconAlign.RIGHT);
|
||||
btnDelete.setToolTip("Delete");
|
||||
btnDelete.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
Log.debug("Pressed Delete");
|
||||
delete();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
btnClose = new TextButton("Close");
|
||||
btnClose.setIcon(ResourceBundle.INSTANCE.close());
|
||||
btnClose.setIconAlign(IconAlign.RIGHT);
|
||||
btnClose.setToolTip("Close");
|
||||
btnClose.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
Log.debug("Pressed Close");
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
||||
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||
flowButton.setPack(BoxLayoutPack.CENTER);
|
||||
|
||||
BoxLayoutData boxLayoutData = new BoxLayoutData(new Margins(2, 4, 2, 4));
|
||||
flowButton.add(btnDelete, boxLayoutData);
|
||||
flowButton.add(btnClose, boxLayoutData);
|
||||
|
||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||
v.add(toolBarHead, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
v.add(grid, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
v.add(toolBar, new VerticalLayoutData(1, 25, new Margins(0)));
|
||||
v.add(flowButton,
|
||||
new VerticalLayoutData(1, 36, new Margins(5, 2, 5, 2)));
|
||||
add(v);
|
||||
|
||||
}
|
||||
|
||||
protected void loadData(ListLoadConfig loadConfig,
|
||||
final AsyncCallback<ListLoadResult<RuleDescriptionData>> callback) {
|
||||
|
||||
ExpressionServiceAsync.INSTANCE.getRules(RuleScopeType.COLUMN,
|
||||
new AsyncCallback<ArrayList<RuleDescriptionData>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Load rules failure:"
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error retrieving rules",
|
||||
"Error retrieving rules");
|
||||
}
|
||||
callback.onFailure(caught);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ArrayList<RuleDescriptionData> result) {
|
||||
Log.trace("loaded " + result.size() + " Rules");
|
||||
callback.onSuccess(new ListLoadResultBean<RuleDescriptionData>(
|
||||
result));
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected ArrayList<RuleDescriptionData> getSelectedItem() {
|
||||
ArrayList<RuleDescriptionData> rules = new ArrayList<RuleDescriptionData>();
|
||||
for (RuleDescriptionData rule : grid.getSelectionModel()
|
||||
.getSelectedItems()) {
|
||||
rules.add(rule);
|
||||
}
|
||||
return rules;
|
||||
}
|
||||
|
||||
protected void delete() {
|
||||
ArrayList<RuleDescriptionData> rules = getSelectedItem();
|
||||
if (rules == null || rules.size() == 0) {
|
||||
UtilsGXT3.info("Attention", "Select the rule to be deleted");
|
||||
} else {
|
||||
Log.debug("Rules Delete: " + rules);
|
||||
parent.removeRule(rules);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void close() {
|
||||
parent.close();
|
||||
}
|
||||
|
||||
protected class ExtendedListStore<M> extends ListStore<M> {
|
||||
|
||||
public ExtendedListStore(ModelKeyProvider<? super M> keyProvider) {
|
||||
super(keyProvider);
|
||||
}
|
||||
|
||||
public void applyFilters() {
|
||||
super.applyFilters();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void gridReload() {
|
||||
grid.getLoader().load();
|
||||
}
|
||||
|
||||
protected boolean select(RuleDescriptionData item, String searchTerm) {
|
||||
if (item.getName() != null
|
||||
&& item.getName().toLowerCase()
|
||||
.contains(searchTerm.toLowerCase()))
|
||||
return true;
|
||||
if (item.getDescription() != null
|
||||
&& item.getDescription().toLowerCase()
|
||||
.contains(searchTerm.toLowerCase()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void requestInfo(RuleDescriptionData rule) {
|
||||
|
||||
final RuleInfoDialog infoRuleDialog = new RuleInfoDialog(rule);
|
||||
infoRuleDialog.show();
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void createContextMenu() {
|
||||
Menu contextMenu = new Menu();
|
||||
|
||||
MenuItem infoItem = new MenuItem();
|
||||
infoItem.setText("Info");
|
||||
infoItem.setIcon(ResourceBundle.INSTANCE.information());
|
||||
infoItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
RuleDescriptionData selected = grid.getSelectionModel()
|
||||
.getSelectedItem();
|
||||
Log.debug(selected.toString());
|
||||
requestInfo(selected);
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(infoItem);
|
||||
|
||||
grid.setContextMenu(contextMenu);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package org.gcube.portlets.user.td.rulewidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
|
||||
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
|
||||
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.widget.core.client.Dialog;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||
import com.sencha.gxt.widget.core.client.container.MarginData;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldSet;
|
||||
import com.sencha.gxt.widget.core.client.form.TextArea;
|
||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class RuleInfoDialog extends Dialog {
|
||||
RuleDescriptionData ruleDescriptionData;
|
||||
|
||||
public RuleInfoDialog(RuleDescriptionData ruleDescriptionData){
|
||||
this.ruleDescriptionData=ruleDescriptionData;
|
||||
initWindow();
|
||||
create();
|
||||
}
|
||||
|
||||
protected void initWindow(){
|
||||
setModal(true);
|
||||
setHeadingText("Info Rule");
|
||||
getHeader().setIcon(
|
||||
ResourceBundle.INSTANCE.information());
|
||||
setPredefinedButtons(PredefinedButton.OK);
|
||||
setHideOnButtonClick(true);
|
||||
setButtonAlign(BoxLayoutPack.CENTER);
|
||||
setWidth(500);
|
||||
|
||||
}
|
||||
|
||||
protected void create(){
|
||||
FieldSet configurationFieldSet = new FieldSet();
|
||||
configurationFieldSet.setHeadingText("Configuration");
|
||||
configurationFieldSet.setCollapsible(false);
|
||||
configurationFieldSet.setBorders(true);
|
||||
|
||||
VerticalLayoutContainer configurationFieldSetLayout = new VerticalLayoutContainer();
|
||||
configurationFieldSet.add(configurationFieldSetLayout,
|
||||
new MarginData(0));
|
||||
|
||||
TextField ruleName = new TextField();
|
||||
ruleName.setValue(ruleDescriptionData.getName());
|
||||
ruleName.setReadOnly(true);
|
||||
FieldLabel ruleNameLabel = new FieldLabel(ruleName, "Name");
|
||||
configurationFieldSetLayout.add(ruleNameLabel, new VerticalLayoutData(
|
||||
1, -1, new Margins(0)));
|
||||
|
||||
TextField ruleScope = new TextField();
|
||||
ruleScope.setValue(ruleDescriptionData.getScopeLabel());
|
||||
ruleScope.setReadOnly(true);
|
||||
FieldLabel ruleScopeLabel = new FieldLabel(ruleScope, "Scope");
|
||||
configurationFieldSetLayout.add(ruleScopeLabel, new VerticalLayoutData(
|
||||
1, -1, new Margins(0)));
|
||||
|
||||
TextArea ruleDescription = new TextArea();
|
||||
ruleDescription.setValue(ruleDescriptionData.getDescription());
|
||||
ruleDescription.setReadOnly(true);
|
||||
FieldLabel ruleDescriptionLabel = new FieldLabel(ruleDescription,
|
||||
"Description");
|
||||
configurationFieldSetLayout.add(ruleDescriptionLabel,
|
||||
new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
|
||||
TextField ruleOwner = new TextField();
|
||||
ruleOwner.setValue(ruleDescriptionData.getOwnerLogin());
|
||||
ruleOwner.setReadOnly(true);
|
||||
FieldLabel ruleOwnerLabel = new FieldLabel(ruleOwner, "Owner");
|
||||
configurationFieldSetLayout.add(ruleOwnerLabel, new VerticalLayoutData(
|
||||
1, -1, new Margins(0)));
|
||||
|
||||
TextArea ruleExpression = new TextArea();
|
||||
ruleExpression.setValue(ruleDescriptionData.getReadableExpression());
|
||||
ruleExpression.setReadOnly(true);
|
||||
ruleExpression.setHeight("82px");
|
||||
FieldLabel ruleExpressionLabel = new FieldLabel(ruleExpression,
|
||||
"Expression");
|
||||
configurationFieldSetLayout.add(ruleExpressionLabel,
|
||||
new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
|
||||
add(configurationFieldSet, new MarginData(0));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package org.gcube.portlets.user.td.rulewidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.RuleEditDialog;
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.notification.RuleEditDialogNotification;
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.notification.RuleEditDialogNotification.RuleEditDialogNotificationListener;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
|
||||
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.widget.core.client.Window;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class RuleOpenDialog extends Window implements RuleEditDialogNotificationListener {
|
||||
private static final String WIDTH = "720px";
|
||||
private static final String HEIGHT = "530px";
|
||||
private RuleOpenPanel rulesOpenPanel;
|
||||
private EventBus eventBus;
|
||||
|
||||
public RuleOpenDialog(EventBus eventBus) {
|
||||
this.eventBus=eventBus;
|
||||
initWindow();
|
||||
rulesOpenPanel= new RuleOpenPanel(this,
|
||||
eventBus);
|
||||
add(rulesOpenPanel);
|
||||
}
|
||||
|
||||
protected void initWindow() {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(false);
|
||||
setHeadingText("Open Rule");
|
||||
setClosable(true);
|
||||
setModal(true);
|
||||
forceLayoutOnResize = true;
|
||||
getHeader().setIcon(ResourceBundle.INSTANCE.ruleOpen());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void initTools() {
|
||||
super.initTools();
|
||||
|
||||
closeBtn.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void close() {
|
||||
hide();
|
||||
}
|
||||
|
||||
public void ruleEdit(RuleDescriptionData ruleDescriptionData) {
|
||||
openRuleDialog(ruleDescriptionData);
|
||||
|
||||
}
|
||||
|
||||
protected void openRuleDialog(RuleDescriptionData ruleDescriptionData) {
|
||||
Log.debug("Request Open New Rule Dialog");
|
||||
RuleEditDialog reDialog = new RuleEditDialog(ruleDescriptionData,eventBus);
|
||||
reDialog.addRuleEditDialogNotificationListener(this);
|
||||
reDialog.show();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNotification(RuleEditDialogNotification ruleEditDialogNotification) {
|
||||
rulesOpenPanel.gridReload();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void aborted() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failed(Throwable throwable) {
|
||||
Log.debug("Error in edit rule: "+throwable.getLocalizedMessage());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,436 @@
|
||||
package org.gcube.portlets.user.td.rulewidget.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionDataProperties;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType;
|
||||
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.cell.client.AbstractCell;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.event.dom.client.KeyUpEvent;
|
||||
import com.google.gwt.event.dom.client.KeyUpHandler;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||
import com.sencha.gxt.core.client.IdentityValueProvider;
|
||||
import com.sencha.gxt.core.client.Style.SelectionMode;
|
||||
import com.sencha.gxt.core.client.XTemplates;
|
||||
import com.sencha.gxt.core.client.resources.ThemeStyles;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.data.client.loader.RpcProxy;
|
||||
import com.sencha.gxt.data.shared.ListStore;
|
||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||
import com.sencha.gxt.data.shared.Store;
|
||||
import com.sencha.gxt.data.shared.Store.StoreFilter;
|
||||
import com.sencha.gxt.data.shared.loader.ListLoadConfig;
|
||||
import com.sencha.gxt.data.shared.loader.ListLoadResult;
|
||||
import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
|
||||
import com.sencha.gxt.data.shared.loader.ListLoader;
|
||||
import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
|
||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||
import com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||
import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||
import com.sencha.gxt.widget.core.client.menu.Item;
|
||||
import com.sencha.gxt.widget.core.client.menu.Menu;
|
||||
import com.sencha.gxt.widget.core.client.menu.MenuItem;
|
||||
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
|
||||
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class RuleOpenPanel extends FramedPanel {
|
||||
private static final String WIDTH = "630px";
|
||||
private static final String HEIGHT = "520px";
|
||||
|
||||
interface RuleOpenTemplates extends XTemplates {
|
||||
@XTemplate("<span title=\"{value}\">{value}</span>")
|
||||
SafeHtml format(String value);
|
||||
}
|
||||
|
||||
private EventBus eventBus;
|
||||
private RuleOpenDialog parent;
|
||||
|
||||
private TextButton btnOpen;
|
||||
private TextButton btnClose;
|
||||
|
||||
private ListLoader<ListLoadConfig, ListLoadResult<RuleDescriptionData>> loader;
|
||||
private Grid<RuleDescriptionData> grid;
|
||||
private ExtendedListStore<RuleDescriptionData> store;
|
||||
|
||||
public RuleOpenPanel(RuleOpenDialog parent, EventBus eventBus) {
|
||||
this.parent = parent;
|
||||
Log.debug("RuleOpenPanel");
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setHeaderVisible(false);
|
||||
setBodyBorder(false);
|
||||
this.eventBus = eventBus;
|
||||
|
||||
create();
|
||||
|
||||
}
|
||||
|
||||
protected void create() {
|
||||
ToolBar toolBarHead = new ToolBar();
|
||||
toolBarHead.add(new LabelToolItem("Search: "));
|
||||
final TextField searchField = new TextField();
|
||||
toolBarHead.add(searchField);
|
||||
|
||||
TextButton btnReload = new TextButton();
|
||||
// btnReload.setText("Reload");
|
||||
btnReload.setIcon(ResourceBundle.INSTANCE.refresh());
|
||||
btnReload.setToolTip("Reload");
|
||||
toolBarHead.add(btnReload);
|
||||
|
||||
IdentityValueProvider<RuleDescriptionData> identity = new IdentityValueProvider<RuleDescriptionData>();
|
||||
CheckBoxSelectionModel<RuleDescriptionData> sm = new CheckBoxSelectionModel<RuleDescriptionData>(
|
||||
identity);
|
||||
|
||||
RuleDescriptionDataProperties props = GWT
|
||||
.create(RuleDescriptionDataProperties.class);
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.name(), 120, "Name");
|
||||
|
||||
nameCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleOpenTemplates ruleOpenTemplates = GWT
|
||||
.create(RuleOpenTemplates.class);
|
||||
sb.append(ruleOpenTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> scopeCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.scopeLabel(), 40, "Scope");
|
||||
|
||||
nameCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleOpenTemplates ruleOpenTemplates = GWT
|
||||
.create(RuleOpenTemplates.class);
|
||||
sb.append(ruleOpenTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.description(), 120, "Description");
|
||||
descriptionCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleOpenTemplates ruleOpenTemplates = GWT
|
||||
.create(RuleOpenTemplates.class);
|
||||
sb.append(ruleOpenTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.ownerLogin(), 70, "Owner");
|
||||
ownerCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleOpenTemplates ruleOpenTemplates = GWT
|
||||
.create(RuleOpenTemplates.class);
|
||||
sb.append(ruleOpenTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
ColumnConfig<RuleDescriptionData, String> readableExpressionCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.readableExpression(), 160, "Expression");
|
||||
|
||||
readableExpressionCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleOpenTemplates ruleOpenTemplates = GWT
|
||||
.create(RuleOpenTemplates.class);
|
||||
sb.append(ruleOpenTemplates.format(value));
|
||||
}
|
||||
});*/
|
||||
|
||||
List<ColumnConfig<RuleDescriptionData, ?>> l = new ArrayList<ColumnConfig<RuleDescriptionData, ?>>();
|
||||
l.add(nameCol);
|
||||
l.add(scopeCol);
|
||||
l.add(descriptionCol);
|
||||
l.add(ownerCol);
|
||||
//l.add(readableExpressionCol);
|
||||
|
||||
ColumnModel<RuleDescriptionData> cm = new ColumnModel<RuleDescriptionData>(
|
||||
l);
|
||||
|
||||
store = new ExtendedListStore<RuleDescriptionData>(props.id());
|
||||
|
||||
searchField.addKeyUpHandler(new KeyUpHandler() {
|
||||
|
||||
public void onKeyUp(KeyUpEvent event) {
|
||||
Log.trace("searchTerm: " + searchField.getCurrentValue());
|
||||
store.applyFilters();
|
||||
}
|
||||
});
|
||||
|
||||
store.addFilter(new StoreFilter<RuleDescriptionData>() {
|
||||
|
||||
@Override
|
||||
public boolean select(Store<RuleDescriptionData> store,
|
||||
RuleDescriptionData parent, RuleDescriptionData item) {
|
||||
String searchTerm = searchField.getCurrentValue();
|
||||
if (searchTerm == null)
|
||||
return true;
|
||||
return RuleOpenPanel.this.select(item, searchTerm);
|
||||
}
|
||||
});
|
||||
|
||||
store.setEnableFilters(true);
|
||||
|
||||
RpcProxy<ListLoadConfig, ListLoadResult<RuleDescriptionData>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<RuleDescriptionData>>() {
|
||||
|
||||
public void load(
|
||||
ListLoadConfig loadConfig,
|
||||
final AsyncCallback<ListLoadResult<RuleDescriptionData>> callback) {
|
||||
loadData(loadConfig, callback);
|
||||
}
|
||||
};
|
||||
loader = new ListLoader<ListLoadConfig, ListLoadResult<RuleDescriptionData>>(
|
||||
proxy);
|
||||
|
||||
loader.setRemoteSort(false);
|
||||
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, RuleDescriptionData, ListLoadResult<RuleDescriptionData>>(
|
||||
store) {
|
||||
});
|
||||
|
||||
SelectHandler sh = new SelectHandler() {
|
||||
public void onSelect(SelectEvent event) {
|
||||
loader.load();
|
||||
}
|
||||
};
|
||||
|
||||
btnReload.addSelectHandler(sh);
|
||||
|
||||
grid = new Grid<RuleDescriptionData>(store, cm) {
|
||||
@Override
|
||||
protected void onAfterFirstAttach() {
|
||||
super.onAfterFirstAttach();
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
public void execute() {
|
||||
loader.load();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
sm.setSelectionMode(SelectionMode.SINGLE);
|
||||
grid.setLoader(loader);
|
||||
grid.setSelectionModel(sm);
|
||||
grid.setHeight("384px");
|
||||
grid.getView().setStripeRows(true);
|
||||
grid.getView().setColumnLines(true);
|
||||
grid.getView().setAutoFill(true);
|
||||
grid.setBorders(false);
|
||||
grid.setLoadMask(true);
|
||||
grid.setColumnReordering(true);
|
||||
grid.setColumnResize(true);
|
||||
grid.getView().setAutoExpandColumn(descriptionCol);
|
||||
|
||||
createContextMenu();
|
||||
|
||||
ToolBar toolBar = new ToolBar();
|
||||
toolBar.add(grid);
|
||||
toolBar.addStyleName(ThemeStyles.get().style().borderTop());
|
||||
toolBar.getElement().getStyle().setProperty("borderBottom", "none");
|
||||
|
||||
btnOpen = new TextButton("Edit");
|
||||
btnOpen.setIcon(ResourceBundle.INSTANCE.ruleEdit());
|
||||
btnOpen.setIconAlign(IconAlign.RIGHT);
|
||||
btnOpen.setToolTip("Edit Rule");
|
||||
btnOpen.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
Log.debug("Pressed Open");
|
||||
edit();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
btnClose = new TextButton("Close");
|
||||
btnClose.setIcon(ResourceBundle.INSTANCE.close());
|
||||
btnClose.setIconAlign(IconAlign.RIGHT);
|
||||
btnClose.setToolTip("Close");
|
||||
btnClose.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
Log.debug("Pressed Close");
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
||||
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||
flowButton.setPack(BoxLayoutPack.CENTER);
|
||||
|
||||
BoxLayoutData boxLayoutData = new BoxLayoutData(new Margins(2, 4, 2, 4));
|
||||
flowButton.add(btnOpen, boxLayoutData);
|
||||
flowButton.add(btnClose, boxLayoutData);
|
||||
|
||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||
v.add(toolBarHead, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
v.add(grid, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
v.add(toolBar, new VerticalLayoutData(1, 25, new Margins(0)));
|
||||
v.add(flowButton,
|
||||
new VerticalLayoutData(1, 36, new Margins(5, 2, 5, 2)));
|
||||
add(v);
|
||||
|
||||
}
|
||||
|
||||
protected void loadData(ListLoadConfig loadConfig,
|
||||
final AsyncCallback<ListLoadResult<RuleDescriptionData>> callback) {
|
||||
|
||||
ExpressionServiceAsync.INSTANCE.getRules(RuleScopeType.COLUMN,
|
||||
new AsyncCallback<ArrayList<RuleDescriptionData>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Load rules failure:"
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error retrieving rules",
|
||||
"Error retrieving rules");
|
||||
}
|
||||
callback.onFailure(caught);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ArrayList<RuleDescriptionData> result) {
|
||||
if (result != null) {
|
||||
Log.trace("loaded " + result.size() + " Rules");
|
||||
} else {
|
||||
Log.trace("get Rules return: null");
|
||||
}
|
||||
callback.onSuccess(new ListLoadResultBean<RuleDescriptionData>(
|
||||
result));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected RuleDescriptionData getSelectedItem() {
|
||||
RuleDescriptionData template = grid.getSelectionModel()
|
||||
.getSelectedItem();
|
||||
return template;
|
||||
}
|
||||
|
||||
protected void edit() {
|
||||
|
||||
RuleDescriptionData rule = getSelectedItem();
|
||||
if (rule == null) {
|
||||
UtilsGXT3.info("Attention", "Select the rule");
|
||||
} else {
|
||||
parent.ruleEdit(rule);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void close() {
|
||||
parent.close();
|
||||
}
|
||||
|
||||
protected class ExtendedListStore<M> extends ListStore<M> {
|
||||
|
||||
public ExtendedListStore(ModelKeyProvider<? super M> keyProvider) {
|
||||
super(keyProvider);
|
||||
}
|
||||
|
||||
public void applyFilters() {
|
||||
super.applyFilters();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void gridReload() {
|
||||
grid.getLoader().load();
|
||||
}
|
||||
|
||||
protected boolean select(RuleDescriptionData item, String searchTerm) {
|
||||
if (item.getName() != null
|
||||
&& item.getName().toLowerCase()
|
||||
.contains(searchTerm.toLowerCase()))
|
||||
return true;
|
||||
if (item.getDescription() != null
|
||||
&& item.getDescription().toLowerCase()
|
||||
.contains(searchTerm.toLowerCase()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void requestInfo(RuleDescriptionData rule) {
|
||||
final RuleInfoDialog infoRuleDialog = new RuleInfoDialog(rule);
|
||||
infoRuleDialog.show();
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void createContextMenu() {
|
||||
Menu contextMenu = new Menu();
|
||||
|
||||
MenuItem infoItem = new MenuItem();
|
||||
infoItem.setText("Info");
|
||||
infoItem.setIcon(ResourceBundle.INSTANCE.information());
|
||||
infoItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
RuleDescriptionData selected = grid.getSelectionModel()
|
||||
.getSelectedItem();
|
||||
Log.debug(selected.toString());
|
||||
requestInfo(selected);
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(infoItem);
|
||||
|
||||
grid.setContextMenu(contextMenu);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package org.gcube.portlets.user.td.rulewidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
|
||||
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.sharewidget.client.RuleShare;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.widget.core.client.Window;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class RuleShareDialog extends Window {
|
||||
private static final String WIDTH = "720px";
|
||||
private static final String HEIGHT = "530px";
|
||||
|
||||
private EventBus eventBus;
|
||||
|
||||
public RuleShareDialog(EventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
initWindow();
|
||||
|
||||
RuleSharePanel templateDeletePanel = new RuleSharePanel(this,
|
||||
eventBus);
|
||||
add(templateDeletePanel);
|
||||
}
|
||||
|
||||
protected void initWindow() {
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setBodyBorder(false);
|
||||
setResizable(false);
|
||||
setHeadingText("Share Rule");
|
||||
setClosable(true);
|
||||
setModal(true);
|
||||
forceLayoutOnResize = true;
|
||||
getHeader().setIcon(ResourceBundle.INSTANCE.ruleShare());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void initTools() {
|
||||
super.initTools();
|
||||
|
||||
closeBtn.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void close() {
|
||||
hide();
|
||||
}
|
||||
|
||||
|
||||
public void ruleShare(RuleDescriptionData ruleDescriptionData) {
|
||||
Log.debug("Share Window");
|
||||
@SuppressWarnings("unused")
|
||||
RuleShare ruleShare = new RuleShare(ruleDescriptionData, eventBus);
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,422 @@
|
||||
package org.gcube.portlets.user.td.rulewidget.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionDataProperties;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleDescriptionData;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType;
|
||||
import org.gcube.portlets.user.td.rulewidget.client.RuleDeletePanel.RuleDeleteTemplates;
|
||||
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.cell.client.AbstractCell;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.event.dom.client.KeyUpEvent;
|
||||
import com.google.gwt.event.dom.client.KeyUpHandler;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||
import com.sencha.gxt.core.client.IdentityValueProvider;
|
||||
import com.sencha.gxt.core.client.Style.SelectionMode;
|
||||
import com.sencha.gxt.core.client.resources.ThemeStyles;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.data.client.loader.RpcProxy;
|
||||
import com.sencha.gxt.data.shared.ListStore;
|
||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||
import com.sencha.gxt.data.shared.Store;
|
||||
import com.sencha.gxt.data.shared.Store.StoreFilter;
|
||||
import com.sencha.gxt.data.shared.loader.ListLoadConfig;
|
||||
import com.sencha.gxt.data.shared.loader.ListLoadResult;
|
||||
import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
|
||||
import com.sencha.gxt.data.shared.loader.ListLoader;
|
||||
import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
|
||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||
import com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||
import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||
import com.sencha.gxt.widget.core.client.menu.Item;
|
||||
import com.sencha.gxt.widget.core.client.menu.Menu;
|
||||
import com.sencha.gxt.widget.core.client.menu.MenuItem;
|
||||
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
|
||||
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class RuleSharePanel extends FramedPanel {
|
||||
private static final String WIDTH = "630px";
|
||||
private static final String HEIGHT = "520px";
|
||||
private EventBus eventBus;
|
||||
private RuleShareDialog parent;
|
||||
|
||||
private TextButton btnClose;
|
||||
private TextButton btnShare;
|
||||
|
||||
private ListLoader<ListLoadConfig, ListLoadResult<RuleDescriptionData>> loader;
|
||||
private Grid<RuleDescriptionData> grid;
|
||||
private ExtendedListStore<RuleDescriptionData> store;
|
||||
|
||||
public RuleSharePanel(RuleShareDialog parent, EventBus eventBus) {
|
||||
this.parent = parent;
|
||||
Log.debug("RuleSharePanel");
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setHeaderVisible(false);
|
||||
setBodyBorder(false);
|
||||
this.eventBus = eventBus;
|
||||
|
||||
create();
|
||||
|
||||
}
|
||||
|
||||
protected void create() {
|
||||
ToolBar toolBarHead = new ToolBar();
|
||||
toolBarHead.add(new LabelToolItem("Search: "));
|
||||
final TextField searchField = new TextField();
|
||||
toolBarHead.add(searchField);
|
||||
|
||||
TextButton btnReload = new TextButton();
|
||||
// btnReload.setText("Reload");
|
||||
btnReload.setIcon(ResourceBundle.INSTANCE.refresh());
|
||||
btnReload.setToolTip("Reload");
|
||||
toolBarHead.add(btnReload);
|
||||
|
||||
IdentityValueProvider<RuleDescriptionData> identity = new IdentityValueProvider<RuleDescriptionData>();
|
||||
CheckBoxSelectionModel<RuleDescriptionData> sm = new CheckBoxSelectionModel<RuleDescriptionData>(
|
||||
identity);
|
||||
|
||||
RuleDescriptionDataProperties props = GWT
|
||||
.create(RuleDescriptionDataProperties.class);
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> nameCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.name(), 120, "Name");
|
||||
|
||||
nameCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleDeleteTemplates ruleDeleteTemplates = GWT
|
||||
.create(RuleDeleteTemplates.class);
|
||||
sb.append(ruleDeleteTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> scopeCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.scopeLabel(), 40, "Scope");
|
||||
|
||||
nameCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleDeleteTemplates ruleDeleteTemplates = GWT
|
||||
.create(RuleDeleteTemplates.class);
|
||||
sb.append(ruleDeleteTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> descriptionCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.description(), 120, "Description");
|
||||
descriptionCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleDeleteTemplates ruleDeleteTemplates = GWT
|
||||
.create(RuleDeleteTemplates.class);
|
||||
sb.append(ruleDeleteTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
ColumnConfig<RuleDescriptionData, String> ownerCol = new ColumnConfig<RuleDescriptionData, String>(
|
||||
props.ownerLogin(), 70, "Owner");
|
||||
ownerCol.setCell(new AbstractCell<String>() {
|
||||
|
||||
@Override
|
||||
public void render(Context context, String value, SafeHtmlBuilder sb) {
|
||||
RuleDeleteTemplates ruleDeleteTemplates = GWT
|
||||
.create(RuleDeleteTemplates.class);
|
||||
sb.append(ruleDeleteTemplates.format(value));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
List<ColumnConfig<RuleDescriptionData, ?>> l = new ArrayList<ColumnConfig<RuleDescriptionData, ?>>();
|
||||
l.add(nameCol);
|
||||
l.add(scopeCol);
|
||||
l.add(descriptionCol);
|
||||
l.add(ownerCol);
|
||||
|
||||
|
||||
ColumnModel<RuleDescriptionData> cm = new ColumnModel<RuleDescriptionData>(l);
|
||||
|
||||
store = new ExtendedListStore<RuleDescriptionData>(props.id());
|
||||
|
||||
searchField.addKeyUpHandler(new KeyUpHandler() {
|
||||
|
||||
public void onKeyUp(KeyUpEvent event) {
|
||||
Log.trace("searchTerm: " + searchField.getCurrentValue());
|
||||
store.applyFilters();
|
||||
}
|
||||
});
|
||||
|
||||
store.addFilter(new StoreFilter<RuleDescriptionData>() {
|
||||
|
||||
@Override
|
||||
public boolean select(Store<RuleDescriptionData> store,
|
||||
RuleDescriptionData parent, RuleDescriptionData item) {
|
||||
String searchTerm = searchField.getCurrentValue();
|
||||
if (searchTerm == null)
|
||||
return true;
|
||||
return RuleSharePanel.this.select(item, searchTerm);
|
||||
}
|
||||
});
|
||||
|
||||
store.setEnableFilters(true);
|
||||
|
||||
RpcProxy<ListLoadConfig, ListLoadResult<RuleDescriptionData>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<RuleDescriptionData>>() {
|
||||
|
||||
public void load(ListLoadConfig loadConfig,
|
||||
final AsyncCallback<ListLoadResult<RuleDescriptionData>> callback) {
|
||||
loadData(loadConfig, callback);
|
||||
}
|
||||
};
|
||||
loader = new ListLoader<ListLoadConfig, ListLoadResult<RuleDescriptionData>>(
|
||||
proxy);
|
||||
|
||||
loader.setRemoteSort(false);
|
||||
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, RuleDescriptionData, ListLoadResult<RuleDescriptionData>>(
|
||||
store) {
|
||||
});
|
||||
|
||||
SelectHandler sh = new SelectHandler() {
|
||||
public void onSelect(SelectEvent event) {
|
||||
loader.load();
|
||||
}
|
||||
};
|
||||
|
||||
btnReload.addSelectHandler(sh);
|
||||
|
||||
grid = new Grid<RuleDescriptionData>(store, cm) {
|
||||
@Override
|
||||
protected void onAfterFirstAttach() {
|
||||
super.onAfterFirstAttach();
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
public void execute() {
|
||||
loader.load();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
sm.setSelectionMode(SelectionMode.SINGLE);
|
||||
grid.setLoader(loader);
|
||||
grid.setSelectionModel(sm);
|
||||
grid.setHeight("384px");
|
||||
grid.getView().setStripeRows(true);
|
||||
grid.getView().setColumnLines(true);
|
||||
grid.getView().setAutoFill(true);
|
||||
grid.setBorders(false);
|
||||
grid.setLoadMask(true);
|
||||
grid.setColumnReordering(true);
|
||||
grid.setColumnResize(true);
|
||||
grid.getView().setAutoExpandColumn(descriptionCol);
|
||||
|
||||
createContextMenu();
|
||||
|
||||
|
||||
ToolBar toolBar = new ToolBar();
|
||||
toolBar.add(grid);
|
||||
toolBar.addStyleName(ThemeStyles.get().style().borderTop());
|
||||
toolBar.getElement().getStyle().setProperty("borderBottom", "none");
|
||||
|
||||
|
||||
|
||||
btnClose = new TextButton("Close");
|
||||
btnClose.setIcon(ResourceBundle.INSTANCE.close());
|
||||
btnClose.setIconAlign(IconAlign.RIGHT);
|
||||
btnClose.setToolTip("Close");
|
||||
btnClose.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
Log.debug("Pressed Close");
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
btnShare = new TextButton("Share");
|
||||
btnShare.setIcon(ResourceBundle.INSTANCE.ruleShare());
|
||||
btnShare.setIconAlign(IconAlign.RIGHT);
|
||||
btnShare.setToolTip("Share");
|
||||
btnShare.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
Log.debug("Pressed Share");
|
||||
share();
|
||||
}
|
||||
});
|
||||
|
||||
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
||||
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||
flowButton.setPack(BoxLayoutPack.CENTER);
|
||||
|
||||
BoxLayoutData boxLayoutData = new BoxLayoutData(new Margins(2, 4, 2, 4));
|
||||
flowButton.add(btnShare, boxLayoutData);
|
||||
flowButton.add(btnClose, boxLayoutData);
|
||||
|
||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||
v.add(toolBarHead, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
v.add(grid, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
v.add(toolBar, new VerticalLayoutData(1, 25, new Margins(0)));
|
||||
v.add(flowButton,
|
||||
new VerticalLayoutData(1, 36, new Margins(5, 2, 5, 2)));
|
||||
add(v);
|
||||
|
||||
}
|
||||
|
||||
protected void loadData(ListLoadConfig loadConfig,
|
||||
final AsyncCallback<ListLoadResult<RuleDescriptionData>> callback) {
|
||||
|
||||
ExpressionServiceAsync.INSTANCE.getRules(RuleScopeType.COLUMN,
|
||||
new AsyncCallback<ArrayList<RuleDescriptionData>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
eventBus.fireEvent(new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
Log.error("Load rules failure:"
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error retrieving rules",
|
||||
"Error retrieving rules");
|
||||
}
|
||||
callback.onFailure(caught);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ArrayList<RuleDescriptionData> result) {
|
||||
Log.trace("loaded " + result.size() + " Rules");
|
||||
callback.onSuccess(new ListLoadResultBean<RuleDescriptionData>(
|
||||
result));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected ArrayList<RuleDescriptionData> getSelectedItem() {
|
||||
ArrayList<RuleDescriptionData> rules = new ArrayList<RuleDescriptionData>();
|
||||
for (RuleDescriptionData rule : grid.getSelectionModel()
|
||||
.getSelectedItems()) {
|
||||
rules.add(rule);
|
||||
}
|
||||
return rules;
|
||||
}
|
||||
|
||||
|
||||
protected void share() {
|
||||
|
||||
ArrayList<RuleDescriptionData> rules = getSelectedItem();
|
||||
if (rules == null || rules.size() == 0) {
|
||||
UtilsGXT3.info("Attention", "Select the rule");
|
||||
} else {
|
||||
RuleDescriptionData rule = rules.get(0);
|
||||
Log.debug("templateShare: " + rule);
|
||||
parent.ruleShare(rule);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void close() {
|
||||
parent.close();
|
||||
}
|
||||
|
||||
protected class ExtendedListStore<M> extends ListStore<M> {
|
||||
|
||||
public ExtendedListStore(ModelKeyProvider<? super M> keyProvider) {
|
||||
super(keyProvider);
|
||||
}
|
||||
|
||||
public void applyFilters() {
|
||||
super.applyFilters();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void gridReload() {
|
||||
grid.getLoader().load();
|
||||
}
|
||||
|
||||
protected boolean select(RuleDescriptionData item, String searchTerm) {
|
||||
if (item.getName() != null
|
||||
&& item.getName().toLowerCase()
|
||||
.contains(searchTerm.toLowerCase()))
|
||||
return true;
|
||||
if (item.getDescription() != null
|
||||
&& item.getDescription().toLowerCase()
|
||||
.contains(searchTerm.toLowerCase()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void requestInfo(RuleDescriptionData rule) {
|
||||
final RuleInfoDialog infoRuleDialog = new RuleInfoDialog(rule);
|
||||
infoRuleDialog.show();
|
||||
|
||||
}
|
||||
|
||||
protected void createContextMenu() {
|
||||
Menu contextMenu = new Menu();
|
||||
|
||||
MenuItem infoItem = new MenuItem();
|
||||
infoItem.setText("Info");
|
||||
infoItem.setIcon(ResourceBundle.INSTANCE.information());
|
||||
infoItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
RuleDescriptionData selected = grid.getSelectionModel()
|
||||
.getSelectedItem();
|
||||
Log.debug(selected.toString());
|
||||
requestInfo(selected);
|
||||
}
|
||||
});
|
||||
|
||||
contextMenu.add(infoItem);
|
||||
|
||||
grid.setContextMenu(contextMenu);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
package org.gcube.portlets.user.td.rulewidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3;
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.user.UserInfo;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class RuleWidgetEntry implements EntryPoint {
|
||||
|
||||
public void onModuleLoad() {
|
||||
callHello();
|
||||
}
|
||||
|
||||
protected void test() {
|
||||
|
||||
// EventBus eventBus= new SimpleEventBus();
|
||||
// TRId trId=new TRId("86",TabResourceType.STANDARD, "1159");
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* RemoveColumnDialog dialog=new RemoveColumnDialog(trId);
|
||||
* dialog.show(); ChangeToAnnotationColumnDialog changeToAnnotation=new
|
||||
* ChangeToAnnotationColumnDialog(trId); changeToAnnotation.show();
|
||||
*/
|
||||
/*
|
||||
* ChangeColumnTypeDialog changeColumnType=new
|
||||
* ChangeColumnTypeDialog(trId,eventBus); changeColumnType.show();
|
||||
*/
|
||||
|
||||
/*
|
||||
* ChangeColumnTypeProgressDialog c=new
|
||||
* ChangeColumnTypeProgressDialog(eventBus);
|
||||
* c.addProgressDialogListener(changeColumnType); c.show();
|
||||
*/
|
||||
|
||||
/*
|
||||
* DialogCodelistSelection dcs=new DialogCodelistSelection();
|
||||
* dcs.show();
|
||||
*/
|
||||
|
||||
Log.info("Hello!");
|
||||
|
||||
}
|
||||
|
||||
protected void callHello() {
|
||||
TDGWTServiceAsync.INSTANCE.hello(new AsyncCallback<UserInfo>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.info("No valid user found: " + caught.getMessage());
|
||||
caught.printStackTrace();
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
UtilsGXT3.alert("Error", "Expired Session");
|
||||
|
||||
} else {
|
||||
UtilsGXT3.alert("Error", "No user found");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(UserInfo result) {
|
||||
Log.info("Hello: " + result.getUsername());
|
||||
test();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
@CHARSET "UTF-8";
|
||||
|
||||
|
@ -0,0 +1,19 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.rulewidget.client.resources;
|
||||
|
||||
import com.google.gwt.resources.client.CssResource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public interface DialogCSS extends CssResource {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,130 @@
|
||||
package org.gcube.portlets.user.td.rulewidget.client.resources;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public interface ResourceBundle extends ClientBundle {
|
||||
|
||||
public static final ResourceBundle INSTANCE = GWT
|
||||
.create(ResourceBundle.class);
|
||||
|
||||
@Source("Dialog.css")
|
||||
DialogCSS dialogCSS();
|
||||
|
||||
@Source("arrow-refresh_16.png")
|
||||
ImageResource refresh();
|
||||
|
||||
@Source("arrow-refresh_32.png")
|
||||
ImageResource refresh32();
|
||||
|
||||
@Source("magnifier.png")
|
||||
ImageResource magnifier();
|
||||
|
||||
@Source("magnifier_32.png")
|
||||
ImageResource magnifier32();
|
||||
|
||||
@Source("close-red.png")
|
||||
ImageResource close();
|
||||
|
||||
@Source("close-red_32.png")
|
||||
ImageResource close32();
|
||||
|
||||
@Source("disk.png")
|
||||
ImageResource save();
|
||||
|
||||
@Source("disk_32.png")
|
||||
ImageResource save32();
|
||||
|
||||
@Source("add.png")
|
||||
ImageResource add();
|
||||
|
||||
@Source("add_32.png")
|
||||
ImageResource add32();
|
||||
|
||||
@Source("delete.png")
|
||||
ImageResource delete();
|
||||
|
||||
@Source("delete_32.png")
|
||||
ImageResource delete32();
|
||||
|
||||
|
||||
@Source("rule-add_32.png")
|
||||
ImageResource ruleAdd32();
|
||||
|
||||
@Source("rule-add.png")
|
||||
ImageResource ruleAdd();
|
||||
|
||||
@Source("rule-edit_32.png")
|
||||
ImageResource ruleEdit32();
|
||||
|
||||
@Source("rule-edit.png")
|
||||
ImageResource ruleEdit();
|
||||
|
||||
@Source("rule-close_32.png")
|
||||
ImageResource ruleClose32();
|
||||
|
||||
@Source("rule-close.png")
|
||||
ImageResource ruleClose();
|
||||
|
||||
@Source("rule-open_32.png")
|
||||
ImageResource ruleOpen32();
|
||||
|
||||
@Source("rule-open.png")
|
||||
ImageResource ruleOpen();
|
||||
|
||||
@Source("rule-delete.png")
|
||||
ImageResource ruleDelete();
|
||||
|
||||
@Source("rule-delete_32.png")
|
||||
ImageResource ruleDelete32();
|
||||
|
||||
@Source("rule-apply.png")
|
||||
ImageResource ruleApply();
|
||||
|
||||
@Source("rule-apply_32.png")
|
||||
ImageResource ruleApply32();
|
||||
|
||||
@Source("rule-share.png")
|
||||
ImageResource ruleShare();
|
||||
|
||||
@Source("rule-share_32.png")
|
||||
ImageResource ruleShare32();
|
||||
|
||||
@Source("rule-column-add.png")
|
||||
ImageResource ruleColumnAdd();
|
||||
|
||||
@Source("rule-column-add_32.png")
|
||||
ImageResource ruleColumnAdd32();
|
||||
|
||||
@Source("rule-column-apply.png")
|
||||
ImageResource ruleColumnApply();
|
||||
|
||||
@Source("rule-column-apply_32.png")
|
||||
ImageResource ruleColumnApply32();
|
||||
|
||||
@Source("rule-column-detach.png")
|
||||
ImageResource ruleColumnDetach();
|
||||
|
||||
@Source("rule-column-detach_32.png")
|
||||
ImageResource ruleColumnDetach32();
|
||||
|
||||
@Source("rule-tabularresource.png")
|
||||
ImageResource ruleTabularResource();
|
||||
|
||||
@Source("rule-tabularresource_32.png")
|
||||
ImageResource ruleActive32();
|
||||
|
||||
@Source("information_32.png")
|
||||
ImageResource information32();
|
||||
|
||||
@Source("information.png")
|
||||
ImageResource information();
|
||||
|
||||
}
|
After Width: | Height: | Size: 781 B |
After Width: | Height: | Size: 660 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 572 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 693 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 693 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 614 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 482 B |
After Width: | Height: | Size: 886 B |
After Width: | Height: | Size: 701 B |
After Width: | Height: | Size: 695 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 771 B |
After Width: | Height: | Size: 548 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 819 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 819 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 882 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 863 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 877 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 862 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 861 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 969 B |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 958 B |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 719 B |
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to='RuleWidget'>
|
||||
<inherits name='com.google.gwt.user.User' />
|
||||
<inherits name="com.google.gwt.http.HTTP" />
|
||||
<!-- <inherits name="com.google.gwt.i18n.I18N" /> -->
|
||||
|
||||
<!-- We need the JUnit module in the main module, -->
|
||||
<!-- otherwise eclipse complains (Google plugin bug?) -->
|
||||
<inherits name='com.google.gwt.junit.JUnit' />
|
||||
|
||||
<!-- Other module inherits -->
|
||||
<inherits name='com.sencha.gxt.ui.GXT' />
|
||||
|
||||
<!-- GXT Theme -->
|
||||
<!-- <inherits name='com.sencha.gxt.theme.blue.Blue' /> -->
|
||||
<!-- <inherits name='com.sencha.gxt.theme.gray.Gray' /> -->
|
||||
<!-- Be sure to include Neptunes gxt-theme-neptune.jar in the classpath -->
|
||||
<!-- <inherits name='com.sencha.gxt.theme.neptune.Theme' /> -->
|
||||
|
||||
<inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" />
|
||||
|
||||
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
|
||||
<inherits
|
||||
name='org.gcube.portlets.user.td.expressionwidget.ExpressionWidget' />
|
||||
<inherits name='org.gcube.portlets.user.td.monitorwidget.MonitorWidgetTD' />
|
||||
<inherits name='org.gcube.portlets.user.td.wizardwidget.Wizard' />
|
||||
<inherits name='org.gcube.portlets.user.td.sharewidget.ShareWidget' />
|
||||
|
||||
|
||||
|
||||
<!-- <set-configuration-property name="locale.cookie" value="TDLangCookie"
|
||||
/> <set-configuration-property name="locale.queryparam" value="TDLang" />
|
||||
<set-configuration-property name="locale.usemeta" value="Y" /> <set-configuration-property
|
||||
name="locale.useragent" value="Y" /> <set-configuration-property name="locale.searchorder"
|
||||
value="cookie,queryparam,meta,useragent" /> <extend-property name="locale"
|
||||
values="en" /> <extend-property name="locale" values="it" /> <extend-property
|
||||
name="locale" values="es" /> <set-property name="locale" value="en, it, es"
|
||||
/> <set-property-fallback name="locale" value="en" /> -->
|
||||
|
||||
<!-- <set-property name="log_ConsoleLogger" value="ENABLED" /> <set-property
|
||||
name="log_DivLogger" value="ENABLED" /> <set-property name="log_GWTLogger"
|
||||
value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED"
|
||||
/> -->
|
||||
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="ENABLED"
|
||||
/> -->
|
||||
|
||||
|
||||
<set-property name="log_ConsoleLogger" value="DISABLED" />
|
||||
<set-property name="log_DivLogger" value="DISABLED" />
|
||||
<set-property name="log_GWTLogger" value="DISABLED" />
|
||||
<set-property name="log_SystemLogger" value="DISABLED" />
|
||||
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="DISABLED"
|
||||
/> -->
|
||||
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
|
||||
|
||||
</module>
|
@ -0,0 +1,3 @@
|
||||
@CHARSET "UTF-8";
|
||||
|
||||
|
After Width: | Height: | Size: 781 B |
After Width: | Height: | Size: 660 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 572 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 693 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 693 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 614 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 482 B |
After Width: | Height: | Size: 886 B |
After Width: | Height: | Size: 701 B |
After Width: | Height: | Size: 695 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 771 B |
After Width: | Height: | Size: 548 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 819 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 819 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 882 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 863 B |