public DataException(Throwable cause) { super(cause); ErrorDialog.show( aplicacion.getMainFrame(), I18N.get("Importacion", "DataError.Titulo"), I18N.get("Importacion", "DataError.Aviso"), StringUtil.stackTrace(this)); }
public DataException(String msg) { super(msg); ErrorDialog.show( aplicacion.getMainFrame(), I18N.get("Importacion", "DataError.Titulo"), msg, StringUtil.stackTrace(this)); }
private void fileBtnActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_fileBtnActionPerformed if (importar.equals("true")) { fileChooser = GUIUtil.createJFileChooserWithExistenceChecking(); if (JFileChooser.APPROVE_OPTION == fileChooser.showOpenDialog(aplicacion.getMainFrame())) { fileTxt.setText(fileChooser.getSelectedFile().getAbsolutePath()); } else JOptionPane.showMessageDialog(null, aplicacion.getI18nString("SLDStyle.SeleccionFichero")); } else { fileChooser = GUIUtil.createJFileXMLChooserWithOverwritePrompting(); FileFilter fileFilter = new MyFileFilter(".xml", "XML"); fileChooser.setFileFilter(fileFilter); fileChooser.setAcceptAllFileFilterUsed(false); if (JFileChooser.APPROVE_OPTION == fileChooser.showSaveDialog(aplicacion.getMainFrame())) { if (fileChooser.getSelectedFile().getAbsolutePath().endsWith(".xml")) fileTxt.setText(fileChooser.getSelectedFile().getAbsolutePath()); else JOptionPane.showMessageDialog( null, AppContext.getMessage("SLDStyle.SeleccionFicheroXML")); } else JOptionPane.showMessageDialog(null, aplicacion.getI18nString("SLDStyle.SeleccionFichero")); } } // GEN-LAST:event_fileBtnActionPerformed
/** Acción realizada al pulsar el botón de salir de la aplicación */ private void jButtonSalirActionPerformed() { String string1 = I18N.get("GestorCapas", "general.si"); String string2 = I18N.get("GestorCapas", "general.no"); Object[] options = {string1, string2}; int n = JOptionPane.showOptionDialog( this, I18N.get("GestorCapas", "general.salir.mensaje"), "", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]); if (n == JOptionPane.NO_OPTION) return; aplicacion.getMainFrame().dispose(); System.exit(0); }
public void mostrarMensaje(String mensaje) { JOptionPane.showMessageDialog(aplicacion.getMainFrame(), mensaje); }
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; }
private void mostrarCalendario() { if (this.chCalendario.isSelected()) { dialogo = new DialogoSeleccionVersion(aplicacion.getMainFrame(), this); dialogo.setVisible(true); } }
private void btnEliminar_actionPerformed(ActionEvent e) { GeopistaMap selectMap = (GeopistaMap) lstListaMapas.getSelectedValue(); if (selectMap != null) { int deleteMapConfirm = JOptionPane.showConfirmDialog( aplicacion.getMainFrame(), aplicacion.getI18nString("GeopistaListaMapasPanel.ConfimarBorradoMapa") + " " + selectMap.getName() + "?", aplicacion.getI18nString("GeopistaListaMapasPanel.BorrarMapa"), JOptionPane.YES_NO_OPTION); if (deleteMapConfirm != 0) return; String mapDeleteSelected = selectMap.getBasePath(); if (!selectMap.isSystemMap()) { File dirBaseMake = new File(mapDeleteSelected); File[] deleteFiles = dirBaseMake.listFiles(); if (deleteFiles != null) { for (int n = 0; n < deleteFiles.length; n++) { try { File actualDeleteFile = deleteFiles[n]; boolean borrado = actualDeleteFile.delete(); if (!borrado) throw new IOException( aplicacion.getI18nString("GeopistaListaMapasPanel.ElMapaInicioErrorBorrado") + " " + selectMap.getName() + " " + aplicacion.getI18nString("GeopistaListaMapasPanel.NoBorrado")); if (dirBaseMake != null) { borrado = dirBaseMake.delete(); } } catch (Exception e1) { JOptionPane.showMessageDialog(aplicacion.getMainFrame(), e1.getMessage()); } } } } else { if (selectMap.getIdEntidad() == 0) { deleteMapConfirm = JOptionPane.showConfirmDialog( aplicacion.getMainFrame(), aplicacion.getI18nString("GeopistaListaMapasPanel.ConfimarBorradoMapaEntidad0") + " " + selectMap.getName() + "?", aplicacion.getI18nString("GeopistaListaMapasPanel.BorrarMapa"), JOptionPane.YES_NO_OPTION); if (deleteMapConfirm != 0) return; } String sUrlPrefix; // ------NUEVO------> if (SSOAuthManager.isSSOActive()) sUrlPrefix = aplicacion.getString(SSOConstants.SSO_SERVER_URL); else sUrlPrefix = aplicacion.getString("geopista.conexion.servidor"); // ----FIN NUEVO----> AdministradorCartografiaClient administradorCartografiaClient = new AdministradorCartografiaClient(sUrlPrefix + "/AdministradorCartografiaServlet"); try { if (!aplicacion.isLogged()) { aplicacion.setProfile("Geopista"); aplicacion.login(); } if (aplicacion.isLogged()) { administradorCartografiaClient.deleteMap(selectMap, Locale.getDefault().toString()); } else { return; } } catch (Exception e1) { Throwable deleteError = e1.getCause(); if (deleteError instanceof PermissionException) { JOptionPane.showMessageDialog( aplicacion.getMainFrame(), aplicacion.getI18nString("GeopistaListaMapasPanel.NoPermisosBorrarMapa")); } if (deleteError instanceof SystemMapException) { JOptionPane.showMessageDialog( aplicacion.getMainFrame(), aplicacion.getI18nString("GeopistaListaMapasPanel.MapaDeSistemaNoBorrar")); } if (deleteError instanceof SQLException) { JOptionPane.showMessageDialog( aplicacion.getMainFrame(), aplicacion.getI18nString("GeopistaListaMapasPanel.MapaNoSePuedeBorrarPublicado")); } if (deleteError instanceof PublishedMapException) { JOptionPane.showMessageDialog( aplicacion.getMainFrame(), aplicacion.getI18nString("GeopistaListaMapasPanel.MapaNoSePuedeBorrarPublicado")); } return; } } listModel.removeElement(selectMap); } }
public void getMapFiles(PlugInContext pluginContext, boolean searchlocal, boolean searchremote) { final ArrayList localMapIds = new ArrayList(); if (searchlocal) { final String rutaBase = aplicacion.getUserPreference( AppContext.PREFERENCES_DATA_PATH_KEY, AppContext.DEFAULT_DATA_PATH, true); ; // Comprobamos si existe la ruta base y en caso de que no exista la // creamos File rutaBaseFile = new File(rutaBase); if (!rutaBaseFile.exists()) { rutaBaseFile.mkdirs(); } final TaskMonitorDialog progressDialog = new TaskMonitorDialog(aplicacion.getMainFrame(), pluginContext.getErrorHandler()); progressDialog.allowCancellationRequests(); progressDialog.setTitle(aplicacion.getI18nString("BuscandoMapas")); progressDialog.report(aplicacion.getI18nString("BuscandoMapasLocales")); 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 { ArrayList listaMap = GeopistaFunctionUtils.searchDirectory(rutaBase, progressDialog); Iterator Iter = listaMap.iterator(); while (Iter.hasNext()) { GeopistaMap currentMap = (GeopistaMap) Iter.next(); if (!(currentMap.isExtracted() && currentMap.getIdEntidad() != AppContext.getIdEntidad())) { listModel.addElement(currentMap); String systemId = currentMap.getSystemId(); if (systemId.startsWith("e")) systemId = systemId.substring(1); localMapIds.add(systemId); } } } catch (Exception e) { } finally { progressDialog.setVisible(false); } } }) .start(); } }); if (aplicacion.getMainFrame() == null) // sin ventana de referencia GUIUtil.centreOnScreen(progressDialog); else GUIUtil.centreOnWindow(progressDialog); progressDialog.setVisible(true); } if (searchremote) { // final String sUrlPrefix = aplicacion.getString("geopista.conexion.servidor"); final String sUrlPrefix; // ------NUEVO------> // if(SSOAuthManager.isSSOActive()) // sUrlPrefix = aplicacion.getString(SSOConstants.SSO_SERVER_URL); // else sUrlPrefix = aplicacion.getString("geopista.conexion.servidor"); // ----FIN NUEVO----> if (aplicacion.isOnline()) { try { if (!aplicacion.isLogged()) { aplicacion.setProfile("Geopista"); aplicacion.login(); } if (aplicacion.isLogged()) { final TaskMonitorDialog progressDialog2 = new TaskMonitorDialog(aplicacion.getMainFrame(), pluginContext.getErrorHandler()); progressDialog2.setTitle(aplicacion.getI18nString("BuscandoMapas")); progressDialog2.report(aplicacion.getI18nString("BuscandoMapasBaseDatos")); progressDialog2.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 { Object[] mapSystemIds = localMapIds.toArray(); Arrays.sort(mapSystemIds); AdministradorCartografiaClient administradorCartografiaClient = new AdministradorCartografiaClient( sUrlPrefix + "/AdministradorCartografiaServlet"); Collection lMaps = administradorCartografiaClient.getMaps( Locale.getDefault().toString()); Iterator lMapsIter = lMaps.iterator(); while (lMapsIter.hasNext()) { try { GeopistaMap currentMap = (GeopistaMap) lMapsIter.next(); int codeIndex = Arrays.binarySearch( mapSystemIds, currentMap.getSystemId()); if (codeIndex >= 0) continue; listModel.addElement(currentMap); } catch (Exception e) { e.printStackTrace(); } } } catch (Exception e) { } finally { progressDialog2.setVisible(false); } } }) .start(); } }); if (aplicacion.getMainFrame() == null) GUIUtil.centreOnScreen(progressDialog2); else GUIUtil.centreOnWindow(progressDialog2); progressDialog2.setVisible(true); } } catch (Exception e) { e.printStackTrace(); } } } }
/** Inicialización de los componentes */ private void initComponents() { this.setBounds(new Rectangle(10, 10, 1000, 830)); this.setBorder(BorderFactory.createLineBorder(Color.black, 1)); this.setLayout(null); // Operaciones para añadir el panel de dominios try { // aplicacion.login(); com.geopista.app.administrador.init.Constantes.url = aplicacion.getString("geopista.conexion.servidorurl") + WebAppConstants.ADMINISTRACION_WEBAPP_NAME; // // com.geopista.app.administrador.init.Constantes.idMunicipio=Integer.parseInt(AppContext.getApplicationContext().getString("geopista.DefaultCityId")); com.geopista.app.administrador.init.Constantes.idEntidad = aplicacion.getIdEntidad(); // com.geopista.security.SecurityManager.setHeartBeatTime(100000); com.geopista.security.SecurityManager.setHeartBeatTime(10000); com.geopista.security.SecurityManager.setsUrl( com.geopista.app.administrador.init.Constantes.url); com.geopista.app.administrador.init.Constantes.Locale = aplicacion.getUserPreference( AppContext.GEOPISTA_LOCALE_KEY, GestorCapas.DEFAULT_LOCALE, false); /*Municipio municipio = (new OperacionesAdministrador(com.geopista.app.administrador.init.Constantes.url)) .getMunicipio(new Integer(com.geopista.app.administrador.init.Constantes.idMunicipio).toString()); if (municipio!=null) { com.geopista.app.administrador.init.Constantes.Municipio = municipio.getNombre(); com.geopista.app.administrador.init.Constantes.Provincia= municipio.getProvincia(); }*/ Entidad entidad = (new OperacionesAdministrador(com.geopista.app.administrador.init.Constantes.url)) .getEntidad( new Integer(com.geopista.app.administrador.init.Constantes.idEntidad).toString()); if (entidad != null) { com.geopista.app.administrador.init.Constantes.Entidad = entidad.getNombre(); // com.geopista.app.administrador.init.Constantes.Provincia= municipio.getProvincia(); } try { messages = ResourceBundle.getBundle( "config.administrador", new Locale( aplicacion.getUserPreference( AppContext.GEOPISTA_LOCALE_KEY, GestorCapas.DEFAULT_LOCALE, false))); } catch (Exception e) { messages = ResourceBundle.getBundle( "config.administrador", new Locale(GestorCapas.DEFAULT_LOCALE)); } jPanelDominios = new JPanelDominios(messages, aplicacion.getMainFrame()); jPanelDominios.hideLeyenda(); } catch (Exception e) { e.printStackTrace(); } templateJScrollPane = new JScrollPane(); templateJPanel = new JPanel(); templateJPanel.setLayout(new BorderLayout()); // jButtonSalir.setBounds(new Rectangle(350, 555, 100, 25)); jButtonSalir.setBounds(new Rectangle(875, 555, 100, 25)); jButtonSalir.setMaximumSize(new java.awt.Dimension(100, 25)); jButtonSalir.setPreferredSize(new java.awt.Dimension(75, 25)); jButtonSalir.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonSalirActionPerformed(); } }); // aplicacion.loadI18NResource("GestorCapasi18n"); jButtonSalir.setText(I18N.get("GestorCapas", "general.boton.salir")); templateJScrollPane.setViewportView(templateJPanel); jPanelDominios.setBounds(new Rectangle(260, 5, 740, 550)); jPanelLevel.setBounds(new java.awt.Rectangle(15, 490, 200, 25)); lblLevel.setText(I18N.get("GestorCapas", "tablas.level.dominio")); txtLevel.setText("0 "); txtLevel.setBounds(new Rectangle(50, 5, 40, 15)); txtLevel.setEnabled(false); lblLevel.setBackground(Color.GRAY); jPanelLevel.add(lblLevel, null); jPanelLevel.add(txtLevel, null); jButtonAsociar.setBounds(new java.awt.Rectangle(35, 525, 180, 25)); jButtonAsociar.setEnabled(false); jButtonAsociar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonAsociarActionPerformed(); } }); jButtonAsociar.setText(I18N.get("GestorCapas", "tablas.boton.asociar")); jButtonDesasociar.setBounds(new java.awt.Rectangle(35, 555, 180, 25)); jButtonDesasociar.setEnabled(false); jButtonDesasociar.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonDesasociarActionPerformed(); } }); jButtonDesasociar.setText(I18N.get("GestorCapas", "tablas.boton.desasociar")); jPanelTablas = new JPanelTables(TreeSelectionModel.SINGLE_TREE_SELECTION); jPanelTablas.setBorder( BorderFactory.createTitledBorder(I18N.get("GestorCapas", "tablas.arbol.titulo"))); jPanelTablas.setBounds(new java.awt.Rectangle(5, 5, 250, 481)); jPanelDominios.changeScreenLang(messages); treeDominios = jPanelDominios.getJTreeArbol(); treeDominios.addTreeSelectionListener(this); treeDominiosParticular = jPanelDominios.getJTreeArbolParticular(); treeDominiosParticular.addTreeSelectionListener(this); treeTablas = jPanelTablas.getTree(); treeTablas.addTreeSelectionListener(this); this.add(jPanelDominios, null); this.add(jButtonSalir, null); this.add(jPanelTablas, null); this.add(jButtonAsociar, null); this.add(jButtonDesasociar, null); this.add(jPanelLevel, null); }