Maven Portlet Initial import.

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/my-vres@65384 82a268e6-3cf1-43bd-a215-b396298e98cf
master
Massimiliano Assante 12 years ago
parent 2ef49729ad
commit 5b9195852b

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/my-vres-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/gwt"/>
<classpathentry including="**/*.java" kind="src" output="src/main/webapp/WEB-INF/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="output" path="target/my-vres-1.0.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>my-vres</name>
<comment>my-vres project</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
</natures>
</projectDescription>

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

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

@ -0,0 +1,6 @@
#Sun Dec 23 11:33:33 CET 2012
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
lastWarOutDir=/Users/massi/Documents/workspace/my-vres/target/my-vres-1.0.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

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

@ -0,0 +1,7 @@
#Sun Dec 23 11:10:00 CET 2012
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,9 @@
#Thu Sep 02 10:42:20 CEST 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
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.5

@ -0,0 +1,5 @@
#Sun Dec 23 11:09:59 CET 2012
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="${module}">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="my-vres"/>
</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.5" />
<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,9 @@
#Thu Sep 02 10:42:12 CEST 2010
activeProfiles=
eclipse.preferences.version=1
fullBuildGoals=process-test-resources
includeModules=false
resolveWorkspaceProjects=true
resourceFilterGoals=process-resources resources\\:testResources
skipCompilerPlugin=true
version=1

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

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

@ -0,0 +1,138 @@
<?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">
<!-- POM file generated with GWT webAppCreator -->
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.portlet.user</groupId>
<artifactId>my-vres</artifactId>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>My VREs Portlet</name>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.4.0</gwtVersion>
<!-- GWT needs at least java 1.5 -->
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- Google Web Toolkit (GWT) -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
<!-- "provided" so that we don't deploy -->
<scope>provided</scope>
</dependency>
<!-- This dependency is needed to use GWT UI BInder without old Xerces
version of gCore complaining -->
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-widgets</artifactId>
<version>1.4.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>custom-portal-handler</artifactId>
<version>1.2.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<version>6.0.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<runTarget>MyVREs.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<i18nMessagesBundle>org.gcube.portlet.user.my_vres.client.Messages</i18nMessagesBundle>
</configuration>
</plugin>
<!-- Copy static web files before executing gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

@ -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">
<g:HTMLPanel>
<div class="headerTitle">
My Virtual Research Environments
</div>
</g:HTMLPanel>
</ui:UiBinder>

@ -0,0 +1,18 @@
package org.gcube.portlet.user.my_vres.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class MyVREs implements EntryPoint {
/**
* This is the entry point method.
*/
public void onModuleLoad() {
RootPanel.get("myVREsDIV").add(new VresPanel());
}
}

@ -0,0 +1,20 @@
package org.gcube.portlet.user.my_vres.client;
import java.util.ArrayList;
import org.gcube.portlet.user.my_vres.shared.VO;
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 MyVREsService extends RemoteService {
ArrayList<VO> getInfrastructureVOs();
void loadLayout(String scope, String URL);
}

@ -0,0 +1,14 @@
package org.gcube.portlet.user.my_vres.client;
import java.util.ArrayList;
import org.gcube.portlet.user.my_vres.shared.VO;
import com.google.gwt.user.client.rpc.AsyncCallback;
public interface MyVREsServiceAsync {
void getInfrastructureVOs(AsyncCallback<ArrayList<VO>> callback);
void loadLayout(String scope, String URL, AsyncCallback<Void> callback);
}

@ -0,0 +1,23 @@
package org.gcube.portlet.user.my_vres.client;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
public class NoVresPanel extends Composite {
private static NoVresPanelUiBinder uiBinder = GWT
.create(NoVresPanelUiBinder.class);
interface NoVresPanelUiBinder extends UiBinder<Widget, NoVresPanel> {
}
public NoVresPanel() {
initWidget(uiBinder.createAndBindUi(this));
}
public NoVresPanel(String firstName) {
initWidget(uiBinder.createAndBindUi(this));
}
}

@ -0,0 +1,12 @@
<!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">
<g:HTMLPanel>
<div class="NoVresStyle">
You are not subscribed to any Virtual Research Environment,
begin by
<a class="vrelink" href="/group/data-e-infrastructure-gateway/join-new/"><span class="important">joining</span></a> one. <br /><br />
<a class="vrelink" href="/group/data-e-infrastructure-gateway/join-new/"><span class="important">Find out</span></a> the Virtual Research Environments available in the infrastructure!
</div>
</g:HTMLPanel>
</ui:UiBinder>

@ -0,0 +1,257 @@
package org.gcube.portlet.user.my_vres.client;
import java.util.ArrayList;
import java.util.Date;
import org.gcube.portlet.user.my_vres.client.widgets.BulletList;
import org.gcube.portlet.user.my_vres.client.widgets.ClickableVRE;
import org.gcube.portlet.user.my_vres.client.widgets.ListItem;
import org.gcube.portlet.user.my_vres.shared.UserBelonging;
import org.gcube.portlet.user.my_vres.shared.VO;
import org.gcube.portlet.user.my_vres.shared.VRE;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
*
* @author Massimiliano Assante - ISTI CNR
* @version 1.1 Dec 2012
*
*/
public class VresPanel extends Composite {
/**
* Create a remote service proxy to talk to the server-side service
*/
private final MyVREsServiceAsync myVREsService = GWT.create(MyVREsService.class);
private static String VO = "Virtual Organizations";
private static String VRE = "Virtual Research Environments";
public static final String COOKIE_NAME = "gCube-EnvironmentViewRestore";
public static final int COOKIE_MONTHS_EXPIRY_TIME = 6; //6 Months
private HTML switcher = new HTML();
private FlowPanel flowPanel;
private VerticalPanel mainPanel = new VerticalPanel();
private HorizontalPanel changeViewPanel = new HorizontalPanel();
private HorizontalPanel imagesPanel = new HorizontalPanel();
private Timer t = null;
private ArrayList<VO> cachedVOs = null;
private boolean isIconView = true;
boolean hasVres = false;
public VresPanel() {
super();
mainPanel.setWidth("100%");
mainPanel.setStyleName("mainPanel");
this.flowPanel = new FlowPanel();
flowPanel.setWidth("100%");
flowPanel.setStyleName("flowPanel");
changeViewPanel.setWidth("95%");
changeViewPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
changeViewPanel.add(imagesPanel);
initWidget(mainPanel);
switcher.setStyleName("imageLink");
imagesPanel.add(switcher);
switcher.setStyleName("switcher");
switcher.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (isIconView)
showListView();
else
showIconView();
}
});
setLastStateUsingCookie();
}
private void loadVREs() {
myVREsService.getInfrastructureVOs(new AsyncCallback<ArrayList<VO>>() {
public void onSuccess(ArrayList<VO> result) {
cachedVOs = result;
if (isIconView)
showIconView();
else
showListView();
}
public void onFailure(Throwable caught) {
flowPanel.add(new HTML("Could not fetch personal VREs: " + caught.getMessage()));
}
});
}
private void showListView() {
mainPanel.clear();
mainPanel.add(changeViewPanel);
HTML voTitle = new HTML(VO);
voTitle.setStyleName("listPanel-title");
BulletList voList = new BulletList();
voList.setStyleName("list");
boolean showVOs = false;
for (VO vo: cachedVOs) {
if (! vo.isRoot() && vo.getUserBelonging() == UserBelonging.BELONGING) {
voList.add(addVo(vo));
showVOs = true;
}
}
if (showVOs){
mainPanel.add(voTitle);
mainPanel.add(voList);
}
HTML vreTitle = new HTML(VRE);
vreTitle.setStyleName("listPanel-title");
BulletList vreList = new BulletList();
vreList.setStyleName("list");
boolean showVREs = false;
for (VO vo: cachedVOs) {
for (VRE vre : vo.getVres()) {
vreList.add(addVRE(vre));
showVREs = true;
}
}
if (showVREs) {
mainPanel.add(vreTitle);
mainPanel.add(vreList);
}
Cookies.setCookie(COOKIE_NAME, "1", getExpiryDate());
isIconView = false;
setSwitcherText();
}
private void showIconView() {
mainPanel.clear();
flowPanel.clear();
mainPanel.add(changeViewPanel);
mainPanel.add(flowPanel);
for (VO vo: cachedVOs) {
for (VRE vre : vo.getVres()) {
ClickableVRE vreButton = new ClickableVRE(vre, myVREsService);
flowPanel.add(vreButton);
hasVres = true;
}
}
if (!hasVres) {
mainPanel.add(new NoVresPanel());
imagesPanel.clear();
}
Cookies.setCookie(COOKIE_NAME, "0", getExpiryDate());
isIconView = true;
setSwitcherText();
}
private ListItem addVo(final VO vo) {
final ListItem li = new ListItem();
li.setStyleName("list-item item-vo ");
li.setText(vo.getName());
li.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
showLoading(li);
String scope = vo.getGroupName();
myVREsService.loadLayout(scope, vo.getFriendlyURL(), new AsyncCallback<Void>() {
public void onFailure(Throwable arg0) {
Window.open( vo.getFriendlyURL(), "_self", "");
}
public void onSuccess(Void arg0) {
Window.open( vo.getFriendlyURL(), "_self", "");
}
});
}
});
return li;
}
private ListItem addVRE(final VRE vre) {
final ListItem li = new ListItem();
li.setStyleName("list-item item-vre ");
li.setText(vre.getName());
li.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
showLoading(li);
String scope = vre.getGroupName();
myVREsService.loadLayout(scope, vre.getFriendlyURL(), new AsyncCallback<Void>() {
public void onFailure(Throwable arg0) {
Window.open( vre.getFriendlyURL(), "_self", "");
}
public void onSuccess(Void arg0) {
Window.open( vre.getFriendlyURL(), "_self", "");
}
});
}
});
return li;
}
private void showLoading(final ListItem li) {
li.setText("Loading .");
t = new Timer() {
@Override
public void run() {
li.setText(li.getText() + " .");
t.schedule(250);
if (li.getText().length() > 50)
t.cancel();
}
};
t.schedule(250);
}
private void setSwitcherText() {
if (isIconView)
switcher.setHTML("SHOW LIST");
else
switcher.setHTML("SHOW TILES");
}
/**
*
* @return
*/
@SuppressWarnings("deprecation")
public Date getExpiryDate() {
Date expiryDate = new Date();
int month = expiryDate.getMonth();
month += COOKIE_MONTHS_EXPIRY_TIME ;
expiryDate.setMonth(month);
return expiryDate;
}
/**
*
*/
private void setLastStateUsingCookie() {
Date expiryDate = getExpiryDate();
if (Cookies.getCookie(COOKIE_NAME) == null) {
Cookies.setCookie(COOKIE_NAME, "0", expiryDate);
}
else {
String lastIconsState = Cookies.getCookie(COOKIE_NAME);
if (lastIconsState.compareTo("1") == 0)
isIconView = false;
else
isIconView = true;
}
loadVREs();
}
}

@ -0,0 +1,25 @@
package org.gcube.portlet.user.my_vres.client.widgets;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Widget;
/**
*
* @author Massimiliano Assante, ISTI-CNR
* @version 0.1 Dec 2012
*
*/
public class BulletList extends ComplexPanel {
public BulletList() {
setElement(DOM.createElement("ul"));
}
public void add(Widget w) {
super.add(w, getElement());
}
public void insert(Widget w, int beforeIndex) {
super.insert(w, getElement(), beforeIndex, true);
}
}

@ -0,0 +1,72 @@
package org.gcube.portlet.user.my_vres.client.widgets;
import org.gcube.portlet.user.my_vres.client.MyVREsServiceAsync;
import org.gcube.portlet.user.my_vres.shared.VRE;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Image;
/**
*
* @author Massimiliano Assante - ISTI CNR
* @version 1.0 Jun 2012
*
*/
public class ClickableVRE extends HTML {
private final static int WIDTH = 115;
private final static int HEIGHT = 120;
private String name;
private String imageUrl;
private int imageWidth = 0;
public static final String LOADING_IMAGE = GWT.getModuleBaseURL() + "../images/loading.gif";
Image img = new Image(LOADING_IMAGE);
public ClickableVRE() {
super();
}
public ClickableVRE(final VRE vre, final MyVREsServiceAsync service) {
super.setPixelSize(WIDTH, HEIGHT);
setPixelSize(WIDTH, HEIGHT);
imageWidth = WIDTH - 20;
name = vre.getName();
imageUrl = vre.getImageURL();
this.setTitle("Enter this VRE");
int imageHeight = 95;
String html = "<div class=\"vreCaption\">" + name + "</div>";
html += "<div style=\"text-align:center\">" +
"<img width=\"" + imageWidth + "\" height=\"" + imageHeight +"\" src=\"" +imageUrl + "\" />" +
"</div>";
setHTML(html);
setStyleName("vreButton");
addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
showLoading();
String scope = vre.getGroupName();
service.loadLayout(scope, vre.getFriendlyURL(), new AsyncCallback<Void>() {
public void onFailure(Throwable arg0) {
Window.open( vre.getFriendlyURL(), "_self", "");
}
public void onSuccess(Void arg0) {
Window.open( vre.getFriendlyURL(), "_self", "");
}
});
}
});
}
public void showLoading() {
String html = "<table width=\"100%\" height=\"120px\"><tr height=\"120px\"><td align=\"center\"><img src=\"" + img.getUrl() + "\"></td></tr></table>";
setHTML(html);
}
}

@ -0,0 +1,61 @@
package org.gcube.portlet.user.my_vres.client.widgets;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.event.dom.client.KeyDownHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Widget;
/**
*
* @author Massimiliano Assante, ISTI-CNR
* @version 0.1 Sep 2012
*
*/
public class ListItem extends ComplexPanel {
HandlerRegistration clickHandler;
public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
return addDomHandler(handler, KeyDownEvent.getType());
}
public HandlerRegistration addClickHandler(ClickHandler handler) {
return addDomHandler(handler, ClickEvent.getType());
}
public String getHTML() {
return DOM.getInnerHTML(getElement());
}
public void setHTML(String html) {
DOM.setInnerHTML(getElement(), (html == null) ? "" : html);
}
public ListItem() {
setElement(DOM.createElement("li"));
}
public void setId(String id) {
DOM.setElementAttribute(getElement(), "id", id);
}
public void add(Widget w) {
super.add(w, getElement());
}
public void insert(Widget w, int beforeIndex) {
super.insert(w, getElement(), beforeIndex, true);
}
public String getText() {
return DOM.getInnerText(getElement());
}
public void setText(String text) {
DOM.setInnerText(getElement(), (text == null) ? "" : text);
}
}

@ -0,0 +1,353 @@
package org.gcube.portlet.user.my_vres.server;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.gcube.application.framework.core.session.ASLSession;
import org.gcube.application.framework.core.session.SessionManager;
import org.gcube.common.core.utils.logging.GCUBELog;
import org.gcube.portal.custom.communitymanager.OrganizationsUtil;
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
import org.gcube.portlet.user.my_vres.client.MyVREsService;
import org.gcube.portlet.user.my_vres.shared.UserBelonging;
import org.gcube.portlet.user.my_vres.shared.VO;
import org.gcube.portlet.user.my_vres.shared.VRE;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.liferay.portal.kernel.servlet.ImageServletTokenUtil;
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.model.Group;
import com.liferay.portal.model.Organization;
import com.liferay.portal.model.User;
import com.liferay.portal.service.OrganizationLocalServiceUtil;
import com.liferay.portal.theme.ThemeDisplay;
/**
* The server side implementation of the RPC service.
* @author Massimiliano Assante - ISTI CNR
* @version 1.0 Jun 2012
*/
@SuppressWarnings("serial")
public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsService {
private static GCUBELog _log = new GCUBELog(MyVREsServiceImpl.class);
/**
*
*/
public static final String CACHED_VOS = "CACHED_VRES";
/**
*
*/
public static final String ROOT_ORG = "rootorganization";
private VO rootVO = new VO();
private boolean withinPortal = false;
/**
* the current ASLSession
* @return the session
*/
private ASLSession getASLSession() {
String sessionID = this.getThreadLocalRequest().getSession().getId();
String user = (String) this.getThreadLocalRequest().getSession().getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
if (user == null) {
_log.warn("USER IS NULL setting test.user");
user = "test.user";
}
else {
_log.info("LIFERAY PORTAL DETECTED user=" + user);
withinPortal = true;
}
return SessionManager.getInstance().getASLSession(sessionID, user);
}
/**
* first method called by the UI
*/
public ArrayList<VO> getInfrastructureVOs() {
getASLSession();
//_log.trace("getInfrastructureVOs method called");
if (!withinPortal)
return getFakeVOs();
//return new ArrayList<VO>();
else
try {
String username = getASLSession().getUsername();
User currUser = OrganizationsUtil.validateUser(username);
List<Organization> organizations = OrganizationLocalServiceUtil.getOrganizations(0, OrganizationLocalServiceUtil.getOrganizationsCount());
ThemeDisplay themeDisplay = (ThemeDisplay) this.getThreadLocalRequest().getSession().getAttribute(WebKeys.THEME_DISPLAY);
Organization rootOrganization = null;
for (Organization organization : organizations) {
if (organization.getName().equals( getRootOrganizationName() ) ) {
rootOrganization = organization;
break;
}
}
try {
//_log.info("root: " + rootOrganization.getName() );
}
catch (NullPointerException e) {
_log.error("Cannot find root organziation, please check gcube-data.properties file in $CATALINA_HOME/conf folder, unless your installing the Bundle");
return new ArrayList<VO>();
}
// Create the list of the Infrastructure VOs
List<VO> infrastructureVOs = new ArrayList<VO>();
//create and check the root VO
rootVO = new VO();
rootVO.setName(rootOrganization.getName());
rootVO.setGroupName("/"+rootOrganization.getName());
rootVO.setRoot(true);
Group orgGroup = rootOrganization.getGroup();
String friendlyURL = orgGroup.getPathFriendlyURL(true, themeDisplay) + orgGroup.getFriendlyURL();
rootVO.setFriendlyURL(getPortalBasicUrl()+friendlyURL);
long logoId = rootOrganization.getLogoId();
String logoURL = themeDisplay.getPathImage()+"/organization_logo?img_id="+ logoId +"&t" + ImageServletTokenUtil.getToken(logoId);
rootVO.setImageURL(logoURL);
if (rootOrganization.getComments() != null)
rootVO.setDescription(rootOrganization.getComments());
//for each root sub organizations (VO)
for (Organization vOrg : rootOrganization.getSuborganizations()) {
//_log.debug("SKIP GCUBE APPS " + vOrg.getName() );
//_log.debug("FOUND VO: " + vOrg.getName() );
//create the VO
VO voToAdd = new VO();
voToAdd.setName(vOrg.getName());
voToAdd.setGroupName("/"+vOrg.getParentOrganization().getName()+"/"+vOrg.getName());
voToAdd.setRoot(false);
for (Organization vre : vOrg.getSuborganizations()) {
VRE vreToAdd = new VRE();
vreToAdd.setName(vre.getName());
vreToAdd.setGroupName("/"+vOrg.getParentOrganization().getName()+"/"+vOrg.getName()+"/"+vre.getName());
logoId = vre.getLogoId();
logoURL = themeDisplay.getPathImage()+"/organization_logo?img_id="+ logoId +"&t" + ImageServletTokenUtil.getToken(logoId);
vreToAdd.setImageURL(logoURL);
String vreUrl = vre.getGroup().getPathFriendlyURL(true, themeDisplay) + vre.getGroup().getFriendlyURL();
vreToAdd.setFriendlyURL(getPortalBasicUrl()+vreUrl);
//set the description for the vre
if (vre.getComments() != null) {
vreToAdd.setDescription(vre.getComments());
}
//check if the user belongs to it
if (currUser.getOrganizations().contains(vre)) {
vreToAdd.setUserBelonging(UserBelonging.BELONGING);
voToAdd.addVRE(vreToAdd);
}
}
Group group = vOrg.getGroup();
String url = group.getPathFriendlyURL(true, themeDisplay) + group.getFriendlyURL();
voToAdd.setFriendlyURL(getPortalBasicUrl() + url);
//set the description for the vre
if (vOrg.getComments() != null) voToAdd.setDescription(vOrg.getComments());
//check if the user belongs to it
if (currUser.getOrganizations().contains(vOrg)) {
voToAdd.setUserBelonging(UserBelonging.BELONGING);
}
else
voToAdd.setUserBelonging(UserBelonging.NOT_BELONGING);
infrastructureVOs.add(voToAdd);
}
ArrayList<VO> toReturn = new ArrayList<VO>();
for (VO vo : infrastructureVOs) {
for (VRE vre : vo.getVres()) {
//_log.debug("VRE FOUND.... " + vre.getName());
}
toReturn.add(vo);
}
//sort the VOs
Collections.sort(toReturn, Collections.reverseOrder());
//set the root vo as FIRST
toReturn.add(0, rootVO);
ArrayList<VO> toStoreInSession = toReturn;
//_log.debug("SETTING INFRASTRUCTURE VOS in ASLSession");
getASLSession().setAttribute(CACHED_VOS, toStoreInSession);
return toReturn;
}
catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
*
* @param scope
*/
public void loadLayout(String scope, String URL) {
_log.trace("Calling Load Layout...");
HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession mysession = getASLSession();
mysession.setAttribute("loadlayout", "true");
session.setAttribute("loadLayout", "true");
session.setAttribute("selectedVRE", scope);
mysession.logUserLogin(scope);
mysession.setScope(scope);
_log.trace("User login logged to: " + scope);
}
/**
* read the root VO name from a property file and retuns it
*/
protected static String getRootOrganizationName() {
//get the portles to look for from the property file
Properties props = new Properties();
String toReturn = "gcube";
try {
String propertyfile = OrganizationsUtil.getTomcatFolder()+"conf/gcube-data.properties";
File propsFile = new File(propertyfile);
FileInputStream fis = new FileInputStream(propsFile);
props.load( fis);
toReturn = props.getProperty(ROOT_ORG);
}
//catch exception in case properties file does not exist
catch(IOException e) {
toReturn = "gcube";
_log.error("gcube-data.properties file not found under $CATALINA_HOME/conf dir, returning default VO Name " + toReturn);
return toReturn;
}
_log.debug("Returning Root VO Name: " + toReturn );
return toReturn;
}
/**
*
* @return the portal basic url, e.g. http://www.foo.com
*/
private String getPortalBasicUrl() {
HttpServletRequest request = this.getThreadLocalRequest();
String toReturn = "";
//protocol
String protocol = (request.isSecure()) ? "https://" : "http://" ;
toReturn += protocol;
//server name
toReturn += request.getServerName();
//port
toReturn += (request.getServerPort() == 80) ? "" : ":"+request.getServerPort() ;
// _log.trace("getPortalBasicUrl: " +toReturn + "queryString: " + request.getQueryString());
return toReturn;
}
/**
* simply returns fake VOS for debugging purpose
* @return
*/
protected static ArrayList<VO> getFakeVOs() {
VO rootVO = new VO();
rootVO.setRoot(true);
rootVO.setName("/d4science.research-infrastructures.eu/");
rootVO.setDescription("This is the description for the ROOT VO");
rootVO.setImageURL("http://portal.d4science.research-infrastructures.eu/vologin/html/RedGrid.jpg");
rootVO.setUserBelonging(UserBelonging.BELONGING);
/***************************************/
VO emVO = new VO();
emVO.setRoot(false);
emVO.setGroupName("/d4science.research-infrastructures.eu/EM/");
emVO.setName("EM VO");
emVO.setDescription("EM and AEM Virtual Organisation The FARM Virtual Organisation is the dynamic group of individuals and/or institutions defined around a set of sharing rules in which resource providers and consumers specify clearly and carefully just what is shared, who is allowed to share, and the conditions under which sharing occurs to serve the needs of the Fisheries and Aquaculture Resources Management.");
emVO.setImageURL("http://portal.d4science.research-infrastructures.eu/vologin/html/RedGrid.jpg");
emVO.setUserBelonging(UserBelonging.NOT_BELONGING);
//
//
VRE cool_EM_VRE = new VRE();
cool_EM_VRE.setName("COOL EM VRE");
cool_EM_VRE.setGroupName("/d4science.research-infrastructures.eu/EM/COOLEMVRE");
cool_EM_VRE.setDescription("cool_EM_VRE VRE Description<br />"+
"This Virtual Research Environment is for cool authors, managers and researchers who produce reports containing cool data.");
cool_EM_VRE.setImageURL("http://portal.d4science.research-infrastructures.eu/vologin/html/gcm-preview.jpg");
cool_EM_VRE.setUserBelonging(UserBelonging.BELONGING);
emVO.addVRE(cool_EM_VRE);
VRE cool_EM_VRE2 = new VRE();
cool_EM_VRE2.setName("COOL VRE 2");
cool_EM_VRE2.setGroupName("/d4science.research-infrastructures.eu/EM/COOLEMVRE2");
cool_EM_VRE2.setDescription("Cool VRE Description<br />"+
"This Virtual Research Environment is for cool authors, managers and researchers who produce reports containing cool data.");
cool_EM_VRE2.setImageURL("https://newportal.i-marine.d4science.org/image/organization_logo?img_id=13302&t1339191699773");
cool_EM_VRE2.setUserBelonging(UserBelonging.NOT_BELONGING);
VRE cool_EM_VRE3 = new VRE();
cool_EM_VRE3.setName("COOL EM VRE TRE");
cool_EM_VRE3.setGroupName("/d4science.research-infrastructures.eu/EM/COOlVRE3");
cool_EM_VRE3.setDescription("Cool VRE Description<br />"+
"This Virtual Research Environment is for cool authors, managers and researchers who produce reports containing cool data.");
cool_EM_VRE3.setImageURL("https://newportal.i-marine.d4science.org/image/organization_logo?img_id=13302&t1339191699773");
cool_EM_VRE3.setUserBelonging(UserBelonging.BELONGING);
VRE demo = new VRE();
demo.setName("Demo");
demo.setGroupName("/d4science.research-infrastructures.eu/EM/Demo");
demo.setDescription("Cool VRE Description<br />"+
"This Virtual Research Environment is for cool authors, managers and researchers who produce reports containing cool data.");
demo.setImageURL("http://portal.d4science.research-infrastructures.eu/vologin/html/RedGrid.jpg");
demo.setUserBelonging(UserBelonging.BELONGING);
VRE vreGCM = new VRE();
vreGCM.setName("GCM");
vreGCM.setGroupName("/d4science.research-infrastructures.eu/EM/GCM");
vreGCM.setDescription("Global Ocean Chlorophyll Monitoring (GCM) Virtual Research Environment<br />"
+ "The phytoplankton plays a similar role to terrestrial green plants in the photosynthetic process and are credited with removing as much carbon dioxide from the atmosphere as their earthbound counterparts, making it important to monitor and model plankton into calculations of future climate change.");
vreGCM.setImageURL("https://newportal.i-marine.d4science.org/image/organization_logo?img_id=13302&t1339191699773");
vreGCM.setUserBelonging(UserBelonging.BELONGING);
emVO.addVRE(cool_EM_VRE);
emVO.addVRE(cool_EM_VRE2);
emVO.addVRE(cool_EM_VRE3);
emVO.addVRE(demo);
emVO.addVRE(vreGCM);
ArrayList<VO> toReturn = new ArrayList<VO>();
toReturn.add(rootVO);
toReturn.add(emVO);
toReturn.add(emVO);
return toReturn;
}
}

@ -0,0 +1,85 @@
package org.gcube.portlet.user.my_vres.server.portlet;
import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.PortletSession;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.model.User;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.theme.ThemeDisplay;
/**
* MyVREsPortlet Portlet Class
* @author Massimiliano Assante - ISTI CNR
* @version 1.0 Jun 2012
*/
public class MyVREsPortlet extends GenericPortlet {
private static Log _log = LogFactoryUtil.getLog(MyVREsPortlet.class);
protected String viewJSP;
public void init() throws PortletException {
viewJSP = "/WEB-INF/jsp/MyVREs_view.jsp";
}
public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException {
long userid = Long.parseLong(renderRequest.getRemoteUser());
ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
renderRequest.getPortletSession().setAttribute(WebKeys.THEME_DISPLAY, themeDisplay, PortletSession.APPLICATION_SCOPE);
User user = null;
try {
user = UserLocalServiceUtil.getUser(userid);
} catch (SystemException e) {
e.printStackTrace();
} catch (PortalException e) {
e.printStackTrace();
}
//get the username
String username = user.getScreenName();
//Set the username to the portlet session, so that it can be accessed through the servlet
renderRequest.getPortletSession().setAttribute("username", username, PortletSession.APPLICATION_SCOPE);
renderRequest.getPortletSession().setAttribute("user", username, PortletSession.APPLICATION_SCOPE);
include(viewJSP, renderRequest, renderResponse);
}
protected void include(String path, RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException {
PortletRequestDispatcher portletRequestDispatcher = getPortletContext().getRequestDispatcher(path);
if (portletRequestDispatcher == null) {
_log.error(path + " is not a valid include");
}
else {
portletRequestDispatcher.include(renderRequest, renderResponse);
}
}
/**
*
*/
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException {
}
}

@ -0,0 +1,87 @@
package org.gcube.portlet.user.my_vres.shared;
import java.io.Serializable;
/**
*
* @author Massimiliano Assante ISTI-CNR
*
* @version 2.0 Jan 10th 2012
*/
@SuppressWarnings("serial")
public class ResearchEnvironment implements Serializable{
private String name;
private String description;
private String imageURL;
private String groupName;
private String friendlyURL;
private UserBelonging userBelonging;
public ResearchEnvironment() {
super();
}
public ResearchEnvironment(String name, String description,
String imageURL, String groupName, String friendlyURL,
UserBelonging userBelonging) {
super();
this.name = name;
this.description = description;
this.imageURL = imageURL;
this.groupName = groupName;
this.friendlyURL = friendlyURL;
this.userBelonging = userBelonging;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getImageURL() {
return imageURL;
}
public void setImageURL(String imageURL) {
this.imageURL = imageURL;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public String getFriendlyURL() {
return friendlyURL;
}
public void setFriendlyURL(String friendlyURL) {
this.friendlyURL = friendlyURL;
}
public UserBelonging getUserBelonging() {
return userBelonging;
}
public void setUserBelonging(UserBelonging userBelonging) {
this.userBelonging = userBelonging;
}
}

@ -0,0 +1,5 @@
package org.gcube.portlet.user.my_vres.shared;
public enum UserBelonging { BELONGING, NOT_BELONGING, PENDING
}

@ -0,0 +1,70 @@
package org.gcube.portlet.user.my_vres.shared;
import java.io.Serializable;
import java.util.ArrayList;
/**
*
* @author Massimiliano Assante ISTI-CNR
*
* @version 2.0 Jan 10th 2012
*/
@SuppressWarnings("serial")
public class VO extends ResearchEnvironment implements Comparable<VO>, Serializable{
private boolean isRoot;
private ArrayList<VRE> vres = new ArrayList<VRE>();
/**
*
*/
public VO() {
super();
}
/**
*
* @param voName .
* @param description .
* @param imageURL .
* @param vomsGroupName .
* @param friendlyURL .
* @param userBelonging .
* @param isRoot .
* @param vres .
*/
public VO(String voName, String description, String imageURL,
String vomsGroupName, String friendlyURL,
UserBelonging userBelonging, boolean isRoot, ArrayList<VRE> vres) {
super(voName, description, imageURL, vomsGroupName, friendlyURL, userBelonging);
this.isRoot = isRoot;
this.vres = vres;
}
public boolean isRoot() {
return isRoot;
}
public void setRoot(boolean isRoot) {
this.isRoot = isRoot;
}
public ArrayList<VRE> getVres() {
return vres;
}
public void setVres(ArrayList<VRE> vres) {
this.vres = vres;
}
/**
*
* @param toAdd
*/
public void addVRE(VRE toAdd) {
if (vres == null)
vres = new ArrayList<VRE>();
vres.add(toAdd);
}
/**
* compare the number of vres
*/
public int compareTo(VO voToCompare) {
return (this.vres.size() >= voToCompare.getVres().size()) ? 1 : -1;
}
}

@ -0,0 +1,30 @@
package org.gcube.portlet.user.my_vres.shared;
import java.io.Serializable;
@SuppressWarnings("serial")
public class VRE extends ResearchEnvironment implements Serializable {
/**
*
*/
public VRE() {
super();
// TODO Auto-generated constructor stub
}
/**
*
* @param vreName
* @param description
* @param imageURL
* @param vomsGroupName
* @param friendlyURL
* @param userBelonging
*/
public VRE(String vreName, String description, String imageURL,
String vomsGroupName, String friendlyURL,
UserBelonging userBelonging) {
super(vreName, description, imageURL, vomsGroupName, friendlyURL, userBelonging);
}
}

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='myvres'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- To Comment out -->
<!-- <set-property name="user.agent" value="gecko1_8" /> -->
<!-- We need the JUnit module in the main module, -->
<!-- otherwise eclipse complains (Google plugin bug?) -->
<inherits name='com.google.gwt.junit.JUnit' />
<!-- 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.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<!-- Specify the app entry point class. -->
<entry-point class='org.gcube.portlet.user.my_vres.client.MyVREs' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>

@ -0,0 +1,157 @@
@import url(http://fonts.googleapis.com/css?family=Architects+Daughter);
div.vreButton {
float: left;
}
a.vrelink,a.vrelink:active,a.vrelink:visited {
cursor: pointer;
cursor: hand;
text-decoration: none;
color: #15C;
}
a.vrelink:hover {
opacity: 0.8;
text-decoration: underline;
}
.gwt-Button {
margin: 0px;
padding: 0px;
}
.mainPanel {
margin-bottom: 15px;
margin-left: 10px;
}
.flowPanel {
margin-left: 5px;
}
.important {
font-weight: bold;
}
.NoVresStyle {
line-height: 25px;
font-family: 'Architects Daughter', Arial, Verdana, sans-serif;
font-size: 15px;
padding-left: 0px;
}
.listPanel {
margin-right: 10px;
margin-top: 5px;
padding: 5px;
}
.switcher {
color: #999;
font-family: 'lucida grande', tahoma, verdana, arial, sans-serif;
font-size: 8px;
font-variant:small-caps;
font-weight: bold;
}
.switcher:hover {
opacity: 0.8;
cursor: pointer;
cursor: hand;
}
.listPanel-title {
color: #999;
font-family: 'lucida grande', tahoma, verdana, arial, sans-serif;
font-size: 12px;
font-variant:small-caps;
font-weight: bold;
}
.list {
list-style-type: none;
margin-bottom: 10px;
margin-top: 5px;
margin-left: 0px;
padding-bottom: 0px;
padding-left: 5px;
padding-right: 0px;
padding-top: 0px;
}
.list-item {
color: #444;
font-family: 'Lucida Grande', Verdana, 'Bitstream Vera Sans', Arial,
sans-serif;
font-size: 15px;
margin-top: 5px;
line-height: 14px;
padding-left: 20px;
background-color: transparent;
background-repeat: no-repeat;
}
.item-vre {
background-image: url("images/vres.png");
}
.item-vo {
background-image: url("images/vos.png");
}
.list-item:hover {
cursor: pointer;
cursor: hand;
color: #336699;
text-decoration: none;
transition: color .25s ease-in-out;
-moz-transition: color .25s ease-in-out;
-webkit-transition: color .25s ease-in-out;
}
.vreButton {
background: transparent;
margin-right: 10px;
margin-top: 5px;
padding: 5px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
background-color: #FFF;
border: 1px solid #DBDBDB;
cursor: pointer;
cursor: hand;
}
.vreCaption {
font-family: Arial, Helvetica, sans-serif;
color: #39C;
display: block;
font-size: 9px;
font-weight: bold;
margin-bottom: 3px;
text-align: left;
padding-left: 1px;
border-bottom: 4px solid #39C;
}
.vreButton[disabled]:hover,.vreButton[disabled]:active,.vreButton[disabled]
{
color: #CCC;
border-color: #BBB;
cursor: default;
opacity: 1.0;
}
.vreButton:hover {
border-color: #39C;
color: #222;
opacity: 0.8;
}
.vreButton:active {
background: #fff;
border: 1px solid #DBDBDB;
}

@ -0,0 +1,38 @@
<!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="MyVREs.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="myvres/myvres.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>
<div id="myVREsDIV"></div>
</body>
</html>

@ -0,0 +1,16 @@
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%-- Uncomment below lines to add portlet taglibs to jsp
<%@ page import="javax.portlet.*"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<portlet:defineObjects />
--%>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href='http://fonts.googleapis.com/css?family=Architects+Daughter' rel='stylesheet' type='text/css'>
<script type="text/javascript" language="javascript" src='<%=request.getContextPath()%>/myvres/myvres.nocache.js'></script>
<div id="myVREsDIV">
</div>

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 5.2.0//EN" "http://www.liferay.com/dtd/liferay-display_5_2_0.dtd">
<display>
<category name="gCube Applications">
<portlet id="MyVREs" />
</category>
</display>

@ -0,0 +1,9 @@
name=MyVREs
module-group-id=liferay
module-incremental-version=1
tags=
short-description=
change-log=
page-url=http://www.d4science.org
author=D4Science Org.
licenses=EUPL

@ -0,0 +1,17 @@
<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 5.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_5_2_0.dtd">
<liferay-portlet-app>
<portlet>
<portlet-name>MyVREs</portlet-name>
<layout-cacheable>false</layout-cacheable>
<instanceable>false</instanceable>
<ajaxable>false</ajaxable>
<!-- LOCATION CSS HERE -->
<header-portlet-css>/MyVREs.css</header-portlet-css>
</portlet>
<role-mapper>
<role-name>administrator</role-name>
<role-link>Administrator</role-link>
</role-mapper>
</liferay-portlet-app>

@ -0,0 +1,21 @@
<?xml version="1.0"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
<portlet>
<portlet-name>MyVREs</portlet-name>
<display-name>gCube MyVREs Login Portlet</display-name>
<portlet-class>org.gcube.portlet.user.my_vres.server.portlet.MyVREsPortlet</portlet-class>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<portlet-info>
<title>My Virtual Research Environments</title>
<short-title>gCube MyVREs Login</short-title>
<keywords>gCube MyVREs Login</keywords>
</portlet-info>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
</portlet>
</portlet-app>

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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"
version="2.5" xmlns="http://java.sun.com/xml/ns/javaee">
<servlet>
<servlet-name>greetServlet</servlet-name>
<servlet-class>org.gcube.portlet.user.my_vres.server.MyVREsServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>greetServlet</servlet-name>
<url-pattern>/myvres/greet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>jUnitHostImpl</servlet-name>
<servlet-class>com.google.gwt.junit.server.JUnitHostImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>jUnitHostImpl</servlet-name>
<url-pattern>/myvres/junithost/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>greetServlet</servlet-name>
<url-pattern>/org.gcube.portlet.user.my_vres.MyVREsJUnit/myvres/greet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>jUnitHostImpl</servlet-name>
<url-pattern>/org.gcube.portlet.user.my_vres.MyVREsJUnit/junithost/*</url-pattern>
</servlet-mapping>
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>MyVREs.html</welcome-file>
</welcome-file-list>
</web-app>

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 464 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -0,0 +1,74 @@
package org.gcube.portlet.user.my_vres.client;
import com.google.gwt.core.client.GWT;
import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
/**
* GWT JUnit <b>integration</b> tests must extend GWTTestCase.
* Using <code>"GwtTest*"</code> naming pattern exclude them from running with
* surefire during the test phase.
*
* If you run the tests using the Maven command line, you will have to
* navigate with your browser to a specific url given by Maven.
* See http://mojo.codehaus.org/gwt-maven-plugin/user-guide/testing.html
* for details.
*/
public class GwtTestMyVREs extends GWTTestCase {
/**
* Must refer to a valid module that sources this class.
*/
public String getModuleName() {
return "org.gcube.portlet.user.my_vres.MyVREsJUnit";
}
/**
* Tests the FieldVerifier.
*/
public void testFieldVerifier() {
// assertFalse(FieldVerifier.isValidName(null));
// assertFalse(FieldVerifier.isValidName(""));
// assertFalse(FieldVerifier.isValidName("a"));
// assertFalse(FieldVerifier.isValidName("ab"));
// assertFalse(FieldVerifier.isValidName("abc"));
// assertTrue(FieldVerifier.isValidName("abcd"));
}
/**
* This test will send a request to the server using the greetServer method in
* MyVREsService and verify the response.
*/
public void testGreetingService() {
// Create the service that we will test.
MyVREsServiceAsync greetingService = GWT.create(MyVREsService.class);
ServiceDefTarget target = (ServiceDefTarget) greetingService;
target.setServiceEntryPoint(GWT.getModuleBaseURL() + "MyVREs/greet");
// Since RPC calls are asynchronous, we will need to wait for a response
// after this test method returns. This line tells the test runner to wait
// up to 10 seconds before timing out.
delayTestFinish(10000);
// Send a request to the server.
// greetingService.greetServer("GWT User", new AsyncCallback<String>() {
// public void onFailure(Throwable caught) {
// // The request resulted in an unexpected error.
// fail("Request failure: " + caught.getMessage());
// }
//
// public void onSuccess(String result) {
// // Verify that the response is correct.
// assertTrue(result.startsWith("Hello, GWT User!"));
//
// // Now that we have received a response, we need to tell the test runner
// // that the test is complete. You must call finishTest() after an
// // asynchronous test finishes successfully, or the test will time out.
// finishTest();
// }
// });
}
}

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module>
<!-- Inherit our applications main module. -->
<inherits name='org.gcube.portlet.user.my_vres.MyVREs' />
<!-- Specify the path to any remote services. -->
<servlet path="/myvres/greet" class="org.gcube.portlet.user.my_vres.server.MyVREsServiceImpl" />
</module>
Loading…
Cancel
Save