Francesco Mangiacrapa 2016-04-21 08:37:31 +00:00
commit 7619df4ca8
148 changed files with 8839 additions and 0 deletions

37
.classpath Normal file
View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/workspace-explorer-app-0.0.1-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/workspace-explorer-app-0.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/workspace-explorer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
</classpath>

47
.project Normal file
View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>workspace-explorer-app-TRUNK</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.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>com.google.gwt.eclipse.core.gwtNature</nature>
</natures>
</projectDescription>

5
.settings/.jsdtscope Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path=""/>
<classpathentry kind="output" path=""/>
</classpath>

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
filesCopiedToWebInfLib=

View File

@ -0,0 +1,6 @@
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
lastWarOutDir=/home/francesco-mangiacrapa/wseclipseluna/workspace-explorer-app/target/workspace-explorer-app-0.0.1-SNAPSHOT
launchConfigExternalUrlPrefix=
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
entryPointModules=

View File

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

View File

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

View File

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

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="java" version="1.7"/>
<installed facet="jst.web" version="2.5"/>
</faceted-project>

View File

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

1
distro/LICENSE Normal file
View File

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

60
distro/README Normal file
View File

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

6
distro/changelog.xml Normal file
View File

@ -0,0 +1,6 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets-user.workspace-explorer-app.1-0-0"
date="2016-21-04">
<Change>first release</Change>
</Changeset>
</ReleaseNotes>

32
distro/descriptor.xml Normal file
View File

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

25
distro/profile.xml Normal file
View File

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

319
pom.xml Normal file
View File

@ -0,0 +1,319 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.0.0</version>
<relativePath />
</parent>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>workspace-explorer-app</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>war</packaging>
<description>
gCube Workspace Explorer Application is an application to navigate the Workspace in read-only mode
</description>
<scm>
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</connection>
<developerConnection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</developerConnection>
<url>http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</url>
</scm>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.7.0</gwtVersion>
<distroDirectory>distro</distroDirectory>
<!-- GWT needs at least java 1.6 -->
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<gwt-material.version>1.4.1</gwt-material.version>
<maven-war-plugin.version>2.1.1</maven-war-plugin.version>
<!-- <gwtp.version>1.4.1</gwtp.version> -->
<!-- <gin.version>2.1.2</gin.version> -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>LATEST</version>
<type>pom</type>
<scope>import</scope>
<exclusions>
<exclusion>
<artifactId>gwt-user</artifactId>
<groupId>com.google.gwt</groupId>
</exclusion>
<exclusion>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
<scope>compile</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>com.google.gwt</groupId> -->
<!-- <artifactId>gwt-servlet</artifactId> -->
<!-- <version>${gwtVersion}</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<dependency>
<groupId>com.github.gwtbootstrap</groupId>
<artifactId>gwt-bootstrap</artifactId>
<version>2.3.2.0</version>
<scope>compile</scope>
</dependency>
<!-- GwtMaterial -->
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material</artifactId>
<version>${gwt-material.version}</version>
</dependency>
<dependency>
<groupId>com.github.gwtmaterialdesign</groupId>
<artifactId>gwt-material-themes</artifactId>
<version>1.4</version>
</dependency>
<!-- <dependency> -->
<!-- <groupId>com.github.gwtmaterialdesign</groupId> -->
<!-- <artifactId>gwt-material-addins</artifactId> -->
<!-- <version>1.5.0-SNAPSHOT</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>com.github.gwtmaterialdesign</groupId> -->
<!-- <artifactId>gwt-material-addins</artifactId> -->
<!-- <version>${gwt-material.version}</version> -->
<!-- </dependency> -->
<!-- FWS -->
<dependency>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<!-- END FWS -->
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslcore</artifactId>
<version>[4.0.0-SNAPSHOT, 5.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<!-- HOME LIBRARY -->
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library-model</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library-jcr</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>asm-debug-all</artifactId>
<groupId>org.ow2.asm</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>home-library</artifactId>
<!-- <version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> -->
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>asm-all</artifactId>
<groupId>asm</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.gcube.portlets.widgets</groupId> -->
<!-- <artifactId>workspace-explorer</artifactId> -->
<!-- <version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> -->
<!-- </dependency> -->
<!-- LOGGER -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>compile</scope>
</dependency>
<!-- LOGGER -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<!-- <version>1.2.16</version> -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwtVersion}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<!-- <goal>test</goal> -->
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<runTarget>WorkspaceExplorerApp.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
</configuration>
</plugin>
<!-- Copy static web files before executing gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven-war-plugin.version}</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<!-- SA Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
<descriptors>
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>servicearchive</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-profile</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>target</outputDirectory>
<resources>
<resource>
<directory>${distroDirectory}</directory>
<filtering>true</filtering>
<includes>
<include>profile.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='workspaceexplorerapp'>
<inherits name='com.google.gwt.user.User' />
<inherits name='gwt.material.design.GwtMaterialWithJQuery' />
<!-- <inherits name="gwt.material.design.GwtMaterialDesignBasic" /> -->
<!-- <inherits name="gwt.material.design.themes.GwtMaterialThemeBlue" /> -->
<inherits name="com.github.gwtbootstrap.Bootstrap" />
<entry-point
class='org.gcube.portlets.user.workspaceexplorerapp.client.WorkspaceExplorerApp' />
<source path='client' />
<source path='shared' />
<!-- <set-configuration-property name="gin.ginjector.modules" value="pl.korbeldaniel.cms.client.gin.ClientModule"/> -->
<!-- <set-configuration-property name="gin.ginjector.extensions" value="pl.korbeldaniel.cms.client.gin.GinjectorExtension"/> -->
<!-- <set-configuration-property name="CssResource.enableGss" value="true"/> -->
<!--Override Bootstrap Css -->
<source path='resources' />
<replace-with
class="org.gcube.portlets.user.workspaceexplorerapp.resources.CustomBootstrapConfigurator">
<when-type-is class="com.github.gwtbootstrap.client.ui.config.Configurator" />
</replace-with>
<public path="resources">
<exclude name="** /*.java" />
<exclude name="** /*.class" />
</public>
</module>

View File

@ -0,0 +1,89 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.gcube.portlets.user.workspaceexplorerapp.client.grid.DisplayField;
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
/**
* The Class ItemComparator.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Mar 21, 2016
* @param <T> the generic type
*/
public class ItemComparatorUtility {
/**
* Instantiates a new item comparator utility.
*
* @param field the field
* @param ascending the ascending
* @param list the list
* @return
*/
public static ArrayList<Item> sortItems(DisplayField field, boolean ascending, List<Item> list) {
if(DisplayField.NAME.equals(field)){
Collections.sort(list, new NameCompare());
if(ascending)
Collections.reverse(list);
}else if(DisplayField.OWNER.equals(field)){
}
return new ArrayList<Item>(list);
}
/**
* The Class NameCompare.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Mar 21, 2016
*/
public static class NameCompare implements Comparator<Item> {
/**
* {@inheritDoc}
*/
@Override
public int compare(Item item1, Item item2) {
//if one of the item is folder and the other one not, we move up the folder
boolean isItem1Folder = item1.isFolder();
boolean isItem2Folder = item2.isFolder();
boolean isSpecialFolder1 = isSpecialFolder(item1);
boolean isSpecialFolder2 = isSpecialFolder(item2);
//XOR
if (isSpecialFolder1 ^ isSpecialFolder2) return isSpecialFolder1 ? -1 : 1;
//XOR
if (isItem1Folder ^ isItem2Folder) return isItem1Folder ? -1 : 1;
//otherwise we compare the names
return String.CASE_INSENSITIVE_ORDER.compare(item1.getName(), item2.getName());
}
/**
* Checks if is special folder.
*
* @param item the item
* @return true, if is special folder
*/
private boolean isSpecialFolder(Item item) {
// return item.getName().equals(WorkspaceExplorerConstants.VRE_FOLDERS_LABEL) && item.getParent()!=null && item.getParent().isRoot();
return item.getName().equals(WorkspaceExplorerAppConstants.VRE_FOLDERS_LABEL) && item.isSpecialFolder();
}
}
}

View File

@ -0,0 +1,51 @@
package org.gcube.portlets.user.workspaceexplorerapp.client;
import com.google.gwt.core.client.JavaScriptObject;
/**
* The Class NewBrowserWindow.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 23, 2016
*/
public final class NewBrowserWindow extends JavaScriptObject {
// All types that extend JavaScriptObject must have a protected,
// no-args constructor.
/**
* Instantiates a new new browser window.
*/
protected NewBrowserWindow() {
}
/**
* Open.
*
* @param url the url
* @param target the target
* @param options the options
* @return the new browser window
*/
public static native NewBrowserWindow open(String url, String target,
String options) /*-{
return $wnd.open(url, target, options);
}-*/;
/**
* Close.
*/
public native void close() /*-{
this.close();
}-*/;
/**
* Sets the url.
*
* @param url the new url
*/
public native void setUrl(String url) /*-{
if (this.location) {
this.location = url;
}
}-*/;
}

View File

@ -0,0 +1,58 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client;
import gwt.material.design.client.ui.MaterialColumn;
import gwt.material.design.client.ui.MaterialLink;
import gwt.material.design.client.ui.MaterialRow;
import java.util.List;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.OrderDataByEvent;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.PopupPanel;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Mar 21, 2016
*/
public class SortByContextMenu extends PopupPanel{
/**
* @param handlerManager
* @param links
*/
public SortByContextMenu(final HandlerManager handlerManager, List<MaterialLink> links) {
setAutoHideEnabled(true);
getElement().addClassName("popup-order");
MaterialRow mr = new MaterialRow();
MaterialColumn mc = new MaterialColumn();
mr.add(mc);
for (int i= 0; i<links.size(); i++) {
final MaterialLink materialLink = links.get(i);
MaterialRow mrs = new MaterialRow();
materialLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
SortByContextMenu.this.hide();
GWT.log("clicked : "+event.getSource().toString());
handlerManager.fireEvent(new OrderDataByEvent(materialLink.getText()));
}
});
// mr.setWidget(i, 0, materialLink);
mrs.add(materialLink);
mc.add(mrs);
}
add(mr);
getElement().getStyle().setZIndex(5000);
}
}

View File

@ -0,0 +1,144 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client;
import org.gcube.portlets.user.workspaceexplorerapp.client.resources.WorkspaceExplorerResources;
import org.gcube.portlets.user.workspaceexplorerapp.client.resources.WorkspaceLightTreeResources;
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemType;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.ui.SimplePanel;
/**
* The Class Util.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jun 18, 2015
*/
public class Util {
// public static final NumberFormat numberFormatterKB = NumberFormat.getFormat("#,##0 KB;(#,##0 KB)");
public static final ItemType[] FOLDERS = new ItemType[] {ItemType.FOLDER};
/**
* Checks if is folder.
*
* @param type
* the type
* @return true, if is folder
*/
public static boolean isFolder(ItemType type) {
for (ItemType folder : FOLDERS)
if (type == folder)
return true;
return false;
}
/**
* Ellipsis.
*
* @param value
* the value
* @param lenght
* the lenght
* @param left
* the left
* @return the string
*/
public static String ellipsis(String value, int lenght, boolean left) {
if (lenght < 3)
throw new IllegalArgumentException(
"The lenght have to be more than 3");
if (value.length() > lenght) {
if (left)
return "..." + value.substring(value.length() - lenght + 3);
else
return value.substring(0, lenght - 3) + "...";
}
return value;
}
/**
* Gets the image resource.
*
* @param item the item
* @return the image resource
*/
public static ImageResource getImageResource(Item item)
{
if(item==null || item.getType()==null)
return WorkspaceLightTreeResources.INSTANCE.unknownType();
switch (item.getType()) {
// case ROOT: return WorkspaceLightTreeResources.INSTANCE.root();
case FOLDER: {
if (item.isSharedFolder()) return WorkspaceExplorerResources.INSTANCE.shared_folder();
else return WorkspaceExplorerResources.INSTANCE.folder();
}
case EXTERNAL_IMAGE: return WorkspaceLightTreeResources.INSTANCE.external_image();
case EXTERNAL_FILE: return WorkspaceLightTreeResources.INSTANCE.external_file();
case EXTERNAL_PDF_FILE: return WorkspaceLightTreeResources.INSTANCE.external_pdf();
case EXTERNAL_URL: return WorkspaceLightTreeResources.INSTANCE.external_url();
case REPORT_TEMPLATE: return WorkspaceLightTreeResources.INSTANCE.report_template();
case REPORT: return WorkspaceLightTreeResources.INSTANCE.report();
case QUERY: return WorkspaceLightTreeResources.INSTANCE.query();
case DOCUMENT: return WorkspaceLightTreeResources.INSTANCE.document();
case METADATA: return WorkspaceLightTreeResources.INSTANCE.metadata();
case PDF_DOCUMENT: return WorkspaceLightTreeResources.INSTANCE.pdf_document();
case IMAGE_DOCUMENT: return WorkspaceLightTreeResources.INSTANCE.image_document();
case URL_DOCUMENT: return WorkspaceLightTreeResources.INSTANCE.url_document();
case GCUBE_ITEM: return WorkspaceLightTreeResources.INSTANCE.gucbeItem();
case UNKNOWN_TYPE: return WorkspaceLightTreeResources.INSTANCE.unknown();
default: {
System.err.println("Unknown item type "+item.getType());
return WorkspaceLightTreeResources.INSTANCE.unknownType();
}
}
}
/**
* Gets the formatted size.
*
* @param value the value
* @return the formatted size
*/
public static String getFormattedSize(long value){
if(value>0){
double kb = value/1024;
if(kb<1)
kb=1;
// return numberFormatterKB.format(kb);
return kb+"KB";
}else if(value==0){
return "EMPTY";
}else
return "";
}
/**
* Adjust size.
*
* @param el the el
* @param panel the panel
* @param offset the offset
*/
public static void adjustSize(Element el, SimplePanel panel, int offset){
if(el!=null){
int heigth = el.getClientHeight();
GWT.log("getClientHeight adjustSize el: "+heigth);
heigth = heigth-offset>100?heigth-offset:0;
if(heigth>0){
GWT.log("set new Explorer size: "+heigth);
panel.setHeight(heigth+"px");
}
}
}
}

View File

@ -0,0 +1,98 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootPanel;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 19, 2016
*/
public class WorkspaceExplorerApp implements EntryPoint {
private WorkspaceExplorerAppController appController;
/**
* This is the entry point method.
*/
public void onModuleLoad() {
boolean jQueryLoaded = isjQueryLoaded();
// GWT.log("Injected : "+Resources.RESOURCES.jquery().getText());
GWT.log("jQueryLoaded: "+jQueryLoaded);
/*if (!jQueryLoaded) {
ScriptInjector.fromString(Resources.RESOURCES.jquery().getText())
.setWindow(ScriptInjector.TOP_WINDOW)
.inject();
}*/
/*ScriptInjector.fromString(Resources.RESOURCES.jquery().getText())
.setWindow(ScriptInjector.TOP_WINDOW)
.inject();*/
appController = new WorkspaceExplorerAppController();
appController.go(RootPanel.get(WorkspaceExplorerAppConstants.APPLICATION_DIV));
Window.addResizeHandler(new ResizeHandler() {
@Override
public void onResize(ResizeEvent event) {
updateSize();
}
});
WorkspaceExplorerAppMainPanel mainPanel = new WorkspaceExplorerAppMainPanel(appController.getMainPanel(), appController.getEventBus(), appController.getDisplayFields());
RootPanel.get(WorkspaceExplorerAppConstants.APPLICATION_DIV).add(mainPanel);
// WorkspaceExplorerFoooterPanel footerPanel = new WorkspaceExplorerFoooterPanel();
// RootPanel.get("footer_we").add(footerPanel);
updateSize();
}
/**
* Checks if is j query loaded.
*
* @return true, if is j query loaded
*/
private native boolean isjQueryLoaded() /*-{
return (typeof $wnd['jQuery'] !== 'undefined');
}-*/;
/**
* Update window size
*/
public static void updateSize() {
int headerH = DOM.getElementById("we_nav_bar").getClientHeight();
GWT.log("headerH " + headerH);
int footerH = DOM.getElementById("footer_we").getClientHeight();
GWT.log("footerH " + footerH);
int breadcrumbsH = DOM.getElementById("breadcrumbs_we").getClientHeight();
GWT.log("breadcrumbs_we " + breadcrumbsH);
int windowHeight = Window.getClientHeight();
GWT.log("rootHeight " + windowHeight);
int diff = windowHeight - (headerH+footerH+breadcrumbsH)-10;
int containerH = diff>0?diff:50;
DOM.getElementById(WorkspaceExplorerAppConstants.APPLICATION_DIV).getElementsByTagName("main").getItem(0).getStyle().setHeight(containerH, Unit.PX);
// DOM.getElementById(WorkspaceExplorerAppConstants.APPLICATION_DIV).getStyle().setHeight(containerH, Unit.PX);
GWT.log("containerH " + containerH);
Element table = DOM.getElementById("data_grid_explorer");
if(table!=null){
int headerTableH = 0;
table.getStyle().setHeight(containerH-headerTableH, Unit.PX);
}
}
}

View File

@ -0,0 +1,41 @@
package org.gcube.portlets.user.workspaceexplorerapp.client;
import org.gcube.portlets.user.workspaceexplorerapp.client.rpc.WorkspaceExplorerAppService;
import org.gcube.portlets.user.workspaceexplorerapp.client.rpc.WorkspaceExplorerAppServiceAsync;
import com.google.gwt.core.client.GWT;
/**
* The Class WorkspaceExplorerAppConstants.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 23, 2016
*/
public class WorkspaceExplorerAppConstants {
public static final String SPECIAL_FOLDERS_NAME = "MySpecialFolders";
public static final String VRE_FOLDERS_LABEL = "My VRE Folders";
public static final String WORKSPACE_EXPLORER_CAPTION = "Workspace Explorer";
public static final String WORKSPACE_EXPLORER_SAVE_AS_CAPTION = "Workspace Explorer Save As...";
public static final String HOME_LABEL = "Home";
public static final String WORKSPACE_MY_SPECIAL_FOLDERS_PATH = "/Workspace/MySpecialFolders";
// DIALOGS
public static final String SAVE = "Save";
public static final String AUTO = "auto";
public static final String SELECT = "Select";
public static final WorkspaceExplorerAppServiceAsync workspaceNavigatorService = GWT.create(WorkspaceExplorerAppService.class);
public static final String APPLICATION_DIV = "workspaceEplorerApplicationDiv";
public static final String VALIDATEITEM = "validateitem";
public static final String IDS = "ids";
public static final String IDS_SEPARATOR = ";";
public static final String DOWNLOAD_WORKSPACE_SERVICE = GWT.getModuleBaseURL() + "DownloadServlet";
public static final String REDIRECTONERROR = "redirectonerror";
}

View File

@ -0,0 +1,140 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client;
import org.gcube.portlets.user.workspaceexplorerapp.client.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
import org.gcube.portlets.user.workspaceexplorerapp.client.grid.DisplayField;
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ContextMenuEvent;
import com.google.gwt.event.dom.client.ContextMenuHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootPanel;
/**
* The Class WorkspaceExplorerAppController.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Oct 8, 2014
*/
public class WorkspaceExplorerAppController {
// private VerticalPanel mainPanel = new VerticalPanel();
private WorkspaceExplorerAppPanel mainPanel;
private WorkspaceResourcesExplorerPanel wsResourcesExplorerPanel;
private final HandlerManager eventBus = new HandlerManager(null);
/**
* Instantiates a new workspace explorer app controller.
*/
public WorkspaceExplorerAppController() {
}
/**
* Go.
*
* @param rootPanel the root panel
*/
public void go(final RootPanel rootPanel) {
RootPanel.getBodyElement().getStyle().setPadding(0, Unit.PX);
// mainPanel.setWidth("100%");
try {
String folderId = Window.Location.getParameter("folderId");
//TODO CHECK FOLDER ID
if(folderId==null)
Window.alert("Folder Id not found, it is not possible to retrieve a folder without a valid id");
RootPanel.get().addDomHandler(new ContextMenuHandler() {
@Override
public void onContextMenu(ContextMenuEvent event) {
event.preventDefault();
event.stopPropagation();
}
}, ContextMenuEvent.getType());
wsResourcesExplorerPanel = new WorkspaceResourcesExplorerPanel(eventBus, folderId, false);
WorskpaceExplorerSelectNotificationListener listener = new WorskpaceExplorerSelectNotificationListener() {
@Override
public void onSelectedItem(Item item) {
GWT.log("Listener Selected Item " + item);
}
@Override
public void onFailed(Throwable throwable) {
GWT.log("There are networks problem, please check your connection.");
}
@Override
public void onAborted() {
}
@Override
public void onNotValidSelection() {
}
};
wsResourcesExplorerPanel.addWorkspaceExplorerSelectNotificationListener(listener);
/*new com.google.gwt.user.client.Timer() {
@Override
public void run() {
//TODO //IS A TEST REMOVE
ArrayList<Item> tests = new ArrayList<Item>();
for (int i = 0; i < 50; i++) {
tests.add(new Item(i+""+Random.nextInt(), "name"+i, false));
}
wsResourcesExplorerPanel.getWsExplorer().updateExplorer(tests);
}
}.schedule(1000);*/
mainPanel = new WorkspaceExplorerAppPanel(wsResourcesExplorerPanel);
}
catch (Exception e) {
e.printStackTrace();
}
}
/**
* Gets the main panel.
*
* @return the mainPanel
*/
public WorkspaceExplorerAppPanel getMainPanel() {
return mainPanel;
}
/**
* Gets the event bus.
*
* @return the event bus
*/
public HandlerManager getEventBus(){
return eventBus;
}
/**
* Gets the display fields.
*
* @return the display fields
*/
public DisplayField[] getDisplayFields(){
return wsResourcesExplorerPanel.getDisplayFields();
}
}

View File

@ -0,0 +1,157 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client;
import gwt.material.design.client.constants.IconPosition;
import gwt.material.design.client.constants.IconType;
import gwt.material.design.client.ui.MaterialLink;
import gwt.material.design.client.ui.MaterialNavBar;
import gwt.material.design.client.ui.MaterialNavSection;
import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.user.workspaceexplorerapp.client.download.DownloadType;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.DownloadItemEvent;
import org.gcube.portlets.user.workspaceexplorerapp.client.grid.DisplayField;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class WorkspaceExplorerAppMainPanel.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Mar 2, 2016
*/
public class WorkspaceExplorerAppMainPanel extends Composite {
private static WorkspaceExplorerAppMainPanelUiBinder uiBinder =
GWT.create(WorkspaceExplorerAppMainPanelUiBinder.class);
/**
* The Interface WorkspaceExplorerAppMainPanelUiBinder.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Mar 8, 2016
*/
interface WorkspaceExplorerAppMainPanelUiBinder
extends UiBinder<Widget, WorkspaceExplorerAppMainPanel> {
}
@UiField
HTMLPanel explorer_main_container;
@UiField
HTMLPanel we_html_base_panel;
@UiField
MaterialNavBar we_nav_bar;
@UiField
MaterialNavSection we_nav_right;
@UiField
MaterialLink download_we;
@UiField
MaterialLink show_we;
@UiField
Image d4science_workspace_logo_180;
private HandlerManager handlerManager;
/**
* Because this class has a default constructor, it can
* be used as a binder template. In other words, it can be used in other
* *.ui.xml files as follows:
* <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
* xmlns:g="urn:import:**user's package**">
* <g:**UserClassName**>Hello!</g:**UserClassName>
* </ui:UiBinder>
* Note that depending on the widget that is used, it may be necessary to
* implement HasHTML instead of HasText.
*
* @param workspaceExplorerAppPanel the workspace explorer app panel
* @param handlerManager the handler manager
*/
public WorkspaceExplorerAppMainPanel(WorkspaceExplorerAppPanel workspaceExplorerAppPanel, HandlerManager handlerManager, DisplayField[] displayFields) {
initWidget(uiBinder.createAndBindUi(this));
this.handlerManager = handlerManager;
explorer_main_container.add(workspaceExplorerAppPanel);
we_nav_bar.getElement().setId("we_nav_bar");
we_nav_bar.getElement().setAttribute("id", "we_nav_bar");
final MaterialLink order = new MaterialLink("Order by");
order.setTitle("Order data for item selected");
order.setActivates("order_list");
order.setTextColor("white");
order.setIconType(IconType.ARROW_DROP_DOWN);
order.setIconPosition(IconPosition.RIGHT);
final List<MaterialLink> links = new ArrayList<MaterialLink>(displayFields.length);
for (final DisplayField field : displayFields) {
if(field.isSortable()){
MaterialLink link = new MaterialLink(field.getLabel());
link.addStyleName("under-line-onhover");
links.add(link);
}
}
final SortByContextMenu scm = new SortByContextMenu(this.handlerManager, links);
order.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
GWT.log("clicked : "+event.getSource().toString());
scm.showRelativeTo(order);
}
});
we_nav_right.add(order);
download_we.addClickHandler(new ClickHandler() {
/* (non-Javadoc)
* @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent)
*/
@Override
public void onClick(ClickEvent event) {
WorkspaceExplorerAppMainPanel.this.handlerManager.fireEvent(new DownloadItemEvent(null, DownloadType.DOWNLOAD));
}
});
show_we.addClickHandler(new ClickHandler() {
/* (non-Javadoc)
* @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent)
*/
@Override
public void onClick(ClickEvent event) {
WorkspaceExplorerAppMainPanel.this.handlerManager.fireEvent(new DownloadItemEvent(null, DownloadType.OPEN));
}
});
d4science_workspace_logo_180.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Window.open("https://www.d4science.org", "_blank", null);
}
});
}
}

View File

@ -0,0 +1,75 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:m="urn:import:gwt.material.design.client.ui">
<ui:style>
.adminMainContent {
overflow: auto;
}
/*.label {
margin-left: 210px;
font-family: sans-serif;
font-size: 16px;
text-align: left;
font-weight: bold;
}*/
.nav-right {
/*padding-left: 200px;*/
/* font-size: 16px;*/
/*text-align: right;*/
/*width: 200px;*/
}
.title-left {
/*font-family: sans-serif;*/
font-size: 14px;
text-align: left;
font-weight: bold;
}
.navigation_explorer {
padding-bottom: 50px;
padding-left: 5px;
padding-top: 10px;
}
.navigation_explorer :HOVER {
cursor: pointer !important;
}
.navigation_bar {
height: 100px;
}
header, main, footer {
padding-left: 200px;
}
</ui:style>
<g:HTMLPanel styleName="navigation_link">
<m:MaterialNavBar backgroundColor="blue" activates="mysidebar"
ui:field="we_nav_bar">
<m:MaterialNavBrand styleName="{style.title-left}" href="#" float="LEFT" title="D4Science Workspace Explorer">Workspace Explorer</m:MaterialNavBrand>
<m:MaterialNavSection styleName="{style.nav-right}" float="RIGHT" ui:field="we_nav_right">
</m:MaterialNavSection>
</m:MaterialNavBar>
<!-- My Dropdown -->
<g:HTMLPanel ui:field="we_html_base_panel">
</g:HTMLPanel>
<m:MaterialSideNav width="200" m:id="mysidebar"
type="OPEN" closeOnClick="false">
<g:Image styleName="{style.navigation_explorer}" url="img/d4science_workspace_logo_180.png"
ui:field="d4science_workspace_logo_180" title="D4Science Workspace Folder Explorer"
altText="D4Science Workspace Folder Explorer" />
<m:MaterialLink iconType="OPEN_IN_NEW" iconPosition="LEFT"
textColor="blue" text="Open" ui:field="show_we" />
<m:MaterialLink iconType="INBOX" iconPosition="LEFT"
textColor="blue" text="Download" ui:field="download_we" />
</m:MaterialSideNav>
<m:MaterialContainer>
<g:HTMLPanel ui:field="explorer_main_container"></g:HTMLPanel>
</m:MaterialContainer>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,33 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class SplitPanel.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 23, 2015
*/
public class WorkspaceExplorerAppPanel extends SimplePanel{
/**
* Instantiates a new workspace explorer app panel.
*
* @param splitterSize the splitter size
* @param navigation the navigation
* @param wsExplorer the ws explorer
*/
public WorkspaceExplorerAppPanel(Widget wsExplorerPanel) {
ensureDebugId("WorkspaceExplorerAppPanel");
this.getElement().setId("WorkspaceExplorerAppPanel");
this.getElement().setAttribute("id","WorkspaceExplorerAppPanel");
setWidth("100%");
add(wsExplorerPanel);
}
}

View File

@ -0,0 +1,51 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client;
import gwt.material.design.client.ui.MaterialFooter;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Mar 18, 2016
*/
public class WorkspaceExplorerFoooterPanel extends Composite {
private static WorkspaceExplorerFoooterPanelUiBinder uiBinder =
GWT.create(WorkspaceExplorerFoooterPanelUiBinder.class);
interface WorkspaceExplorerFoooterPanelUiBinder
extends UiBinder<Widget, WorkspaceExplorerFoooterPanel> {
}
/**
* Because this class has a default constructor, it can
* be used as a binder template. In other words, it can be used in other
* *.ui.xml files as follows:
* <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
* xmlns:g="urn:import:**user's package**">
* <g:**UserClassName**>Hello!</g:**UserClassName>
* </ui:UiBinder>
* Note that depending on the widget that is used, it may be necessary to
* implement HasHTML instead of HasText.
*/
public WorkspaceExplorerFoooterPanel() {
initWidget(uiBinder.createAndBindUi(this));
}
@UiField
MaterialFooter we_footer_bar;
public WorkspaceExplorerFoooterPanel(String firstName) {
initWidget(uiBinder.createAndBindUi(this));
}
}

View File

@ -0,0 +1,14 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:m="urn:import:gwt.material.design.client.ui">
<ui:style>
.we_footer {
height: 50px important!
}
</ui:style>
<g:HTMLPanel>
<m:MaterialFooter styleName="{style.we_footer}" ui:field="we_footer_bar">
</m:MaterialFooter>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,94 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client;
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
/**
* The Class WorskpaceExplorerNotification.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 29, 2015
*/
public class WorkspaceExplorerSelectNotification {
/**
* The listener interface for receiving worskpaceExplorerSelectNotification events.
* The class that is interested in processing a worskpaceExplorerSelectNotification
* event implements this interface, and the object created
* with that class is registered with a component using the
* component's <code>addWorskpaceExplorerSelectNotificationListener<code> method. When
* the worskpaceExplorerSelectNotification event occurs, that object's appropriate
* method is invoked.
*
* @see WorskpaceExplorerSelectNotificationEvent
*/
public interface WorskpaceExplorerSelectNotificationListener {
/**
* On selected item.
*
* @param item the item
*/
void onSelectedItem(Item item);
/**
* On aborted.
*/
void onAborted();
/**
* On failed.
*
* @param throwable the throwable
*/
void onFailed(Throwable throwable);
/**
* On not valid selection.
*/
void onNotValidSelection();
}
/**
* The listener interface for receiving hasWorskpaceExplorerSelectNotification events.
* The class that is interested in processing a hasWorskpaceExplorerSelectNotification
* event implements this interface, and the object created
* with that class is registered with a component using the
* component's <code>addHasWorskpaceExplorerSelectNotificationListener<code> method. When
* the hasWorskpaceExplorerSelectNotification event occurs, that object's appropriate
* method is invoked.
*
* @see HasWorskpaceExplorerSelectNotificationEvent
*/
public interface HasWorskpaceExplorerSelectNotificationListener {
/**
* Adds the workspace explorer select notification listener.
*
* @param handler the handler
*/
public void addWorkspaceExplorerSelectNotificationListener(WorskpaceExplorerSelectNotificationListener handler);
/**
* Removes the workspace explorer select notification listener.
*
* @param handler the handler
*/
public void removeWorkspaceExplorerSelectNotificationListener(WorskpaceExplorerSelectNotificationListener handler);
}
}

View File

@ -0,0 +1,510 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client;
import gwt.material.design.client.ui.MaterialToast;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.gcube.portlets.user.workspaceexplorerapp.client.WorkspaceExplorerSelectNotification.HasWorskpaceExplorerSelectNotificationListener;
import org.gcube.portlets.user.workspaceexplorerapp.client.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
import org.gcube.portlets.user.workspaceexplorerapp.client.download.RequestBuilderWorkspaceValidateItem;
import org.gcube.portlets.user.workspaceexplorerapp.client.download.WindowOpenParameter;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.BreadcrumbClickEvent;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.BreadcrumbClickEventHandler;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.ClickItemEvent;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.ClickItemEventHandler;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.DownloadItemEvent;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.DownloadItemEventHandler;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.LoadFolderEvent;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.LoadFolderEventHandler;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.OrderDataByEvent;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.OrderDataByEventHandler;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.RightClickItemEvent;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.RightClickItemEventHandler;
import org.gcube.portlets.user.workspaceexplorerapp.client.grid.DisplayField;
import org.gcube.portlets.user.workspaceexplorerapp.client.view.Breadcrumbs;
import org.gcube.portlets.user.workspaceexplorerapp.client.view.PopupContextMenu;
import org.gcube.portlets.user.workspaceexplorerapp.client.view.WorkspaceExplorer;
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemType;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
* The Class WorkspaceResourcesExplorerPanel.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Dec 3, 2015
*/
public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWorskpaceExplorerSelectNotificationListener{
public HandlerManager eventBus;
private Breadcrumbs breadcrumbs;
private boolean isSelect = false;
private String captionTxt;
// private WorkspaceExplorerController controller;
private List<WorskpaceExplorerSelectNotificationListener> listeners = new ArrayList<WorskpaceExplorerSelectNotificationListener>();
private VerticalPanel mainVP = new VerticalPanel();
// private HorizontalPanel footerHP = new HorizontalPanel();
private WorkspaceExplorer wsExplorer;
private ScrollPanel centerScrollable = new ScrollPanel();
// private ScrollPanel southPanel = new ScrollPanel();
private String folderId;
private String folderName;
private DisplayField[] displayFields = new DisplayField[]{DisplayField.ICON, DisplayField.NAME, DisplayField.OWNER, DisplayField.CREATION_DATE};
/**
* Instantiates a new workspace folder explorer select panel.
*
* @param eventBus the event bus
* @param folderId the folder id like root folder to explore
* @param folderName the folder name
* @throws Exception the exception
*/
public WorkspaceResourcesExplorerPanel(HandlerManager eventBus, String folderId, String folderName) throws Exception {
initExplorer(eventBus, folderId, folderName, ItemType.values(), ItemType.values());
}
/**
* Inits the explorer.
*
* @param eventBus the event bus
* @param folderId the folder id
* @param folderName the folder name
* @param selectableTypes the selectable types
* @param showableTypes the showable types
* @throws Exception the exception
*/
private void initExplorer(HandlerManager eventBus, String folderId, String folderName, ItemType[] selectableTypes, ItemType[] showableTypes) throws Exception{
this.folderId = folderId;
this.folderName = folderName;
this.eventBus = eventBus;
this.breadcrumbs = new Breadcrumbs(eventBus);
bindEvents();
wsExplorer = new WorkspaceExplorer(eventBus, showableTypes, selectableTypes, displayFields);
Item item = new Item(folderId, folderName, true);
if(folderId!=null && !folderId.isEmpty())
wsExplorer.loadFolder(item);
initPanel("");
}
/**
* @return the displayFields
*/
public DisplayField[] getDisplayFields() {
return displayFields;
}
/**
* Instantiates a new workspace explorer select panel.
*
* @param folderId the folder id
* @param showOnlyFolders the show only folders
* @throws Exception the exception
*/
public WorkspaceResourcesExplorerPanel(HandlerManager eventBus, String folderId, boolean showOnlyFolders) throws Exception {
if(showOnlyFolders){
ItemType[] itemsType = new ItemType[1];
itemsType[0] = ItemType.FOLDER;
initExplorer(eventBus, folderId, "", itemsType, itemsType);
}else{
initExplorer(eventBus, folderId, "", ItemType.values(), ItemType.values());
}
}
/**
* Bind events.
*/
private void bindEvents(){
eventBus.addHandler(ClickItemEvent.TYPE, new ClickItemEventHandler() {
@Override
public void onClick(final ClickItemEvent clickItemEvent) {
isSelect = false;
Set<Item> items = wsExplorer.getItemsSelected();
List<Item> lstItems = toList(items);
//Return if item is not selectable
if(!itemIsSelectable(lstItems.get(0))){
notifyNotValidSelection();
return;
}
notifySelectedItem(lstItems.get(0));
isSelect = true;
}
});
eventBus.addHandler(LoadFolderEvent.TYPE, new LoadFolderEventHandler() {
@Override
public void onLoadFolder(LoadFolderEvent loadFolderEvent) {
if(loadFolderEvent.getTargetFolder()==null)
return;
Item item = loadFolderEvent.getTargetFolder();
if(item.isFolder()){
try {
wsExplorer.loadFolder(item);
loadParentBreadcrumbByItemId(item.getId(), true);
// clearMoreInfo();
} catch (Exception e) {
GWT.log(e.getMessage());
}
}
}
});
eventBus.addHandler(BreadcrumbClickEvent.TYPE, new BreadcrumbClickEventHandler() {
@Override
public void onBreadcrumbClick(BreadcrumbClickEvent breadcrumbClickEvent) {
if(breadcrumbClickEvent.getTargetItem()!=null)
eventBus.fireEvent(new LoadFolderEvent(breadcrumbClickEvent.getTargetItem()));
}
});
eventBus.addHandler(OrderDataByEvent.TYPE, new OrderDataByEventHandler() {
@Override
public void onOrderDataBy(OrderDataByEvent orderDataByEvent) {
wsExplorer.getItTables().sortDataBy(orderDataByEvent.getLabel());
/*ArrayList<Item> items = ItemComparatorUtility.sortItems(DisplayField.NAME, true, wsExplorer.getItTables().getDataProvider().getList());
wsExplorer.updateExplorer(items);*/
}
});
eventBus.addHandler(RightClickItemEvent.TYPE, new RightClickItemEventHandler() {
@Override
public void onClick(RightClickItemEvent rightClickItemEvent) {
if(rightClickItemEvent.getItem()!=null && rightClickItemEvent.getItem().getId()!=null){
PopupContextMenu popupCM = new PopupContextMenu(true, eventBus, rightClickItemEvent.getItem());
popupCM.showPopup(rightClickItemEvent.getXPos(), Window.getScrollTop()+rightClickItemEvent.getYPos());
/*final PopupPanel contextMenu = new PopupPanel(true);
contextMenu.getElement().getStyle().setBackgroundColor("#F5F5F5");
Navigation nav = new Navigation(eventBus, rightClickItemEvent.getItem());
nav.addCommandOnDownloadClick(new Command() {
@Override
public void execute() {
contextMenu.hide();
}
});
contextMenu.add(nav);
contextMenu.setPopupPosition(rightClickItemEvent.getXPos(), Window.getScrollTop()+rightClickItemEvent.getYPos());
contextMenu.show();*/
}
}
});
eventBus.addHandler(DownloadItemEvent.TYPE, new DownloadItemEventHandler() {
@Override
public void onDownloadItem(DownloadItemEvent downloadItemEvent) {
GWT.log("Fired event DownloadItemEvent");
String itemIds = "";
if(downloadItemEvent.getItem()!=null)
itemIds = downloadItemEvent.getItem().getId()+WorkspaceExplorerAppConstants.IDS_SEPARATOR;
else{
List<Item> lstItems = toList(wsExplorer.getItemsSelected());
for (Item item : lstItems) {
itemIds +=item.getId()+WorkspaceExplorerAppConstants.IDS_SEPARATOR;
}
}
GWT.log("itemIds: "+itemIds);
if(!itemIds.isEmpty()){
// MaterialToast.fireToast("Download...");
switch (downloadItemEvent.getType()) {
case DOWNLOAD:
MaterialToast.fireToast("Download...");
try {
new RequestBuilderWorkspaceValidateItem(RequestBuilder.GET,WorkspaceExplorerAppConstants.DOWNLOAD_WORKSPACE_SERVICE, WorkspaceExplorerAppConstants.IDS+"="+itemIds, "_self", downloadHandlerCallback);
} catch (Exception e) {
Window.alert("Sorry, an error occurred while contacting server, try again");
}
break;
case PREVIEW:
break;
case OPEN:
MaterialToast.fireToast("Showing...");
try {
new RequestBuilderWorkspaceValidateItem(RequestBuilder.GET, WorkspaceExplorerAppConstants.DOWNLOAD_WORKSPACE_SERVICE, WorkspaceExplorerAppConstants.IDS+"="+itemIds+"&viewContent=true", "_blank", downloadHandlerCallback);
} catch (Exception e) {
Window.alert("Sorry, an error occurred while contacting server, try again");
}
break;
default:
break;
}
/*final NewBrowserWindow newBW = NewBrowserWindow.open("", "_self", "");
WorkspaceExplorerAppConstants.workspaceNavigatorService.getPublicLinkForItemId(itemId, new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
Window.alert(caught.getMessage());
}
@Override
public void onSuccess(String url) {
if(url!=null){
newBW.setUrl(url);
}else
Window.alert("Sorry, the item selected is not available for download");
}
});*/
}
}
});
}
/**
* To list.
*
* @param items the items
* @return the list
*/
private List<Item> toList(Set<Item> items){
if(items!=null && items.size()>0){
List<Item> lstItems = new ArrayList<Item> (items.size());
lstItems.addAll(items);
return lstItems;
}
return null;
}
/**
* Load parent breadcrumb by item id.
*
* @param itemIdentifier the item identifier
* @param includeItemAsParent the include item as parent
*/
private void loadParentBreadcrumbByItemId(final String itemIdentifier, boolean includeItemAsParent){
GWT.log("Reload Parent Breadcrumb: [Item id: "+itemIdentifier+"]");
WorkspaceExplorerAppConstants.workspaceNavigatorService.getBreadcrumbsByItemIdentifierToParentLimit(itemIdentifier, folderId, includeItemAsParent, new AsyncCallback<List<Item>>() {
@Override
public void onFailure(Throwable caught) {
GWT.log(caught.getMessage());
wsExplorer.setAlert(caught.getMessage(), AlertType.ERROR);
}
@Override
public void onSuccess(List<Item> result) {
if(result!=null){
breadcrumbs.setPath(result);
// clearMoreInfo();
}
}
});
}
/**
* Refresh root folder view.
*/
public void refreshRootFolderView(){
Item item = new Item(folderId, folderName, true);
eventBus.fireEvent(new LoadFolderEvent(item));
}
// /**
// * Clear more info.
// */
// private void clearMoreInfo(){
// southPanel.clear();
// }
/**
* Inits the panel.
*
* @param captionTxt the caption txt is the tool-tip
*/
private void initPanel(String captionTxt) {
this.captionTxt = captionTxt;
this.getElement().setId("WorkspaceExplorerContainer");
this.getElement().setAttribute("id", "WorkspaceExplorerContainer");
this.getElement().addClassName("workspace-explorer-container");
if(this.captionTxt!=null && !this.captionTxt.isEmpty())
setTitle(this.captionTxt);
setWidth("100%");
add(breadcrumbs, DockPanel.NORTH);
mainVP.add(wsExplorer.getPanel());
centerScrollable.add(mainVP);
add(centerScrollable, DockPanel.CENTER);
}
/**
* Notify selected item.
*
* @param selected the selected
*/
private void notifySelectedItem(Item selected){
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onSelectedItem(selected);
}
}
/**
* Notify aborted.
*/
private void notifyAborted(){
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onAborted();
}
}
/**
* Notify not valid selection.
*/
private void notifyNotValidSelection(){
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onNotValidSelection();
}
}
/**
* Notify failed.
*
* @param t the t
*/
@SuppressWarnings("unused")
private void notifyFailed(Throwable t){
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onFailed(t);
}
}
/**
* Gets the caption txt.
*
* @return the captionTxt
*/
public String getCaptionTxt() {
return captionTxt;
}
/**
* Checks if is valid hide.
*
* @return the isValidHide
*/
public boolean isValidHide() {
return isSelect;
}
/* (non-Javadoc)
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener#addWorkspaceExplorerNotificationListener(org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.WorskpaceExplorerNotificationListener)
*/
@Override
public void addWorkspaceExplorerSelectNotificationListener(WorskpaceExplorerSelectNotificationListener handler) {
if(handler!=null)
listeners.add(handler);
}
/* (non-Javadoc)
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener#removeWorkspaceExplorerNotificationListener(org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.WorskpaceExplorerNotificationListener)
*/
@Override
public void removeWorkspaceExplorerSelectNotificationListener(WorskpaceExplorerSelectNotificationListener handler) {
if(handler!=null){
if(listeners.contains(handler))
listeners.remove(handler);
}
}
/**
* Item is selectable.
*
* @param item the item
* @return true, if successful
*/
public boolean itemIsSelectable(Item item){
GWT.log("Selectable type: "+wsExplorer.getSelectableTypes());
GWT.log("item: "+item);
if (item!=null){
boolean selectable = wsExplorer.getSelectableTypes().contains(item.getType());
return selectable?true:false;
}
return false;
}
/**
* @return the wsExplorer
*/
public WorkspaceExplorer getWsExplorer() {
return wsExplorer;
}
/**
* Gets the event bus.
*
* @return the eventBus
*/
public HandlerManager getEventBus() {
return eventBus;
}
public AsyncCallback<WindowOpenParameter> downloadHandlerCallback = new AsyncCallback<WindowOpenParameter>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(WindowOpenParameter windowOpenParam) {
String params = "?"+windowOpenParam.getParameters();
if(params.length()>1)
params+="&";
params+=WorkspaceExplorerAppConstants.REDIRECTONERROR+"="+windowOpenParam.isRedirectOnError();
windowOpenParam.getBrowserWindow().setUrl(WorkspaceExplorerAppConstants.DOWNLOAD_WORKSPACE_SERVICE+params);
}
};
}

View File

@ -0,0 +1,18 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client.download;
/**
* The Enum DownloadType.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Mar 7, 2016
*/
public enum DownloadType {
PREVIEW,
OPEN,
DOWNLOAD;
}

View File

@ -0,0 +1,121 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client.download;
import org.gcube.portlets.user.workspaceexplorerapp.client.NewBrowserWindow;
import org.gcube.portlets.user.workspaceexplorerapp.client.WorkspaceExplorerAppConstants;
import com.google.gwt.core.client.GWT;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
* The Class RequestBuilderWorkspaceValidateItem.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Jun 24, 2013
*/
public class RequestBuilderWorkspaceValidateItem {
private AsyncCallback<WindowOpenParameter> callback;
private String parameters;
/**
* Instantiates a new request builder workspace validate item.
*
* @param method the method
* @param servletName the name of the servlet that must be called
* @param params param=value&param1=value1&...
* @param targetWindow the target of the window (e.g. "_blank")
* @param callback the callback
* @throws Exception the exception
*/
public RequestBuilderWorkspaceValidateItem(RequestBuilder.Method method, String servletName, final String params, final String targetWindow, final AsyncCallback<WindowOpenParameter> callback) throws Exception{
this.callback = callback;
final NewBrowserWindow newBrowserWindow = NewBrowserWindow.open("", targetWindow, "");
this.parameters = params;
if(servletName==null)
return;
servletName = servletName.isEmpty()?"/":servletName;
if(!servletName.contains("/"))
servletName+="/"+servletName;
if(parameters==null)
parameters = WorkspaceExplorerAppConstants.VALIDATEITEM+"=true";
else
parameters +="&"+WorkspaceExplorerAppConstants.VALIDATEITEM+"=true";
String urlRequest = servletName+"?"+parameters;
GWT.log("request builder for: "+urlRequest);
RequestBuilder requestBuilder = new RequestBuilder(method, urlRequest);
try {
requestBuilder.sendRequest("", new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
int status = response.getStatusCode();
if(!(status==200) && !(status==202)){ //NOT IS STATUS SC_ACCEPTED
// if(status==401){ // SC_UNAUTHORIZED = 401;
// GWT.log("Session expired");
// AppControllerExplorer.getEventBus().fireEvent(new SessionExpiredEvent());
// return;
// }
newBrowserWindow.close();
handleError("Sorry, an error occurred on retriving the file. "+response.getText()); //ERROR STATUS
}else { //OK STATUS
if(callback!=null){
//PASSING PARAMS WITHOUT VALIDATION=TRUE
callback.onSuccess(new WindowOpenParameter(targetWindow, "", params, true, newBrowserWindow));
}
}
}
@Override
public void onError(Request request, Throwable exception) {
newBrowserWindow.close();
// System.out.println("exception message is "+exception.getMessage());
handleError(exception.getMessage());
}
});
} catch (RequestException e) {
newBrowserWindow.close();
throw new Exception("Sorry, an error occurred while contacting server, try again");
}
}
/**
* Handle error.
*
* @param message the message
*/
public void handleError(String message){
if(callback!=null)
callback.onFailure(new Exception(message));
else
Window.alert("Error: "+message);
}
}

View File

@ -0,0 +1,91 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client.download;
import org.gcube.portlets.user.workspaceexplorerapp.client.NewBrowserWindow;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Jun 25, 2013
*
*/
public class WindowOpenParameter {
private String option;
private String parameters;
private String itemName;
private boolean redirectOnError;
private NewBrowserWindow browserWindow;
/**
*
*/
public WindowOpenParameter() {
}
/**
*
* @param target the target of the window (e.g. "_blank")
* @param itemName
* @param parameters param=value&param1=value1&...
* @param redirectOnError if true execute a redirect on fake URL
* @param browserWindow an instance of NewBrowserWindow
*/
public WindowOpenParameter(String target, String itemName, String parameters, boolean redirectOnError, NewBrowserWindow browserWindow) {
super();
this.option = target;
this.itemName = itemName;
this.parameters = parameters;
this.redirectOnError = redirectOnError;
this.browserWindow = browserWindow;
}
public String getParameters() {
return parameters;
}
public void setParameters(String parameters) {
this.parameters = parameters;
}
public String getOption() {
return option;
}
public void setOption(String option) {
this.option = option;
}
public String getItemName() {
return itemName;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
public boolean isRedirectOnError() {
return redirectOnError;
}
public void setRedirectOnError(boolean redirectOnError) {
this.redirectOnError = redirectOnError;
}
public NewBrowserWindow getBrowserWindow() {
return browserWindow;
}
public void setBrowserWindow(NewBrowserWindow browserWindow) {
this.browserWindow = browserWindow;
}
}

View File

@ -0,0 +1,61 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class BreadcrumbClickEvent.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Aug 3, 2015
*/
public class BreadcrumbClickEvent extends GwtEvent<BreadcrumbClickEventHandler> {
public static Type<BreadcrumbClickEventHandler> TYPE = new Type<BreadcrumbClickEventHandler>();
private Item targetItem;
/**
* Instantiates a new breadcrumb click event.
*
* @param target the target
*/
public BreadcrumbClickEvent(Item target) {
this.targetItem = target;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<BreadcrumbClickEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(BreadcrumbClickEventHandler handler) {
handler.onBreadcrumbClick(this);
}
/**
* Gets the target item.
*
* @return the targetItem
*/
public Item getTargetItem() {
return targetItem;
}
/**
* Sets the target item.
*
* @param targetItem the targetItem to set
*/
public void setTargetItem(Item targetItem) {
this.targetItem = targetItem;
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface BreadcrumbClickEventHandler.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Aug 3, 2015
*/
public interface BreadcrumbClickEventHandler extends EventHandler {
/**
* On breadcrumb click.
*
* @param breadcrumbClickEvent the breadcrumb click event
*/
void onBreadcrumbClick(BreadcrumbClickEvent breadcrumbClickEvent);
}

View File

@ -0,0 +1,61 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class BreadcrumbInitEvent.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 2, 2016
*/
public class BreadcrumbInitEvent extends GwtEvent<BreadcrumbInitEventHandler> {
public static Type<BreadcrumbInitEventHandler> TYPE = new Type<BreadcrumbInitEventHandler>();
private Item targetItem;
/**
* Instantiates a new breadcrumb click event.
*
* @param target the target
*/
public BreadcrumbInitEvent(Item target) {
this.targetItem = target;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<BreadcrumbInitEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(BreadcrumbInitEventHandler handler) {
handler.onBreadcrumbInit(this);
}
/**
* Gets the target item.
*
* @return the targetItem
*/
public Item getTargetItem() {
return targetItem;
}
/**
* Sets the target item.
*
* @param targetItem the targetItem to set
*/
public void setTargetItem(Item targetItem) {
this.targetItem = targetItem;
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface BreadcrumbInitEventHandler.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 2, 2016
*/
public interface BreadcrumbInitEventHandler extends EventHandler {
/**
* On breadcrumb init.
*
* @param breadcrumbInitEvent the breadcrumb init event
*/
void onBreadcrumbInit(BreadcrumbInitEvent breadcrumbInitEvent);
}

View File

@ -0,0 +1,54 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import java.util.Set;
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class ClickItemEvent.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jul 6, 2015
*/
public class ClickItemEvent extends GwtEvent<ClickItemEventHandler> {
public static Type<ClickItemEventHandler> TYPE = new Type<ClickItemEventHandler>();
private Set<Item> items;
/**
* Instantiates a new click item event.
*
* @param selectedObject the item
*/
public ClickItemEvent(Set<Item> selectedObject) {
this.items = selectedObject;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<ClickItemEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(ClickItemEventHandler handler) {
handler.onClick(this);
}
/**
* Gets the items.
*
* @return the items
*/
public Set<Item> getItems() {
return items;
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface ClickItemEventHandler.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jul 6, 2015
*/
public interface ClickItemEventHandler extends EventHandler {
/**
* On click.
*
* @param moreInfoShowEvent the more info show event
*/
void onClick(ClickItemEvent moreInfoShowEvent);
}

View File

@ -0,0 +1,36 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class CreateFolderClickEvent.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 1, 2016
*/
public class CreateFolderClickEvent extends GwtEvent<CreateFolderClickEventHandler> {
public static Type<CreateFolderClickEventHandler> TYPE = new Type<CreateFolderClickEventHandler>();
/**
* Instantiates a new click item event.
*/
public CreateFolderClickEvent() {
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<CreateFolderClickEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(CreateFolderClickEventHandler handler) {
handler.onClick(this);
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface ClickItemEventHandler.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jul 6, 2015
*/
public interface CreateFolderClickEventHandler extends EventHandler {
/**
* On click.
*
* @param createFolderClickEvent the more info show event
*/
void onClick(CreateFolderClickEvent createFolderClickEvent);
}

View File

@ -0,0 +1,63 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import org.gcube.portlets.user.workspaceexplorerapp.client.download.DownloadType;
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemInterface;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class ClickItemEvent.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jul 6, 2015
*/
public class DownloadItemEvent extends GwtEvent<DownloadItemEventHandler> {
public static Type<DownloadItemEventHandler> TYPE = new Type<DownloadItemEventHandler>();
private ItemInterface item;
private DownloadType type;
/**
* Instantiates a new click item event.
*
* @param itemDownload the item download
* @param type the type
*/
public DownloadItemEvent(ItemInterface itemDownload, DownloadType type) {
this.item = itemDownload;
this.type = type;
}
/**
* @return the type
*/
public DownloadType getType() {
return type;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<DownloadItemEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(DownloadItemEventHandler handler) {
handler.onDownloadItem(this);
}
/**
* Gets the item.
*
* @return the item
*/
public ItemInterface getItem() {
return item;
}
}

View File

@ -0,0 +1,19 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface DownloadItemEventHandler.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 23, 2016
*/
public interface DownloadItemEventHandler extends EventHandler {
/**
* On download item.
*
* @param downloadItemEvent the download item event
*/
void onDownloadItem(DownloadItemEvent downloadItemEvent);
}

View File

@ -0,0 +1,61 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class LoadFolderEvent.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 25, 2015
*/
public class LoadFolderEvent extends GwtEvent<LoadFolderEventHandler> {
public static Type<LoadFolderEventHandler> TYPE = new Type<LoadFolderEventHandler>();
private Item item;
/**
* Instantiates a new load folder event.
*
* @param selected the selected
*/
public LoadFolderEvent(Item selected) {
this.item = selected;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<LoadFolderEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(LoadFolderEventHandler handler) {
handler.onLoadFolder(this);
}
/**
* Gets the target folder.
*
* @return the target folder
*/
public Item getTargetFolder() {
return item;
}
/**
* Sets the target folder.
*
* @param item the new target folder
*/
public void setTargetFolder(Item item) {
this.item = item;
}
}

View File

@ -0,0 +1,16 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @May 23, 2013
*
*/
public interface LoadFolderEventHandler extends EventHandler {
/**
* @param accountingHistoryEvent
*/
void onLoadFolder(LoadFolderEvent loadFolderEvent);
}

View File

@ -0,0 +1,35 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
*
*/
public class LoadMySpecialFolderEvent extends GwtEvent<LoadMySpecialFolderEventHandler> {
public static Type<LoadMySpecialFolderEventHandler> TYPE = new Type<LoadMySpecialFolderEventHandler>();
/**
* Instantiates a new double click event.
*
* @param target the target
*/
public LoadMySpecialFolderEvent() {
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<LoadMySpecialFolderEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(LoadMySpecialFolderEventHandler handler) {
handler.onLoadMySpecialFolder(this);
}
}

View File

@ -0,0 +1,21 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface LoadMySpecialFolderEventHandler.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 25, 2015
*/
public interface LoadMySpecialFolderEventHandler extends EventHandler {
/**
* On load my special folder.
*
* @param loadMySpecialFolderEvent the load my special folder event
*/
void onLoadMySpecialFolder(LoadMySpecialFolderEvent loadMySpecialFolderEvent);
}

View File

@ -0,0 +1,33 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class LoadRootEvent.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 25, 2015
*/
public class LoadRootEvent extends GwtEvent<LoadRootEventHandler> {
public static Type<LoadRootEventHandler> TYPE = new Type<LoadRootEventHandler>();
public LoadRootEvent() {
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<LoadRootEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(LoadRootEventHandler handler) {
handler.onLoadRoot(this);
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface LoadRootEventHandler.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 25, 2015
*/
public interface LoadRootEventHandler extends EventHandler {
/**
* On load root.
*
* @param loadRootEvent the load root event
*/
void onLoadRoot(LoadRootEvent loadRootEvent);
}

View File

@ -0,0 +1,51 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class LoadFolderEvent.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 25, 2015
*/
public class OrderDataByEvent extends GwtEvent<OrderDataByEventHandler> {
public static Type<OrderDataByEventHandler> TYPE = new Type<OrderDataByEventHandler>();
private String label;
/**
* Instantiates a new order data by event.
*
* @param label the label
*/
public OrderDataByEvent(String label) {
this.label = label;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<OrderDataByEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(OrderDataByEventHandler handler) {
handler.onOrderDataBy(this);
}
/**
* @return the label
*/
public String getLabel() {
return label;
}
}

View File

@ -0,0 +1,24 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* The Class OrderDataByEventHandler.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Mar 18, 2016
*/
public interface OrderDataByEventHandler extends EventHandler {
/**
* On load root.
*
* @param orderDataByEvent the label
*/
void onOrderDataBy(OrderDataByEvent orderDataByEvent);
}

View File

@ -0,0 +1,81 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class RightClickItemEvent.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 23, 2016
*/
public class RightClickItemEvent extends GwtEvent<RightClickItemEventHandler> {
public static Type<RightClickItemEventHandler> TYPE = new Type<RightClickItemEventHandler>();
private Item item;
private int xPos;
private int yPos;
/**
* Instantiates a new click item event.
* @param yPos
* @param xPos
*
* @param item the item
*/
public RightClickItemEvent(int xPos, int yPos, Item item) {
this.xPos = xPos;
this.yPos = yPos;
this.item = item;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<RightClickItemEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(RightClickItemEventHandler handler) {
handler.onClick(this);
}
/**
* Gets the item.
*
* @return the item
*/
public Item getItem() {
return item;
}
/**
* @return the xPos
*/
public int getXPos() {
return xPos;
}
/**
* Gets the y pos.
*
* @return the yPos
*/
public int getYPos() {
return yPos;
}
}

View File

@ -0,0 +1,21 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface RightClickItemEventHandler.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 23, 2016
*/
public interface RightClickItemEventHandler extends EventHandler {
/**
* On click.
*
* @param rightClickItemEvent the right click item event
*/
void onClick(RightClickItemEvent rightClickItemEvent);
}

View File

@ -0,0 +1,45 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class LoadRootEvent.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 25, 2015
*/
public class RootLoadedEvent extends GwtEvent<RootLoadedEventHandler> {
public static Type<RootLoadedEventHandler> TYPE = new Type<RootLoadedEventHandler>();
private Item root;
public RootLoadedEvent(Item root) {
this.root = root;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<RootLoadedEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(RootLoadedEventHandler handler) {
handler.onRootLoaded(this);
}
/**
* @return the root
*/
public Item getRoot() {
return root;
}
}

View File

@ -0,0 +1,23 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface RootLoadedEventHandler.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Aug 3, 2015
*/
public interface RootLoadedEventHandler extends EventHandler {
/**
* On root loaded.
*
* @param rootLoadedEvent the root loaded event
*/
void onRootLoaded(RootLoadedEvent rootLoadedEvent);
}

View File

@ -0,0 +1,196 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.grid;
import java.util.List;
import java.util.Set;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.ClickItemEvent;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.LoadFolderEvent;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.RightClickItemEvent;
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
import com.github.gwtbootstrap.client.ui.Pagination;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.event.dom.client.ContextMenuEvent;
import com.google.gwt.event.dom.client.ContextMenuHandler;
import com.google.gwt.event.dom.client.DoubleClickEvent;
import com.google.gwt.event.dom.client.DoubleClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.cellview.client.DataGrid;
import com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy.KeyboardSelectionPolicy;
import com.google.gwt.user.cellview.client.SimplePager;
import com.google.gwt.user.client.Event;
import com.google.gwt.view.client.CellPreviewEvent;
import com.google.gwt.view.client.ListDataProvider;
import com.google.gwt.view.client.MultiSelectionModel;
import com.google.gwt.view.client.SelectionChangeEvent;
import com.google.gwt.view.client.SelectionChangeEvent.Handler;
/**
* The Class AbstractItemTable.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 19, 2015
*/
public abstract class AbstractItemsCellTable {
protected DataGrid<Item> dataGrid;
protected ListDataProvider<Item> dataProvider = new ListDataProvider<Item>();
protected Item itemContextMenu = null;
protected boolean showMoreInfo;
protected final MultiSelectionModel<Item> msm;
protected final HandlerManager eventBus;
/**
* Inits the table.
*
* @param ItemTable
* the Item table
* @param pager
* the pager
* @param pagination
* the pagination
*/
public abstract void initTable(final SimplePager pager, final Pagination pagination);
/**
* Instantiates a new abstract items cell table.
*
* @param eventBus the event bus
* @param fireOnClick the fire on click
*/
public AbstractItemsCellTable(HandlerManager eventBus, boolean fireOnClick) {
this.eventBus = eventBus;
this.showMoreInfo = fireOnClick;
dataGrid = new DataGrid<Item>(1);
dataGrid.getElement().setId("data_grid_explorer");
dataGrid.getElement().setAttribute("id", "data_grid_explorer");
dataGrid.setWidth("100%");
dataGrid.setHeight("100%");
dataProvider.addDataDisplay(dataGrid);
dataGrid.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
msm = new MultiSelectionModel<Item>();
dataGrid.setSelectionModel(msm);
msm.addSelectionChangeHandler(new Handler() {
@Override
public void onSelectionChange(final SelectionChangeEvent event)
{
final Set<Item> selectedObject = msm.getSelectedSet();
GWT.log("Clicked: "+selectedObject);
// dataGrid.getRowContainer().removeClassName("dataGridSelectedRow");
if(selectedObject!=null && !selectedObject.isEmpty()){
// GWT.log("Current Selected Row : "+ dataGrid.getKeyboardSelectedRow());
// dataGrid.getRowElement(dataGrid.getKeyboardSelectedRow()).addClassName("dataGridSelectedRow");
// selectedItem(selectedObject);
if(showMoreInfo)
AbstractItemsCellTable.this.eventBus.fireEvent(new ClickItemEvent(selectedObject));
}
}
});
dataGrid.addDomHandler(new DoubleClickHandler() {
@Override
public void onDoubleClick(final DoubleClickEvent event) {
Set<Item> selected = msm.getSelectedSet();
GWT.log("Double Click: "+selected);
if (selected != null && !selected.isEmpty()) {
AbstractItemsCellTable.this.eventBus.fireEvent(new LoadFolderEvent(selected.iterator().next()));
}
}
},
DoubleClickEvent.getType());
dataGrid.addDomHandler(new ContextMenuHandler() {
@Override
public void onContextMenu(ContextMenuEvent event) {
event.preventDefault();
event.stopPropagation();
}
}, ContextMenuEvent.getType());
dataGrid.addCellPreviewHandler(new CellPreviewEvent.Handler<Item>() {
@Override
public void onCellPreview(CellPreviewEvent<Item> event) {
// GWT.log("CellPreview click");
if (event.getNativeEvent().getButton() == NativeEvent.BUTTON_RIGHT && event.getNativeEvent().getType().equals("contextmenu")) {
event.getNativeEvent().preventDefault();
event.getNativeEvent().stopPropagation();
// int clickedRow = event.getIndex();
Item item = event.getValue();
GWT.log("Right click on "+ item);
AbstractItemsCellTable.this.eventBus.fireEvent(new RightClickItemEvent(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY(), item));
event.setCanceled(true);
}
}
});
/*MenuBar options = new MenuBar(true);
ScheduledCommand openCommand = new ScheduledCommand() {
@Override
public void execute() {
AbstractItemsCellTable.this.eventBus.fireEvent(new LoadFolderEvent(itemContextMenu));
}
};
MenuItem openItem = new MenuItem("Open", openCommand);
options.addItem(openItem);
final DialogBox menuWrapper = new DialogBox(true);
menuWrapper.getElement().getStyle().setBorderStyle(BorderStyle.NONE);
menuWrapper.getElement().getStyle().setZIndex(10000);
menuWrapper.add(options);*/
dataGrid.sinkEvents(Event.ONCONTEXTMENU);
}
/**
* Update items.
*
* @param items the items
* @param removeOldItems the remove old items
*/
public void updateItems(List<Item> items, boolean removeOldItems) {
if(removeOldItems){
dataProvider.getList().clear();
msm.clear();
}
dataProvider.getList().addAll(items);
dataGrid.setPageSize(items.size()+1);
dataGrid.redraw();
}
/**
* Gets the cell tables.
*
* @return the cell tables
*/
public DataGrid<Item> getCellTable() {
return dataGrid;
}
/**
* Gets the data provider.
*
* @return the data provider
*/
public ListDataProvider<Item> getDataProvider() {
return dataProvider;
}
/**
* Sets the data provider.
*
* @param dataProvider
* the new data provider
*/
public void setDataProvider(ListDataProvider<Item> dataProvider) {
this.dataProvider = dataProvider;
}
}

View File

@ -0,0 +1,84 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client.grid;
/**
* The Enum DisplayField.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Mar 18, 2016
*/
public enum DisplayField {
ICON("Icon", true, false),
NAME("Name", true, true),
OWNER("Owner", true, true),
CREATION_DATE("Creation Date", false, true);
private String label;
private boolean isSortable;
private boolean showIntable;
/**
* Instantiates a new display field.
*
* @param id the id
* @param isSortable the is sortable
*/
private DisplayField(String label, boolean showInTable, boolean isSortable) {
this.label = label;
this.isSortable = isSortable;
this.showIntable = showInTable;
}
/**
* @return the label
*/
public String getLabel() {
return label;
}
/**
* @return the isSortable
*/
public boolean isSortable() {
return isSortable;
}
/**
* @return the showIntable
*/
public boolean isShowIntable() {
return showIntable;
}
/**
* @param label the label to set
*/
public void setLabel(String label) {
this.label = label;
}
/**
* @param isSortable the isSortable to set
*/
public void setSortable(boolean isSortable) {
this.isSortable = isSortable;
}
/**
* @param showIntable the showIntable to set
*/
public void setShowIntable(boolean showIntable) {
this.showIntable = showIntable;
}
}

View File

@ -0,0 +1,399 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client.grid;
import gwt.material.design.client.base.MaterialImageCell;
import gwt.material.design.client.constants.IconPosition;
import gwt.material.design.client.constants.IconType;
import gwt.material.design.client.constants.ImageType;
import gwt.material.design.client.ui.MaterialIcon;
import gwt.material.design.client.ui.MaterialImage;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.gcube.portlets.user.workspaceexplorerapp.client.Util;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.LoadFolderEvent;
import org.gcube.portlets.user.workspaceexplorerapp.client.view.PopupContextMenu;
import org.gcube.portlets.user.workspaceexplorerapp.client.view.SelectionItem;
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
import com.github.gwtbootstrap.client.ui.Pagination;
import com.google.gwt.cell.client.ButtonCell;
import com.google.gwt.cell.client.Cell.Context;
import com.google.gwt.cell.client.DateCell;
import com.google.gwt.cell.client.SafeHtmlCell;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
import com.google.gwt.user.cellview.client.Column;
import com.google.gwt.user.cellview.client.ColumnSortEvent;
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
import com.google.gwt.user.cellview.client.ColumnSortList.ColumnSortInfo;
import com.google.gwt.user.cellview.client.SimplePager;
import com.google.gwt.user.cellview.client.TextColumn;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
/**
* The Class PackagesTable.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 19, 2015
*/
public class ItemsTable extends AbstractItemsCellTable implements SelectionItem{
private DateTimeFormat dateFormatter = DateTimeFormat.getFormat("dd MMM hh:mm aaa yyyy");
/**
* The Enum DISPLAY_FIELD.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 1, 2016
*/
// public static enum DISPLAY_FIELD{ICON, NAME, OWNER};
private List<DisplayField> displayFields;
private Map<String, Integer> mapFieldToColumnIndex = new HashMap<String, Integer>();
private Column<Item, Date> dateColumn;
/**
* Instantiates a new items table.
*
* @param eventBus the event bus
* @param showMoreInfo the show more info
* @param fields the fields
*/
public ItemsTable(HandlerManager eventBus, boolean showMoreInfo, DisplayField[] fields) {
super(eventBus, showMoreInfo);
setDisplayFields(fields);
initTable(null, null);
}
/* (non-Javadoc)
* @see org.gcube.portlets.widgets.wsexplorer.client.view.grid.AbstractItemsCellTable#updateItems(java.util.List, boolean)
*/
public void updateItems(List<Item> items, boolean removeOldItems) {
super.updateItems(items, removeOldItems);
}
/**
* Adds the items.
*
* @param items the items
*/
public void addItems(List<Item> items) {
if(items!=null)
dataProvider.getList().addAll(items);
}
/* (non-Javadoc)
* @see org.gcube.portlets.admin.gcubereleases.client.view.AbstractPackageTable#initTable(com.google.gwt.user.cellview.client.AbstractCellTable, com.google.gwt.user.cellview.client.SimplePager, com.github.gwtbootstrap.client.ui.Pagination)
*/
@Override
public void initTable(final SimplePager pager, final Pagination pagination) {
dataGrid.setEmptyTableWidget(new Label("No data."));
if(this.displayFields.contains(DisplayField.ICON)){
MaterialImageCell myIcon = new MaterialImageCell(){
public Set<String> getConsumedEvents() {
HashSet<String> events = new HashSet<String>();
events.add("click");
return events;
}
};
// IMAGE
Column<Item, MaterialImage> icon = new Column<Item, MaterialImage>(myIcon) {
@Override
public MaterialImage getValue(final Item object) {
MaterialImage img = new MaterialImage();
img.setUrl(Util.getImageResource(object).getSafeUri().asString());
img.setWidth("32px");
img.setHeight("32px");
img.setType(ImageType.DEFAULT);
if(object.isFolder()){
img.addStyleName("navigation-cursor");
}
return img;
}
public void onBrowserEvent(com.google.gwt.cell.client.Cell.Context context, Element elem, Item object, NativeEvent event) {
super.onBrowserEvent(context, elem, object, event);
GWT.log("onBrowserEvent ON IMG "+event.getType());
// Handle the click event.
if ("click".equals(event.getType())) {
if(object.isFolder()){
GWT.log("clicked folder onBrowserEvent "+object);
eventBus.fireEvent(new LoadFolderEvent(object));
}
}
};
};
icon.setSortable(false);
// packageTable.addColumn(icon, "");
dataGrid.addColumn(icon);
dataGrid.setColumnWidth(icon, "45px");
}
Column<Item, SafeHtml> nameColumn;
if(this.displayFields.contains(DisplayField.NAME)){
final SafeHtmlCell progressCell = new SafeHtmlCell();
nameColumn = new Column<Item, SafeHtml>(progressCell) {
@Override
public SafeHtml getValue(Item object) {
SafeHtmlBuilder sb = new SafeHtmlBuilder();
sb.appendHtmlConstant("<div style=''>");
sb.appendHtmlConstant(object.getName());
String formatDate = dateFormatter.format(object.getCreationDate());
String tooltipDate = "Created: "+formatDate;
sb.appendHtmlConstant("<div title='"+tooltipDate+"' style='display: block; text-align: left; font-size: 11px; font-family: Arial, Courier; opacity: 0.8;'>");
sb.appendHtmlConstant(formatDate);
sb.appendHtmlConstant("</div></div>");
return sb.toSafeHtml();
}
};
nameColumn.setSortable(true);
ListHandler<Item> nameColumnHandler = new ListHandler<Item>(dataProvider.getList());
nameColumnHandler.setComparator(nameColumn, new Comparator<Item>() {
@Override
public int compare(Item o1, Item o2) {
if(o1==null)
return 1;
else if(o2==null)
return -1;
//XOR
if (o1.isSpecialFolder() ^ o2.isSpecialFolder()) return o1.isSpecialFolder() ? -1 : 1;
if (o1.isFolder() ^ o2.isFolder()) return o1.isFolder() ? -1 : 1;
return String.CASE_INSENSITIVE_ORDER.compare(o1.getName(), o2.getName());
}
});
dataGrid.addColumnSortHandler(nameColumnHandler);
dataGrid.addColumn(nameColumn);
mapFieldToColumnIndex.put(DisplayField.NAME.getLabel(), dataGrid.getColumnIndex(nameColumn));
dataGrid.getColumnSortList().push(nameColumn);
}
if(this.displayFields.contains(DisplayField.OWNER)){
TextColumn<Item> owner = new TextColumn<Item>() {
@Override
public String getValue(Item object) {
return object.getOwner() != null ? object.getOwner() : "";
}
};
owner.setSortable(true);
ListHandler<Item> ownerColumnHandler = new ListHandler<Item>(dataProvider.getList());
ownerColumnHandler.setComparator(owner, new Comparator<Item>() {
@Override
public int compare(Item o1, Item o2) {
if(o1==null)
return 1;
else if (o2==null)
return -1;
return o1.getOwner().compareTo(o2.getOwner());
}
});
dataGrid.addColumnSortHandler(ownerColumnHandler);
dataGrid.addColumn(owner);
mapFieldToColumnIndex.put(DisplayField.OWNER.getLabel(), dataGrid.getColumnIndex(owner));
}
if(this.displayFields.contains(DisplayField.CREATION_DATE)){
DateCell dateCell = new DateCell();
dateColumn = new Column<Item, Date>(dateCell) {
@Override
public Date getValue(Item object) {
return object.getCreationDate();
}
};
dateColumn.setSortable(true);
ListHandler<Item> dateColumnHandler = new ListHandler<Item>(dataProvider.getList());
dateColumnHandler.setComparator(dateColumn, new Comparator<Item>() {
@Override
public int compare(Item o1, Item o2) {
return o1.getCreationDate().compareTo(o2.getCreationDate());
}
});
dataGrid.addColumnSortHandler(dateColumnHandler);
// dataGrid.addColumn(dateColumn);
// mapFieldToColumnIndex.put(DisplayField.CREATION_DATE.getLabel(), dataGrid.getColumnIndex(dateColumn));
}
Column<Item, MaterialIcon> moreColumn = new Column<Item, MaterialIcon>(new MaterialIconCell()){
@Override
public MaterialIcon getValue(final Item object) {
MaterialIcon button = new MaterialIcon();
button.setIconColor("black");
button.setWidth("15px");
// button.setWaves(WavesType.DEFAULT);
button.setIconPosition(IconPosition.RIGHT);
button.getElement().getStyle().setMarginRight(17.0,Unit.PX);
button.setIconType(IconType.MORE_VERT);
return button;
}
/* (non-Javadoc)
* @see com.google.gwt.user.cellview.client.Column#onBrowserEvent(com.google.gwt.cell.client.Cell.Context, com.google.gwt.dom.client.Element, java.lang.Object, com.google.gwt.dom.client.NativeEvent)
*/
@Override
public void onBrowserEvent(Context context, Element elem, Item object, NativeEvent event) {
// Handle the click event.
if ("click".equals(event.getType())) {
//skip right click
if (event.getButton() == NativeEvent.BUTTON_RIGHT) {
return;
}
PopupContextMenu popupCM = new PopupContextMenu(true, eventBus, object);
popupCM.showPopup(event.getClientX()-100, Window.getScrollTop()+event.getClientY());
}
}
};
moreColumn.setSortable(false);
// packageTable.addColumn(moreColumn, "");
dataGrid.addColumn(moreColumn);
dataGrid.setColumnWidth(moreColumn, "50px");
}
/**
* Sets the display fields.
*
* @param fields the new display fields
*/
public void setDisplayFields(DisplayField[] fields) {
this.displayFields = fields!=null && fields.length>0?Arrays.asList(fields):Arrays.asList(DisplayField.values());
}
/**
* Gets the display fields.
*
* @return the displayFields
*/
public List<DisplayField> getDisplayFields() {
return displayFields;
}
/**
* The Class ButtonImageCell.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 1, 2016
*/
public class ButtonImageCell extends ButtonCell{
/* (non-Javadoc)
* @see com.google.gwt.cell.client.AbstractSafeHtmlCell#render(com.google.gwt.cell.client.Cell.Context, java.lang.Object, com.google.gwt.safehtml.shared.SafeHtmlBuilder)
*/
@Override
public void render(com.google.gwt.cell.client.Cell.Context context,
String value, SafeHtmlBuilder sb) {
SafeHtml html = SafeHtmlUtils.fromTrustedString(new Image(value).toString());
sb.append(html);
}
}
/* (non-Javadoc)
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.SelectionItemHandler#getSelectionItem()
*/
@Override
public Set<Item> getSelectedItems() {
Set<Item> items = msm.getSelectedSet();
if(items==null || items.isEmpty())
return null;
return items;
}
/**
* @param label
*/
public void sortDataBy(String label) {
GWT.log("sort by "+label);
boolean isAscending = true;
if(this.dataGrid.getColumnSortList().size()>0)
isAscending = this.dataGrid.getColumnSortList().get(0).isAscending();
boolean removeDateColumn = false;
if(label.compareTo(DisplayField.CREATION_DATE.getLabel())==0){
dataGrid.addColumn(dateColumn);
mapFieldToColumnIndex.put(DisplayField.CREATION_DATE.getLabel(), dataGrid.getColumnIndex(dateColumn));
removeDateColumn = true;
}
int colIndex = mapFieldToColumnIndex.get(label);
GWT.log("colIndex " + colIndex);
GWT.log("isAscending " + isAscending);
if(colIndex>-1){
Column<Item, ?> column = this.dataGrid.getColumn(colIndex);
if (column != null && column.isSortable()) {
this.dataGrid.getColumnSortList().clear();
setSortedColumn(column, !isAscending);
ColumnSortEvent.fire(dataGrid, dataGrid.getColumnSortList());
if(removeDateColumn)
dataGrid.removeColumn(colIndex);
}
}
}
/**
* Displays the appropriate sorted icon in the header of the column for the given index.
*
* @param columnIndex
* of the column to mark as sorted
* @param ascending
* <code>true</code> for ascending icon, <code>false</code> for descending icon
*/
public void setSortedColumn(Column<Item, ?> column, boolean ascending) {
if (column != null && column.isSortable()) {
ColumnSortInfo info = this.dataGrid.getColumnSortList().push(column);
GWT.log("ColumnSortInfo is anscending "+info.isAscending());
if (info.isAscending() != ascending) {
this.dataGrid.getColumnSortList().push(column);
}
}
}
}

View File

@ -0,0 +1,61 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client.grid;
import gwt.material.design.client.ui.MaterialIcon;
import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.cell.client.ValueUpdater;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Mar 8, 2016
*/
public class MaterialIconCell extends AbstractCell<MaterialIcon> {
/**
*
*/
public MaterialIconCell() {
/*
* Sink the click and keydown events. We handle click events in this
* class. AbstractCell will handle the keydown event and call
* onEnterKeyDown() if the user presses the enter key while the cell is
* selected.
*/
super("click", "keydown");
}
@Override
public void render(
com.google.gwt.cell.client.Cell.Context context, MaterialIcon value,
SafeHtmlBuilder sb) {
if(value==null)
return;
sb.appendHtmlConstant(value.getElement().getString());
}
/**
* Called when an event occurs in a rendered instance of this Cell. The
* parent element refers to the element that contains the rendered cell, NOT
* to the outermost element that the Cell rendered.
*/
/* (non-Javadoc)
* @see com.google.gwt.cell.client.AbstractCell#onBrowserEvent(com.google.gwt.cell.client.Cell.Context, com.google.gwt.dom.client.Element, java.lang.Object, com.google.gwt.dom.client.NativeEvent, com.google.gwt.cell.client.ValueUpdater)
*/
@Override
public void onBrowserEvent(
com.google.gwt.cell.client.Cell.Context context, Element parent,
MaterialIcon value, NativeEvent event,
ValueUpdater<MaterialIcon> valueUpdater) {
super.onBrowserEvent(context, parent, value, event, valueUpdater);
}
}

View File

@ -0,0 +1,93 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client.grid;
import gwt.material.design.client.ui.MaterialLink;
import org.gcube.portlets.user.workspaceexplorerapp.client.download.DownloadType;
import org.gcube.portlets.user.workspaceexplorerapp.client.event.DownloadItemEvent;
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemInterface;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Mar 8, 2016
*/
public class MenuMoreOptionsOnItem extends Composite {
private static MenuMoreOptionsOnItemUiBinder uiBinder =
GWT.create(MenuMoreOptionsOnItemUiBinder.class);
interface MenuMoreOptionsOnItemUiBinder
extends UiBinder<Widget, MenuMoreOptionsOnItem> {
}
@UiField
MaterialLink open;
@UiField
MaterialLink download;
private HandlerManager eventBus;
private ItemInterface itemToDownload;
private Command commandOnClick;
public MenuMoreOptionsOnItem(HandlerManager eventBus) {
initWidget(uiBinder.createAndBindUi(this));
this.eventBus = eventBus;
download.addClickHandler(new ClickHandler() {
/* (non-Javadoc)
* @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent)
*/
@Override
public void onClick(ClickEvent event) {
MenuMoreOptionsOnItem.this.eventBus.fireEvent(new DownloadItemEvent(itemToDownload, DownloadType.DOWNLOAD));
GWT.log("commandOnClick " + commandOnClick);
if(commandOnClick!=null)
commandOnClick.execute();
}
});
open.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
MenuMoreOptionsOnItem.this.eventBus.fireEvent(new DownloadItemEvent(itemToDownload, DownloadType.OPEN));
GWT.log("commandOnClick " + commandOnClick);
if(commandOnClick!=null)
commandOnClick.execute();
}
});
}
/**
* Inits the on item.
*
* @param itemToDownload the item to download
* @param commandOnClick the command on click
*/
public void initOnItem(ItemInterface itemToDownload, Command commandOnClick){
this.itemToDownload = itemToDownload;
this.commandOnClick = commandOnClick;
}
}

View File

@ -0,0 +1,19 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:m="urn:import:gwt.material.design.client.ui">
<ui:style>
.onHoverUnderline :HOVER{
text-decoration: underline;
}
</ui:style>
<m:MaterialRow>
<m:MaterialColumn>
<m:MaterialRow>
<m:MaterialLink text="Open" ui:field="open" styleName="{style.onHoverUnderline}"/>
</m:MaterialRow>
<m:MaterialRow>
<m:MaterialLink text="Download" ui:field="download" styleName="{style.onHoverUnderline}"/>
</m:MaterialRow>
</m:MaterialColumn>
</m:MaterialRow>
</ui:UiBinder>

View File

@ -0,0 +1,7 @@
/* @url <constant name> <DataResource method name> */
@url invalidNameUrl invalidName;
.nameError{
background:#fff invalidNameUrl repeat-x bottom;
border: 1px solid #dd7870;
}

View File

@ -0,0 +1,23 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client.resources;
import com.google.gwt.resources.client.CssResource;
/**
* The Interface WorkspaceLightTreeCss.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jul 8, 2015
*/
public interface WorkspaceExplorerAppCss extends CssResource {
/**
* Name error.
*
* @return the string
*/
public String nameError();
}

View File

@ -0,0 +1,36 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client.resources;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
/**
* The Interface WorkspaceLightTreeResources.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jul 8, 2015
*/
public interface WorkspaceExplorerResources extends ClientBundle {
public static final WorkspaceExplorerResources INSTANCE = GWT.create(WorkspaceExplorerResources.class);
/**
* Root.
*
* @return the image resource
*/
@Source("_32/folder.png")
ImageResource folder();
/**
* Folder.
*
* @return the image resource
*/
@Source("_32/groups_folder.png")
ImageResource shared_folder();
}

View File

@ -0,0 +1,245 @@
/**
*
*/
package org.gcube.portlets.user.workspaceexplorerapp.client.resources;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.DataResource;
import com.google.gwt.resources.client.ImageResource;
/**
* The Interface WorkspaceLightTreeResources.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jul 8, 2015
*/
public interface WorkspaceLightTreeResources extends ClientBundle {
public static final WorkspaceLightTreeResources INSTANCE = GWT.create(WorkspaceLightTreeResources.class);
/**
* Root.
*
* @return the image resource
*/
@Source("root.png")
ImageResource root();
/**
* Folder.
*
* @return the image resource
*/
@Source("folder.png")
ImageResource folder();
/**
* Shared folder.
*
* @return the image resource
*/
@Source("shared_folder.png")
ImageResource sharedFolder();
/**
* External_image.
*
* @return the image resource
*/
@Source("external_image.gif")
ImageResource external_image();
/**
* External_pdf.
*
* @return the image resource
*/
@Source("external_pdf.gif")
ImageResource external_pdf();
/**
* External_file.
*
* @return the image resource
*/
@Source("external_file.png")
ImageResource external_file();
/**
* External_resource_link.
*
* @return the image resource
*/
@Source("external_resource_link.png")
ImageResource external_resource_link();
/**
* External_url.
*
* @return the image resource
*/
@Source("external_url.png")
ImageResource external_url();
/**
* Report_template.
*
* @return the image resource
*/
@Source("report_template.png")
ImageResource report_template();
/**
* Report.
*
* @return the image resource
*/
@Source("report.png")
ImageResource report();
/**
* Query.
*
* @return the image resource
*/
@Source("query.png")
ImageResource query();
/**
* Document.
*
* @return the image resource
*/
@Source("document.png")
ImageResource document();
/**
* Metadata.
*
* @return the image resource
*/
@Source("metadata.png")
ImageResource metadata();
/**
* Pdf_document.
*
* @return the image resource
*/
@Source("pdf_document.png")
ImageResource pdf_document();
/**
* Image_document.
*
* @return the image resource
*/
@Source("image_document.png")
ImageResource image_document();
/**
* Url_document.
*
* @return the image resource
*/
@Source("url_document.png")
ImageResource url_document();
/**
* Timeseries.
*
* @return the image resource
*/
@Source("timeseries.png")
ImageResource timeseries();
/**
* Aquamaps.
*
* @return the image resource
*/
@Source("aquamaps.png")
ImageResource aquamaps();
/**
* Workflow_report.
*
* @return the image resource
*/
@Source("workflow_report.png")
ImageResource workflow_report();
/**
* Workflow_template.
*
* @return the image resource
*/
@Source("workflow_template.png")
ImageResource workflow_template();
/**
* Unknown type.
*
* @return the image resource
*/
@Source("noimage.png")
ImageResource unknownType();
/**
* Loading.
*
* @return the image resource
*/
@Source("ajax-loader.gif")
ImageResource loading();
/**
* Gucbe item.
*
* @return the image resource
*/
@Source("gcubeItem.jpeg")
ImageResource gucbeItem();
/**
* Unknown.
*
* @return the image resource
*/
@Source("icon-unknown.gif")
ImageResource unknown();
/**
* Invalid name.
*
* @return the data resource
*/
@Source("invalid_name.gif")
DataResource invalidName();
/**
* Css.
*
* @return the workspace light tree css
*/
@Source("WorkspaceExplorerAppCss.css")
WorkspaceExplorerAppCss css();
/**
* Error.
*
* @return the image resource
*/
@Source("error.png")
ImageResource error();
/**
* Refresh.
*
* @return the image resource
*/
@Source("refresh.png")
ImageResource refresh();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 980 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 980 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 603 B

View File

@ -0,0 +1,52 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.resources.newres;
import com.github.gwtbootstrap.client.ui.constants.BaseIconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class WorkspaceExplorerAppResources {
public static final WorkspaceExplorerIcons ICONS = GWT.create(WorkspaceExplorerIcons.class);
/** Inject the icon's css once at first usage */
static {
WorkspaceExplorerIcons icons = GWT.create(WorkspaceExplorerIcons.class);
icons.css().ensureInjected();
}
public static AbstractImagePrototype getIconCancel() {
return AbstractImagePrototype.create(ICONS.cancel());
}
public static AbstractImagePrototype getIconLoading() {
return AbstractImagePrototype.create(ICONS.loading());
}
public static AbstractImagePrototype getIconInfo() {
return AbstractImagePrototype.create(ICONS.info());
}
/** My custom base icon collection */
public enum CustomIconType implements BaseIconType {
home, // Our runtime access
vre_folder,
new_folder;
private static final String PREFIX = "myBaseIcon_";
private String className;
private CustomIconType() {
this.className = this.name().toLowerCase();
}
@Override public String get() {
return PREFIX + className;
}
}
}

View File

@ -0,0 +1,41 @@
package org.gcube.portlets.user.workspaceexplorerapp.client.resources.newres;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.resources.client.ImageResource;
public interface WorkspaceExplorerIcons extends ClientBundle {
/** Get access to the css resource during gwt compilation */
@Source("baseIcons.css")
CssResource css();
@Source("cancel.png")
ImageResource cancel();
/**
* @return
*/
@Source("loading.gif")
ImageResource loading();
/**
* Our sample image icon. Makes the image resource for the gwt-compiler's
* css composer accessible
*/
@Source("loading.gif")
ImageResource logo();
@Source("vre_folder.png")
ImageResource vre_folder();
@Source("new_folder.png")
ImageResource new_folder();
@Source("home.png")
ImageResource home();
@Source("info-icon.png")
ImageResource info();
}

View File

@ -0,0 +1,32 @@
/* Prevent our icons from css obfuscation */
@external .myBaseIcon_*; /* Do some css stuff */
.myBaseIcon_home:hover {
/* opacity: 0.5; */
}
/* Our sample icon */
@sprite .myBaseIcon_home {
gwt-image: "home";
display: inline-block;
vertical-align: middle;
margin-bottom: 3px;
margin-right: 2px;
}
/* Our sample icon */
@sprite .myBaseIcon_vre_folder {
gwt-image: "vre_folder";
display: inline-block;
vertical-align: middle;
margin-bottom: 3px;
margin-right: 2px;
}
@sprite .myBaseIcon_new_folder {
gwt-image: "new_folder";
display: inline-block;
vertical-align: middle;
margin-bottom: 3px;
margin-right: 2px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 908 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 775 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 835 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

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