256: Workspace explorer
Task-Url: https://support.d4science.org/issues/256 Starting project git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@115508 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
088d475f03
commit
45dfe0dd75
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src/main/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" path="src/main/resources"/>
|
||||||
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry 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"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
|
</classpath>
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>workspace-explorer</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||||
|
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||||
|
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src/main/webapp"/>
|
||||||
|
<classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="hide" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
|
||||||
|
<classpathentry kind="output" path=""/>
|
||||||
|
</classpath>
|
|
@ -0,0 +1,6 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding//src/main/java=UTF-8
|
||||||
|
encoding//src/main/resources=UTF-8
|
||||||
|
encoding//src/test/java=UTF-8
|
||||||
|
encoding//src/test/resources=UTF-8
|
||||||
|
encoding/<project>=UTF-8
|
|
@ -0,0 +1,8 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.7
|
|
@ -0,0 +1,4 @@
|
||||||
|
activeProfiles=
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
resolveWorkspaceProjects=true
|
||||||
|
version=1
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
<wb-module deploy-name="workspace-explorer">
|
||||||
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
|
<property name="context-root" value="workspace-explorer"/>
|
||||||
|
<property name="java-output-path" value="/workspace-explorer/target/workspace-explorer-0.0.1-SNAPSHOT/WEB-INF/classes"/>
|
||||||
|
</wb-module>
|
||||||
|
</project-modules>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<faceted-project>
|
||||||
|
<fixed facet="wst.jsdt.web"/>
|
||||||
|
<installed facet="java" version="1.7"/>
|
||||||
|
<installed facet="jst.web" version="2.3"/>
|
||||||
|
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||||
|
</faceted-project>
|
|
@ -0,0 +1 @@
|
||||||
|
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
|
|
@ -0,0 +1 @@
|
||||||
|
Window
|
|
@ -0,0 +1,2 @@
|
||||||
|
disabled=06target
|
||||||
|
eclipse.preferences.version=1
|
|
@ -0,0 +1,245 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>maven-parent</artifactId>
|
||||||
|
<groupId>org.gcube.tools</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<relativePath />
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
|
<artifactId>workspace-explorer</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>gCube Workspace Explorer</name>
|
||||||
|
<description>
|
||||||
|
gCube Workspace Explorer
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<scm>
|
||||||
|
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/${project.artifactId}</connection>
|
||||||
|
<developerConnection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/${project.artifactId}</developerConnection>
|
||||||
|
<url>http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/${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>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- Google Web Toolkit (GWT) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.gwt</groupId>
|
||||||
|
<artifactId>gwt-user</artifactId>
|
||||||
|
<version>${gwtVersion}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.gwtbootstrap</groupId>
|
||||||
|
<artifactId>gwt-bootstrap</artifactId>
|
||||||
|
<version>2.3.2.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- FWS -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.resources.discovery</groupId>
|
||||||
|
<artifactId>ic-client</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.core</groupId>
|
||||||
|
<artifactId>common-scope-maps</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- END FWS -->
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||||
|
<artifactId>aslcore</artifactId>
|
||||||
|
<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>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> -->
|
||||||
|
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<!-- LOGGER -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>log4j</groupId>
|
||||||
|
<artifactId>log4j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.11</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/java</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/*.*</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>${maven.compiler.source}</source>
|
||||||
|
<target>${maven.compiler.target}</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>test-jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.12</version>
|
||||||
|
<configuration>
|
||||||
|
<skipTests>true</skipTests>
|
||||||
|
</configuration>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
<configuration>
|
||||||
|
<descriptors>
|
||||||
|
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
|
||||||
|
</descriptors>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<mainClass>fully.qualified.MainClass</mainClass>
|
||||||
|
</manifest>
|
||||||
|
</archive>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>servicearchive</id>
|
||||||
|
<phase>install</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<!-- GWT Maven Plugin - not needed -->
|
||||||
|
<!-- 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>
|
||||||
|
<configuration>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,10 @@
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client;
|
||||||
|
|
||||||
|
public interface Messages extends com.google.gwt.i18n.client.Messages {
|
||||||
|
|
||||||
|
@DefaultMessage("Enter your name")
|
||||||
|
String nameField();
|
||||||
|
|
||||||
|
@DefaultMessage("Send")
|
||||||
|
String sendButton();
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class Util.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jun 18, 2015
|
||||||
|
*/
|
||||||
|
public class Util {
|
||||||
|
|
||||||
|
public static final ItemType[] FOLDERS = new ItemType[] { ItemType.ROOT,
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client;
|
||||||
|
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entry point classes define <code>onModuleLoad()</code>.
|
||||||
|
*/
|
||||||
|
public class WorkspaceExplorer implements EntryPoint {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the entry point method.
|
||||||
|
*/
|
||||||
|
public void onModuleLoad() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client;
|
||||||
|
|
||||||
|
public class WorkspaceNavigatorConstants {
|
||||||
|
public static final String SPECIAL_FOLDERS_LABEL = "MySpecialFolders";
|
||||||
|
|
||||||
|
public static final String VRE_FOLDERS_LABEL = "My VRE Folders";
|
||||||
|
|
||||||
|
public static final String WORKSPACE_EXPLORER_CAPTION = "Workspace Explorer";
|
||||||
|
|
||||||
|
public static final String HOME_LABEL = "Home";
|
||||||
|
}
|
|
@ -0,0 +1,119 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client;
|
||||||
|
|
||||||
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.user.client.ui.Button;
|
||||||
|
import com.google.gwt.user.client.ui.DialogBox;
|
||||||
|
import com.google.gwt.user.client.ui.DockPanel;
|
||||||
|
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
||||||
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class WorspaceNavigatorDialog.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Jun 24, 2015
|
||||||
|
*/
|
||||||
|
public class WorkspaceNavigatorDialog extends DialogBox implements ClickHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
private Button cancel;
|
||||||
|
private WorkspaceNavigatorDialog INSTANCE = this;
|
||||||
|
private boolean isValidHide;
|
||||||
|
private String captionTxt;
|
||||||
|
private WorkspaceNavigatorPanel wsp = new WorkspaceNavigatorPanel(5);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new worspace navigator dialog.
|
||||||
|
*
|
||||||
|
* @param captionTxt sets the text inside the caption, if null sets "Workspace Explorer"
|
||||||
|
*/
|
||||||
|
public WorkspaceNavigatorDialog(String captionTxt) {
|
||||||
|
this.captionTxt = (captionTxt==null || captionTxt.isEmpty())?WorkspaceNavigatorConstants.WORKSPACE_EXPLORER_CAPTION:captionTxt;
|
||||||
|
setText(this.captionTxt);
|
||||||
|
isValidHide = false;
|
||||||
|
cancel = new Button("Close");
|
||||||
|
|
||||||
|
DockPanel dock = new DockPanel();
|
||||||
|
dock.setSpacing(5);
|
||||||
|
|
||||||
|
// dock.add(okButton, DockPanel.SOUTH);
|
||||||
|
// dock.add(cancel, DockPanel.SOUTH);
|
||||||
|
|
||||||
|
HorizontalPanel hp = new HorizontalPanel();
|
||||||
|
hp.setStyleName("margin-auto");
|
||||||
|
//// hp.add(okButton);
|
||||||
|
// hp.setWidth("50%");
|
||||||
|
// hp.setStyleAttribute("margin", "0 auto");
|
||||||
|
hp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
||||||
|
cancel.getElement().getStyle().setMarginTop(5.0, Unit.PX);
|
||||||
|
// cancel.getElement().getStyle().setMarginBottom(5.0, Unit.PX);
|
||||||
|
// hp.getElement().getStyle().setMarginLeft("0 auto", Unit.PCT);
|
||||||
|
hp.add(cancel);
|
||||||
|
dock.add(hp, DockPanel.SOUTH);
|
||||||
|
|
||||||
|
dock.add(wsp, DockPanel.CENTER);
|
||||||
|
|
||||||
|
dock.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
||||||
|
dock.setWidth("100%");
|
||||||
|
setWidget(dock);
|
||||||
|
|
||||||
|
// okButton.addClickHandler(new ClickHandler() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onClick(ClickEvent event) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
cancel.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
isValidHide = false;
|
||||||
|
INSTANCE.hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event
|
||||||
|
* .dom.client.ClickEvent)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the captionTxt
|
||||||
|
*/
|
||||||
|
public String getCaptionTxt() {
|
||||||
|
return captionTxt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is valid hide.
|
||||||
|
*
|
||||||
|
* @return the isValidHide
|
||||||
|
*/
|
||||||
|
public boolean isValidHide() {
|
||||||
|
return isValidHide;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
super.show();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.view.Breadcrumbs;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.view.Navigation;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.view.WorkspaceNavigator;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.ui.DockPanel;
|
||||||
|
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class SplitPanel.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Jun 23, 2015
|
||||||
|
*/
|
||||||
|
public class WorkspaceNavigatorPanel extends DockPanel{
|
||||||
|
|
||||||
|
public int width = 550;
|
||||||
|
public int height = 400;
|
||||||
|
public int west_width = 130;
|
||||||
|
|
||||||
|
private ScrollPanel westPanel = new ScrollPanel();
|
||||||
|
private ScrollPanel centerScrollable = new ScrollPanel();
|
||||||
|
private Breadcrumbs breadcrumbs = new Breadcrumbs();
|
||||||
|
private Navigation navigation = new Navigation();
|
||||||
|
private WorkspaceNavigator wsExplorer = new WorkspaceNavigator();
|
||||||
|
/**
|
||||||
|
* Instantiates a new split panel.
|
||||||
|
*/
|
||||||
|
public WorkspaceNavigatorPanel(int splitterSize) {
|
||||||
|
// setStyleName("cw-DockPanel");
|
||||||
|
ensureDebugId("WorkspaceNavigatorPanel");
|
||||||
|
setSpacing(4);
|
||||||
|
// setHorizontalAlignment(DockPanel.ALIGN_CENTER);
|
||||||
|
|
||||||
|
add(breadcrumbs, DockPanel.NORTH);
|
||||||
|
// northPanel.add(breadcrumbs);
|
||||||
|
westPanel.setWidth(west_width+"px");
|
||||||
|
westPanel.add(navigation);
|
||||||
|
add(westPanel, DockPanel.WEST);
|
||||||
|
|
||||||
|
centerScrollable.setSize(width+"px", height+"px");
|
||||||
|
centerScrollable.add(wsExplorer.getExplorerPanel());
|
||||||
|
add(centerScrollable, DockPanel.CENTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the westPanel
|
||||||
|
*/
|
||||||
|
public ScrollPanel getWestPanel() {
|
||||||
|
return westPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the centerScrollable
|
||||||
|
*/
|
||||||
|
public ScrollPanel getCenterScrollable() {
|
||||||
|
return centerScrollable;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,180 @@
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client.grid;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.resources.CellTableResources;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.CellTable;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Pagination;
|
||||||
|
import com.google.gwt.core.shared.GWT;
|
||||||
|
import com.google.gwt.event.dom.client.DoubleClickEvent;
|
||||||
|
import com.google.gwt.event.dom.client.DoubleClickHandler;
|
||||||
|
import com.google.gwt.user.cellview.client.AbstractCellTable;
|
||||||
|
import com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy.KeyboardSelectionPolicy;
|
||||||
|
import com.google.gwt.user.cellview.client.SimplePager;
|
||||||
|
import com.google.gwt.view.client.ListDataProvider;
|
||||||
|
import com.google.gwt.view.client.SelectionChangeEvent;
|
||||||
|
import com.google.gwt.view.client.SelectionChangeEvent.Handler;
|
||||||
|
import com.google.gwt.view.client.SingleSelectionModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class AbstractItemTable.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 19, 2015
|
||||||
|
*/
|
||||||
|
public abstract class AbstractItemsCellTable {
|
||||||
|
|
||||||
|
protected CellTable<Item> cellTable;
|
||||||
|
protected ListDataProvider<Item> dataProvider = new ListDataProvider<Item>();
|
||||||
|
protected boolean showGroupId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inits the table.
|
||||||
|
*
|
||||||
|
* @param ItemTable
|
||||||
|
* the Item table
|
||||||
|
* @param pager
|
||||||
|
* the pager
|
||||||
|
* @param pagination
|
||||||
|
* the pagination
|
||||||
|
*/
|
||||||
|
public abstract void initTable(AbstractCellTable<Item> ItemTable,
|
||||||
|
final SimplePager pager, final Pagination pagination);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new abstract Item table.
|
||||||
|
*
|
||||||
|
* @param showGroupId
|
||||||
|
* the show group id
|
||||||
|
*/
|
||||||
|
public AbstractItemsCellTable(boolean showGroupId) {
|
||||||
|
this.showGroupId = showGroupId;
|
||||||
|
cellTable = new CellTable<Item>(1, CellTableResources.INSTANCE);
|
||||||
|
cellTable.addStyleName("table-overflow");
|
||||||
|
cellTable.setStriped(true);
|
||||||
|
cellTable.setBordered(true);
|
||||||
|
// cellTable.setCondensed(true);
|
||||||
|
cellTable.setWidth("98%", true);
|
||||||
|
dataProvider.addDataDisplay(cellTable);
|
||||||
|
initTable(cellTable, null, null);
|
||||||
|
cellTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
|
||||||
|
|
||||||
|
final SingleSelectionModel<Item> ssm = new SingleSelectionModel<Item>();
|
||||||
|
cellTable.setSelectionModel(ssm);
|
||||||
|
ssm.addSelectionChangeHandler(new Handler() {
|
||||||
|
@Override
|
||||||
|
public void onSelectionChange(final SelectionChangeEvent event)
|
||||||
|
{
|
||||||
|
final Item selectedObject = ssm.getSelectedObject();
|
||||||
|
GWT.log("Clicked: "+selectedObject);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cellTable.addDomHandler(new DoubleClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDoubleClick(final DoubleClickEvent event) {
|
||||||
|
Item selected = ssm.getSelectedObject();
|
||||||
|
if (selected != null) {
|
||||||
|
GWT.log("Double Click: "+selected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
DoubleClickEvent.getType());
|
||||||
|
/*
|
||||||
|
cellTable.addCellPreviewHandler(new CellPreviewEvent.Handler<Item> () {
|
||||||
|
long lastClick=-1000;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCellPreview(CellPreviewEvent<Item> event) {
|
||||||
|
long clictAt = System.currentTimeMillis();
|
||||||
|
GWT.log("clickAt: "+(clictAt));
|
||||||
|
GWT.log("lastClick: "+(lastClick));
|
||||||
|
if(event.getNativeEvent().getType().contains("click")){
|
||||||
|
GWT.log(""+(clictAt-lastClick));
|
||||||
|
if(clictAt-lastClick < 300) { // dblclick on 2 clicks detected within 300 ms
|
||||||
|
Window.alert("I am a double click crafted event!");
|
||||||
|
}
|
||||||
|
lastClick = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}); */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the Items.
|
||||||
|
*
|
||||||
|
* @param Items
|
||||||
|
* the Items
|
||||||
|
*/
|
||||||
|
public void addItems(List<Item> Items) {
|
||||||
|
dataProvider.getList().clear();
|
||||||
|
|
||||||
|
for (Item pckg : Items)
|
||||||
|
addItem(pckg);
|
||||||
|
|
||||||
|
cellTable.setPageSize(Items.size() + 1);
|
||||||
|
cellTable.redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the Item.
|
||||||
|
*
|
||||||
|
* @param pckg
|
||||||
|
* the pckg
|
||||||
|
*/
|
||||||
|
private void addItem(Item pckg) {
|
||||||
|
dataProvider.getList().add(pckg);
|
||||||
|
dataProvider.flush();
|
||||||
|
dataProvider.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the cell tables.
|
||||||
|
*
|
||||||
|
* @return the cell tables
|
||||||
|
*/
|
||||||
|
public CellTable<Item> getCellTable() {
|
||||||
|
return cellTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the data provider.
|
||||||
|
*
|
||||||
|
* @return the data provider
|
||||||
|
*/
|
||||||
|
public ListDataProvider<Item> getDataProvider() {
|
||||||
|
return dataProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is show group id.
|
||||||
|
*
|
||||||
|
* @return true, if is show group id
|
||||||
|
*/
|
||||||
|
public boolean isShowGroupId() {
|
||||||
|
return showGroupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the data provider.
|
||||||
|
*
|
||||||
|
* @param dataProvider
|
||||||
|
* the new data provider
|
||||||
|
*/
|
||||||
|
public void setDataProvider(ListDataProvider<Item> dataProvider) {
|
||||||
|
this.dataProvider = dataProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the show group id.
|
||||||
|
*
|
||||||
|
* @param showGroupId
|
||||||
|
* the new show group id
|
||||||
|
*/
|
||||||
|
public void setShowGroupId(boolean showGroupId) {
|
||||||
|
this.showGroupId = showGroupId;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,208 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client.grid;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Pagination;
|
||||||
|
import com.google.gwt.cell.client.Cell.Context;
|
||||||
|
import com.google.gwt.cell.client.ImageResourceCell;
|
||||||
|
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.resources.client.ImageResource;
|
||||||
|
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||||
|
import com.google.gwt.user.cellview.client.AbstractCellTable;
|
||||||
|
import com.google.gwt.user.cellview.client.Column;
|
||||||
|
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
|
||||||
|
import com.google.gwt.user.cellview.client.SimplePager;
|
||||||
|
import com.google.gwt.user.cellview.client.TextColumn;
|
||||||
|
import com.google.gwt.user.client.ui.Label;
|
||||||
|
import com.google.gwt.view.client.SelectionChangeEvent;
|
||||||
|
import com.google.gwt.view.client.SelectionChangeEvent.Handler;
|
||||||
|
import com.google.gwt.view.client.SingleSelectionModel;
|
||||||
|
/**
|
||||||
|
* The Class PackagesTable.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Feb 19, 2015
|
||||||
|
*/
|
||||||
|
public class ItemsTable extends AbstractItemsCellTable{
|
||||||
|
|
||||||
|
private Column<Item, ImageResource> icon;
|
||||||
|
private TextColumn<Item> name;
|
||||||
|
private TextColumn<Item> owner;
|
||||||
|
private TextColumn<Item> lastModified;
|
||||||
|
/**
|
||||||
|
* Instantiates a new packages table.
|
||||||
|
*
|
||||||
|
* @param showGroupId the show group id
|
||||||
|
*/
|
||||||
|
public ItemsTable(boolean showGroupId) {
|
||||||
|
super(showGroupId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.gcube.portlets.admin.gcubereleases.client.view.AbstractPackageTable#addPackages(java.util.List)
|
||||||
|
*/
|
||||||
|
public void addItems(List<Item> packages) {
|
||||||
|
dataProvider.getList().clear();
|
||||||
|
|
||||||
|
for (Item pckg : packages)
|
||||||
|
addItem(pckg);
|
||||||
|
|
||||||
|
cellTable.setPageSize(packages.size()+1);
|
||||||
|
cellTable.redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the package.
|
||||||
|
*
|
||||||
|
* @param pckg the pckg
|
||||||
|
*/
|
||||||
|
private void addItem(Item pckg) {
|
||||||
|
dataProvider.getList().add(pckg);
|
||||||
|
dataProvider.flush();
|
||||||
|
dataProvider.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (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(AbstractCellTable<Item> packageTable, final SimplePager pager, final Pagination pagination) {
|
||||||
|
packageTable.setEmptyTableWidget(new Label("No data."));
|
||||||
|
|
||||||
|
double artifactIDWidht = 40.0;
|
||||||
|
|
||||||
|
//ICONS
|
||||||
|
ImageResourceCell iconResourceCell = new ImageResourceCell() {
|
||||||
|
public Set<String> getConsumedEvents() {
|
||||||
|
HashSet<String> events = new HashSet<String>();
|
||||||
|
events.add("click");
|
||||||
|
return events;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
icon = new Column<Item, ImageResource>(iconResourceCell) {
|
||||||
|
@Override
|
||||||
|
public ImageResource getValue(Item dataObj) {
|
||||||
|
|
||||||
|
// if(dataObj.getURL()!=null && !dataObj.getURL().isEmpty())
|
||||||
|
// return Icons.ICONS.download();
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBrowserEvent(Context context, Element elem, Item object, NativeEvent event) {
|
||||||
|
super.onBrowserEvent(context, elem, object, event);
|
||||||
|
if ("click".equals(event.getType())) {
|
||||||
|
// Window.open(object.getURL(), "_blank", "");
|
||||||
|
// GcubeReleasesAppController.eventBus.fireEvent(new PackageClickEvent(object, AccoutingReference.DOWNLOAD));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.google.gwt.user.cellview.client.Column#render(com.google.gwt.cell.client.Cell.Context, java.lang.Object, com.google.gwt.safehtml.shared.SafeHtmlBuilder)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void render(Context context, Item object, SafeHtmlBuilder sb) {
|
||||||
|
super.render(context, object, sb);
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//ARTIFACT ID
|
||||||
|
name = new TextColumn<Item>() {
|
||||||
|
@Override
|
||||||
|
public String getValue(Item object) {
|
||||||
|
return object.getName();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
name.setSortable(true);
|
||||||
|
packageTable.addColumn(name, "Name");
|
||||||
|
packageTable.setColumnWidth(name, artifactIDWidht, Unit.PCT);
|
||||||
|
|
||||||
|
ListHandler<Item> nameColumnHandler = new ListHandler<Item>(dataProvider.getList());
|
||||||
|
nameColumnHandler.setComparator(name, new Comparator<Item>() {
|
||||||
|
@Override
|
||||||
|
public int compare(Item o1, Item o2) {
|
||||||
|
return o1.getName().compareTo(o2.getName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
packageTable.addColumnSortHandler(nameColumnHandler);
|
||||||
|
/*
|
||||||
|
owner = new TextColumn<Item>() {
|
||||||
|
@Override
|
||||||
|
public String getValue(Item object) {
|
||||||
|
return object.getVersion() != null ? object.getVersion() : "";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
owner.setCellStyleNames("img-centered-clickable");
|
||||||
|
owner.setSortable(true);
|
||||||
|
packageTable.addColumn(owner, "Version");
|
||||||
|
|
||||||
|
packageTable.setColumnWidth(owner, 10.0, Unit.PCT);
|
||||||
|
*/
|
||||||
|
|
||||||
|
icon.setCellStyleNames("img-centered-clickable");
|
||||||
|
icon.setSortable(false);
|
||||||
|
packageTable.addColumn(icon, "Download");
|
||||||
|
packageTable.setColumnWidth(icon, 10.0, Unit.PCT);
|
||||||
|
|
||||||
|
//MAVEN COORDS
|
||||||
|
ImageResourceCell myImgMavenCell = new ImageResourceCell() {
|
||||||
|
public Set<String> getConsumedEvents() {
|
||||||
|
HashSet<String> events = new HashSet<String>();
|
||||||
|
events.add("click");
|
||||||
|
return events;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
//AS LINK
|
||||||
|
final SafeHtmlRenderer<String> mvnCoordinatesRenderer = new AbstractSafeHtmlRenderer<String>() {
|
||||||
|
@Override
|
||||||
|
public SafeHtml render(String object) {
|
||||||
|
SafeHtmlBuilder sb = new SafeHtmlBuilder();
|
||||||
|
sb.appendHtmlConstant("<a target=\"_blank\" href=\""+object+"\">").appendEscaped("Maven Repo").appendHtmlConstant("</a>");
|
||||||
|
return sb.toSafeHtml();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
mvnCoordinates = new Column<Package, String>(new ClickableTextCell(mvnCoordinatesRenderer)) {
|
||||||
|
@Override
|
||||||
|
public String getValue(Package object) {
|
||||||
|
return "http://maven.research-infrastructures.eu/nexus/index.html#nexus-search;quick~"+object.getArtifactID();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
*/
|
||||||
|
// mvn.setSortable(false);
|
||||||
|
|
||||||
|
final SingleSelectionModel<Item> selectionModel = new SingleSelectionModel<Item>();
|
||||||
|
selectionModel.addSelectionChangeHandler(new Handler() {
|
||||||
|
@Override
|
||||||
|
public void onSelectionChange(SelectionChangeEvent event) {
|
||||||
|
// Package p = selectionModel.getSelectedObject();
|
||||||
|
// CellTables.this.driver.edit(person);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// exampleTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.BOUND_TO_SELECTION);
|
||||||
|
// packageTable.setSelectionModel(selectionModel);
|
||||||
|
// pager.setDisplay(exampleTable);
|
||||||
|
// pagination.clear();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,251 @@
|
||||||
|
/* * Copyright 2010 Google Inc . */
|
||||||
|
/* * */
|
||||||
|
/* * Licensed under the Apache License, Version 2.0 (the "License "); you may not */
|
||||||
|
/* * use this file except in compliance with the License . You may obtain a copy of */
|
||||||
|
/* * the License at */
|
||||||
|
/* * */
|
||||||
|
/* * http: //www.apache.org /licenses/LICENSE-2.0 */
|
||||||
|
/* * */
|
||||||
|
/* * Unless required by applicable law or agreed to in writing, software */
|
||||||
|
/* * distributed under the License is distributed on an "AS IS " BASIS, */
|
||||||
|
/* WITHOUT */
|
||||||
|
/* * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied . See the */
|
||||||
|
/* * License for the specific language governing permissions and limitations under */
|
||||||
|
/* * the License . */
|
||||||
|
/* * / */
|
||||||
|
/* @def selectionBorderWidth 2px ; */
|
||||||
|
/* .cellTableWidget { */
|
||||||
|
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableFirstColumn { */
|
||||||
|
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableLastColumn { */
|
||||||
|
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableFooter { */
|
||||||
|
/* border-top: 2px solid #6f7277; */
|
||||||
|
/* padding: 3px 15px; */
|
||||||
|
/* text-align: left; */
|
||||||
|
/* color: #4b4a4a; */
|
||||||
|
/* text-shadow: #ddf 1px 1px 0; */
|
||||||
|
/* overflow: hidden; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableHeader { */
|
||||||
|
/* border-bottom: 2px solid #6f7277; */
|
||||||
|
/* padding: 3px 15px; */
|
||||||
|
/* text-align: left; */
|
||||||
|
/* color: #4b4a4a; */
|
||||||
|
/* text-shadow: #ddf 1px 1px 0; */
|
||||||
|
/* overflow: hidden; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableCell { */
|
||||||
|
/* padding: 2px 15px; */
|
||||||
|
/* overflow: hidden; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableFirstColumnFooter { */
|
||||||
|
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableFirstColumnHeader { */
|
||||||
|
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableLastColumnFooter { */
|
||||||
|
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableLastColumnHeader { */
|
||||||
|
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableSortableHeader { */
|
||||||
|
/* cursor: pointer; */
|
||||||
|
/* cursor: hand; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableSortableHeader:hover { */
|
||||||
|
/* color: #6c6b6b; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableSortedHeaderAscending { */
|
||||||
|
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableSortedHeaderDescending { */
|
||||||
|
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableEvenRow { */
|
||||||
|
/* background: #ffffff; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableEvenRowCell { */
|
||||||
|
/* border: selectionBorderWidth solid #ffffff; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableOddRow { */
|
||||||
|
/* background: #f3f7fb; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableOddRowCell { */
|
||||||
|
/* border: selectionBorderWidth solid #f3f7fb; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableHoveredRow { */
|
||||||
|
/* background: #eee; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableHoveredRowCell { */
|
||||||
|
/* border: selectionBorderWidth solid #eee; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableKeyboardSelectedRow { */
|
||||||
|
/* background: #ffc; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableKeyboardSelectedRowCell { */
|
||||||
|
/* border: selectionBorderWidth solid #ffc; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableSelectedRow { */
|
||||||
|
/* background: #628cd5; */
|
||||||
|
/* color: white; */
|
||||||
|
/* height: auto; */
|
||||||
|
/* overflow: auto; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
/* .cellTableSelectedRowCell { */
|
||||||
|
/* border: selectionBorderWidth solid #628cd5; */
|
||||||
|
/* } */
|
||||||
|
/* /** */
|
||||||
|
/* * The keyboard selected cell is visible over selection. */
|
||||||
|
/* */
|
||||||
|
* /
|
||||||
|
/* .cellTableKeyboardSelectedCell { */
|
||||||
|
/* border: selectionBorderWidth solid #d7dde8; */
|
||||||
|
/* } */
|
||||||
|
/* .cellTableLoading { */
|
||||||
|
/* margin: 30px; */
|
||||||
|
/* } */
|
||||||
|
|
||||||
|
@def selectionBorderWidth 1px ; .cellTableWidget {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableFirstColumn {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableLastColumn {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableFooter {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableHeader {
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableCell {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableFirstColumnFooter {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableFirstColumnHeader {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableLastColumnFooter {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableLastColumnHeader {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableSortableHeader {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableSortableHeader:hover {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableSortedHeaderAscending {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableSortedHeaderDescending {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableEvenRow {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableEvenRowCell {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableOddRow {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableOddRowCell {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableHoveredRow {
|
||||||
|
background: #D9EDF7 !important;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableHoveredRowCell {
|
||||||
|
background: #D9EDF7 !important;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableKeyboardSelectedRow, .cellTableKeyboardSelectedRow td,
|
||||||
|
.cellTableKeyboardSelectedRow th {
|
||||||
|
background: #3A87AD !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableSelectedRow, .cellTableSelectedRow td, .cellTableSelectedRow th
|
||||||
|
{
|
||||||
|
/* background: #D9EDF7 !important; */
|
||||||
|
/* color: white !important; */
|
||||||
|
/* height: auto; */
|
||||||
|
/* overflow: auto; */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableSelectedRowCell, .cellTableSelectedRow td.cellTableSelectedRowCell
|
||||||
|
{
|
||||||
|
background: #3A87AD !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableKeyboardSelectedRowCell, .cellTableKeyboardSelectedRow td.cellTableKeyboardSelectedRowCell
|
||||||
|
{
|
||||||
|
background: #3A87AD !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableKeyboardSelectedCell, .cellTableKeyboardSelectedRow td.cellTableKeyboardSelectedCell
|
||||||
|
{
|
||||||
|
background: #3A87AD !important;
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cellTableLoading {
|
||||||
|
margin: 30px;
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client.resources;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.CellTable;
|
||||||
|
import com.github.gwtbootstrap.client.ui.CellTable.Resources;
|
||||||
|
import com.google.gwt.core.shared.GWT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Jun 23, 2015
|
||||||
|
*/
|
||||||
|
public interface CellTableResources extends Resources {
|
||||||
|
|
||||||
|
public CellTableResources INSTANCE = GWT.create(CellTableResources.class);
|
||||||
|
|
||||||
|
// The styles used in this widget.
|
||||||
|
@Override
|
||||||
|
@Source("CellTable.css")
|
||||||
|
CellTable.Style cellTableStyle();
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client.resources;
|
||||||
|
|
||||||
|
import com.google.gwt.resources.client.ClientBundle;
|
||||||
|
import com.google.gwt.resources.client.ImageResource;
|
||||||
|
|
||||||
|
public interface Icons extends ClientBundle {
|
||||||
|
|
||||||
|
@Source("cancel.png")
|
||||||
|
ImageResource cancel();
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client.resources;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.resources.client.ImageResource;
|
||||||
|
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Resources {
|
||||||
|
|
||||||
|
public static final Icons ICONS = GWT.create(Icons.class);
|
||||||
|
|
||||||
|
|
||||||
|
public static AbstractImagePrototype getIconCancel(){
|
||||||
|
|
||||||
|
return AbstractImagePrototype.create(ICONS.cancel());
|
||||||
|
}
|
||||||
|
public static ImageResource getImageCancel() {
|
||||||
|
return ICONS.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 908 B |
|
@ -0,0 +1,57 @@
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client.rpc;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.WorkspaceNavigatorServiceException;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.RemoteService;
|
||||||
|
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The client side stub for the RPC service.
|
||||||
|
*/
|
||||||
|
@RemoteServiceRelativePath("greet")
|
||||||
|
public interface WorkspaceExplorerService extends RemoteService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param itemIdentifier
|
||||||
|
* @param includeItemAsParent
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
List<Item> getListParentsByItemIdentifier(String itemIdentifier,
|
||||||
|
boolean includeItemAsParent) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name
|
||||||
|
* @return
|
||||||
|
* @throws WorkspaceNavigatorServiceException
|
||||||
|
*/
|
||||||
|
boolean checkName(String name) throws WorkspaceNavigatorServiceException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param folderId
|
||||||
|
* @param showableTypes
|
||||||
|
* @param purgeEmpyFolders
|
||||||
|
* @param filterCriteria
|
||||||
|
* @return
|
||||||
|
* @throws WorkspaceNavigatorServiceException
|
||||||
|
*/
|
||||||
|
Item getFolder(String folderId, List<ItemType> showableTypes,
|
||||||
|
boolean purgeEmpyFolders, FilterCriteria filterCriteria)
|
||||||
|
throws WorkspaceNavigatorServiceException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param showableTypes
|
||||||
|
* @param purgeEmpyFolders
|
||||||
|
* @param filterCriteria
|
||||||
|
* @return
|
||||||
|
* @throws WorkspaceNavigatorServiceException
|
||||||
|
*/
|
||||||
|
Item getRoot(List<ItemType> showableTypes, boolean purgeEmpyFolders,
|
||||||
|
FilterCriteria filterCriteria)
|
||||||
|
throws WorkspaceNavigatorServiceException;
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client.rpc;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Jun 24, 2015
|
||||||
|
*/
|
||||||
|
public interface WorkspaceExplorerServiceAsync {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the root.
|
||||||
|
*
|
||||||
|
* @param showableTypes
|
||||||
|
* the showable types
|
||||||
|
* @param purgeEmpyFolders
|
||||||
|
* the purge empy folders
|
||||||
|
* @param filterCriteria
|
||||||
|
* the filter criteria
|
||||||
|
* @param callback
|
||||||
|
* the callback
|
||||||
|
* @return the root
|
||||||
|
*/
|
||||||
|
public void getRoot(List<ItemType> showableTypes, boolean purgeEmpyFolders,
|
||||||
|
FilterCriteria filterCriteria, AsyncCallback<Item> callback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check name.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* the name
|
||||||
|
* @param callback
|
||||||
|
* the callback
|
||||||
|
*/
|
||||||
|
public void checkName(String name, AsyncCallback<Boolean> callback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the folder.
|
||||||
|
*
|
||||||
|
* @param folderId
|
||||||
|
* the folder id
|
||||||
|
* @param showableTypes
|
||||||
|
* the showable types
|
||||||
|
* @param purgeEmpyFolders
|
||||||
|
* the purge empy folders
|
||||||
|
* @param filterCriteria
|
||||||
|
* the filter criteria
|
||||||
|
* @param callback
|
||||||
|
* the callback
|
||||||
|
* @return the folder
|
||||||
|
*/
|
||||||
|
public void getFolder(String folderId, List<ItemType> showableTypes,
|
||||||
|
boolean purgeEmpyFolders, FilterCriteria filterCriteria,
|
||||||
|
AsyncCallback<Item> callback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the list parents by item identifier.
|
||||||
|
*
|
||||||
|
* @param itemIdentifier the item identifier
|
||||||
|
* @param includeItemAsParent the include item as parent
|
||||||
|
* @param callback the callback
|
||||||
|
* @return the list parents by item identifier
|
||||||
|
*/
|
||||||
|
public void getListParentsByItemIdentifier(String itemIdentifier,
|
||||||
|
boolean includeItemAsParent, AsyncCallback<List<Item>> callback);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,137 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client.view;
|
||||||
|
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||||
|
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.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class Breadcrumbs.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jun 23, 2015
|
||||||
|
*/
|
||||||
|
public class Breadcrumbs extends Composite {
|
||||||
|
|
||||||
|
public static final String DIVIDER = ">";
|
||||||
|
private LinkedHashMap<String, Item> hashFileModel = new LinkedHashMap<String, Item>();// Ordered-HashMap
|
||||||
|
private Item lastParent;
|
||||||
|
private static BreadcrumbsUiBinder uiBinder = GWT.create(BreadcrumbsUiBinder.class);
|
||||||
|
private NavLink homeLink = new NavLink("Home");
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
com.github.gwtbootstrap.client.ui.Breadcrumbs breadcrumbs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface BreadcrumbsUiBinder.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jun 23,
|
||||||
|
* 2015
|
||||||
|
*/
|
||||||
|
interface BreadcrumbsUiBinder extends UiBinder<Widget, Breadcrumbs> {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new breadcrumbs.
|
||||||
|
*
|
||||||
|
* @param rootName
|
||||||
|
* the root name
|
||||||
|
*/
|
||||||
|
public Breadcrumbs() {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
breadcrumbs.setDivider(DIVIDER);
|
||||||
|
initBreadcrumbs();
|
||||||
|
// initBreadcrumb(true);
|
||||||
|
this.addStyleName("breadcrumbs-navigator");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the path.
|
||||||
|
*
|
||||||
|
* @param parents
|
||||||
|
* the new path
|
||||||
|
*/
|
||||||
|
public void setPath(List<Item> parents) {
|
||||||
|
initBreadcrumbs();
|
||||||
|
if (parents != null && parents.size() > 0) {
|
||||||
|
hashFileModel = new LinkedHashMap<String, Item>();
|
||||||
|
for (Item parent : parents) {
|
||||||
|
addNavigationLink(parent);
|
||||||
|
hashFileModel.put(parent.getId(), parent);
|
||||||
|
}
|
||||||
|
lastParent = parents.get(parents.size() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset breadcrumbs.
|
||||||
|
*/
|
||||||
|
private void initBreadcrumbs() {
|
||||||
|
breadcrumbs.clear();
|
||||||
|
breadcrumbs.add(new NavLink(""));// INIT
|
||||||
|
breadcrumbs.add(homeLink);// INIT
|
||||||
|
breadcrumbs.add(new NavLink("2"));// INIT
|
||||||
|
}
|
||||||
|
|
||||||
|
// @UiHandler("add")
|
||||||
|
/**
|
||||||
|
* Adds the navigation link.
|
||||||
|
*
|
||||||
|
* @param parent
|
||||||
|
* the parent
|
||||||
|
*/
|
||||||
|
public void addNavigationLink(Item parent) {
|
||||||
|
if (parent != null && parent.getParent() != null) {
|
||||||
|
final NavLink navLink = new NavLink(parent.getName());
|
||||||
|
navLink.setName(parent.getId());
|
||||||
|
breadcrumbs.add(navLink);
|
||||||
|
|
||||||
|
navLink.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
|
||||||
|
Item target = hashFileModel.get(navLink.getName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else { // is Root
|
||||||
|
// final NavLink navLink = new NavLink("");
|
||||||
|
NavLink navLink = new NavLink("");
|
||||||
|
breadcrumbs.add(navLink);// INIT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Breadcrumb is empty.
|
||||||
|
*
|
||||||
|
* @return true, if successful
|
||||||
|
*/
|
||||||
|
public boolean breadcrumbIsEmpty() {
|
||||||
|
|
||||||
|
if (hashFileModel.size() == 0)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the last parent.
|
||||||
|
*
|
||||||
|
* @return the last parent
|
||||||
|
*/
|
||||||
|
public Item getLastParent() {
|
||||||
|
return lastParent;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||||
|
<!-- <g:FlowPanel styleName="{style.pretty}"> -->
|
||||||
|
<b:FluidRow>
|
||||||
|
<b:Breadcrumbs ui:field="breadcrumbs">
|
||||||
|
</b:Breadcrumbs>
|
||||||
|
</b:FluidRow>
|
||||||
|
</ui:UiBinder>
|
|
@ -0,0 +1,55 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client.view;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceNavigatorConstants;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.NavWidget;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
|
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
|
||||||
|
* Jun 24, 2015
|
||||||
|
*/
|
||||||
|
public class Navigation extends Composite{
|
||||||
|
|
||||||
|
private static NavigationUiBinder uiBinder = GWT.create(NavigationUiBinder.class);
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
NavWidget home;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
NavWidget vre_folder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface BreadcrumbsUiBinder.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Jun 23, 2015
|
||||||
|
*/
|
||||||
|
interface NavigationUiBinder extends UiBinder<Widget, Navigation> {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public Navigation() {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
getElement().getStyle().setMarginLeft(5.0, Unit.PX);
|
||||||
|
home.setActive(true);
|
||||||
|
home.setText(WorkspaceNavigatorConstants.HOME_LABEL);
|
||||||
|
home.setIcon(IconType.HOME);
|
||||||
|
|
||||||
|
vre_folder.setActive(true);
|
||||||
|
vre_folder.setText(WorkspaceNavigatorConstants.VRE_FOLDERS_LABEL);
|
||||||
|
vre_folder.setIcon(IconType.FOLDER_OPEN_ALT);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
<!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:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||||
|
<g:FlowPanel>
|
||||||
|
<b:NavWidget ui:field="home">
|
||||||
|
</b:NavWidget>
|
||||||
|
<b:NavWidget ui:field="vre_folder">
|
||||||
|
</b:NavWidget>
|
||||||
|
</g:FlowPanel>
|
||||||
|
</ui:UiBinder>
|
|
@ -0,0 +1,133 @@
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.client.view;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.Util;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.grid.ItemsTable;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerServiceAsync;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entry point classes define <code>onModuleLoad()</code>.
|
||||||
|
*/
|
||||||
|
public class WorkspaceNavigator {
|
||||||
|
|
||||||
|
private final WorkspaceExplorerServiceAsync workspaceNavigatorService = GWT.create(WorkspaceExplorerService.class);
|
||||||
|
protected static final HorizontalPanel LOADING_PANEL = new HorizontalPanel();
|
||||||
|
|
||||||
|
static {
|
||||||
|
LOADING_PANEL.setSpacing(3);
|
||||||
|
// LOADING_PANEL.add(LOADING_IMAGE);
|
||||||
|
LOADING_PANEL.add(new HTML("Loading..."));
|
||||||
|
}
|
||||||
|
protected List<ItemType> selectableTypes = new ArrayList<ItemType>();
|
||||||
|
protected List<ItemType> showableTypes = new ArrayList<ItemType>();
|
||||||
|
protected List<String> allowedMimeTypes = new ArrayList<String>();
|
||||||
|
protected boolean showEmptyFolders = true;
|
||||||
|
protected Map<String, String> requiredProperties = new HashMap<String, String>();
|
||||||
|
/**
|
||||||
|
* Create a remote service proxy to talk to the server-side Greeting
|
||||||
|
* service.
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected ScrollPanel explorerPanel;
|
||||||
|
|
||||||
|
public WorkspaceNavigator() {
|
||||||
|
// as default all items are showable and selectable
|
||||||
|
for (ItemType type : ItemType.values()) {
|
||||||
|
showableTypes.add(type);
|
||||||
|
selectableTypes.add(type);
|
||||||
|
}
|
||||||
|
explorerPanel = new ScrollPanel();
|
||||||
|
|
||||||
|
// sp.setWidth(width+"px");
|
||||||
|
// sp.setHeight(height+"px");
|
||||||
|
|
||||||
|
loadTree();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the panel in loading mode.
|
||||||
|
*/
|
||||||
|
protected void setLoading() {
|
||||||
|
explorerPanel.clear();
|
||||||
|
explorerPanel.add(LOADING_PANEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the Workspace Tree.
|
||||||
|
*/
|
||||||
|
public void loadTree() {
|
||||||
|
GWT.log("loading tree data");
|
||||||
|
setLoading();
|
||||||
|
|
||||||
|
// we make a copy of showable types
|
||||||
|
List<ItemType> showableTypesParam = new ArrayList<ItemType>(
|
||||||
|
showableTypes);
|
||||||
|
|
||||||
|
// we get sure that folders are displayed
|
||||||
|
for (ItemType folder : Util.FOLDERS) {
|
||||||
|
if (!showableTypesParam.contains(folder))
|
||||||
|
showableTypesParam.add(folder);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean purgeEmpyFolders = !showEmptyFolders;
|
||||||
|
|
||||||
|
FilterCriteria filterCriteria = new FilterCriteria(allowedMimeTypes,
|
||||||
|
requiredProperties);
|
||||||
|
|
||||||
|
GWT.log("loading workspace tree from server");
|
||||||
|
|
||||||
|
workspaceNavigatorService.getRoot(showableTypesParam, purgeEmpyFolders,
|
||||||
|
filterCriteria, new AsyncCallback<Item>() {
|
||||||
|
|
||||||
|
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
GWT.log("Error loading workspace tree from server",
|
||||||
|
caught);
|
||||||
|
// showErrorPanel(caught);
|
||||||
|
// DataLoadEvent.fireLoadDataFailed(WorkspaceLightTreePanel.this,
|
||||||
|
// caught);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSuccess(Item root) {
|
||||||
|
GWT.log("workspace tree retrieved.");
|
||||||
|
// tree.setRootItem(root);
|
||||||
|
|
||||||
|
// we select the root
|
||||||
|
// tree.selectItem(root.getId());
|
||||||
|
|
||||||
|
// then we remove the loading icon
|
||||||
|
explorerPanel.clear();
|
||||||
|
ItemsTable itTables = new ItemsTable(false);
|
||||||
|
itTables.addItems(root.getChildren());
|
||||||
|
explorerPanel.add(itTables.getCellTable());
|
||||||
|
|
||||||
|
GWT.log("workspace tree loaded");
|
||||||
|
// DataLoadEvent.fireLoadDataSuccess(WorkspaceLightTreePanel.this);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the explorerPanel
|
||||||
|
*/
|
||||||
|
public ScrollPanel getExplorerPanel() {
|
||||||
|
return explorerPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
.margin-auto {
|
||||||
|
margin: 0 auto;
|
||||||
|
/* width: 50%; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-overflow td, th {
|
||||||
|
overflow: hidden !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-overflow th{
|
||||||
|
text-align: center !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumbs-navigator .breadcrumb {
|
||||||
|
margin-bottom: 3px !important;
|
||||||
|
}
|
|
@ -0,0 +1,159 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.server;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.gcube.common.homelibary.model.items.type.WorkspaceItemType;
|
||||||
|
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||||
|
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
||||||
|
import org.gcube.common.homelibrary.home.workspace.folder.FolderItem;
|
||||||
|
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.Util;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceNavigatorConstants;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Federico De Faveri defaveri@isti.cnr.it
|
||||||
|
* Modified by Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*/
|
||||||
|
public class ItemBuilder {
|
||||||
|
|
||||||
|
public static Item purgeEmptyFolders(Item item)
|
||||||
|
{
|
||||||
|
for (Item child:item.getChildren()) purgeEmptyFolders(child);
|
||||||
|
|
||||||
|
List<Item> toRemoveList = new LinkedList<Item>();
|
||||||
|
for (Item child:item.getChildren()) {
|
||||||
|
boolean toRemove = isAnEmptyFolder(child);
|
||||||
|
if (toRemove) toRemoveList.add(child);
|
||||||
|
}
|
||||||
|
for (Item child:toRemoveList) item.removeChild(child);
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static boolean isAnEmptyFolder(Item item)
|
||||||
|
{
|
||||||
|
return Util.isFolder(item.getType()) && item.getChildren().size() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param parent
|
||||||
|
* @param workspaceItem
|
||||||
|
* @param showableTypes
|
||||||
|
* @param depth
|
||||||
|
* @return
|
||||||
|
* @throws InternalErrorException
|
||||||
|
*/
|
||||||
|
public static Item getItem(Item parent, WorkspaceItem workspaceItem, List<ItemType> showableTypes, FilterCriteria filterCriteria, int depth) throws InternalErrorException
|
||||||
|
{
|
||||||
|
// System.out.println("\n\n workspaceItem: " + workspaceItem.getName() + ", depth : "+depth);
|
||||||
|
|
||||||
|
if (depth == 0) return null;
|
||||||
|
|
||||||
|
ItemType type = getItemType(workspaceItem);
|
||||||
|
|
||||||
|
if (!showableTypes.contains(type)) return null;
|
||||||
|
if (!filterItem(type, workspaceItem, filterCriteria)) return null;
|
||||||
|
|
||||||
|
// Added in date 26/06/2012 by Francesco Mangiacrapa
|
||||||
|
// Item item = new Item(parent, workspaceItem.getId(), workspaceItem.getName(), type, workspaceItem.getPath());
|
||||||
|
|
||||||
|
String itemName = workspaceItem.getName();
|
||||||
|
if ( workspaceItem.getName().equals(WorkspaceNavigatorConstants.SPECIAL_FOLDERS_LABEL)) {
|
||||||
|
itemName = "My VRE Folders";
|
||||||
|
}
|
||||||
|
|
||||||
|
Item item = new Item(parent, workspaceItem.getId(), itemName, type, "");
|
||||||
|
item.setShared(workspaceItem.getType()==WorkspaceItemType.SHARED_FOLDER);
|
||||||
|
|
||||||
|
Item empty = null;
|
||||||
|
|
||||||
|
// Add temporary item
|
||||||
|
if(Util.isFolder(item.getType())){
|
||||||
|
empty = new Item(parent, UUID.randomUUID().toString(), "empty", ItemType.UNKNOWN_TYPE, "");
|
||||||
|
item.addChild(empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(depth==1) return item;
|
||||||
|
|
||||||
|
for (WorkspaceItem child: workspaceItem.getChildren()){
|
||||||
|
Item itemChild = getItem(item, child, showableTypes, filterCriteria, depth-1);
|
||||||
|
if (itemChild!=null){
|
||||||
|
// item.removeChild(empty);
|
||||||
|
item.addChild(itemChild);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the temporary item when we finish loading
|
||||||
|
if(Util.isFolder(item.getType())&& item.getChildren().size()>1)
|
||||||
|
item.removeChild(empty);
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static ItemType getItemType(WorkspaceItem item) throws InternalErrorException
|
||||||
|
{
|
||||||
|
switch(item.getType())
|
||||||
|
{
|
||||||
|
case SHARED_FOLDER:
|
||||||
|
case FOLDER:{
|
||||||
|
if (item.isRoot()) return ItemType.ROOT;
|
||||||
|
return ItemType.FOLDER;
|
||||||
|
}
|
||||||
|
case FOLDER_ITEM: return getFolderItemType((FolderItem) item);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static ItemType getFolderItemType(FolderItem item)
|
||||||
|
{
|
||||||
|
//System.out.println("getFolderItemType "+item.getFolderItemType().toString());
|
||||||
|
return ItemType.valueOf(item.getFolderItemType().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static boolean filterItem(ItemType type, WorkspaceItem item, FilterCriteria filterCriteria) throws InternalErrorException
|
||||||
|
{
|
||||||
|
boolean mimeTypeCheck = checkAllowedMimeTypes(type, item, filterCriteria.getAllowedMimeTypes());
|
||||||
|
if (!mimeTypeCheck) return false;
|
||||||
|
|
||||||
|
boolean propertiesCheck = checkProperties(item, filterCriteria.getRequiredProperties());
|
||||||
|
return propertiesCheck;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static boolean checkAllowedMimeTypes(ItemType type, WorkspaceItem item, List<String> allowedMimeTypes)
|
||||||
|
{
|
||||||
|
if (allowedMimeTypes.size()==0) return true;
|
||||||
|
|
||||||
|
if (type == ItemType.EXTERNAL_FILE || type == ItemType.EXTERNAL_IMAGE || type == ItemType.EXTERNAL_PDF_FILE) {
|
||||||
|
ExternalFile externalFile = (ExternalFile)item;
|
||||||
|
String mimeType = externalFile.getMimeType();
|
||||||
|
return allowedMimeTypes.contains(mimeType);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected static boolean checkProperties(WorkspaceItem item, Map<String, String> requestedProperties) throws InternalErrorException
|
||||||
|
{
|
||||||
|
if (requestedProperties.size()==0 || item.getType()!=WorkspaceItemType.FOLDER_ITEM) return true;
|
||||||
|
|
||||||
|
Map<String, String> itemProperties = item.getProperties().getProperties();
|
||||||
|
for (Entry<String, String> requestProperty:requestedProperties.entrySet()) {
|
||||||
|
String propertyValue = itemProperties.get(requestProperty.getKey());
|
||||||
|
if (propertyValue == null) return false;
|
||||||
|
if (!propertyValue.equals(requestProperty.getValue())) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.server;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.Util;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceNavigatorConstants;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A comparator that sorts the items first by type, folder up others down, the each group alphabetically on the item name.
|
||||||
|
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
||||||
|
*/
|
||||||
|
public class ItemComparator 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 = Util.isFolder(item1.getType());
|
||||||
|
boolean isItem2Folder = Util.isFolder(item2.getType());
|
||||||
|
|
||||||
|
if (isSpecialFolder(item1) ^ isSpecialFolder(item2)) return isSpecialFolder(item1) ? -1 : 1;
|
||||||
|
|
||||||
|
if (isItem1Folder ^ isItem2Folder) return isItem1Folder ? -1 : 1;
|
||||||
|
|
||||||
|
//otherwise we compare the names
|
||||||
|
return String.CASE_INSENSITIVE_ORDER.compare(item1.getName(), item2.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isSpecialFolder(Item item) {
|
||||||
|
return item.getName().equals(WorkspaceNavigatorConstants.VRE_FOLDERS_LABEL);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,248 @@
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.server;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
|
import org.gcube.application.framework.core.session.SessionManager;
|
||||||
|
import org.gcube.common.homelibrary.home.HomeLibrary;
|
||||||
|
import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException;
|
||||||
|
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||||
|
import org.gcube.common.homelibrary.home.workspace.Workspace;
|
||||||
|
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
|
||||||
|
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
||||||
|
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||||
|
import org.gcube.portlets.widgets.wsexplorer.shared.WorkspaceNavigatorServiceException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The server side implementation of the RPC service.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implements WorkspaceExplorerService {
|
||||||
|
|
||||||
|
public static final Logger _log = LoggerFactory.getLogger(WorkspaceExplorerServiceImpl.class);
|
||||||
|
public static final String USERNAME_ATTRIBUTE = "username";
|
||||||
|
|
||||||
|
|
||||||
|
private ASLSession getASLSession(HttpSession httpSession) {
|
||||||
|
String sessionID = httpSession.getId();
|
||||||
|
String user = (String) httpSession.getAttribute(USERNAME_ATTRIBUTE);
|
||||||
|
|
||||||
|
_log.error("WORKSPACE PORTLET SessionID= " + sessionID);
|
||||||
|
|
||||||
|
//TODO we check for the older attribute name
|
||||||
|
if (user == null) user = (String) httpSession.getAttribute("user");
|
||||||
|
|
||||||
|
if (user == null) {
|
||||||
|
|
||||||
|
_log.error("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND");
|
||||||
|
|
||||||
|
//for test only
|
||||||
|
// user = "test.user";
|
||||||
|
user = "francesco.mangiacrapa";
|
||||||
|
httpSession.setAttribute(USERNAME_ATTRIBUTE, user);
|
||||||
|
ASLSession session = SessionManager.getInstance().getASLSession(sessionID, user);
|
||||||
|
session.setScope("/gcube/devsec/devVRE");
|
||||||
|
|
||||||
|
return session;
|
||||||
|
} else _log.trace("user found in session "+user);
|
||||||
|
return SessionManager.getInstance().getASLSession(sessionID, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected Workspace getWorkspace() throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException {
|
||||||
|
ASLSession session = getASLSession(this.getThreadLocalRequest().getSession());
|
||||||
|
|
||||||
|
Workspace workspace = HomeLibrary.getUserWorkspace(session.getUsername());
|
||||||
|
return workspace;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Item getRoot(List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria) throws WorkspaceNavigatorServiceException {
|
||||||
|
_log.trace("getRoot showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+ filterCriteria);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
Workspace workspace = getWorkspace();
|
||||||
|
|
||||||
|
_log.trace("Start getRoot...");
|
||||||
|
|
||||||
|
WorkspaceFolder specials = workspace.getMySpecialFolders();
|
||||||
|
|
||||||
|
WorkspaceItem root = workspace.getRoot();
|
||||||
|
|
||||||
|
_log.trace("GetRoot - Replyiing root");
|
||||||
|
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
_log.trace("start time - " + startTime);
|
||||||
|
|
||||||
|
Item rootItem = ItemBuilder.getItem(null, root, showableTypes, filterCriteria, 2);
|
||||||
|
|
||||||
|
Item specialFolders = ItemBuilder.getItem(null, specials, showableTypes, filterCriteria, 2);
|
||||||
|
specialFolders.setShared(true);
|
||||||
|
rootItem.addChild(specialFolders);
|
||||||
|
|
||||||
|
if(rootItem==null)
|
||||||
|
_log.trace("############ rootItem null");
|
||||||
|
|
||||||
|
_log.trace("Only showable types:");
|
||||||
|
//printName("", rootItem);
|
||||||
|
|
||||||
|
if (purgeEmpyFolders) rootItem = ItemBuilder.purgeEmptyFolders(rootItem);
|
||||||
|
|
||||||
|
_log.trace("Returning:");
|
||||||
|
|
||||||
|
Long endTime = System.currentTimeMillis() - startTime;
|
||||||
|
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
|
||||||
|
_log.trace("end time - " + time);
|
||||||
|
|
||||||
|
//printName("", rootItem);
|
||||||
|
|
||||||
|
Collections.sort(rootItem.getChildren(), new ItemComparator());
|
||||||
|
|
||||||
|
return rootItem;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
_log.error("Error during root retrieving", e);
|
||||||
|
throw new WorkspaceNavigatorServiceException(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Item getFolder(String folderId, List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria) throws WorkspaceNavigatorServiceException {
|
||||||
|
_log.trace("getFolder folderId: "+folderId+" showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+filterCriteria);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
Workspace workspace = getWorkspace();
|
||||||
|
WorkspaceItem folder = workspace.getItem(folderId);
|
||||||
|
|
||||||
|
_log.trace("GetFolder - Replyiing folder");
|
||||||
|
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
_log.trace("start time - " + startTime);
|
||||||
|
|
||||||
|
|
||||||
|
Item folderItem = ItemBuilder.getItem(null, folder, showableTypes, filterCriteria, 2);
|
||||||
|
|
||||||
|
_log.trace("Only showable types:");
|
||||||
|
//printName("", folderItem);
|
||||||
|
|
||||||
|
if (purgeEmpyFolders) folderItem = ItemBuilder.purgeEmptyFolders(folderItem);
|
||||||
|
|
||||||
|
_log.trace("Returning:");
|
||||||
|
|
||||||
|
Long endTime = System.currentTimeMillis() - startTime;
|
||||||
|
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
|
||||||
|
_log.trace("end time - " + time);
|
||||||
|
|
||||||
|
//printName("", folderItem);
|
||||||
|
|
||||||
|
Collections.sort(folderItem.getChildren(), new ItemComparator());
|
||||||
|
|
||||||
|
return folderItem;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
_log.error("Error during folder retrieving", e);
|
||||||
|
throw new WorkspaceNavigatorServiceException(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean checkName(String name) throws WorkspaceNavigatorServiceException {
|
||||||
|
_log.trace("checkName name: "+name);
|
||||||
|
try {
|
||||||
|
ASLSession session = getASLSession(this.getThreadLocalRequest().getSession());
|
||||||
|
Workspace workspace = HomeLibrary.getUserWorkspace(session.getUsername());
|
||||||
|
return workspace.isValidName(name);
|
||||||
|
} catch (Exception e) {
|
||||||
|
_log.error("Error during folder retrieving", e);
|
||||||
|
throw new WorkspaceNavigatorServiceException(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*protected void printName(String indentation, Item item)
|
||||||
|
{
|
||||||
|
if(item!=null){
|
||||||
|
_log.trace(indentation+item.getName());
|
||||||
|
for (Item child:item.getChildren()) printName(indentation+"\t", child);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the list parents by item identifier.
|
||||||
|
*
|
||||||
|
* @param itemIdentifier the item identifier
|
||||||
|
* @param includeItemAsParent - if parameter is true and item passed in input is a folder, the folder is included in path returned as last parent
|
||||||
|
* @return the list parents by item identifier
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Item> getListParentsByItemIdentifier(String itemIdentifier, boolean includeItemAsParent) throws Exception {
|
||||||
|
/*List<Item> listParents = new ArrayList<Item>();
|
||||||
|
_log.trace("get List Parents By Item Identifier "+ itemIdentifier);
|
||||||
|
try {
|
||||||
|
Workspace workspace = getWorkspace();
|
||||||
|
|
||||||
|
WorkspaceItem wsItem = workspace.getItem(itemIdentifier);
|
||||||
|
|
||||||
|
_log.trace("workspace retrieve item name: "+wsItem.getName());
|
||||||
|
|
||||||
|
|
||||||
|
String nameSpecialFolder = getNameForSpecialFolder();
|
||||||
|
|
||||||
|
if(includeItemAsParent==true && wsItem.getType().equals(WorkspaceItemType.FOLDER)){
|
||||||
|
listParents.add(builder.buildGXTFolderModelItemHandleSpecialFolder((WorkspaceFolder) wsItem, null, nameSpecialFolder));
|
||||||
|
}
|
||||||
|
|
||||||
|
while(wsItem!=null && wsItem.getParent()!=null){
|
||||||
|
|
||||||
|
WorkspaceFolder wsFolder = wsItem.getParent();
|
||||||
|
listParents.add(builder.buildGXTFolderModelItemHandleSpecialFolder(wsFolder, null, nameSpecialFolder));
|
||||||
|
wsItem = wsFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
Collections.reverse(listParents);
|
||||||
|
|
||||||
|
//SET PARENTS
|
||||||
|
for(int i=0; i<listParents.size()-1; i++){
|
||||||
|
|
||||||
|
Item parent = listParents.get(i);
|
||||||
|
Item fileModel = listParents.get(i+1);
|
||||||
|
|
||||||
|
fileModel.setParentFileModel(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
_log.trace("list parents return size: "+listParents.size());
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
_log.error("Error in get List Parents By Item Identifier ", e);
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new Exception(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return listParents;
|
||||||
|
*/
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.shared;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* FieldVerifier validates that the name the user enters is valid.
|
||||||
|
* </p>
|
||||||
|
* <p>
|
||||||
|
* This class is in the <code>shared</code> packing because we use it in both
|
||||||
|
* the client code and on the server. On the client, we verify that the name is
|
||||||
|
* valid before sending an RPC request so the user doesn't have to wait for a
|
||||||
|
* network round trip to get feedback. On the server, we verify that the name is
|
||||||
|
* correct to ensure that the input is correct regardless of where the RPC
|
||||||
|
* originates.
|
||||||
|
* </p>
|
||||||
|
* <p>
|
||||||
|
* When creating a class that is used on both the client and the server, be sure
|
||||||
|
* that all code is translatable and does not use native JavaScript. Code that
|
||||||
|
* is note translatable (such as code that interacts with a database or the file
|
||||||
|
* system) cannot be compiled into client side JavaScript. Code that uses native
|
||||||
|
* JavaScript (such as Widgets) cannot be run on the server.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public class FieldVerifier {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that the specified name is valid for our service.
|
||||||
|
*
|
||||||
|
* In this example, we only require that the name is at least four
|
||||||
|
* characters. In your application, you can use more complex checks to ensure
|
||||||
|
* that usernames, passwords, email addresses, URLs, and other fields have the
|
||||||
|
* proper syntax.
|
||||||
|
*
|
||||||
|
* @param name the name to validate
|
||||||
|
* @return true if valid, false if invalid
|
||||||
|
*/
|
||||||
|
public static boolean isValidName(String name) {
|
||||||
|
if (name == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return name.length() > 3;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class FilterCriteria.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Jun 18, 2015
|
||||||
|
*/
|
||||||
|
public class FilterCriteria implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 1912760277441333686L;
|
||||||
|
protected List<String> allowedMimeTypes;
|
||||||
|
protected Map<String, String> requiredProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new filter criteria.
|
||||||
|
*/
|
||||||
|
public FilterCriteria(){}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new filter criteria.
|
||||||
|
*
|
||||||
|
* @param allowedMimeTypes the allowed mime types
|
||||||
|
* @param requiredProperties the required properties
|
||||||
|
*/
|
||||||
|
public FilterCriteria(List<String> allowedMimeTypes,
|
||||||
|
Map<String, String> requiredProperties) {
|
||||||
|
this.allowedMimeTypes = allowedMimeTypes;
|
||||||
|
this.requiredProperties = requiredProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the allowed mime types.
|
||||||
|
*
|
||||||
|
* @return the allowedMimeTypes
|
||||||
|
*/
|
||||||
|
public List<String> getAllowedMimeTypes() {
|
||||||
|
return allowedMimeTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the required properties.
|
||||||
|
*
|
||||||
|
* @return the requiredProperties
|
||||||
|
*/
|
||||||
|
public Map<String, String> getRequiredProperties() {
|
||||||
|
return requiredProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("FilterCriteria [allowedMimeTypes=");
|
||||||
|
builder.append(allowedMimeTypes);
|
||||||
|
builder.append(", requiredProperties=");
|
||||||
|
builder.append(requiredProperties);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,212 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.shared;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class Item.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Jun 18, 2015
|
||||||
|
*/
|
||||||
|
public class Item implements IsSerializable{
|
||||||
|
|
||||||
|
protected Item parent;
|
||||||
|
protected String id;
|
||||||
|
protected String name;
|
||||||
|
protected ItemType type;
|
||||||
|
|
||||||
|
protected String path;
|
||||||
|
|
||||||
|
protected boolean shared;
|
||||||
|
|
||||||
|
protected ArrayList<Item> children;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new item.
|
||||||
|
*/
|
||||||
|
public Item(){}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new item.
|
||||||
|
* @param parent the item parent.
|
||||||
|
* @param id the item id.
|
||||||
|
* @param name the item name.
|
||||||
|
* @param type the item type.
|
||||||
|
* @param path the item path.
|
||||||
|
*/
|
||||||
|
public Item(Item parent, String id, String name, ItemType type, String path) {
|
||||||
|
this.parent = parent;
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.type = type;
|
||||||
|
this.path = path;
|
||||||
|
this.children = new ArrayList<Item>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is shared.
|
||||||
|
*
|
||||||
|
* @return the shared
|
||||||
|
*/
|
||||||
|
public boolean isShared() {
|
||||||
|
return shared;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the shared.
|
||||||
|
*
|
||||||
|
* @param shared the shared to set
|
||||||
|
*/
|
||||||
|
public void setShared(boolean shared) {
|
||||||
|
this.shared = shared;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The item parent. Null if is the root.
|
||||||
|
* @return the item parent.
|
||||||
|
*/
|
||||||
|
public Item getParent() {
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The item id.
|
||||||
|
* @return the id.
|
||||||
|
*/
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The item name.
|
||||||
|
* @return the name.
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The item type.
|
||||||
|
* @return the type.
|
||||||
|
*/
|
||||||
|
public ItemType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The item children.
|
||||||
|
* @return the children.
|
||||||
|
*/
|
||||||
|
public ArrayList<Item> getChildren() {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The item child.
|
||||||
|
*
|
||||||
|
* @param index the index
|
||||||
|
* @return the child at the specific position.
|
||||||
|
*/
|
||||||
|
public Item getChild(int index) {
|
||||||
|
return children.get(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a child to this item.
|
||||||
|
* @param child the child to add.
|
||||||
|
*/
|
||||||
|
public void addChild(Item child)
|
||||||
|
{
|
||||||
|
children.add(child);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a child from this item.
|
||||||
|
*
|
||||||
|
* @param child the child
|
||||||
|
*/
|
||||||
|
public void removeChild(Item child)
|
||||||
|
{
|
||||||
|
children.remove(child);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return this item path.
|
||||||
|
* @return the item path.
|
||||||
|
*/
|
||||||
|
// Modified in date 26/06/2012 by Francesco Mangiacrapa
|
||||||
|
public String getPath()
|
||||||
|
{
|
||||||
|
System.out.println("getting path for "+name);
|
||||||
|
if (parent == null) return "/";
|
||||||
|
|
||||||
|
return parent.getPath() + name + "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((id == null) ? 0 : id.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
Item other = (Item) obj;
|
||||||
|
if (id == null) {
|
||||||
|
if (other.id != null)
|
||||||
|
return false;
|
||||||
|
} else if (!id.equals(other.id))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("Item [name=");
|
||||||
|
builder.append(name);
|
||||||
|
builder.append(", type=");
|
||||||
|
builder.append(type);
|
||||||
|
builder.append(", id=");
|
||||||
|
builder.append(id);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the parent.
|
||||||
|
*
|
||||||
|
* @param parent the new parent
|
||||||
|
*/
|
||||||
|
public void setParent(Item parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.shared;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Enum ItemType.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Jun 18, 2015
|
||||||
|
*/
|
||||||
|
public enum ItemType {
|
||||||
|
|
||||||
|
ROOT,
|
||||||
|
FOLDER,
|
||||||
|
EXTERNAL_IMAGE,
|
||||||
|
EXTERNAL_FILE,
|
||||||
|
EXTERNAL_PDF_FILE,
|
||||||
|
EXTERNAL_URL,
|
||||||
|
QUERY,
|
||||||
|
REPORT_TEMPLATE,
|
||||||
|
REPORT,
|
||||||
|
DOCUMENT,
|
||||||
|
METADATA,
|
||||||
|
PDF_DOCUMENT,
|
||||||
|
IMAGE_DOCUMENT,
|
||||||
|
URL_DOCUMENT,
|
||||||
|
GCUBE_ITEM,
|
||||||
|
UNKNOWN_TYPE;
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.widgets.wsexplorer.shared;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class WorkspaceNavigatorServiceException.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Jun 18, 2015
|
||||||
|
*/
|
||||||
|
public class WorkspaceNavigatorServiceException extends Exception {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 6416932531764081333L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new workspace navigator service exception.
|
||||||
|
*/
|
||||||
|
public WorkspaceNavigatorServiceException() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new workspace navigator service exception.
|
||||||
|
*
|
||||||
|
* @param message the message
|
||||||
|
*/
|
||||||
|
public WorkspaceNavigatorServiceException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module rename-to='WorkspaceExplorer'>
|
||||||
|
<!-- Inherit the core Web Toolkit stuff. -->
|
||||||
|
<inherits name='com.google.gwt.user.User' />
|
||||||
|
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
||||||
|
|
||||||
|
<!-- Inherit the default GWT style sheet. You can change -->
|
||||||
|
<!-- the theme of your GWT application by uncommenting -->
|
||||||
|
<!-- any one of the following lines. -->
|
||||||
|
<inherits name='com.google.gwt.user.theme.standard.Standard' />
|
||||||
|
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
||||||
|
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
||||||
|
<stylesheet src='workspace-explorer.css' />
|
||||||
|
<!-- Other module inherits -->
|
||||||
|
|
||||||
|
<!-- Specify the app entry point class. -->
|
||||||
|
<!-- <entry-point class='org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorer' /> -->
|
||||||
|
|
||||||
|
<!-- Specify the paths for translatable code -->
|
||||||
|
<source path='client' />
|
||||||
|
<source path='shared' />
|
||||||
|
|
||||||
|
</module>
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<web-app version="2.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
||||||
|
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||||
|
xmlns="http://java.sun.com/xml/ns/javaee">
|
||||||
|
|
||||||
|
<!-- Servlets -->
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>workspaceExplorer</servlet-name>
|
||||||
|
<servlet-class>org.gcube.portlets.widgets.wsexplorer.server.WorkspaceExplorerServiceImpl</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>workspaceExplorer</servlet-name>
|
||||||
|
<url-pattern>/WorkspaceExplorer/greet</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<!-- Default page to serve -->
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>WorkspaceExplorer.html</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
|
||||||
|
</web-app>
|
|
@ -0,0 +1,34 @@
|
||||||
|
/** Add css rules here for your application. */
|
||||||
|
|
||||||
|
|
||||||
|
/** Example rules used by the template application (remove for your app) */
|
||||||
|
h1 {
|
||||||
|
font-size: 2em;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #777777;
|
||||||
|
margin: 40px 0px 70px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sendButton {
|
||||||
|
display: block;
|
||||||
|
font-size: 16pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Most GWT widgets already have a style name defined */
|
||||||
|
.gwt-DialogBox {
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialogVPanel {
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.serverResponseLabelError {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Set ids using widget.getElement().setId("idOfElement") */
|
||||||
|
#closeButton {
|
||||||
|
margin: 15px 6px 6px;
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
<!doctype html>
|
||||||
|
<!-- The DOCTYPE declaration above will set the -->
|
||||||
|
<!-- browser's rendering engine into -->
|
||||||
|
<!-- "Standards Mode". Replacing this declaration -->
|
||||||
|
<!-- with a "Quirks Mode" doctype may lead to some -->
|
||||||
|
<!-- differences in layout. -->
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<!-- Consider inlining CSS to reduce the number of requested files -->
|
||||||
|
<!-- -->
|
||||||
|
<link type="text/css" rel="stylesheet" href="WorkspaceExplorer.css">
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<!-- Any title is fine -->
|
||||||
|
<!-- -->
|
||||||
|
<title>Web Application Starter Project</title>
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<!-- This script loads your compiled module. -->
|
||||||
|
<!-- If you add any GWT meta tags, they must -->
|
||||||
|
<!-- be added before this line. -->
|
||||||
|
<!-- -->
|
||||||
|
<script type="text/javascript" language="javascript" src="WorkspaceExplorer/WorkspaceExplorer.nocache.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<!-- The body can have arbitrary html, or -->
|
||||||
|
<!-- you can leave the body empty if you want -->
|
||||||
|
<!-- to create a completely dynamic UI. -->
|
||||||
|
<!-- -->
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- OPTIONAL: include this if you want history support -->
|
||||||
|
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
|
||||||
|
|
||||||
|
<!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
|
||||||
|
<noscript>
|
||||||
|
<div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
|
||||||
|
Your web browser must have JavaScript enabled
|
||||||
|
in order for this application to display correctly.
|
||||||
|
</div>
|
||||||
|
</noscript>
|
||||||
|
|
||||||
|
<h1>Web Application Starter Project</h1>
|
||||||
|
|
||||||
|
<table align="center">
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" style="font-weight:bold;">Please enter your name:</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td id="nameFieldContainer"></td>
|
||||||
|
<td id="sendButtonContainer"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" style="color:red;" id="errorLabelContainer"></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module rename-to="WorkspaceExplorer">
|
||||||
|
<!-- Inherit our applications main module. -->
|
||||||
|
<!-- <inherits name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' /> -->
|
||||||
|
|
||||||
|
<!-- Specify the path to any remote services. -->
|
||||||
|
<!-- <servlet path="/WorkspaceExplorer/greet" class="org.gcube.portlets.widgets.wsexplorer.server.GreetingServiceImpl" /> -->
|
||||||
|
|
||||||
|
</module>
|
Loading…
Reference in New Issue