/** Acción realizada al pulsar el botón "Guardar Estilo" */ private void jbSaveStyleActionPerformed(ActionEvent evt) { saveStyle(); JOptionPane.showMessageDialog( this, GeopistaFunctionUtils.i18n_getname("EditWMSQuery.stylesSaved"), GeopistaFunctionUtils.i18n_getname("EditWMSQuery.stylesSaved"), JOptionPane.INFORMATION_MESSAGE); } // fin del método
public void initialize(PlugInContext context) throws Exception { FeatureInstaller featureInstaller = new FeatureInstaller(context.getWorkbenchContext()); featureInstaller.addPopupMenuItem( context.getWorkbenchContext().getIWorkbench().getGuiComponent().getCategoryPopupMenu(), this, GeopistaFunctionUtils.i18n_getname(this.getName()), false, null, null); featureInstaller.addLayerViewMenuItem( this, GeopistaFunctionUtils.i18n_getname("Layer"), GeopistaFunctionUtils.i18n_getname(this.getName())); }
public void initialize(PlugInContext context) throws Exception { saveDatasetDialog = new DriverDialog( GeopistaFunctionUtils.getFrame(context.getWorkbenchGuiComponent()), "Save Dataset", true); saveDatasetDialog.initialize(context.getDriverManager().getOutputDrivers()); GUIUtil.centreOnWindow(saveDatasetDialog); }
public boolean execute(PlugInContext context) throws Exception { LineString a = null; List capasVisibles = context.getWorkbenchContext().getLayerNamePanel().getLayerManager().getVisibleLayers(true); context.getLayerViewPanel().getLayerManager().getVisibleLayers(true); context.getLayerNamePanel().getLayerManager().getVisibleLayers(false); Iterator capasVisiblesIter = capasVisibles.iterator(); boolean cancelWhile = false; final LockManager lockManager = (LockManager) context .getActiveTaskComponent() .getLayerViewPanel() .getBlackboard() .get(LockManager.LOCK_MANAGER_KEY); while (capasVisiblesIter.hasNext()) { Layer capaActual = (Layer) capasVisiblesIter.next(); Collection featuresSeleccionadas = context .getWorkbenchContext() .getLayerViewPanel() .getSelectionManager() .getFeaturesWithSelectedItems(capaActual); // Almacenamos en este ArrayList el resultado de la operacion de // bloqueo Iterator featuresSeleccionadasIter = featuresSeleccionadas.iterator(); while (featuresSeleccionadasIter.hasNext()) { if (cancelWhile == true) { if (JOptionPane.showConfirmDialog( (Component) context.getWorkbenchGuiComponent(), aplicacion.getI18nString("GeopistaFeatureSchemaPlugIn.RestoFeatures"), aplicacion.getI18nString("GeopistaFeatureSchemaPlugIn.EditarMultiplesEntidades"), JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) return false; else cancelWhile = false; } localFeature = (Feature) featuresSeleccionadasIter.next(); String systemId = ((GeopistaFeature) localFeature).getSystemId(); final ArrayList lockResultaArrayList = new ArrayList(); // capa de sistema. La feature debe bloquearse if (capaActual instanceof GeopistaLayer && !((GeopistaLayer) capaActual).isLocal() && !((GeopistaLayer) capaActual).isExtracted() && capaActual.isEditable() && systemId != null && !((GeopistaFeature) localFeature).isTempID() && !systemId.equals("")) { final TaskMonitorDialog progressDialog = new TaskMonitorDialog(aplicacion.getMainFrame(), context.getErrorHandler()); progressDialog.setTitle(aplicacion.getI18nString("LockFeatures")); progressDialog.addComponentListener( new ComponentAdapter() { public void componentShown(ComponentEvent e) { // Wait for the dialog to appear before starting the // task. Otherwise // the task might possibly finish before the dialog // appeared and the // dialog would never close. [Jon Aquino] new Thread( new Runnable() { public void run() { try { Integer lockID = lockManager.lockFeature(localFeature, progressDialog); lockResultaArrayList.add(lockID); } catch (Exception e) { } finally { progressDialog.setVisible(false); } } }) .start(); } }); GUIUtil.centreOnWindow(progressDialog); progressDialog.setVisible(true); } FeatureDialog featureDialog = new FeatureDialog( GeopistaFunctionUtils.getFrame(context.getWorkbenchGuiComponent()), "Atributos", true, localFeature, context.getWorkbenchContext().getLayerViewPanel(), capaActual); Integer tempLockID = null; Iterator lockResultaArrayListIter = lockResultaArrayList.iterator(); if (lockResultaArrayListIter.hasNext()) { tempLockID = (Integer) lockResultaArrayListIter.next(); } final Integer lockID = tempLockID; try { ImageIcon icon = IconLoader.icon("logo_geopista.png"); featureDialog.setSideBarImage(null); } catch (NullPointerException e) { e.printStackTrace(); } if (capaActual instanceof GeopistaLayer) { String extendedForm = ((GeopistaLayer) capaActual).getFieldExtendedForm(); if (extendedForm == null) extendedForm = ""; if (!extendedForm.equals("")) { featureDialog.setExtendedForm(extendedForm); } } featureDialog.buildDialog(); if ((capaActual instanceof GeopistaLayer && (((GeopistaLayer) capaActual).isLocal() || ((GeopistaLayer) capaActual).isExtracted()) && !capaActual.isEditable()) || (lockID == null && capaActual instanceof GeopistaLayer && !((GeopistaLayer) capaActual).isLocal() && !((GeopistaLayer) capaActual).isExtracted() && !capaActual.isEditable() && systemId != null && !((GeopistaFeature) localFeature).isTempID() && !systemId.equals(""))) { featureDialog.setLock(); } featureDialog.setVisible(true); // solo para GeopistaLayer if (featureDialog.wasOKPressed()) { if (capaActual.isEditable()) { if (capaActual instanceof GeopistaLayer && !((GeopistaLayer) capaActual).isLocal() && lockID == null) continue; // obtenemos la feature con los cambios introducidos por // el usuario clonefeature = featureDialog.getModifiedFeature(); // Actualiza los parámetros execute( new UndoableCommand(getName()) { public void execute() { localFeature.setAttributes(clonefeature.getAttributes()); } public void unexecute() { ((GeopistaFeature) clonefeature).setFireDirtyEvents(false); clonefeature.setAttributes(localFeature.getAttributes()); ((GeopistaFeature) clonefeature).setFireDirtyEvents(true); } }, context); } } else { // el usuario ha pedido cancelar la edición cancelWhile = true; } if (lockID != null) { final TaskMonitorDialog progressDialogFinal = new TaskMonitorDialog(aplicacion.getMainFrame(), context.getErrorHandler()); progressDialogFinal.setTitle(aplicacion.getI18nString("UnlockFeatures")); progressDialogFinal.addComponentListener( new ComponentAdapter() { public void componentShown(ComponentEvent e) { // Wait for the dialog to appear before starting // the // task. Otherwise // the task might possibly finish before the // dialog // appeared and the // dialog would never close. [Jon Aquino] new Thread( new Runnable() { public void run() { try { lockManager.unlockFeaturesByLockId(lockID, progressDialogFinal); } catch (Exception e) { } finally { progressDialogFinal.setVisible(false); } } }) .start(); } }); GUIUtil.centreOnWindow(progressDialogFinal); progressDialogFinal.setVisible(true); } } } return false; }