use of au.org.emii.portal.composer.MapComposer in project spatial-portal by AtlasOfLivingAustralia.
the class PortalEvent method getMapComposer.
protected MapComposer getMapComposer(Event event) {
MapComposer mapComposer = null;
Page page;
if ((event == null) || ((page = event.getPage()) == null) || ((mapComposer = (MapComposer) page.getFellow(StringConstants.MAPPORTALPAGE)) == null)) {
LOGGER.debug("Unable to obtain reference to mapPortalPage instance to perform changes " + "I think this is a strange concurrent access problem, I've only ever seen " + "it once (ignoring and proceeding normally)");
}
return mapComposer;
}
use of au.org.emii.portal.composer.MapComposer in project spatial-portal by AtlasOfLivingAustralia.
the class ActiveLayerDNDEventListener method onEvent.
@Override
public void onEvent(Event event) throws Exception {
LOGGER.debug("active layers item drop received");
MapComposer mapComposer = getMapComposer(event);
if (mapComposer != null && mapComposer.safeToPerformMapAction()) {
LOGGER.debug("inside ActiveLayerDNDEventListener.onEvent()");
if (event instanceof DropEvent) {
DropEvent dragEvent = (DropEvent) event;
// we support the treechildren and other list items...
Component eventType = dragEvent.getDragged();
if (eventType instanceof Listitem) {
reorderList(mapComposer, dragEvent);
} else {
LOGGER.debug("unsupported dnd event " + eventType.getClass().getName());
}
} else {
LOGGER.debug("event is not a DropEvent instance: " + event.getClass().getName());
}
}
}
use of au.org.emii.portal.composer.MapComposer in project spatial-portal by AtlasOfLivingAustralia.
the class ActiveLayersInfoEventListener method onEvent.
@Override
public void onEvent(Event event) throws Exception {
MapComposer mapComposer = getMapComposer(event);
if (mapComposer != null && mapComposer.safeToPerformMapAction()) {
// get reference to the label/image the user clicked on
Component target = event.getTarget();
Listitem listItem = (Listitem) target.getParent().getParent();
MapLayer activeLayer = listItem.getValue();
if (activeLayer != null) {
if (activeLayer.getSpeciesQuery() != null) {
Query q = activeLayer.getSpeciesQuery();
Events.echoEvent(StringConstants.OPEN_HTML, mapComposer, q.getMetadataHtml());
} else if (activeLayer.getMapLayerMetadata().getMoreInfo() != null && activeLayer.getMapLayerMetadata().getMoreInfo().startsWith("http://")) {
String infourl = activeLayer.getMapLayerMetadata().getMoreInfo().replace("__", ".");
if (activeLayer.getSubType() == LayerUtilitiesImpl.SCATTERPLOT) {
ScatterplotDataDTO data = activeLayer.getScatterplotDataDTO();
infourl += "?dparam=X-Layer:" + data.getLayer1Name();
infourl += "&dparam=Y-Layer:" + data.getLayer2Name();
}
// send the user to the BIE page for the species
LOGGER.debug("opening the following url " + infourl);
Events.echoEvent(StringConstants.OPEN_URL, mapComposer, activeLayer.getMapLayerMetadata().getMoreInfo().replace("__", "."));
} else if (activeLayer.getMapLayerMetadata().getMoreInfo() != null && activeLayer.getMapLayerMetadata().getMoreInfo().length() > 0) {
LOGGER.debug("performing a MapComposer.showMessage for following content " + activeLayer.getMapLayerMetadata().getMoreInfo());
String metadata = activeLayer.getMapLayerMetadata().getMoreInfo();
Events.echoEvent(StringConstants.OPEN_HTML, mapComposer, metadata);
} else if (activeLayer.getType() == LayerUtilitiesImpl.MAP) {
String metaurl = "http://www.google.com/intl/en_au/help/terms_maps.html";
if ("outline".equalsIgnoreCase(mapComposer.getPortalSession().getBaseLayer())) {
metaurl = "openstreetmap_metadata.html";
} else if ("minimal".equalsIgnoreCase(mapComposer.getPortalSession().getBaseLayer())) {
metaurl = "http://www.naturalearthdata.com/about/terms-of-use";
}
LOGGER.debug("opening base map metadata for: " + mapComposer.getPortalSession().getBaseLayer() + ", url:" + metaurl);
Events.echoEvent(StringConstants.OPEN_URL, mapComposer, metaurl);
} else {
LOGGER.debug("no metadata is available for current layer");
mapComposer.showMessage("Metadata currently unavailable");
}
}
} else {
LOGGER.debug("MapController reports unsafe to perform action");
}
}
Aggregations