git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/storagehub-icons-library@167678 82a268e6-3cf1-43bd-a215-b396298e98cf
|
@ -0,0 +1,26 @@
|
||||||
|
<?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" output="target/test-classes" path="src/test/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<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.8">
|
||||||
|
<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,23 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>storagehub-icons-library</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,4 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
encoding//src/main/java=UTF-8
|
||||||
|
encoding//src/test/java=UTF-8
|
||||||
|
encoding/<project>=UTF-8
|
|
@ -0,0 +1,5 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||||
|
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 @@
|
||||||
|
${gcube.license}
|
|
@ -0,0 +1,62 @@
|
||||||
|
The gCube System - ${name}
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
${description}
|
||||||
|
|
||||||
|
|
||||||
|
${gcube.description}
|
||||||
|
|
||||||
|
${gcube.funding}
|
||||||
|
|
||||||
|
|
||||||
|
Version
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
${version} (${buildDate})
|
||||||
|
|
||||||
|
Please see the file named "changelog.xml" in this directory for the release notes.
|
||||||
|
|
||||||
|
|
||||||
|
Authors
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
* Massimiliano Assante (massimiliano.assante@isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
|
||||||
|
|
||||||
|
Maintainers
|
||||||
|
-----------
|
||||||
|
|
||||||
|
* Massimiliano Assante (massimiliano.assante@isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
|
||||||
|
|
||||||
|
Download information
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
Source code is available from SVN:
|
||||||
|
${scm.url}
|
||||||
|
|
||||||
|
Binaries can be downloaded from the gCube website:
|
||||||
|
${gcube.website}
|
||||||
|
|
||||||
|
|
||||||
|
Installation
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
Installation documentation is available on-line in the gCube Wiki:
|
||||||
|
${gcube.wikiRoot}
|
||||||
|
|
||||||
|
Documentation
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
Documentation is available on-line in the gCube Wiki:
|
||||||
|
${gcube.wikiRoot}
|
||||||
|
|
||||||
|
Support
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
Bugs and support requests can be reported in the gCube issue tracking tool:
|
||||||
|
${gcube.issueTracking}
|
||||||
|
|
||||||
|
|
||||||
|
Licensing
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
|
|
@ -0,0 +1,6 @@
|
||||||
|
<ReleaseNotes>
|
||||||
|
<Changeset component="org.gcube.portal-storagehub-icons-library.1-0-0"
|
||||||
|
date="2018-05-22">
|
||||||
|
<Change>First Release</Change>
|
||||||
|
</Changeset>
|
||||||
|
</ReleaseNotes>
|
|
@ -0,0 +1,31 @@
|
||||||
|
<assembly
|
||||||
|
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||||
|
<id>servicearchive</id>
|
||||||
|
<formats>
|
||||||
|
<format>tar.gz</format>
|
||||||
|
</formats>
|
||||||
|
<baseDirectory>/</baseDirectory>
|
||||||
|
<fileSets>
|
||||||
|
<fileSet>
|
||||||
|
<directory>${distroDirectory}</directory>
|
||||||
|
<outputDirectory>/</outputDirectory>
|
||||||
|
<useDefaultExcludes>true</useDefaultExcludes>
|
||||||
|
<includes>
|
||||||
|
<include>README</include>
|
||||||
|
<include>LICENSE</include>
|
||||||
|
<include>changelog.xml</include>
|
||||||
|
<include>profile.xml</include>
|
||||||
|
</includes>
|
||||||
|
<fileMode>755</fileMode>
|
||||||
|
<filtered>true</filtered>
|
||||||
|
</fileSet>
|
||||||
|
</fileSets>
|
||||||
|
<files>
|
||||||
|
<file>
|
||||||
|
<source>target/${build.finalName}.${project.packaging}</source>
|
||||||
|
<outputDirectory>/${artifactId}</outputDirectory>
|
||||||
|
</file>
|
||||||
|
</files>
|
||||||
|
</assembly>
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<ID></ID>
|
||||||
|
<Type>Service</Type>
|
||||||
|
<Profile>
|
||||||
|
<Description>${Description}</Description>
|
||||||
|
<Class>Portal</Class>
|
||||||
|
<Name>${artifactId}</Name>
|
||||||
|
<Version>${version}</Version>
|
||||||
|
<Packages>
|
||||||
|
<Software>
|
||||||
|
<Name>${artifactId}</Name>
|
||||||
|
<Version>${version}</Version>
|
||||||
|
<MavenCoordinates>
|
||||||
|
<groupId>${groupId}</groupId>
|
||||||
|
<artifactId>${artifactId}</artifactId>
|
||||||
|
<version>${version}</version>
|
||||||
|
</MavenCoordinates>
|
||||||
|
<Files>
|
||||||
|
<File>target/${build.finalName}.jar</File>
|
||||||
|
</Files>
|
||||||
|
</Software>
|
||||||
|
</Packages>
|
||||||
|
</Profile>
|
||||||
|
</Resource>
|
|
@ -0,0 +1,173 @@
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<artifactId>maven-parent</artifactId>
|
||||||
|
<groupId>org.gcube.tools</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<relativePath />
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<groupId>org.gcube.portal</groupId>
|
||||||
|
<artifactId>storagehub-support-library</artifactId>
|
||||||
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>storagehub-support-library</name>
|
||||||
|
<description>
|
||||||
|
storagehub support library exposes API for getting the correct file icon depending on the file name
|
||||||
|
</description>
|
||||||
|
<scm>
|
||||||
|
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portal/${project.artifactId}</connection>
|
||||||
|
<developerConnection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/trunk/portal/${project.artifactId}</developerConnection>
|
||||||
|
<url>http://svn.d4science.research-infrastructures.eu/gcube/trunk/portal/${project.artifactId}</url>
|
||||||
|
</scm>
|
||||||
|
<properties>
|
||||||
|
<distroDirectory>distro</distroDirectory>
|
||||||
|
<maven.compiler.source>1.7</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
<gwtVersion>2.7.0</gwtVersion>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
<json.simple.version>1.1.1</json.simple.version>
|
||||||
|
<apache.http.version>4.3</apache.http.version>
|
||||||
|
</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>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.8</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/java</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/*.*</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>settings.properties</include>
|
||||||
|
</includes>
|
||||||
|
<targetPath>etc</targetPath>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.0</version>
|
||||||
|
<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.6</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>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
package org.gcube.portal.stohubicons;
|
||||||
|
|
||||||
|
import org.gcube.portal.stohubicons.shared.MDIcon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author M. Assante CNR
|
||||||
|
* <p>
|
||||||
|
* makes it easy to incorporate icons into your web page. Here’s a small example: <i class="material-icons">face</i> <br><br>
|
||||||
|
* <b>Please note: for make this work you must install material-design-icons</b>:<br>
|
||||||
|
* The easiest way to set up icon fonts for use in any web page is through Google Web Fonts. All you need to do is include a single line of HTML:
|
||||||
|
* <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
* </p>
|
||||||
|
* More information and othere ways to setup MD Icons @see <a href="http://google.github.io/material-design-icons/">http://google.github.io/material-design-icons/</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class IconsManager {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param isShared true is the folder is shared
|
||||||
|
* @return the html related to the private or shared Folders
|
||||||
|
*/
|
||||||
|
public static MDIcon getIconFolder(boolean isShared) {
|
||||||
|
if (isShared)
|
||||||
|
return new MDIcon("folder_shared", "#8F8F8F"); //darker gray
|
||||||
|
else
|
||||||
|
return new MDIcon("folder", "#8F8F8F"); //darker gray
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return the html related to the VRE Folders
|
||||||
|
*/
|
||||||
|
public static MDIcon getIconVREFolder() {
|
||||||
|
return new MDIcon("folder_special", "#8F8F8F"); //darker gray
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* easy to incorporate icons into your web page. Here’s a small example: <i class="material-icons">face</i>
|
||||||
|
* @see <a href="http://google.github.io/material-design-icons/">http://google.github.io/material-design-icons/</a>
|
||||||
|
* @param filenameWithExtension the file name with extension
|
||||||
|
* @return the Material Design Icon textual name to be placed within any <i class="material-icons"> $The Returned Material Design Icon Textual Name </i>
|
||||||
|
*/
|
||||||
|
public static MDIcon getMDIconTextualName(String filenameWithExtension) {
|
||||||
|
String[] splits = filenameWithExtension.split("\\.");
|
||||||
|
String extension = "";
|
||||||
|
if (splits.length > 0) {
|
||||||
|
extension = splits[splits.length-1];
|
||||||
|
}
|
||||||
|
if (extension == null || extension.compareTo("") == 0)
|
||||||
|
return new MDIcon("insert_drive_file", "#CCC"); //gray
|
||||||
|
|
||||||
|
extension = extension.toLowerCase();
|
||||||
|
if (extension.equals( "doc") ||extension.equals( "docx"))
|
||||||
|
return new MDIcon("description", "#0277bd"); // light-blue darken-3
|
||||||
|
if (extension.equals( "xls") ||extension.equals( "xlsx"))
|
||||||
|
return new MDIcon("description", "#4caf50"); //green
|
||||||
|
if (extension.equals( "rtf") ||extension.equals( "txt"))
|
||||||
|
return new MDIcon("description", "#CCC"); //gray
|
||||||
|
if (extension.equals( "csv"))
|
||||||
|
return new MDIcon("assessment", "#283593"); //blue
|
||||||
|
if (extension.equals( "ics"))
|
||||||
|
return new MDIcon("calendar_today", "#f44336");
|
||||||
|
if (extension.equals( "ppt") ||extension.equals( "pptx"))
|
||||||
|
return new MDIcon("description", "#fb8c00"); //orange
|
||||||
|
if (extension.equals( "pdf"))
|
||||||
|
return new MDIcon("picture_as_pdf", "#f44336"); //red
|
||||||
|
if (extension.equals( "jpg") ||extension.equals( "jpeg")
|
||||||
|
|| extension.equals( "gif")
|
||||||
|
|| extension.equals( "bmp")
|
||||||
|
|| extension.equals( "png")
|
||||||
|
|| extension.equals( "tif")
|
||||||
|
||extension.equals( "tiff")
|
||||||
|
)
|
||||||
|
return new MDIcon("panorama", "#d81b60"); //fuxia
|
||||||
|
if (extension.equals( "avi") ||extension.equals( "mp4") || extension.equals( "mpeg") || extension.equals( "mkv"))
|
||||||
|
return new MDIcon("movie_creation", "#90caf9");
|
||||||
|
if (extension.equals( "html") ||extension.equals( "htm") || extension.equals( "jsp") || extension.equals( "asp") || extension.equals( "php"))
|
||||||
|
return new MDIcon("web", "#0277bd");
|
||||||
|
if (extension.equals( "rar")
|
||||||
|
|| extension.equals( "zip")
|
||||||
|
|| extension.equals( "tar")
|
||||||
|
|| extension.equals( "tar.gz")
|
||||||
|
|| extension.equals( "cpgz")
|
||||||
|
|| extension.equals( "gz")
|
||||||
|
|| extension.equals( "jar")
|
||||||
|
)
|
||||||
|
return new MDIcon("archive", "#ffc107"); //amber
|
||||||
|
|
||||||
|
return new MDIcon("insert_drive_file", "#CCC"); //gray
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module rename-to='StorageHubIcons'>
|
||||||
|
<!-- Inherit the core Web Toolkit stuff. -->
|
||||||
|
<inherits name='com.google.gwt.user.User' />
|
||||||
|
|
||||||
|
<!-- Specify the paths for translatable code -->
|
||||||
|
<source path='client' />
|
||||||
|
<source path='shared' />
|
||||||
|
|
||||||
|
</module>
|
|
@ -0,0 +1,50 @@
|
||||||
|
package org.gcube.portal.stohubicons.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author M. Assante, CNR-ISTI
|
||||||
|
*
|
||||||
|
* easy to incorporate icons into your web page. Here’s a small example: <i class="material-icons">face</i>
|
||||||
|
* @see <a href="http://google.github.io/material-design-icons/">http://google.github.io/material-design-icons/</a>
|
||||||
|
* object representing Material Design Icon <i class="material-icons"> $The Returned Material Design Icon Textual Name </i>
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class MDIcon implements Serializable {
|
||||||
|
|
||||||
|
private StringBuilder html;
|
||||||
|
private String textualName;
|
||||||
|
private String color;
|
||||||
|
|
||||||
|
public MDIcon(String textualName, String color) {
|
||||||
|
this.html = new StringBuilder
|
||||||
|
("<i style=\"color: ")
|
||||||
|
.append(color)
|
||||||
|
.append("\" class=\"material-icons\">")
|
||||||
|
.append(textualName)
|
||||||
|
.append("</i>");
|
||||||
|
this.textualName = textualName;
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHtml() {
|
||||||
|
return html.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTextualName() {
|
||||||
|
return textualName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTextualName(String textualName) {
|
||||||
|
this.textualName = textualName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColor(String color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
|
@ -0,0 +1,86 @@
|
||||||
|
package org.gcube.portal.stohubicons.shared.resources;
|
||||||
|
|
||||||
|
import com.google.gwt.resources.client.ImageResource;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author M. Assante, CNR-ISTI
|
||||||
|
* class to be used in GWT for getting image resource
|
||||||
|
*/
|
||||||
|
public class GWTIconsManager {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param isShared true is the folder is shared
|
||||||
|
* @return the ImageResource instance related to the private or shared Folders
|
||||||
|
*/
|
||||||
|
public static ImageResource getIconFolder(boolean isShared) {
|
||||||
|
if (isShared)
|
||||||
|
return StorageHubIconResources.INSTANCE.SHARED_FOLDER();
|
||||||
|
else
|
||||||
|
return StorageHubIconResources.INSTANCE.FOLDER();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return the ImageResource instance related to the VRE Folders
|
||||||
|
*/
|
||||||
|
public static ImageResource getIconVREFolder() {
|
||||||
|
return StorageHubIconResources.INSTANCE.VRE_FOLDER();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param filenameWithExtension
|
||||||
|
* @return the ImageResource instance related to the file extension
|
||||||
|
* @throws IllegalArgumentException
|
||||||
|
*/
|
||||||
|
public static ImageResource getIconFile(String filenameWithExtension) throws IllegalArgumentException {
|
||||||
|
if(filenameWithExtension==null || filenameWithExtension.compareTo("") == 0)
|
||||||
|
throw new IllegalArgumentException("The file name is null or empty");
|
||||||
|
|
||||||
|
String[] splits = filenameWithExtension.split("\\.");
|
||||||
|
String extension = "";
|
||||||
|
if (splits.length > 0) {
|
||||||
|
extension = splits[splits.length-1];
|
||||||
|
}
|
||||||
|
if (extension == null || extension.compareTo("") == 0)
|
||||||
|
return StorageHubIconResources.INSTANCE.unknown();
|
||||||
|
|
||||||
|
extension = extension.toLowerCase();
|
||||||
|
if (extension.equals( "doc") ||extension.equals( "docx"))
|
||||||
|
return StorageHubIconResources.INSTANCE.DOC();
|
||||||
|
else if (extension.equals( "rtf") ||extension.equals( "txt"))
|
||||||
|
return StorageHubIconResources.INSTANCE.TXT();
|
||||||
|
else if (extension.equals( "xls") ||extension.equals( "xlsx"))
|
||||||
|
return StorageHubIconResources.INSTANCE.XLS();
|
||||||
|
else if (extension.equals( "csv"))
|
||||||
|
return StorageHubIconResources.INSTANCE.CSV();
|
||||||
|
else if (extension.equals( "ics"))
|
||||||
|
return StorageHubIconResources.INSTANCE.CALENDAR();
|
||||||
|
else if (extension.equals( "ppt") ||extension.equals( "pptx"))
|
||||||
|
return StorageHubIconResources.INSTANCE.PPT();
|
||||||
|
else if (extension.equals( "pdf"))
|
||||||
|
return StorageHubIconResources.INSTANCE.PDF();
|
||||||
|
else if (extension.equals( "jpg") ||extension.equals( "jpeg")
|
||||||
|
|| extension.equals( "gif")
|
||||||
|
|| extension.equals( "bmp")
|
||||||
|
|| extension.equals( "png")
|
||||||
|
|| extension.equals( "tif")
|
||||||
|
||extension.equals( "tiff")
|
||||||
|
)
|
||||||
|
return StorageHubIconResources.INSTANCE.IMAGE();
|
||||||
|
else if (extension.equals( "avi") ||extension.equals( "mp4") || extension.equals( "mpeg") || extension.equals( "mkv"))
|
||||||
|
return StorageHubIconResources.INSTANCE.MOVIE();
|
||||||
|
else if (extension.equals( "html") ||extension.equals( "htm") || extension.equals( "jsp") || extension.equals( "asp") || extension.equals( "php"))
|
||||||
|
return StorageHubIconResources.INSTANCE.HTML();
|
||||||
|
else if (extension.equals( "rar")
|
||||||
|
|| extension.equals( "zip")
|
||||||
|
|| extension.equals( "tar")
|
||||||
|
|| extension.equals( "tar.gz")
|
||||||
|
|| extension.equals( "cpgz")
|
||||||
|
|| extension.equals( "gz")
|
||||||
|
|| extension.equals( "jar")
|
||||||
|
)
|
||||||
|
return StorageHubIconResources.INSTANCE.ARCHIVE();
|
||||||
|
else
|
||||||
|
return StorageHubIconResources.INSTANCE.unknown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 149 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
|
@ -0,0 +1,79 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portal.stohubicons.shared.resources;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.resources.client.ClientBundle;
|
||||||
|
import com.google.gwt.resources.client.ImageResource;
|
||||||
|
|
||||||
|
|
||||||
|
public interface StorageHubIconResources extends ClientBundle {
|
||||||
|
public static final StorageHubIconResources INSTANCE = GWT.create(StorageHubIconResources.class);
|
||||||
|
|
||||||
|
@Source("FOLDER.png")
|
||||||
|
ImageResource FOLDER();
|
||||||
|
|
||||||
|
@Source("SHARED_FOLDER.png")
|
||||||
|
ImageResource SHARED_FOLDER();
|
||||||
|
|
||||||
|
@Source("SHARED_FOLDER.png")
|
||||||
|
ImageResource VRE_FOLDER();
|
||||||
|
|
||||||
|
@Source("DOC.png")
|
||||||
|
ImageResource DOC();
|
||||||
|
|
||||||
|
@Source("PPTX.png")
|
||||||
|
ImageResource PPT();
|
||||||
|
|
||||||
|
@Source("XLS.png")
|
||||||
|
ImageResource XLS();
|
||||||
|
|
||||||
|
@Source("CSV.png")
|
||||||
|
ImageResource CSV();
|
||||||
|
|
||||||
|
@Source("CALENDAR.png")
|
||||||
|
ImageResource CALENDAR();
|
||||||
|
|
||||||
|
@Source("PDF.png")
|
||||||
|
ImageResource PDF();
|
||||||
|
|
||||||
|
@Source("IMAGE.png")
|
||||||
|
ImageResource IMAGE();
|
||||||
|
|
||||||
|
@Source("TXT.png")
|
||||||
|
ImageResource TXT();
|
||||||
|
|
||||||
|
@Source("MOVIE.png")
|
||||||
|
ImageResource MOVIE();
|
||||||
|
|
||||||
|
@Source("HTML.png")
|
||||||
|
ImageResource HTML();
|
||||||
|
|
||||||
|
@Source("ZIP.png")
|
||||||
|
ImageResource ARCHIVE();
|
||||||
|
|
||||||
|
@Source("external_resource_link.png")
|
||||||
|
ImageResource external_resource_link();
|
||||||
|
|
||||||
|
@Source("external_url.png")
|
||||||
|
ImageResource external_url();
|
||||||
|
|
||||||
|
@Source("metadata.png")
|
||||||
|
ImageResource metadata();
|
||||||
|
|
||||||
|
@Source("timeseries.png")
|
||||||
|
ImageResource timeseries();
|
||||||
|
|
||||||
|
@Source("aquamaps.png")
|
||||||
|
ImageResource aquamaps();
|
||||||
|
|
||||||
|
@Source("UNKNOWN.png")
|
||||||
|
ImageResource unknownType();
|
||||||
|
|
||||||
|
@Source("gcubeItem.jpeg")
|
||||||
|
ImageResource gucbeItem();
|
||||||
|
|
||||||
|
@Source("UNKNOWN.png")
|
||||||
|
ImageResource unknown();
|
||||||
|
}
|
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 980 B |
After Width: | Height: | Size: 855 B |
After Width: | Height: | Size: 343 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 603 B |
After Width: | Height: | Size: 566 B |
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module rename-to='StorageHubIcons'>
|
||||||
|
<!-- Inherit the core Web Toolkit stuff. -->
|
||||||
|
<inherits name='com.google.gwt.user.User' />
|
||||||
|
|
||||||
|
<!-- Specify the paths for translatable code -->
|
||||||
|
<source path='client' />
|
||||||
|
<source path='shared' />
|
||||||
|
|
||||||
|
</module>
|
|
@ -0,0 +1,38 @@
|
||||||
|
package org.gcube.portal.stohubsupport;
|
||||||
|
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for simple App.
|
||||||
|
*/
|
||||||
|
public class AppTest
|
||||||
|
extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create the test case
|
||||||
|
*
|
||||||
|
* @param testName name of the test case
|
||||||
|
*/
|
||||||
|
public AppTest( String testName )
|
||||||
|
{
|
||||||
|
super( testName );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the suite of tests being tested
|
||||||
|
*/
|
||||||
|
public static Test suite()
|
||||||
|
{
|
||||||
|
return new TestSuite( AppTest.class );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rigourous Test :-)
|
||||||
|
*/
|
||||||
|
public void testApp()
|
||||||
|
{
|
||||||
|
assertTrue( true );
|
||||||
|
}
|
||||||
|
}
|