use of org.geosdi.geoplatform.gui.client.command.publish.basic.ProcessEPSGResultResponse in project geo-platform by geosdi.
the class CasProcessEPSGResultCommand method execute.
@Override
public ProcessEPSGResultResponse execute(CasProcessEPSGResultRequest request, HttpServletRequest httpServletRequest) {
GPAccount account;
try {
account = sessionUtility.getLoggedAccount(httpServletRequest);
} catch (GPSessionTimeout timeout) {
throw new GeoPlatformException(timeout);
}
List<EPSGLayerData> previewLayerList = request.getPreviewLayerList();
try {
List<InfoPreview> resultList = casPublisherService.processEPSGResult(new ProcessEPSGResultRequest(account.getNaturalID(), this.trasformPreviewLayerList(previewLayerList), request.getWorkspace())).getInfoPreviews();
return new ProcessEPSGResultResponse(generateJSONObjects(resultList));
} catch (Exception ex) {
ex.printStackTrace();
throw new GeoPlatformException("Error on publish shape.");
}
}
use of org.geosdi.geoplatform.gui.client.command.publish.basic.ProcessEPSGResultResponse in project geo-platform by geosdi.
the class EPSGTablePanel method addComponent.
@Override
public void addComponent() {
List<ColumnConfig> configs = Lists.<ColumnConfig>newArrayList();
ColumnConfig featureNameColumnConfig = new ColumnConfig(EPSGLayerData.NAME, PublisherWidgetConstants.INSTANCE.EPSGTablePanel_columnFeatureNameText(), 80);
configs.add(featureNameColumnConfig);
ColumnConfig epsgColumnConfig = new ColumnConfig(EPSGLayerData.CRS, PublisherWidgetConstants.INSTANCE.EPSGTablePanel_columnEPSGCodeText(), 80);
GPSecureStringTextField epsgTextField = new GPSecureStringTextField();
epsgTextField.setEmptyText(PublisherWidgetConstants.INSTANCE.EPSGTablePanel_epsgTextFieldEmptyText());
epsgTextField.setAllowBlank(Boolean.FALSE);
epsgColumnConfig.setEditor(new CellEditor(epsgTextField));
configs.add(epsgColumnConfig);
ColumnConfig newNameColumnConfig = new ColumnConfig(EPSGLayerData.NEW_NAME, PublisherWidgetConstants.INSTANCE.EPSGTablePanel_columnNewNameText(), 120);
GPSecureStringTextField newNameTextField = new GPSecureStringTextField();
newNameTextField.setEmptyText(PublisherWidgetConstants.INSTANCE.EPSGTablePanel_epsgTextFieldEmptyText());
newNameTextField.setAllowBlank(Boolean.TRUE);
final CellEditor newNameCellEditor = new CellEditor(newNameTextField);
newNameColumnConfig.setEditor(newNameCellEditor);
ColumnConfig publishColumnConfig = new ColumnConfig(EPSGLayerData.PUBLISH_ACTION, PublisherWidgetConstants.INSTANCE.EPSGTablePanel_columnPublishActionText(), 100);
GridCellRenderer<EPSGLayerData> renderer = new GridCellRenderer<EPSGLayerData>() {
@Override
public Object render(final EPSGLayerData model, String property, ColumnData config, int rowIndex, final int colIndex, final ListStore<EPSGLayerData> store, final Grid<EPSGLayerData> grid) {
SimpleComboBox<String> publishActionComboBox;
Object publishActionCBObj = comboBoxMap.get("" + model.hashCode());
if (publishActionCBObj == null) {
publishActionComboBox = new SimpleComboBox<String>();
publishActionComboBox.setEditable(Boolean.FALSE);
publishActionComboBox.setWidth(grid.getColumnModel().getColumnWidth(colIndex) - 5);
List<LayerPublishAction> l = model.getPublishActions();
if (l != null) {
for (LayerPublishAction publishAction : GPSharedUtils.safeList(l)) {
publishActionComboBox.add(publishAction.toString());
}
publishActionComboBox.setAllowBlank(Boolean.FALSE);
publishActionComboBox.addSelectionChangedListener(new SelectionChangedListener<SimpleComboValue<String>>() {
@Override
public void selectionChanged(SelectionChangedEvent<SimpleComboValue<String>> se) {
SimpleComboValue<String> selectedItem = se.getSelectedItem();
if (selectedItem != null) {
String publishAction = selectedItem.getValue();
model.setPublishAction(publishAction);
if (!LayerPublishAction.valueOf(publishAction).equals(LayerPublishAction.RENAME)) {
model.setNewName("");
store.update(model);
}
} else {
model.setPublishAction(null);
}
manageProcessEPSGButton();
}
});
} else {
publishActionComboBox.setEnabled(Boolean.FALSE);
}
comboBoxMap.put("" + model.hashCode(), publishActionComboBox);
} else {
publishActionComboBox = (SimpleComboBox<String>) publishActionCBObj;
}
return publishActionComboBox;
}
};
publishColumnConfig.setRenderer(renderer);
configs.add(publishColumnConfig);
configs.add(newNameColumnConfig);
this.grid = new EditorGrid<EPSGLayerData>(store, new ColumnModel(configs));
grid.setBorders(Boolean.TRUE);
grid.setStripeRows(Boolean.TRUE);
grid.setBorders(Boolean.TRUE);
this.grid.setClicksToEdit(EditorGrid.ClicksToEdit.ONE);
grid.setStyleAttribute("borderTop", "none");
grid.setAutoExpandColumn(EPSGLayerData.NAME);
grid.setAutoExpandMin(120);
grid.setSize(GPPublisherWidget.PUBLISHER_WIDGET_WIDTH - 29, GPPublisherWidget.PUBLISHER_WIDGET_HEIGHT - 223);
super.add(this.grid);
this.processEPSGButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
PublisherProgressBar.getInstance().show(PublisherWidgetConstants.INSTANCE.EPSGTablePanel_processingDataProgressBarText());
store.commitChanges();
processEPSGRequest.setPreviewLayerList(store.getModels());
processEPSGRequest.setWorkspace(workspace);
ClientCommandDispatcher.getInstance().execute(new GPClientCommand<ProcessEPSGResultResponse>() {
private static final long serialVersionUID = -8303308816796000537L;
{
super.setCommandRequest(processEPSGRequest);
}
private FeaturePreviewEvent event = new FeaturePreviewEvent();
@Override
public void onCommandSuccess(ProcessEPSGResultResponse response) {
PublisherProgressBar.getInstance().hide();
event.setResult(response.getResult());
GPHandlerManager.fireEvent(event);
comboBoxMap.clear();
}
@Override
public void onCommandFailure(Throwable exception) {
PublisherProgressBar.getInstance().hide();
GeoPlatformMessage.errorMessage(PublisherWidgetConstants.INSTANCE.errorPublishingText(), exception.getMessage());
logger.log(Level.WARNING, "EPSGTablePanel Exception: " + exception.toString());
logger.log(Level.WARNING, "Stack Trace Exception: " + exception.getStackTrace());
logger.log(Level.WARNING, "Message Exception: " + exception.getMessage());
exception.printStackTrace();
}
});
}
});
this.processEPSGButton.setToolTip(PublisherWidgetConstants.INSTANCE.EPSGTablePanel_processEPSGButtonTooltipText());
super.addButton(this.processEPSGButton);
}
Aggregations