Details for selected product are shown in the right panel

This commit is contained in:
Francesco Mangiacrapa 2020-11-18 12:19:29 +01:00
parent eb8ea01bfb
commit 294bc2aa66
11 changed files with 314 additions and 155 deletions

36
pom.xml
View File

@ -109,30 +109,30 @@
<artifactId>geo-utility</artifactId> <artifactId>geo-utility</artifactId>
<version>[1.0.0,2.0.0-SNAPSHOT)</version> <version>[1.0.0,2.0.0-SNAPSHOT)</version>
</dependency> </dependency>
<dependency> <!-- <dependency> -->
<groupId>org.gcube.common</groupId> <!-- <groupId>org.gcube.common</groupId> -->
<artifactId>authorization-client</artifactId> <!-- <artifactId>authorization-client</artifactId> -->
<version>[2.0.0, 3.0.0-SNAPSHOT)</version> <!-- <version>[2.0.0, 3.0.0-SNAPSHOT)</version> -->
<scope>provided</scope> <!-- <scope>provided</scope> -->
</dependency> <!-- </dependency> -->
<dependency> <!-- <dependency> -->
<groupId>org.gcube.resources.discovery</groupId> <!-- <groupId>org.gcube.resources.discovery</groupId> -->
<artifactId>ic-client</artifactId> <!-- <artifactId>ic-client</artifactId> -->
<version>[1.0.0, 2.0.0-SNAPSHOT)</version> <!-- <version>[1.0.0, 2.0.0-SNAPSHOT)</version> -->
<scope>provided</scope> <!-- <scope>provided</scope> -->
</dependency> <!-- </dependency> -->
<dependency> <dependency>
<groupId>org.gcube.core</groupId> <groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId> <artifactId>common-scope-maps</artifactId>
<version>[1.1.0, 2.0.0-SNAPSHOT)</version> <version>[1.1.0, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <!-- <dependency> -->
<groupId>org.gcube.portlets.user</groupId> <!-- <groupId>org.gcube.portlets.user</groupId> -->
<artifactId>gcube-url-shortener</artifactId> <!-- <artifactId>gcube-url-shortener</artifactId> -->
<version>[1.0.0,2.0.0-SNAPSHOT)</version> <!-- <version>[1.0.0,2.0.0-SNAPSHOT)</version> -->
<scope>compile</scope> <!-- <scope>compile</scope> -->
</dependency> <!-- </dependency> -->
<dependency> <dependency>
<groupId>org.gcube.common.portal</groupId> <groupId>org.gcube.common.portal</groupId>
<artifactId>portal-manager</artifactId> <artifactId>portal-manager</artifactId>

View File

@ -10,8 +10,6 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV; import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import com.github.gwtbootstrap.client.ui.Tab;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
@ -19,7 +17,6 @@ import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.Window; import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.RootPanel;
/** /**
@ -183,29 +180,31 @@ public class GeoportalDataViewer implements EntryPoint {
String tabName = showDetailsEvent.getItemName()==null?"Dettagli Prodotto":showDetailsEvent.getItemName(); String tabName = showDetailsEvent.getItemName()==null?"Dettagli Prodotto":showDetailsEvent.getItemName();
boolean found = mainPanel.selectTabForProductId(id); // boolean found = mainPanel.selectTabForProductId(id);
boolean found = false;
GWT.log("Product with id: "+id+" found? "+found); GWT.log("Product with id: "+id+" found? "+found);
if(!found) { if(!found) {
if(showDetailsEvent.getGeonaItemType().equalsIgnoreCase("Concessione")) { if(showDetailsEvent.getGeonaItemType().equalsIgnoreCase("Concessione")) {
final Tab theTab = mainPanel.addAsTab(tabName, true, null); //final Tab theTab = mainPanel.addAsTab(tabName, true, null);
GeoportalDataViewerServiceAsync.Util.getInstance().getConcessioneForId(id, new AsyncCallback<ConcessioneDV>() { GeoportalDataViewerServiceAsync.Util.getInstance().getConcessioneForId(id, new AsyncCallback<ConcessioneDV>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Window.alert(caught.getMessage()); Window.alert(caught.getMessage());
theTab.clear(); // theTab.clear();
theTab.setIcon(IconType.WARNING_SIGN); // theTab.setIcon(IconType.WARNING_SIGN);
theTab.add(new HTML(caught.getMessage())); // theTab.add(new HTML(caught.getMessage()));
} }
@Override @Override
public void onSuccess(ConcessioneDV result) { public void onSuccess(ConcessioneDV concessioneDV) {
GWT.log("Showing: "+result); GWT.log("Showing: "+concessioneDV);
mainPanel.renderProductIntoTab(theTab, result, showDetailsEvent.getGeonaItemRef()); //mainPanel.renderProductIntoTab(theTab, concessioneDV, showDetailsEvent.getGeonaItemRef());
mainPanel.showAsDetails(concessioneDV, showDetailsEvent.getGeonaItemRef());
} }
}); });
} }

View File

@ -0,0 +1,65 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni.ConcessioneView;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
public class DetailsPanel extends Composite {
private static DetailsPanelUiBinder uiBinder = GWT.create(DetailsPanelUiBinder.class);
@UiField
Button closeButton;
@UiField
HTMLPanel datailsContainerPanel;
@UiField
HTMLPanel detailsHTMLPanel;
interface DetailsPanelUiBinder extends UiBinder<Widget, DetailsPanel> {
}
public DetailsPanel() {
initWidget(uiBinder.createAndBindUi(this));
closeButton.setType(ButtonType.LINK);
closeButton.setIcon(IconType.REMOVE_SIGN);
closeButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
showPanelDetails(false);
}
});
}
public void showDetailsFor(ConcessioneDV cdv, GeoNaItemRef geonaItemRef) {
datailsContainerPanel.clear();
if(detailsHTMLPanel.getParent()!=null)
detailsHTMLPanel.getParent().getElement().setScrollTop(0);
datailsContainerPanel.add(new ConcessioneView(geonaItemRef, cdv));
showPanelDetails(true);
}
private void showPanelDetails(boolean visible) {
detailsHTMLPanel.setVisible(visible);
}
}

View File

@ -0,0 +1,19 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
.to-align-right{
position: absolute;
top: 10px;
right: 10px;
}
</ui:style>
<g:HTMLPanel ui:field="detailsHTMLPanel" visible="false">
<b:Button ui:field="closeButton" addStyleNames="{style.to-align-right}"></b:Button>
<g:HTMLPanel ui:field="datailsContainerPanel"></g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -6,25 +6,21 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM; import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni.ConcessioneView;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef; import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV; import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.NavLink; import com.github.gwtbootstrap.client.ui.NavLink;
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.constants.IconType; import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;
public class GeonaDataViewMainPanel extends Composite { public class GeonaDataViewMainPanel extends Composite {
@ -34,8 +30,11 @@ public class GeonaDataViewMainPanel extends Composite {
interface GeonaDataViewMainPanelUiBinder extends UiBinder<Widget, GeonaDataViewMainPanel> { interface GeonaDataViewMainPanelUiBinder extends UiBinder<Widget, GeonaDataViewMainPanel> {
} }
// @UiField
// Tab mapTabPanel;
@UiField @UiField
Tab mapTabPanel; HTMLPanel mainTabPanel;
@UiField @UiField
NavLink dataPointSelection; NavLink dataPointSelection;
@ -46,8 +45,11 @@ public class GeonaDataViewMainPanel extends Composite {
@UiField @UiField
Button removeQuery; Button removeQuery;
// @UiField
// TabPanel mainTabPanel;
@UiField @UiField
TabPanel mainTabPanel; DetailsPanel detailsPanel;
private List<Tab> listTabs = new ArrayList<Tab>(); private List<Tab> listTabs = new ArrayList<Tab>();
@ -63,7 +65,8 @@ public class GeonaDataViewMainPanel extends Composite {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
this.eventBus = eventBus; this.eventBus = eventBus;
mapPanel = new MapPanel(mapHeight+"px"); mapPanel = new MapPanel(mapHeight+"px");
mapTabPanel.add(mapPanel); detailsPanel.setHeight(mapHeight+"px");
mainTabPanel.add(mapPanel);
bindHandlers(); bindHandlers();
dataPointSelection.setIcon(IconType.SCREENSHOT); dataPointSelection.setIcon(IconType.SCREENSHOT);
dataBoxSelection.setIcon(IconType.BOOKMARK); dataBoxSelection.setIcon(IconType.BOOKMARK);
@ -126,90 +129,95 @@ public class GeonaDataViewMainPanel extends Composite {
} }
public void renderProductIntoTab(Tab tab, ConcessioneDV cdv, GeoNaItemRef geonaItemRef) { // public void renderProductIntoTab(Tab tab, ConcessioneDV cdv, GeoNaItemRef geonaItemRef) {
tab.clear(); // tab.clear();
tab.setHeading(cdv.getNome()); // tab.setHeading(cdv.getNome());
tab.add(new ConcessioneView(geonaItemRef, cdv)); // tab.add(new ConcessioneView(geonaItemRef, cdv));
mapProducts.put(cdv.getId(), tab); // mapProducts.put(cdv.getId(), tab);
selectTabForProductId(cdv.getId()); // selectTabForProductId(cdv.getId());
} // }
public boolean selectTabForProductId(long productId) { // public boolean selectTabForProductId(long productId) {
//
Tab product = mapProducts.get(productId); // Tab product = mapProducts.get(productId);
if(product!=null) { // if(product!=null) {
selectTab(product); // selectTab(product);
//found // //found
return true; // return true;
} // }
//not found // //not found
return false; // return false;
//
} // }
/** // /**
* Adds the as tab. // * Adds the as tab.
* // *
* @param tabTitle the tab title // * @param tabTitle the tab title
* @param tabDescr the tab descr // * @param tabDescr the tab descr
* @param spinner the spinner // * @param spinner the spinner
* @param w the w // * @param w the w
* @return the tab // * @return the tab
*/ // */
public Tab addAsTab(String tabTitle, boolean spinner, Widget w){ // public Tab addAsTab(String tabTitle, boolean spinner, Widget w){
//
// field_create_analytics_request.setActive(false); //// field_create_analytics_request.setActive(false);
//
Tab tab = new Tab(); // Tab tab = new Tab();
mainTabPanel.add(tab); // mainTabPanel.add(tab);
//
if(spinner) { // if(spinner) {
LoaderIcon loader = new LoaderIcon("Loading..."); // LoaderIcon loader = new LoaderIcon("Loading...");
tab.add(loader); // tab.add(loader);
} // }
//
tab.addClickHandler(new ClickHandler() { // tab.addClickHandler(new ClickHandler() {
//
@Override // @Override
public void onClick(ClickEvent event) { // public void onClick(ClickEvent event) {
//
} // }
}); // });
//
//tab.setActive(true); // //tab.setActive(true);
tab.setHeading(tabTitle); // tab.setHeading(tabTitle);
listTabs.add(tab); // listTabs.add(tab);
//
if(w!=null) // if(w!=null)
tab.add(w); // tab.add(w);
//
Scheduler.get().scheduleDeferred(new ScheduledCommand() { // Scheduler.get().scheduleDeferred(new ScheduledCommand() {
//
@Override // @Override
public void execute() { // public void execute() {
selectTab(tab); // selectTab(tab);
//
} // }
}); // });
//
return tab; // return tab;
//
// tab.setActive(true); //// tab.setActive(true);
} // }
private void selectTab(Tab theTab) { // private void selectTab(Tab theTab) {
int i = 1; // int i = 1;
for (Tab tab : listTabs) { // for (Tab tab : listTabs) {
GWT.log("Selecting "+tab); // GWT.log("Selecting "+tab);
tab.setActive(false); // tab.setActive(false);
if(tab.equals(theTab)) { // if(tab.equals(theTab)) {
GWT.log("Tab selected "+tab); // GWT.log("Tab selected "+tab);
mainTabPanel.selectTab(i); // mainTabPanel.selectTab(i);
} // }
i++; // i++;
} // }
//
// }
public void showAsDetails(ConcessioneDV concessioneDV, GeoNaItemRef geonaItemRef) {
detailsPanel.showDetailsFor(concessioneDV, geonaItemRef);
} }
} }

View File

@ -1,26 +1,32 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"> xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
xmlns:c="urn:import:org.gcube.portlets.user.geoportaldataviewer.client.ui">
<ui:style> <ui:style>
.margin-right-10 { .margin-right-10 {
margin-right: 10px; margin-right: 10px;
} }
</ui:style> </ui:style>
<g:HTMLPanel ui:field="mainHTMLPanel"> <g:HTMLPanel ui:field="mainHTMLPanel">
<b:TabPanel ui:field="mainTabPanel" tabPosition="top"> <!-- <b:TabPanel ui:field="mainTabPanel" tabPosition="top"> -->
<b:Tab ui:field="mapTabPanel" active="true" heading="Map"> <!-- <b:Tab ui:field="mapTabPanel" active="true" heading="Map"> -->
<b:DropdownButton type="LINK" text="Query"> <g:HTMLPanel ui:field="mainTabPanel">
<!-- <b:ButtonGroup toggle="checkbox" ui:field="buttonGroup"> --> <b:DropdownButton type="LINK" text="Query">
<b:NavLink ui:field="dataPointSelection" <!-- <b:ButtonGroup toggle="checkbox" ui:field="buttonGroup"> -->
addStyleNames="{style.margin-right-10}">Data Point <b:NavLink ui:field="dataPointSelection"
Selection</b:NavLink> addStyleNames="{style.margin-right-10}">Data Point
<b:NavLink ui:field="dataBoxSelection" visible="false">Data Box Selection</b:NavLink>
Selection</b:NavLink> <b:NavLink ui:field="dataBoxSelection" visible="false">Data Box
<!-- </b:ButtonGroup> --> Selection</b:NavLink>
</b:DropdownButton> <!-- </b:ButtonGroup> -->
<b:Button type="LINK" ui:field="removeQuery" text="Remove Query" visible="false"></b:Button> </b:DropdownButton>
</b:Tab> <b:Button type="LINK" ui:field="removeQuery"
</b:TabPanel> text="Remove Query" visible="false"></b:Button>
</g:HTMLPanel>
<!-- </b:Tab> -->
<!-- </b:TabPanel> -->
<c:DetailsPanel ui:field="detailsPanel"
addStyleNames="details-panel"></c:DetailsPanel>
</g:HTMLPanel> </g:HTMLPanel>
</ui:UiBinder> </ui:UiBinder>

View File

@ -16,6 +16,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.Relazio
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV; import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.github.gwtbootstrap.client.ui.PageHeader; import com.github.gwtbootstrap.client.ui.PageHeader;
import com.github.gwtbootstrap.client.ui.Paragraph; import com.github.gwtbootstrap.client.ui.Paragraph;
import com.github.gwtbootstrap.client.ui.Thumbnails; import com.github.gwtbootstrap.client.ui.Thumbnails;
@ -69,10 +70,14 @@ public class ConcessioneView extends Composite {
@UiField @UiField
HTMLPanel piantaFineScavoPanel; HTMLPanel piantaFineScavoPanel;
@UiField // @UiField
HTMLPanel sharePanel; // HTMLPanel sharePanel;
@UiField
Button shareButton; Button shareButton;
@UiField
Button openButton;
private ConcessioneDV concessioneDV; private ConcessioneDV concessioneDV;
@ -159,7 +164,6 @@ public class ConcessioneView extends Composite {
customTable.addNextKeyValue("Titolare Copyright", concessioneDV.getTitolareCopyright()); customTable.addNextKeyValue("Titolare Copyright", concessioneDV.getTitolareCopyright());
} }
shareButton = new Button("Share");
shareButton.setType(ButtonType.LINK); shareButton.setType(ButtonType.LINK);
shareButton.setIcon(IconType.SHARE); shareButton.setIcon(IconType.SHARE);
@ -172,7 +176,19 @@ public class ConcessioneView extends Composite {
} }
}); });
sharePanel.add(shareButton); openButton.setType(ButtonType.LINK);
openButton.setIcon(IconType.EXPAND);
openButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
}
});
// sharePanel.add(shareButton);
concessioniPanel.add(customTable); concessioniPanel.add(customTable);

View File

@ -18,10 +18,14 @@
} }
</ui:style> </ui:style>
<g:HTMLPanel ui:field="pageViewDetails"> <g:HTMLPanel ui:field="pageViewDetails">
<g:HTMLPanel ui:field="sharePanel" <!-- <g:HTMLPanel ui:field="sharePanel" -->
addStyleNames="{style.align-to-right}"> <!-- addStyleNames="{style.align-to-right}"> -->
</g:HTMLPanel> <!-- </g:HTMLPanel> -->
<b:PageHeader ui:field="titolo"></b:PageHeader> <b:PageHeader ui:field="titolo"></b:PageHeader>
<g:HorizontalPanel>
<b:Button ui:field="shareButton">Share</b:Button>
<b:Button ui:field="openButton">Open</b:Button>
</g:HorizontalPanel>
<b:Paragraph ui:field="introduzione"></b:Paragraph> <b:Paragraph ui:field="introduzione"></b:Paragraph>
<g:HorizontalPanel> <g:HorizontalPanel>
<g:HTMLPanel ui:field="concessioniPanel"> <g:HTMLPanel ui:field="concessioniPanel">

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.geoportaldataviewer.server;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
@ -13,7 +14,6 @@ import org.gcube.application.geoportal.managers.ManagerFactory;
import org.gcube.application.geoportal.model.Record; import org.gcube.application.geoportal.model.Record;
import org.gcube.application.geoportal.model.concessioni.Concessione; import org.gcube.application.geoportal.model.concessioni.Concessione;
import org.gcube.application.geoportal.model.content.UploadedImage; import org.gcube.application.geoportal.model.content.UploadedImage;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser; import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
@ -441,7 +441,22 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
if (shortener != null && shortener.isAvailable()) { if (shortener != null && shortener.isAvailable()) {
String toShort = longUrl; String toShort = longUrl;
return shortener.shorten(toShort); String[] splitted = toShort.split("\\?");
LOG.debug("Splitted long URL is: "+Arrays.asList(splitted));
String link = toShort;
if (splitted.length > 1) {
LOG.debug("Query string detected, encoding it...");
String encodedQuery = splitted[1];
try {
encodedQuery = URLEncoder.encode(splitted[1], "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
LOG.debug("encodedQuery is: "+encodedQuery);
link = String.format("%s?%s", splitted[0], encodedQuery);
}
return shortener.shorten(link);
} }
return longUrl; return longUrl;

View File

@ -1,5 +1,10 @@
/** Add css rules here for your application. */ /** Add css rules here for your application. */
/** Most GWT widgets already have a style name defined */ /** Most GWT widgets already have a style name defined */
body {
padding-top: 0px !important;
}
.gwt-DialogBox { .gwt-DialogBox {
width: 400px; width: 400px;
} }
@ -43,6 +48,7 @@
width: 0; width: 0;
position: absolute; position: absolute;
pointer-events: none; pointer-events: none;
overflow: hidden;
} }
.ol-popup:after { .ol-popup:after {
@ -155,4 +161,21 @@
font-size: 14px !important; font-size: 14px !important;
padding-top: 4px !important; padding-top: 4px !important;
margin-bottom: 5px; margin-bottom: 5px;
}
.details-panel {
position: absolute;
top: 0;
right: 0px;
background: #FFF;
width: 725px;
margin-top: 30px;
padding-left: 5px;
overflow-y: auto;
transition: width 0.2s;
}
.overlay {
z-index: 1000;
opacity: 0.9;
} }

View File

@ -2,6 +2,7 @@ package org.gcube.portlets.user.geoportaldataviewer;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.Arrays;
import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portlets.user.urlshortener.UrlShortener; import org.gcube.portlets.user.urlshortener.UrlShortener;
@ -10,22 +11,25 @@ public class TestShortener {
public static void main(String[] args) { public static void main(String[] args) {
try { try {
String toShort = "https://next.d4science.org/group/nextnext/geona-data-viewer?gid=20&git=concessione"; String toShort = "https://next.d4science.org/group/nextnext/geona-data-viewer";
String[] splitted = toShort.split("\\?"); String[] splitted = toShort.split("\\?");
System.out.println("Splitted is: "+Arrays.asList(splitted));
String link = toShort; String link = toShort;
// if (splitted.length > 1) { if (splitted.length > 1) {
// String encodedQuery = splitted[1]; String encodedQuery = splitted[1];
// try {
// encodedQuery = URLEncoder.encode(splitted[1], "UTF-8"); try {
// } catch (UnsupportedEncodingException e) { encodedQuery = URLEncoder.encode(splitted[1], "UTF-8");
// e.printStackTrace(); } catch (UnsupportedEncodingException e) {
// e.printStackTrace();
// }
// link = String.format("%s?%s", splitted[0], encodedQuery); }
// } System.out.println("encodedQuery is: "+encodedQuery);
// ScopeProvider.instance.set("/gcube/devNext/NextNext"); link = String.format("%s?%s", splitted[0], encodedQuery);
// UrlShortener shortener = new UrlShortener(); }
// System.out.println(shortener.shorten(link)); ScopeProvider.instance.set("/gcube/devNext/NextNext");
UrlShortener shortener = new UrlShortener();
System.out.println(shortener.shorten(link));
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }