bug fixed the Layer Switcher #22170#note-10 and improved pop-up

This commit is contained in:
Francesco Mangiacrapa 2021-10-15 17:51:09 +02:00
parent dba98bfd0f
commit 2030798e1c
11 changed files with 164 additions and 56 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/geoportal-data-viewer-app-2.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/geoportal-data-viewer-app-2.0.0/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-2.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-2.0.0/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -35,5 +35,5 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/geoportal-data-viewer-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/geoportal-data-viewer-app-2.0.0/WEB-INF/classes"/>
</classpath>

View File

@ -1,4 +1,4 @@
eclipse.preferences.version=1
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-2.0.0-SNAPSHOT
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-2.0.0
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -1,15 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="geoportal-data-viewer-app-2.0.0-SNAPSHOT">
<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="/target/generated-sources/gwt"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="geoportal-data-common-1.2.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
<property name="context-root" value="geoportal-data-viewer-app"/>
</wb-module>
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="geoportal-data-viewer-app-2.0.0">
<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="/target/generated-sources/gwt"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
<property name="context-root" value="geoportal-data-viewer-app"/>
</wb-module>
</project-modules>

View File

@ -16,6 +16,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetai
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEventHandler;
@ -379,10 +380,10 @@ public class GeoportalDataViewer implements EntryPoint {
break;
case SWAP:
org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem sourceLayerSwap = doLayerActionEvent.getSourceLayerSwap();
org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem target = doLayerActionEvent.getTargetLayerSwap();
GWT.log("SWAPPING source "+sourceLayerSwap.getName() +", target: "+target.getName());
olMap.swapDetailsLayers(sourceLayerSwap.getName(), target.getName());
SwapLayer swLS = doLayerActionEvent.getSourceLayerSwap();
SwapLayer swLT = doLayerActionEvent.getTargetLayerSwap();
GWT.log("SWAPPING source "+swLS.getLayerItem().getName() +", target: "+swLT.getLayerItem().getName());
olMap.swapDetailsLayers(swLS, swLT);
break;
case VISIBILITY:

View File

@ -27,6 +27,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMini
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow;
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
@ -41,6 +42,7 @@ import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Heading;
import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.github.gwtbootstrap.client.ui.constants.LabelType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
@ -286,8 +288,9 @@ public class LayerManager {
@Override
public void onSuccess(List<LayerConcessioneDV> result) {
GWT.log("Adding layers: " + result);
for (LayerConcessioneDV layer : result) {
GWT.log("Adding layer: " + layer.getLayerName());
addLayer("concessione", layer.getLayerName(),
layer.getLayerName(), layer.getWmsLink(),
false, false, layer.getLayerUUID(), true,
@ -551,10 +554,62 @@ public class LayerManager {
public void showPopupInfoForLayer(List<GeoNaSpatialQueryResult> listGeoNaDataObject, ExtentWrapped queryClick) {
ScrollPanel scrollPanel = new ScrollPanel();
FlowPanel flowPanel = new FlowPanel();
// flowPanel.getElement().getStyle().setProperty("maxHeight", "600px");
final FlowPanel flowPanel = new FlowPanel();
flowPanel.getElement().getStyle().setProperty("maxHeight", "600px");
scrollPanel.add(flowPanel);
final Button expandButton = new Button("Expand");
expandButton.setType(ButtonType.LINK);
expandButton.setIcon(IconType.EXPAND);
expandButton.getElement().setId("expand-query");
expandButton.setTitle("Show this view in new Window");
/*expandButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
flowPanel.getElement().getStyle().setProperty("maxHeight", "100%");
int width = Window.getClientWidth() * 75 / 100;
int height = Window.getClientHeight() * 70 / 100;
ModalWindow mw = new ModalWindow("Query view", width, height);
mw.add(flowPanel);
mw.show();
}
});*/
flowPanel.add(expandButton);
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
Element buttonElement = DOM.getElementById("expand-query");
Event.sinkEvents(buttonElement, Event.ONCLICK);
Event.setEventListener(buttonElement, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
if (Event.ONCLICK == event.getTypeInt()) {
expandButton.setVisible(false);
flowPanel.getElement().getStyle().setProperty("maxHeight", "100%");
int width = Window.getClientWidth() * 75 / 100;
int height = Window.getClientHeight() * 70 / 100;
Coordinate center = queryClick.getCenter();
double x = center.getX();
double y = center.getY();
//"with center x: "+x +", y: "+y;
ModalWindow mw = new ModalWindow("Query view", width, height);
mw.add(flowPanel);
mw.show();
}
}
});
}
});
//fillLayersAndProperties(listGeoNaDataObject, expandButton, flowPanel);
String prevConcessioneName = "";
for (GeoNaSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) {
try {
@ -578,8 +633,9 @@ public class LayerManager {
String nomeConcessione = lo.getSourceConcessione().getNome();
if (prevConcessioneName.compareTo(nomeConcessione) != 0) {
String concessioneIntro = StringUtil.ellipsize(lo.getSourceConcessione().getNome(), 40);
String concessioneIntro = nomeConcessione.length()>100? StringUtil.ellipsize(nomeConcessione, 100):nomeConcessione;
Heading heading = new Heading(4, concessioneIntro);
heading.setTitle(nomeConcessione);
heading.getElement().getStyle().setMarginBottom(10, Unit.PX);
flowPanel.add(heading);
HTML subText = new HTML(
@ -599,19 +655,6 @@ public class LayerManager {
layerLabel.getElement().getStyle().setMarginBottom(5, Unit.PX);
flowPanel.add(layerLabel);
/*
if (features == null || features.isEmpty()) {
FlexTable flex = new FlexTable();
flex.setCellPadding(1);
flex.setCellSpacing(1);
flex.getElement().addClassName("table-feature");
flex.setHTML(0, 0, new HTML("<i>No data available</i>").toString());
flowPanel.add(flex);
continue;
// olMap.showPopup(vpPanel.toString(), onFailureCenterTo);
}*/
GWT.log("Displaying " + features.size() + " features");
FlexTable intFlex = new FlexTable();
intFlex.setCellPadding(1);
@ -661,7 +704,7 @@ public class LayerManager {
olMap.showPopup(scrollPanel.toString(), queryClick.getCenter());
}
/**
* Show popup info for centroid layer.
*

View File

@ -29,8 +29,49 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
private LayerItem layerItem;
private double opacity;
private boolean visibility;
private LayerItem sourceLayerSwap;
private LayerItem targetLayerSwap;
private SwapLayer sourceLayerSwap;
private SwapLayer targetLayerSwap;
/**
* The Class SwapLayer.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 15, 2021
*/
public static class SwapLayer{
private LayerItem layerItem;
private int position;
/**
* Instantiates a new swap layer.
*
* @param layerItem the layer item
* @param position the position
*/
public SwapLayer(LayerItem layerItem, int position){
this.layerItem = layerItem;
this.position = position;
}
/**
* Gets the layer item.
*
* @return the layer item
*/
public LayerItem getLayerItem() {
return layerItem;
}
/**
* Gets the position.
*
* @return the position
*/
public int getPosition() {
return position;
}
}
/**
* Instantiates a new do action on detail layers event.
@ -49,7 +90,7 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
* @param sourceLayerItem the source layer item
* @param targetLayerItem the target layer item
*/
public void setSwapLayers(LayerItem sourceLayerItem, LayerItem targetLayerItem) {
public void setSwapLayers(SwapLayer sourceLayerItem, SwapLayer targetLayerItem) {
this.sourceLayerSwap = sourceLayerItem;
this.targetLayerSwap = targetLayerItem;
@ -117,7 +158,7 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
*
* @return the source layer swap
*/
public LayerItem getSourceLayerSwap() {
public SwapLayer getSourceLayerSwap() {
return sourceLayerSwap;
}
@ -126,7 +167,7 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
*
* @return the target layer swap
*/
public LayerItem getTargetLayerSwap() {
public SwapLayer getTargetLayerSwap() {
return targetLayerSwap;
}

View File

@ -7,6 +7,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerCon
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import com.google.gwt.core.client.GWT;
@ -388,7 +389,7 @@ public abstract class OpenLayerOSM {
*
* @param layerItem the layer item
*/
public void addWMSDetailLayer(LayerItem layerItem) {
public synchronized void addWMSDetailLayer(LayerItem layerItem) {
if (wmsDetailsLayerMap == null)
wmsDetailsLayerMap = new LinkedHashMap<String, Image>();
@ -822,15 +823,22 @@ public abstract class OpenLayerOSM {
* @param layerSource the source index
* @param layerTarget the target index
*/
public void swapDetailsLayers(String layerSource, String layerTarget) {
public void swapDetailsLayers(SwapLayer swapLSource, SwapLayer swapLTarget) {
String layerSource = swapLSource.getLayerItem().getName();
String layerTarget = swapLTarget.getLayerItem().getName();
Image layer1 = wmsDetailsLayerMap.get(layerSource);
Image layer2 = wmsDetailsLayerMap.get(layerTarget);
int zIndex1 = layer1.getZIndex();
int zIndex2 = layer2.getZIndex();
layer1.setZIndex(zIndex2);
layer2.setZIndex(zIndex1);
int zIndexS = swapLSource.getPosition()+1;
int zIndexT = swapLTarget.getPosition()+1;
GWT.log("new zindex source: "+zIndexS+", new zTarget: "+zIndexT);
layer1.setZIndex(zIndexT);
layer2.setZIndex(zIndexS);
GWT.log("layer1 source: "+layerSource+", new zIndex: "+layer1.getZIndex());
GWT.log("layer1 target: "+layerTarget+", new zIndex: "+layer2.getZIndex());
}
/**

View File

@ -21,10 +21,12 @@ import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
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.Image;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.Widget;
/**
@ -76,7 +78,7 @@ public class GeonaDataViewMainPanel extends Composite {
Button layersDDB;
@UiField
FlowPanel overlayLayersPanel;
ScrollPanel overlayLayersPanel;
private MapPanel mapPanel;
@ -278,6 +280,9 @@ public class GeonaDataViewMainPanel extends Composite {
//layersDDB.setVisible(true);
overlayLayersPanel.setVisible(true);
overlayLayersPanel.clear();
int height = Window.getClientHeight() * 87 / 100;
panel.getElement().getStyle().setProperty("maxHeight", height+"px");
//panel.getElement().getStyle().setProperty("maxHeight", height+"px");
overlayLayersPanel.add(panel);
//layersDDBClickEvent();
}

View File

@ -57,8 +57,8 @@
text="Remove Query" visible="false"></b:Button>
<b:Button type="LINK" text="Layers" ui:field="layersDDB">
</b:Button>
<g:FlowPanel ui:field="overlayLayersPanel"
addStyleNames="layers-panel" visible="false"></g:FlowPanel>
<g:ScrollPanel ui:field="overlayLayersPanel"
addStyleNames="layers-panel" visible="false"></g:ScrollPanel>
</g:HTMLPanel>
</g:HTMLPanel>
<c:DetailsPanel ui:field="detailsPanel"

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
@ -167,7 +168,9 @@ public class DragDropLayer extends FlowPanel {
// target.setState(true);
DoActionOnDetailLayersEvent actionSwapLayers = new DoActionOnDetailLayersEvent(
DO_LAYER_ACTION.SWAP, layerItem);
actionSwapLayers.setSwapLayers(dragging.getLayerItem(), draggingTarget.getLayerItem());
SwapLayer swapLS = new DoActionOnDetailLayersEvent.SwapLayer(dragging.getLayerItem(), sourceIndex);
SwapLayer swapLT = new DoActionOnDetailLayersEvent.SwapLayer(draggingTarget.getLayerItem(), targetIndex);
actionSwapLayers.setSwapLayers(swapLS, swapLT);
applicationBus.fireEvent(actionSwapLayers);
}
dragging = null;

View File

@ -343,6 +343,7 @@ body {
background-color: white;
opacity: 80%;
padding: 10px;
width: 410px;
}
.dand-layer {