use of org.geosdi.geoplatform.gui.client.model.PreviewLayer in project geo-platform by geosdi.
the class AbstractPublisherWidget method showEPSGTable.
@Override
public void showEPSGTable(String jsonString, String workspace) {
StringBuilder layerProblems = new StringBuilder();
List<PreviewLayer> epsgLayerList = Lists.<PreviewLayer>newArrayList();
PreviewLayerList previewLayers = PreviewLayerList.JSON.read(jsonString);
for (PreviewLayer previewLayer : GPSharedUtils.safeList(previewLayers.getPreviewLayers())) {
if (previewLayer.getMessage().contains("Some problems")) {
layerProblems.append(previewLayer.getTitle()).append("\n");
} else {
epsgLayerList.add(previewLayer);
}
}
if (epsgLayerList.size() > 0) {
this.epsgTable.populateStore(epsgLayerList);
this.epsgTable.setWorkspace(workspace);
centralPanel.removeAll();
// aggiungere tabella epsg
centralPanel.add(this.epsgTable);
this.epsgTable.layout();
centralPanel.layout();
}
this.manageLayerProblems(layerProblems);
}
use of org.geosdi.geoplatform.gui.client.model.PreviewLayer in project geo-platform by geosdi.
the class EPSGTablePanel method populateStore.
public void populateStore(List<PreviewLayer> epsgLayerList) {
this.store.removeAll();
for (PreviewLayer previewLayer : GPSharedUtils.safeList(epsgLayerList)) {
EPSGLayerData epsgLayerData = new EPSGLayerData(previewLayer.getTitle(), previewLayer.getCrs(), previewLayer.getStyleName(), previewLayer.isIsShape(), previewLayer.getAlreadyExists(), previewLayer.getFileName());
this.store.add(epsgLayerData);
}
this.manageProcessEPSGButton();
}
use of org.geosdi.geoplatform.gui.client.model.PreviewLayer in project geo-platform by geosdi.
the class GPPublisherWidget method getFinalizePublishButton.
@Override
public Button getFinalizePublishButton() {
if (super.finishButton == null) {
super.finishButton = new Button(ButtonsConstants.INSTANCE.addOnTreeText(), AbstractImagePrototype.create(BasicWidgetResources.ICONS.done()));
super.finishButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
if (tree.getSelectionModel().getSelectedItem() instanceof AbstractFolderTreeNode) {
// expander.checkNodeState();
List<String> layersName = Lists.<String>newArrayList();
for (PreviewLayer layer : layerList) {
layersName.add(layer.getTitle());
}
publishLayerRequest.setLayerList(layersName);
String workspaceName = getSelectedWorkspace();
if (GPSharedUtils.isEmpty(workspaceName)) {
IGPAccountDetail accountDetail = Registry.get(UserSessionEnum.ACCOUNT_DETAIL_IN_SESSION.name());
workspaceName = accountDetail.getUsername();
}
logger.info("**** Selected workspace: " + workspaceName);
publishLayerRequest.setWorkspace(workspaceName);
ClientCommandDispatcher.getInstance().execute(new GPClientCommand<PublishLayerPreviewResponse>() {
private static final long serialVersionUID = -7646291858544319457L;
{
super.setCommandRequest(publishLayerRequest);
}
@Override
public void onCommandSuccess(final PublishLayerPreviewResponse response) {
PublisherProgressBar.getInstance().show(PublisherWidgetConstants.INSTANCE.EPSGTablePanel_processingDataProgressBarText());
Timer t = new Timer() {
public void run() {
LayerHandlerManager.fireEvent(new AddRasterFromPublisherEvent(layerList));
reset();
logger.info("Response: " + response);
LayoutManager.getInstance().getStatusMap().setStatus(PublisherWidgetConstants.INSTANCE.GPPublisherWidget_statusShapePublishedSuccesfullyText(), EnumSearchStatus.STATUS_SEARCH.toString());
PublisherProgressBar.getInstance().hide();
}
};
// Schedule the timer to run once in 5 seconds.
t.schedule(5000);
}
@Override
public void onCommandFailure(Throwable exception) {
if (exception.getCause() instanceof GPSessionTimeout) {
GPHandlerManager.fireEvent(new GPLoginEvent(publishShapePreviewEvent));
} else if (exception.getCause() instanceof GPReloadURLException) {
GeoPlatformMessage.errorMessage(PublisherWidgetConstants.INSTANCE.GPPublisherWidget_errorReloadClusterTitleText(), PublisherWidgetMessages.INSTANCE.GPPublisherWidget_errorReloadClusterBodyMessage(exception.getCause().getMessage()));
LayoutManager.getInstance().getStatusMap().setStatus(PublisherWidgetConstants.INSTANCE.statusErrorShapePublishingText(), EnumSearchStatus.STATUS_NO_SEARCH.toString());
System.out.println("Error Publishing previewed shape: " + exception.toString() + " data: " + exception.getMessage());
} else {
GeoPlatformMessage.errorMessage(PublisherWidgetConstants.INSTANCE.errorPublishingText(), WindowsConstants.INSTANCE.errorMakingConnectionBodyText());
LayoutManager.getInstance().getStatusMap().setStatus(PublisherWidgetConstants.INSTANCE.statusErrorShapePublishingText(), EnumSearchStatus.STATUS_NO_SEARCH.toString());
System.out.println("Error Publishing previewed shape: " + exception.toString() + " data: " + exception.getMessage());
}
}
});
} else {
GeoPlatformMessage.alertMessage(PublisherWidgetConstants.INSTANCE.GPPublisherWidget_shapePreviewTitleText(), WindowsConstants.INSTANCE.warningLayerInToFolderText());
}
}
});
super.finishButton.disable();
}
return super.finishButton;
}
use of org.geosdi.geoplatform.gui.client.model.PreviewLayer in project geo-platform by geosdi.
the class AbstractPublisherWidget method showLayerPreview.
@Override
public void showLayerPreview(String jsonString) {
StringBuilder layerProblems = new StringBuilder();
PreviewLayerList previewLayers = PreviewLayerList.JSON.read(jsonString);
for (PreviewLayer previewLayer : previewLayers.getPreviewLayers()) {
if (!previewLayer.getMessage().contains("Some problems")) {
previewLayer.setLayerType(GPLayerType.WMS);
layerList.add(previewLayer);
WMS wmsLayer = this.generateLayer(previewLayer);
shpPreviewWidget.getMapPreview().getMap().addLayer(wmsLayer);
} else {
layerProblems.append(previewLayer.getTitle()).append("\n");
}
}
if (shpPreviewWidget.getMapPreview().getMap().getNumLayers() > 1) {
centralPanel.removeAll();
centralPanel.add(shpPreviewWidget.getMapPreview());
shpPreviewWidget.getMapPreview().getMap().zoomToExtent(bounds);
shpPreviewWidget.getMapPreview().getMap().updateSize();
centralPanel.layout();
finishButton.enable();
}
this.manageLayerProblems(layerProblems);
}
Aggregations