updated to support Description of tab names and changed category to thematic area
git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/join-vre@158589 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
93e4a61ebe
commit
abf283727c
|
@ -7,9 +7,6 @@
|
||||||
<dependent-module archiveName="email-templates-library-1.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/email-templates-library/email-templates-library">
|
<dependent-module archiveName="email-templates-library-1.0.1-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/email-templates-library/email-templates-library">
|
||||||
<dependency-type>uses</dependency-type>
|
<dependency-type>uses</dependency-type>
|
||||||
</dependent-module>
|
</dependent-module>
|
||||||
<dependent-module archiveName="invites-common-library-1.4.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/invites-common-library/invites-common-library">
|
|
||||||
<dependency-type>uses</dependency-type>
|
|
||||||
</dependent-module>
|
|
||||||
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
||||||
<property name="context-root" value="join-vre"/>
|
<property name="context-root" value="join-vre"/>
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portal.databook.shared.UserInfo;
|
import org.gcube.portal.databook.shared.UserInfo;
|
||||||
|
import org.gcube.portlets.user.joinvre.shared.TabbedPage;
|
||||||
import org.gcube.portlets.user.joinvre.shared.VRE;
|
import org.gcube.portlets.user.joinvre.shared.VRE;
|
||||||
import org.gcube.portlets.user.joinvre.shared.VRECategory;
|
import org.gcube.portlets.user.joinvre.shared.VRECategory;
|
||||||
|
|
||||||
|
@ -18,7 +19,7 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||||
@RemoteServiceRelativePath("JoinService")
|
@RemoteServiceRelativePath("JoinService")
|
||||||
public interface JoinService extends RemoteService {
|
public interface JoinService extends RemoteService {
|
||||||
|
|
||||||
List<String> isTabbedPanel();
|
List<TabbedPage> isTabbedPanel();
|
||||||
|
|
||||||
LinkedHashMap<VRECategory, ArrayList<VRE>> getVREs();
|
LinkedHashMap<VRECategory, ArrayList<VRE>> getVREs();
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portal.databook.shared.UserInfo;
|
import org.gcube.portal.databook.shared.UserInfo;
|
||||||
|
import org.gcube.portlets.user.joinvre.shared.TabbedPage;
|
||||||
import org.gcube.portlets.user.joinvre.shared.VRE;
|
import org.gcube.portlets.user.joinvre.shared.VRE;
|
||||||
import org.gcube.portlets.user.joinvre.shared.VRECategory;
|
import org.gcube.portlets.user.joinvre.shared.VRECategory;
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ public interface JoinServiceAsync {
|
||||||
|
|
||||||
void getTermsOfUse(long siteId, AsyncCallback<String> callback);
|
void getTermsOfUse(long siteId, AsyncCallback<String> callback);
|
||||||
|
|
||||||
void isTabbedPanel(AsyncCallback<List<String>> callback);
|
void isTabbedPanel(AsyncCallback<List<TabbedPage>> callback);
|
||||||
|
|
||||||
void getPortalSitesMappedToVRE(String tabName, AsyncCallback<LinkedHashMap<VRECategory, ArrayList<VRE>>> callback);
|
void getPortalSitesMappedToVRE(String tabName, AsyncCallback<LinkedHashMap<VRECategory, ArrayList<VRE>>> callback);
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,13 @@ import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.gcube.portlets.user.joinvre.client.responsive.ResponsivePanel;
|
import org.gcube.portlets.user.joinvre.client.responsive.ResponsivePanel;
|
||||||
import org.gcube.portlets.user.joinvre.client.ui.LoadingPanel;
|
import org.gcube.portlets.user.joinvre.client.ui.LoadingPanel;
|
||||||
|
import org.gcube.portlets.user.joinvre.client.ui.TabPageDescription;
|
||||||
|
import org.gcube.portlets.user.joinvre.shared.TabbedPage;
|
||||||
import org.gcube.portlets.user.joinvre.shared.VRE;
|
import org.gcube.portlets.user.joinvre.shared.VRE;
|
||||||
import org.gcube.portlets.user.joinvre.shared.VRECategory;
|
import org.gcube.portlets.user.joinvre.shared.VRECategory;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.DropdownTab;
|
import com.github.gwtbootstrap.client.ui.DropdownTab;
|
||||||
|
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||||
import com.github.gwtbootstrap.client.ui.Tab;
|
import com.github.gwtbootstrap.client.ui.Tab;
|
||||||
import com.github.gwtbootstrap.client.ui.TabPanel;
|
import com.github.gwtbootstrap.client.ui.TabPanel;
|
||||||
import com.github.gwtbootstrap.client.ui.resources.Bootstrap.Tabs;
|
import com.github.gwtbootstrap.client.ui.resources.Bootstrap.Tabs;
|
||||||
|
@ -31,7 +34,7 @@ public class JoinVRE implements EntryPoint {
|
||||||
Logger logger = Logger.getLogger(JoinVRE.class.getName());
|
Logger logger = Logger.getLogger(JoinVRE.class.getName());
|
||||||
public static final String GET_OID_PARAMETER = "siteId";
|
public static final String GET_OID_PARAMETER = "siteId";
|
||||||
public static final String ORGANISATIONS_LABEL = "Organisations";
|
public static final String ORGANISATIONS_LABEL = "Organisations";
|
||||||
public static final String CATEGORIES_LABEL = "Categories";
|
public static final String CATEGORIES_LABEL = "Thematic areas";
|
||||||
|
|
||||||
private final JoinServiceAsync joinService = GWT.create(JoinService.class);
|
private final JoinServiceAsync joinService = GWT.create(JoinService.class);
|
||||||
|
|
||||||
|
@ -100,12 +103,12 @@ public class JoinVRE implements EntryPoint {
|
||||||
final ResponsivePanel toReturn = new ResponsivePanel();
|
final ResponsivePanel toReturn = new ResponsivePanel();
|
||||||
mainPanel.setWidth("100%");
|
mainPanel.setWidth("100%");
|
||||||
mainPanel.add(toReturn);
|
mainPanel.add(toReturn);
|
||||||
joinService.isTabbedPanel(new AsyncCallback<List<String>>() {
|
joinService.isTabbedPanel(new AsyncCallback<List<TabbedPage>>() {
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {}
|
public void onFailure(Throwable caught) {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<String> tabNames) {
|
public void onSuccess(List<TabbedPage> tabNames) {
|
||||||
if (tabNames != null) {
|
if (tabNames != null) {
|
||||||
GWT.log("TabbedPanel");
|
GWT.log("TabbedPanel");
|
||||||
showTabs(toReturn, tabNames);
|
showTabs(toReturn, tabNames);
|
||||||
|
@ -122,12 +125,13 @@ public class JoinVRE implements EntryPoint {
|
||||||
* @param rp
|
* @param rp
|
||||||
* @param tabNames
|
* @param tabNames
|
||||||
*/
|
*/
|
||||||
private void showTabs(ResponsivePanel rp, List<String> tabNames) {
|
private void showTabs(ResponsivePanel rp, List<TabbedPage> tabNames) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (final String theTabName : tabNames) {
|
for (final TabbedPage theTabPage : tabNames) {
|
||||||
final Tab tab2Add = new Tab();
|
final Tab tab2Add = new Tab();
|
||||||
tab2Add.setHeading(theTabName);
|
tab2Add.setHeading(theTabPage.getName());
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
|
tab2Add.add(new TabPageDescription(theTabPage));
|
||||||
tab2Add.add(rp); //we add the responsivepanel to the first tab only and we set it active
|
tab2Add.add(rp); //we add the responsivepanel to the first tab only and we set it active
|
||||||
tab2Add.setActive(true);
|
tab2Add.setActive(true);
|
||||||
}
|
}
|
||||||
|
@ -138,6 +142,7 @@ public class JoinVRE implements EntryPoint {
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
final ResponsivePanel rpPort = new ResponsivePanel(tab2Add);
|
final ResponsivePanel rpPort = new ResponsivePanel(tab2Add);
|
||||||
tab2Add.clear();
|
tab2Add.clear();
|
||||||
|
tab2Add.add(new TabPageDescription(theTabPage));
|
||||||
tab2Add.add(rpPort);
|
tab2Add.add(rpPort);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package org.gcube.portlets.user.joinvre.client.ui;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.joinvre.shared.TabbedPage;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
public class TabPageDescription extends Composite {
|
||||||
|
|
||||||
|
private static TabPageDescriptionUiBinder uiBinder = GWT.create(TabPageDescriptionUiBinder.class);
|
||||||
|
|
||||||
|
interface TabPageDescriptionUiBinder extends UiBinder<Widget, TabPageDescription> {
|
||||||
|
}
|
||||||
|
|
||||||
|
public TabPageDescription() {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Paragraph desc;
|
||||||
|
|
||||||
|
public TabPageDescription(TabbedPage theTab) {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
desc.setText(theTab.getDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
|
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||||
|
<ui:style>
|
||||||
|
.important {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 200;
|
||||||
|
padding: 0 2px;
|
||||||
|
|
||||||
|
}
|
||||||
|
</ui:style>
|
||||||
|
<b:Paragraph ui:field="desc" styleName="{style.important}">Some Text for the
|
||||||
|
Hero Unit.</b:Paragraph>
|
||||||
|
</ui:UiBinder>
|
|
@ -21,6 +21,7 @@ import org.gcube.portal.tou.TermsOfUseImpl;
|
||||||
import org.gcube.portal.tou.exceptions.ToUNotFoundException;
|
import org.gcube.portal.tou.exceptions.ToUNotFoundException;
|
||||||
import org.gcube.portal.tou.model.ToU;
|
import org.gcube.portal.tou.model.ToU;
|
||||||
import org.gcube.portlets.user.joinvre.client.JoinService;
|
import org.gcube.portlets.user.joinvre.client.JoinService;
|
||||||
|
import org.gcube.portlets.user.joinvre.shared.TabbedPage;
|
||||||
import org.gcube.portlets.user.joinvre.shared.UserBelonging;
|
import org.gcube.portlets.user.joinvre.shared.UserBelonging;
|
||||||
import org.gcube.portlets.user.joinvre.shared.VRE;
|
import org.gcube.portlets.user.joinvre.shared.VRE;
|
||||||
import org.gcube.portlets.user.joinvre.shared.VRECategory;
|
import org.gcube.portlets.user.joinvre.shared.VRECategory;
|
||||||
|
@ -139,7 +140,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
||||||
/**
|
/**
|
||||||
* returns null if is not a tabbedpanel, the tab names as list of Strings otherwise
|
* returns null if is not a tabbedpanel, the tab names as list of Strings otherwise
|
||||||
*/
|
*/
|
||||||
public List<String> isTabbedPanel() {
|
public List<TabbedPage> isTabbedPanel() {
|
||||||
if (isWithinPortal()) {
|
if (isWithinPortal()) {
|
||||||
_log.info("check if isTabbedPanel ");
|
_log.info("check if isTabbedPanel ");
|
||||||
Object tabbedLayoutObj = null;
|
Object tabbedLayoutObj = null;
|
||||||
|
@ -159,7 +160,10 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return Arrays.asList(new String[]{"Products?", "Portfolio"});
|
return Arrays.asList(
|
||||||
|
new TabbedPage[]{new TabbedPage("Products", "designed to apply Data Mining techniques to biological data. "),
|
||||||
|
new TabbedPage("Portfolio", "Portfolio description The algorithms are executed in ..")}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -167,12 +171,28 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
||||||
* @return the list containing the names of the Tabs to show in the correct order.
|
* @return the list containing the names of the Tabs to show in the correct order.
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private List<String> getTabNames() throws Exception {
|
private List<TabbedPage> getTabNames() throws Exception {
|
||||||
List<String> toReturn = new ArrayList<String>();
|
List<TabbedPage> toReturn = new ArrayList<TabbedPage>();
|
||||||
long currentSiteGroupId = getSiteFromServletRequest(getThreadLocalRequest()).getGroupId();
|
long currentSiteGroupId = getSiteFromServletRequest(getThreadLocalRequest()).getGroupId();
|
||||||
String[] values = (String[]) groupsManager.readCustomAttr(currentSiteGroupId, TAB_NAMES_ATTRIBUTE);
|
String[] values = (String[]) groupsManager.readCustomAttr(currentSiteGroupId, TAB_NAMES_ATTRIBUTE);
|
||||||
for (int i = 0; i < values.length; i++) {
|
TabbedPage toAdd = new TabbedPage();
|
||||||
toReturn.add(values[i]);
|
if (values != null && values.length > 0) {
|
||||||
|
for (int i = 0; i < values.length; i++) {
|
||||||
|
toAdd = new TabbedPage();
|
||||||
|
String[] splits = values[i].split("\\|");
|
||||||
|
if (splits.length > 1) {
|
||||||
|
toAdd.setName(splits[0]);
|
||||||
|
toAdd.setDescription(splits[1]);
|
||||||
|
} else {
|
||||||
|
_log.warn("I could not find the Tab Description in the Custom field, is it separated by the pipe? getting all the value ...");
|
||||||
|
toAdd.setName(values[i]);
|
||||||
|
toAdd.setDescription("");
|
||||||
|
}
|
||||||
|
toReturn.add(toAdd);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
toAdd.setName("NoTabbedPageAssigned");
|
||||||
|
toAdd.setDescription("NoTabbedPageDescription");
|
||||||
}
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
@ -184,7 +204,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
||||||
try {
|
try {
|
||||||
if (isWithinPortal()) {
|
if (isWithinPortal()) {
|
||||||
if (isTabbedPanel() != null) {
|
if (isTabbedPanel() != null) {
|
||||||
String firstTabName = getTabNames().get(0);
|
String firstTabName = getTabNames().get(0).getName();
|
||||||
return getPortalSitesMappedToVRE(firstTabName);
|
return getPortalSitesMappedToVRE(firstTabName);
|
||||||
} else {
|
} else {
|
||||||
toReturn = getPortalSitesMappedToVRE();
|
toReturn = getPortalSitesMappedToVRE();
|
||||||
|
@ -217,11 +237,16 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
|
||||||
ArrayList<VRE> toAdd = new ArrayList<VRE>();
|
ArrayList<VRE> toAdd = new ArrayList<VRE>();
|
||||||
tabVREs.put(cat, toAdd);
|
tabVREs.put(cat, toAdd);
|
||||||
for (VRE vre : allVREs.get(cat)) {
|
for (VRE vre : allVREs.get(cat)) {
|
||||||
|
_log.debug("getting selected tab for " + vre.getName());
|
||||||
String[] vreTabNames = (String[]) groupsManager.readCustomAttr(vre.getId(), TAB_NAMES_ATTRIBUTE);
|
String[] vreTabNames = (String[]) groupsManager.readCustomAttr(vre.getId(), TAB_NAMES_ATTRIBUTE);
|
||||||
String vreTabName = vreTabNames[0];
|
if (vreTabNames != null && vreTabNames.length > 0) {
|
||||||
if (tabName.equals(vreTabName)) {
|
String vreTabName = vreTabNames[0];
|
||||||
toAdd.add(vre);
|
if (tabName.equals(vreTabName)) {
|
||||||
_log.debug("Added " + vre.getName() + " as it belongs to " + vreTabName);
|
toAdd.add(vre);
|
||||||
|
_log.debug("Added " + vre.getName() + " as it belongs to " + vreTabName);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
_log.warn("Spotted vre without tab assigned: " + vre.getName() + " skipping it ...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package org.gcube.portlets.user.joinvre.shared;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
|
||||||
|
public class TabbedPage implements IsSerializable, Comparable<TabbedPage> {
|
||||||
|
|
||||||
|
protected String name;
|
||||||
|
protected String description;
|
||||||
|
|
||||||
|
public TabbedPage() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
public TabbedPage(String name, String description) {
|
||||||
|
super();
|
||||||
|
this.name = name;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
public int compareTo(TabbedPage tabName) {
|
||||||
|
return name.compareTo(tabName.name);
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,7 +13,7 @@
|
||||||
<mime-type>text/html</mime-type>
|
<mime-type>text/html</mime-type>
|
||||||
</supports>
|
</supports>
|
||||||
<portlet-info>
|
<portlet-info>
|
||||||
<title>Explore Virtual Research Environments</title>
|
<title>Explore (New) Virtual Research Environments</title>
|
||||||
<short-title>JoinVRE Portlet</short-title>
|
<short-title>JoinVRE Portlet</short-title>
|
||||||
<keywords>JoinVRE Portlet</keywords>
|
<keywords>JoinVRE Portlet</keywords>
|
||||||
</portlet-info>
|
</portlet-info>
|
||||||
|
|
Loading…
Reference in New Issue