enhancement on view details
This commit is contained in:
parent
3b1caa2d7f
commit
654ca73dcf
|
@ -19,5 +19,7 @@ public class GeoportalDataViewerConstants {
|
|||
public enum LayerType {RASTER_BASELAYER, FEATURE_TYPE};
|
||||
|
||||
public static final int MAX_WFS_FEATURES = 5; // zero for no limit
|
||||
|
||||
public static final String NEW_LINE_BR = "<br/>";
|
||||
|
||||
}
|
||||
|
|
|
@ -24,4 +24,6 @@ public interface GeoportalDataViewerService extends RemoteService {
|
|||
|
||||
ConcessioneDV getConcessioneForId(Long id) throws Exception;
|
||||
|
||||
String getMyLogin();
|
||||
|
||||
}
|
||||
|
|
|
@ -36,4 +36,6 @@ public interface GeoportalDataViewerServiceAsync {
|
|||
AsyncCallback<List<GeoNaDataObject>> callback);
|
||||
|
||||
void getConcessioneForId(Long id, AsyncCallback<ConcessioneDV> callback);
|
||||
|
||||
void getMyLogin(AsyncCallback<String> callback);
|
||||
}
|
||||
|
|
|
@ -28,10 +28,11 @@ import ol.source.ImageWmsOptions;
|
|||
import ol.source.ImageWmsParams;
|
||||
import ol.source.Osm;
|
||||
import ol.source.XyzOptions;
|
||||
import ol.style.FillOptions;
|
||||
import ol.style.Icon;
|
||||
import ol.style.IconOptions;
|
||||
import ol.style.Style;
|
||||
import ol.style.Text;
|
||||
import ol.style.TextOptions;
|
||||
|
||||
public class LightOpenLayerOSM {
|
||||
|
||||
|
@ -183,7 +184,7 @@ import ol.style.Style;
|
|||
}
|
||||
|
||||
|
||||
public void addPoint(Coordinate coordinate) {
|
||||
public void addPoint(Coordinate coordinate, boolean showCoordinateText) {
|
||||
|
||||
if(geometryLayer!=null) {
|
||||
map.removeLayer(geometryLayer);
|
||||
|
@ -195,7 +196,21 @@ import ol.style.Style;
|
|||
iconOptions.setSrc(markerURL);
|
||||
Icon icon = new Icon(iconOptions);
|
||||
style.setImage(icon);
|
||||
FillOptions fillOptions = new FillOptions();
|
||||
if(showCoordinateText) {
|
||||
TextOptions textOptions = new TextOptions();
|
||||
textOptions.setOffsetY(-25);
|
||||
textOptions.setText("Long: "+coordinate.getX() + ", Lat: "+coordinate.getY());
|
||||
Text text = new Text(textOptions);
|
||||
// FillOptions fillOptions = new FillOptions();
|
||||
// Color color = new Color(217, 217, 223, 0.0);
|
||||
// fillOptions.setColor(color);
|
||||
// Fill fill = new Fill(fillOptions);
|
||||
// style.setFill(fill);
|
||||
style.setText(text);
|
||||
|
||||
|
||||
}
|
||||
// FillOptions fillOptions = new FillOptions();
|
||||
//fillOptions.setColor(new Color(red, green, blue, alpha));
|
||||
//style.setFill(new Fill(fillOptions));
|
||||
// style.setFillColor("#00FF00");
|
||||
|
|
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.products.ConcessioneView;
|
||||
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.products.ConcessioneDV;
|
||||
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.images;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.NewBrowserWindow;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.WorkspaceContentDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.Heading;
|
||||
import com.github.gwtbootstrap.client.ui.Image;
|
||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||
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;
|
||||
|
@ -32,6 +38,11 @@ public class ImageView extends Composite {
|
|||
@UiField
|
||||
Paragraph paragraph1;
|
||||
|
||||
@UiField
|
||||
Button expandImage;
|
||||
|
||||
private WorkspaceContentDV latest;
|
||||
|
||||
|
||||
public ImageView(UploadedImageDV imageDV) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
@ -41,9 +52,56 @@ public class ImageView extends Composite {
|
|||
paragraph1.setText(imageDV.getDidascalia());
|
||||
|
||||
if(imageDV.getListWsContent()!=null && imageDV.getListWsContent().size()>0) {
|
||||
WorkspaceContentDV latest = imageDV.getListWsContent().get(imageDV.getListWsContent().size()-1);
|
||||
latest = imageDV.getListWsContent().get(imageDV.getListWsContent().size()-1);
|
||||
expandImage.setVisible(true);
|
||||
imageURL.setVisible(true);
|
||||
imageURL.setUrl(latest.getLink());
|
||||
}
|
||||
|
||||
expandImage.setType(ButtonType.LINK);
|
||||
expandImage.setIcon(IconType.RESIZE_FULL);
|
||||
|
||||
expandImage.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
if(latest!=null) {
|
||||
|
||||
NewBrowserWindow.open(latest.getLink(), "_blank", null);
|
||||
|
||||
/*String noProtocolLink = latest.getLink().replaceFirst("https:", "").replaceFirst("httP:", "");
|
||||
GWT.log("noProtocolLink: "+noProtocolLink);
|
||||
|
||||
final RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.HEAD, noProtocolLink);
|
||||
|
||||
requestBuilder.setHeader("Content-Disposition", "inline");
|
||||
|
||||
requestBuilder.setCallback(new RequestCallback() {
|
||||
|
||||
@Override
|
||||
public void onResponseReceived(Request request, Response response) {
|
||||
String responseURL = response.getHeader("Location");
|
||||
GWT.log("Response Received link: "+responseURL);
|
||||
String link = responseURL+"?content-disposition=inline";
|
||||
|
||||
NewBrowserWindow.open(link, "_blank", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Request request, Throwable exception) {
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
requestBuilder.send();
|
||||
} catch (RequestException e) {
|
||||
e.printStackTrace();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -3,19 +3,21 @@
|
|||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<ui:style>
|
||||
.max-width-300 {
|
||||
max-width: 300px;
|
||||
.max-width-400 {
|
||||
max-width: 400px !important;
|
||||
}
|
||||
.float-right{
|
||||
float: right;
|
||||
}
|
||||
</ui:style>
|
||||
<b:Thumbnail size="4">
|
||||
<b:Image ui:field="imageURL"
|
||||
addStyleNames="{style.max-width-300}" />
|
||||
<b:Thumbnail size="4" addStyleNames="{style.max-width-400}">
|
||||
<b:Button ui:field="expandImage" addStyleNames="{style.float-right}" visible="false">Open</b:Button>
|
||||
<b:Image ui:field="imageURL" visible="false" />
|
||||
<b:Caption>
|
||||
<b:Heading size="4" ui:field="heading"></b:Heading>
|
||||
<b:Paragraph ui:field="paragraph1">
|
||||
</b:Paragraph>
|
||||
<b:Paragraph ui:field="paragraph2">
|
||||
<b:Button ui:field="expandImage">Expand</b:Button>
|
||||
</b:Paragraph>
|
||||
</b:Caption>
|
||||
</b:Thumbnail>
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.google.gwt.uibinder.client.UiField;
|
|||
import com.google.gwt.user.client.Random;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
import ol.Coordinate;
|
||||
|
@ -24,13 +25,16 @@ import ol.Coordinate;
|
|||
@UiField
|
||||
HTMLPanel theMap;
|
||||
|
||||
@UiField
|
||||
HorizontalPanel coordinatePanel;
|
||||
|
||||
private LightOpenLayerOSM olsm;
|
||||
|
||||
public MapView(Double x, Double y) {
|
||||
public MapView(Double x, Double y, boolean showCoordinate) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
String theMapId = "map"+Random.nextInt();
|
||||
theMap.getElement().setId(theMapId);
|
||||
theMap.setSize("300px", "300px");
|
||||
//theMap.setSize("300px", "300px");
|
||||
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
|
@ -44,11 +48,10 @@ import ol.Coordinate;
|
|||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void addPoint(Coordinate coordinate){
|
||||
olsm.addPoint(coordinate);
|
||||
olsm.addPoint(coordinate, true);
|
||||
olsm.getMap().getView().setCenter(coordinate);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,16 @@
|
|||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
||||
<ui:style>
|
||||
|
||||
.internalMap {
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel ui:field="theMap">
|
||||
<g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="theMap"
|
||||
addStyleNames="{style.internalMap}">
|
||||
</g:HTMLPanel>
|
||||
<g:HorizontalPanel ui:field="coordinatePanel"
|
||||
visible="false"></g:HorizontalPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -1,129 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.products;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.images.ImageView;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.Page;
|
||||
import com.github.gwtbootstrap.client.ui.Label;
|
||||
import com.github.gwtbootstrap.client.ui.PageHeader;
|
||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||
import com.github.gwtbootstrap.client.ui.Thumbnails;
|
||||
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class ConcessioneView extends Composite {
|
||||
|
||||
private static ConcessioneViewUiBinder uiBinder = GWT.create(ConcessioneViewUiBinder.class);
|
||||
|
||||
interface ConcessioneViewUiBinder extends UiBinder<Widget, ConcessioneView> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
PageHeader titolo;
|
||||
|
||||
@UiField
|
||||
Paragraph introduzione;
|
||||
|
||||
@UiField
|
||||
HTMLPanel concessioniPanel;
|
||||
|
||||
@UiField
|
||||
HTMLPanel imagesPanel;
|
||||
|
||||
@UiField
|
||||
HTMLPanel pageViewDetails;
|
||||
|
||||
@UiField
|
||||
HTMLPanel mapViewPanel;
|
||||
|
||||
private ConcessioneDV concessioneDV;
|
||||
|
||||
private Thumbnails thumbNails = new Thumbnails();
|
||||
|
||||
private CustomFlexTable customTable = new CustomFlexTable();
|
||||
|
||||
public ConcessioneView() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
pageViewDetails.getElement().setId("page-view-details");
|
||||
}
|
||||
|
||||
public ConcessioneView(ConcessioneDV concessioneDV) {
|
||||
this();
|
||||
this.concessioneDV = concessioneDV;
|
||||
titolo.setText(concessioneDV.getNome());
|
||||
introduzione.setText(concessioneDV.getIntroduzione());
|
||||
|
||||
concessioniPanel.add(new RecordView(concessioneDV));
|
||||
|
||||
|
||||
if (concessioneDV.getDataInizioProgetto() != null) {
|
||||
customTable.addNextKeyValue("Data Inizio Progetto", concessioneDV.getDataFineProgetto());
|
||||
}
|
||||
|
||||
if (concessioneDV.getDataFineProgetto() != null) {
|
||||
customTable.addNextKeyValue("Data Fine Progetto", concessioneDV.getDataFineProgetto());
|
||||
|
||||
}
|
||||
|
||||
if (concessioneDV.getAuthors() != null) {
|
||||
customTable.addNextKeyValues("Autori", concessioneDV.getAuthors(), "\n");
|
||||
|
||||
}
|
||||
|
||||
customTable.addNextKeyValue("Contributore", concessioneDV.getContributore());
|
||||
|
||||
concessioniPanel.add(customTable);
|
||||
addImages();
|
||||
addMap();
|
||||
}
|
||||
|
||||
private void addMap() {
|
||||
MapView mapView = new MapView(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat());
|
||||
mapViewPanel.add(mapView);
|
||||
}
|
||||
|
||||
private void addImages() {
|
||||
List<UploadedImageDV> immagini = concessioneDV.getImmaginiRappresentative();
|
||||
if (immagini != null && immagini.size() > 0) {
|
||||
imagesPanel.setVisible(true);
|
||||
int i = 0;
|
||||
for (UploadedImageDV uploadedImageDV : immagini) {
|
||||
if (i == 0)
|
||||
imagesPanel.add(thumbNails);
|
||||
|
||||
thumbNails.add(new ImageView(uploadedImageDV));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void addLabel(FlowPanel w, String labelValue, LabelType type) {
|
||||
Label label = new Label(labelValue);
|
||||
label.setType(type);
|
||||
label.getElement().getStyle().setMarginRight(5, Unit.PX);
|
||||
w.add(label);
|
||||
}
|
||||
|
||||
public void addLabel(FlowPanel w, String labelValue) {
|
||||
com.google.gwt.user.client.ui.Label label = new com.google.gwt.user.client.ui.Label(labelValue);
|
||||
label.getElement().getStyle().setMarginRight(5, Unit.PX);
|
||||
w.add(label);
|
||||
}
|
||||
|
||||
public ConcessioneDV getConcessioneDV() {
|
||||
return concessioneDV;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,219 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.images.ImageView;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RelazioneScavoDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Label;
|
||||
import com.github.gwtbootstrap.client.ui.PageHeader;
|
||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||
import com.github.gwtbootstrap.client.ui.Thumbnails;
|
||||
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.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.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class ConcessioneView extends Composite {
|
||||
|
||||
|
||||
|
||||
private static ConcessioneViewUiBinder uiBinder = GWT.create(ConcessioneViewUiBinder.class);
|
||||
|
||||
interface ConcessioneViewUiBinder extends UiBinder<Widget, ConcessioneView> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
PageHeader titolo;
|
||||
|
||||
@UiField
|
||||
Paragraph introduzione;
|
||||
|
||||
@UiField
|
||||
HTMLPanel concessioniPanel;
|
||||
|
||||
@UiField
|
||||
HTMLPanel relazioneScavoPanel;
|
||||
|
||||
@UiField
|
||||
HTMLPanel imagesPanel;
|
||||
|
||||
@UiField
|
||||
HTMLPanel pageViewDetails;
|
||||
|
||||
@UiField
|
||||
HTMLPanel mapViewPanel;
|
||||
|
||||
private ConcessioneDV concessioneDV;
|
||||
|
||||
private Thumbnails thumbNails = new Thumbnails();
|
||||
|
||||
private CustomFlexTable customTable = new CustomFlexTable();
|
||||
|
||||
public ConcessioneView() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
pageViewDetails.getElement().setId("page-view-details");
|
||||
}
|
||||
|
||||
public ConcessioneView(ConcessioneDV concessioneDV) {
|
||||
this();
|
||||
this.concessioneDV = concessioneDV;
|
||||
|
||||
titolo.setText(concessioneDV.getNome());
|
||||
introduzione.setText(concessioneDV.getIntroduzione());
|
||||
|
||||
if (concessioneDV.getDataInizioProgetto() != null) {
|
||||
customTable.addNextKeyValue("Data Inizio Progetto", concessioneDV.getDataFineProgetto());
|
||||
}
|
||||
|
||||
if (concessioneDV.getDataFineProgetto() != null) {
|
||||
customTable.addNextKeyValue("Data Fine Progetto", concessioneDV.getDataFineProgetto());
|
||||
}
|
||||
|
||||
if (concessioneDV.getParoleChiaveLibere() != null) {
|
||||
customTable.addNextKeyValues("Parole chiave Libere", concessioneDV.getParoleChiaveICCD(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
}
|
||||
|
||||
if (concessioneDV.getParoleChiaveICCD() != null) {
|
||||
customTable.addNextKeyValues("Parole chiave Cronologia", concessioneDV.getParoleChiaveICCD(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
}
|
||||
|
||||
if (concessioneDV.getAuthors() != null) {
|
||||
customTable.addNextKeyValues("Autori", concessioneDV.getAuthors(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
}
|
||||
|
||||
if (concessioneDV.getContributore() != null) {
|
||||
customTable.addNextKeyValue("Contributore", concessioneDV.getContributore());
|
||||
}
|
||||
|
||||
if (concessioneDV.getEditore() != null) {
|
||||
customTable.addNextKeyValue("Editore", concessioneDV.getEditore());
|
||||
}
|
||||
|
||||
if (concessioneDV.getResponsabile() != null) {
|
||||
customTable.addNextKeyValue("Responsabile", concessioneDV.getResponsabile());
|
||||
}
|
||||
|
||||
if (concessioneDV.getRisorseCorrelate() != null) {
|
||||
customTable.addNextKeyValues("Risorse Correlate", concessioneDV.getRisorseCorrelate(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
}
|
||||
|
||||
if (concessioneDV.getTitolari() != null) {
|
||||
customTable.addNextKeyValues("Titolari dei dati", concessioneDV.getTitolari(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
}
|
||||
|
||||
if (concessioneDV.getSoggetto() != null) {
|
||||
customTable.addNextKeyValues("Soggetti", concessioneDV.getSoggetto(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
}
|
||||
|
||||
if (concessioneDV.getEditore() != null) {
|
||||
customTable.addNextKeyValue("Editore", concessioneDV.getEditore());
|
||||
}
|
||||
|
||||
if (concessioneDV.getFontiFinanziamento() != null) {
|
||||
customTable.addNextKeyValues("Fonti di Finanziamento", concessioneDV.getFontiFinanziamento(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
}
|
||||
|
||||
if (concessioneDV.getLicenzaID() != null) {
|
||||
customTable.addNextKeyValue("ID Licenza", concessioneDV.getLicenzaID());
|
||||
}
|
||||
|
||||
if (concessioneDV.getTitolareLicenza() != null) {
|
||||
customTable.addNextKeyValue("Titolare Licenza", concessioneDV.getTitolareLicenza());
|
||||
}
|
||||
|
||||
if (concessioneDV.getTitolareCopyright() != null) {
|
||||
customTable.addNextKeyValue("Titolare Copyright", concessioneDV.getTitolareCopyright());
|
||||
}
|
||||
|
||||
|
||||
|
||||
concessioniPanel.add(customTable);
|
||||
|
||||
//concessioniPanel.add(new RecordView(concessioneDV));
|
||||
addCentroidMap();
|
||||
addRelazioneDiScavo();
|
||||
addImages();
|
||||
}
|
||||
|
||||
private void addRelazioneDiScavo() {
|
||||
|
||||
RelazioneScavoDV relazioneScavo = concessioneDV.getRelazioneScavo();
|
||||
|
||||
if(relazioneScavo==null)
|
||||
return;
|
||||
|
||||
if(relazioneScavo.getPolicy()==null || relazioneScavo.getPolicy().equalsIgnoreCase("OPEN")) {
|
||||
relazioneScavoPanel.setVisible(true);
|
||||
relazioneScavoPanel.add(new RelazioneScavoView(relazioneScavo));
|
||||
}else {
|
||||
//I need to be authenticated to show the fields according to POLICY
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
|
||||
//Authenticated user
|
||||
if(result!=null) {
|
||||
relazioneScavoPanel.setVisible(true);
|
||||
relazioneScavoPanel.add(new RelazioneScavoView(relazioneScavo));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void addCentroidMap() {
|
||||
MapView mapView = new MapView(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat(), true);
|
||||
mapViewPanel.add(mapView);
|
||||
}
|
||||
|
||||
private void addImages() {
|
||||
List<UploadedImageDV> immagini = concessioneDV.getImmaginiRappresentative();
|
||||
if (immagini != null && immagini.size() > 0) {
|
||||
imagesPanel.setVisible(true);
|
||||
int i = 0;
|
||||
for (UploadedImageDV uploadedImageDV : immagini) {
|
||||
if (i == 0)
|
||||
imagesPanel.add(thumbNails);
|
||||
|
||||
thumbNails.add(new ImageView(uploadedImageDV));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void addLabel(FlowPanel w, String labelValue, LabelType type) {
|
||||
Label label = new Label(labelValue);
|
||||
label.setType(type);
|
||||
label.getElement().getStyle().setMarginRight(5, Unit.PX);
|
||||
w.add(label);
|
||||
}
|
||||
|
||||
public void addLabel(FlowPanel w, String labelValue) {
|
||||
com.google.gwt.user.client.ui.Label label = new com.google.gwt.user.client.ui.Label(labelValue);
|
||||
label.getElement().getStyle().setMarginRight(5, Unit.PX);
|
||||
w.add(label);
|
||||
}
|
||||
|
||||
public ConcessioneDV getConcessioneDV() {
|
||||
return concessioneDV;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RelazioneScavoDV;
|
||||
|
||||
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.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class RelazioneScavoView extends Composite {
|
||||
|
||||
private static RelazioneScavoViewUiBinder uiBinder = GWT.create(RelazioneScavoViewUiBinder.class);
|
||||
|
||||
interface RelazioneScavoViewUiBinder extends UiBinder<Widget, RelazioneScavoView> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
HTMLPanel relazioneScavoPanel;
|
||||
|
||||
@UiField
|
||||
Paragraph abstractParagraph;
|
||||
|
||||
private CustomFlexTable customTable = new CustomFlexTable();
|
||||
|
||||
|
||||
public RelazioneScavoView(RelazioneScavoDV relazioneScavoDV) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
if(relazioneScavoDV.getAbstractSection()!=null)
|
||||
abstractParagraph.setText(relazioneScavoDV.getAbstractSection());
|
||||
|
||||
//customTable.addNextKeyValue("Created", relazioneScavoDV.getCreationTime());
|
||||
customTable.addNextKeyValue("ID Licenza", relazioneScavoDV.getLicenseID());
|
||||
customTable.addNextKeyValues("Responsabili", relazioneScavoDV.getResponsabili(), GeoportalDataViewerConstants.NEW_LINE_BR);
|
||||
relazioneScavoPanel.add(customTable);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<!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>
|
||||
|
||||
.description > p {
|
||||
font-size: 20px;
|
||||
padding: 10px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
</ui:style>
|
||||
<g:HTMLPanel ui:field="relazioneScavoPanel" addStyleNames="{style.description}">
|
||||
<b:Paragraph ui:field="abstractParagraph"></b:Paragraph>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -2,7 +2,9 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.util;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
@ -33,6 +35,7 @@ public class CustomFlexTable extends FlexTable {
|
|||
* @param separator the separator
|
||||
*/
|
||||
public void addNextKeyValues(String key, List<String> listValues, String separator) {
|
||||
GWT.log("adding key "+key +", values: "+listValues);
|
||||
Label keyLabel = new Label(key);
|
||||
int row = getRowCount() + 1;
|
||||
setWidget(row, 0, keyLabel);
|
||||
|
@ -42,10 +45,14 @@ public class CustomFlexTable extends FlexTable {
|
|||
|
||||
String valuesAsString = "";
|
||||
for (String value : listValues) {
|
||||
valuesAsString+=value+separator;
|
||||
String theValue = value;
|
||||
if(theValue.startsWith("http://") || (theValue.startsWith("https://"))){
|
||||
theValue = "<a href=\""+value+"\" target=\"_blank\">"+value+"</a>";
|
||||
}
|
||||
valuesAsString+=theValue+separator;
|
||||
}
|
||||
valuesAsString = valuesAsString.substring(0, valuesAsString.lastIndexOf(separator));
|
||||
Label valuesLabel = new Label(valuesAsString);
|
||||
HTML valuesLabel = new HTML(valuesAsString);
|
||||
setWidget(row, 1, valuesLabel);
|
||||
}
|
||||
|
||||
|
@ -64,7 +71,7 @@ public class CustomFlexTable extends FlexTable {
|
|||
if(value==null)
|
||||
return;
|
||||
|
||||
Label valueLabel = new Label(value);
|
||||
HTML valueLabel = new HTML(value);
|
||||
setWidget(row, 1, valueLabel);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.gcube.spatial.data.geoutility.GeoNcWMSMetadataUtility;
|
|||
import org.gcube.spatial.data.geoutility.bean.LayerStyles;
|
||||
import org.gcube.spatial.data.geoutility.bean.LayerZAxis;
|
||||
import org.gcube.spatial.data.geoutility.bean.WmsParameters;
|
||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -149,5 +150,24 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the my login.
|
||||
*
|
||||
* @return the my login
|
||||
*/
|
||||
@Override
|
||||
public String getMyLogin(){
|
||||
try {
|
||||
GCubeUser user = SessionUtil.getCurrentUser(this.getThreadLocalRequest());
|
||||
if(user==null)
|
||||
return null;
|
||||
return user.getUsername();
|
||||
}catch (Exception e) {
|
||||
LOG.warn("Error on getting the login, am I out of portal? Returning null");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ public class TestModel {
|
|||
|
||||
|
||||
concessione.setSoggetto(Arrays.asList(new String[] {"Research Excavation","Archeology"}));
|
||||
|
||||
concessione.setRisorseCorrelate(Arrays.asList(new String[] {"https://google.com","https://www.repubblica.it"}));
|
||||
|
||||
|
||||
concessione.setDataInizioProgetto(LocalDateTime.now());
|
||||
|
|
|
@ -87,12 +87,16 @@
|
|||
|
||||
#page-view-details .my-custom-flex-table{
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
margin-right: 40px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#page-view-details .my-custom-flex-table td {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#page-view-details .my-custom-flex-table tbody tr > td:first-child {
|
||||
color: gray;
|
||||
font-weight: bold;
|
||||
width: 170px;
|
||||
width: 200px;
|
||||
}
|
Loading…
Reference in New Issue