Search in sources :

Example 1 with PreviewLayer

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);
}
Also used : PreviewLayerList(org.geosdi.geoplatform.gui.client.model.PreviewLayerList) PreviewLayer(org.geosdi.geoplatform.gui.client.model.PreviewLayer)

Example 2 with PreviewLayer

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();
}
Also used : EPSGLayerData(org.geosdi.geoplatform.gui.client.model.EPSGLayerData) PreviewLayer(org.geosdi.geoplatform.gui.client.model.PreviewLayer)

Example 3 with PreviewLayer

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;
}
Also used : IGPAccountDetail(org.geosdi.geoplatform.gui.global.security.IGPAccountDetail) AbstractFolderTreeNode(org.geosdi.geoplatform.gui.model.tree.AbstractFolderTreeNode) GPSessionTimeout(org.geosdi.geoplatform.gui.utility.GPSessionTimeout) GPClientCommand(org.geosdi.geoplatform.gui.command.api.GPClientCommand) GPLoginEvent(org.geosdi.geoplatform.gui.impl.map.event.GPLoginEvent) PublishLayerPreviewResponse(org.geosdi.geoplatform.gui.client.command.publish.basic.PublishLayerPreviewResponse) GPReloadURLException(org.geosdi.geoplatform.gui.utility.GPReloadURLException) Timer(com.google.gwt.user.client.Timer) Button(com.extjs.gxt.ui.client.widget.button.Button) ButtonEvent(com.extjs.gxt.ui.client.event.ButtonEvent) PreviewLayer(org.geosdi.geoplatform.gui.client.model.PreviewLayer) List(java.util.List) AddRasterFromPublisherEvent(org.geosdi.geoplatform.gui.client.widget.tree.store.puregwt.event.AddRasterFromPublisherEvent)

Example 4 with PreviewLayer

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);
}
Also used : PreviewLayerList(org.geosdi.geoplatform.gui.client.model.PreviewLayerList) PreviewLayer(org.geosdi.geoplatform.gui.client.model.PreviewLayer) WMS(org.gwtopenmaps.openlayers.client.layer.WMS)

Aggregations

PreviewLayer (org.geosdi.geoplatform.gui.client.model.PreviewLayer)4 PreviewLayerList (org.geosdi.geoplatform.gui.client.model.PreviewLayerList)2 ButtonEvent (com.extjs.gxt.ui.client.event.ButtonEvent)1 Button (com.extjs.gxt.ui.client.widget.button.Button)1 Timer (com.google.gwt.user.client.Timer)1 List (java.util.List)1 PublishLayerPreviewResponse (org.geosdi.geoplatform.gui.client.command.publish.basic.PublishLayerPreviewResponse)1 EPSGLayerData (org.geosdi.geoplatform.gui.client.model.EPSGLayerData)1 AddRasterFromPublisherEvent (org.geosdi.geoplatform.gui.client.widget.tree.store.puregwt.event.AddRasterFromPublisherEvent)1 GPClientCommand (org.geosdi.geoplatform.gui.command.api.GPClientCommand)1 IGPAccountDetail (org.geosdi.geoplatform.gui.global.security.IGPAccountDetail)1 GPLoginEvent (org.geosdi.geoplatform.gui.impl.map.event.GPLoginEvent)1 AbstractFolderTreeNode (org.geosdi.geoplatform.gui.model.tree.AbstractFolderTreeNode)1 GPReloadURLException (org.geosdi.geoplatform.gui.utility.GPReloadURLException)1 GPSessionTimeout (org.geosdi.geoplatform.gui.utility.GPSessionTimeout)1 WMS (org.gwtopenmaps.openlayers.client.layer.WMS)1