@Override
 protected void succeeded(Object result) {
   setMessage("Importación finalizada.");
   if (result instanceof Boolean) {
     if ((Boolean) result) {
       String extra = "";
       if (ImportadorDatosGeneralesSeneca.isImportar(tipo, ImportadorDatosGeneralesSeneca.UNIDADES)
           || ImportadorDatosGeneralesSeneca.isImportar(
               tipo, ImportadorDatosGeneralesSeneca.CURSOS)) {
         extra =
             "\nRecuerde revisar las asignaciones de los códigos cortos para cursos y unidades.";
       }
       JOptionPane.showMessageDialog(
           MaimonidesApp.getApplication().getMainFrame(),
           "Se han importado los datos correctamente." + extra,
           "Importación realizada con éxito",
           JOptionPane.INFORMATION_MESSAGE);
     } else {
       JOptionPane.showMessageDialog(
           MaimonidesApp.getApplication().getMainFrame(),
           "No se han podido importar correctamente los datos.\nRevise que el fichero es el correcto (o que los datos están en Séneca)\no contacte con el servicio técnico si no consigue solucionar el error.",
           "Error importando datos",
           JOptionPane.ERROR_MESSAGE);
     }
   }
 }
Пример #2
0
 BorrarTask(org.jdesktop.application.Application app) {
   super(app);
   int[] filas = tabla.getSelectedRows();
   int op =
       JOptionPane.showConfirmDialog(
           MaimonidesApp.getApplication().getMainFrame(),
           "¿Esta seguro de que desea borrar los usuarios seleccionados (" + filas.length + ")?",
           "Borrar",
           JOptionPane.YES_NO_OPTION,
           JOptionPane.QUESTION_MESSAGE);
   if (op == JOptionPane.YES_OPTION) {
     for (int i : filas) {
       int row = tabla.convertRowIndexToModel(i);
       Usuario u = modelo.getElemento(row);
       if (u.getId() == 1) {
         JOptionPane.showMessageDialog(
             MaimonidesApp.getApplication().getMainFrame(),
             "El usuario administrador no puede ser eliminado",
             "Error",
             JOptionPane.ERROR_MESSAGE);
       } else {
         profs.add(u);
       }
     }
     modelo.quitarDatos(profs);
   }
 }
Пример #3
0
 private void setValorApoyo(int dia, int hora, Boolean val) {
   if (val == null || !val) {
     // Borramos la asignacion
     String sql =
         "DELETE apoyos_alumnos FROM apoyos_alumnos JOIN horarios AS h ON h.id=apoyos_alumnos.horario_id WHERE apoyos_alumnos.alumno_id=? AND h.hora=? AND h.dia=?";
     try {
       PreparedStatement st =
           (PreparedStatement)
               MaimonidesApp.getApplication().getConector().getConexion().prepareStatement(sql);
       st.setInt(1, getAlumno().getId());
       st.setInt(2, hora);
       st.setInt(3, dia);
       st.executeUpdate();
     } catch (SQLException ex) {
       Logger.getLogger(PanelApoyos.class.getName()).log(Level.SEVERE, null, ex);
     }
   } else {
     // Creamos la asignacion
     String sql =
         "INSERT INTO apoyos_alumnos SELECT distinct ?, h.id FROM horarios_ AS h WHERE h.hora=? AND h.dia=? AND h.unidad_id=? ";
     try {
       PreparedStatement st =
           (PreparedStatement)
               MaimonidesApp.getApplication().getConector().getConexion().prepareStatement(sql);
       st.setInt(1, getAlumno().getId());
       st.setInt(2, hora);
       st.setInt(3, dia);
       st.setInt(4, getAlumno().getUnidad().getId());
       st.executeUpdate();
     } catch (SQLException ex) {
       Logger.getLogger(PanelApoyos.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
 }
Пример #4
0
 public static int getNumeroExpulsiones(Alumno alumno, GregorianCalendar fecha) {
   int ret = 0;
   PreparedStatement st = null;
   ResultSet res = null;
   try {
     // Tenemos que ver si hay expulsiones para ese alumno
     st =
         (PreparedStatement)
             MaimonidesApp.getApplication()
                 .getConector()
                 .getConexion()
                 .prepareStatement(
                     "SELECT count(*) FROM expulsiones WHERE alumno_id=? AND fecha<=?");
     st.setInt(1, alumno.getId());
     st.setDate(2, new java.sql.Date(fecha.getTimeInMillis()));
     res = st.executeQuery();
     if (res.next()) {
       ret = res.getInt(1);
     }
   } catch (SQLException ex) {
     Logger.getLogger(Expulsion.class.getName()).log(Level.SEVERE, null, ex);
   }
   Obj.cerrar(st, res);
   return ret;
 }
Пример #5
0
 /**
  * Calcula si un alumno esta expulsado. Se sabe si un alumno está expulsado por el número de dias
  * escolares entre la fecha de expulsión y la de parte. Un día escolar es el numero de partes con
  * fecha distinta entre dos fechas.
  *
  * @param anoEscolar Año escola
  * @param alumno Alumno
  * @param fecha Fecha en la que se quiere saber si el alumno estça expulsado
  * @return true si está expulsado en la fecha del parte, false si no lo está
  */
 public static Boolean isAlumnoExpulsado(Alumno alumno, GregorianCalendar fecha) {
   boolean ret = false;
   try {
     // Tenemos que ver si hay expulsiones para ese alumno
     PreparedStatement st =
         (PreparedStatement)
             MaimonidesApp.getApplication()
                 .getConector()
                 .getConexion()
                 .prepareStatement("SELECT * FROM expulsiones WHERE alumno_id=? AND fecha<=?");
     st.setInt(1, alumno.getId());
     st.setDate(2, new java.sql.Date(fecha.getTimeInMillis()));
     ResultSet res = st.executeQuery();
     while (res.next() && !ret) {
       // Si hay expulsiones tenemos que ver si son válidas
       // Para eso tenemos que contar los partes desde la fecha de expulsión hasta ahora
       GregorianCalendar fechaExpulsion = Fechas.toGregorianCalendar(res.getDate("fecha"));
       if (fechaExpulsion != null) {
         // Como la fecha de expulsión esta incluida tenemos que quitarle un día
         fechaExpulsion.add(GregorianCalendar.DATE, -1);
         // Y vemos la diferencia en días
         int dias = res.getInt("dias");
         long diasTranscurridos =
             Fechas.getDiferenciaTiempoEn(fecha, fechaExpulsion, GregorianCalendar.DATE);
         ret = diasTranscurridos <= dias;
       }
     }
     Obj.cerrar(st, res);
   } catch (SQLException ex) {
     Logger.getLogger(Expulsion.class.getName()).log(Level.SEVERE, null, ex);
   }
   return ret;
 }
Пример #6
0
        @Override
        public void elementoModificado(Usuario elemento, int col, Object valor) {
          // Tenemos que verificar si existe ya el nombre de usuario
          boolean existe = true;
          String nombre = elemento.getNombre();
          int cont = 0;
          boolean cambiado = false;
          while (existe) {
            cont++;
            existe = false;
            for (Usuario u : modelo.getDatos()) {
              if (elemento != u && u.getNombre().equals(elemento.getNombre())) {
                existe = true;

                break;
              }
            }
            if (existe) {
              cambiado = true;
              elemento.setNombre(nombre + cont);
            }
          }

          if (cambiado) {
            JOptionPane.showMessageDialog(
                MaimonidesApp.getApplication().getMainFrame(),
                "Ya existe un usuario con ese nombre.\nSe le añadirá automáticamente un contador para diferenciarlo.",
                "Error",
                JOptionPane.ERROR_MESSAGE);
          }
          elemento.guardar();
        }
Пример #7
0
 @Override
 protected ArrayList<Usuario> doInBackground() {
   ArrayList<Usuario> ret = new ArrayList<Usuario>();
   if (!Beans.isDesignTime()) {
     try {
       PreparedStatement st =
           (PreparedStatement)
               MaimonidesApp.getApplication()
                   .getConector()
                   .getConexion()
                   .prepareStatement(
                       "SELECT * FROM usuarios WHERE fbaja IS NULL ORDER BY nombre");
       ResultSet res = st.executeQuery();
       while (res.next()) {
         Usuario p = new Usuario();
         try {
           p.cargarDesdeResultSet(res);
           ret.add(p);
         } catch (SQLException ex) {
           Logger.getLogger(PanelUsuarios.class.getName()).log(Level.SEVERE, null, ex);
         } catch (Exception ex) {
           Logger.getLogger(PanelUsuarios.class.getName()).log(Level.SEVERE, null, ex);
         }
       }
       Obj.cerrar(st, res);
     } catch (SQLException ex) {
       Logger.getLogger(PanelUsuarios.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
   return ret; // return your result
 }
Пример #8
0
 public void setAlumno(Alumno alumno) {
   this.alumno = null;
   lInfoAlumno.setText("");
   // De primeras ponemos todos los apoyos a false
   for (int hora = 0; hora < 6; hora++) {
     for (int dia = 0; dia < 5; dia++) {
       tabla.getModel().setValueAt(false, hora, dia + 1);
     }
   }
   // Sacamos todos sus apoyos
   if (alumno != null) {
     lInfoAlumno.setText(alumno.getNombreFormateado());
     try {
       String sql =
           "SELECT distinct h.dia,h.hora FROM horarios_ AS h JOIN apoyos_alumnos AS aa ON aa.horario_id=h.id WHERE aa.alumno_id=? ";
       PreparedStatement st =
           (PreparedStatement)
               MaimonidesApp.getApplication().getConector().getConexion().prepareStatement(sql);
       st.setInt(1, alumno.getId());
       ResultSet res = st.executeQuery();
       while (res.next()) {
         tabla.getModel().setValueAt(true, res.getInt("hora") - 1, res.getInt("dia"));
       }
       Obj.cerrar(st, res);
     } catch (SQLException ex) {
       Logger.getLogger(PanelApoyos.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
   this.alumno = alumno;
 }
Пример #9
0
 @Override
 public boolean guardar() {
   boolean ret = false;
   try {
     String sql = "UPDATE expulsiones SET ano=?,alumno_id=?,fecha=?,dias=? WHERE id=?";
     if (getId() == null) {
       sql = "INSERT INTO expulsiones (ano,alumno_id,fecha,dias,id) VALUES(?,?,?,?,?)";
     }
     PreparedStatement st =
         (PreparedStatement)
             MaimonidesApp.getApplication()
                 .getConector()
                 .getConexion()
                 .prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
     st.setInt(1, getAnoEscolar().getId());
     st.setInt(2, getAlumno().getId());
     st.setDate(3, new java.sql.Date(getFecha().getTimeInMillis()));
     st.setInt(4, getDias());
     st.setObject(5, getId());
     ret = st.executeUpdate() > 0;
     if (ret && getId() == null) {
       setId((int) st.getLastInsertID());
     }
     st.close();
     ret = true;
   } catch (SQLException ex) {
     Logger.getLogger(Conducta.class.getName())
         .log(Level.SEVERE, "Error guardando datos de expulsion: " + this, ex);
   }
   return ret;
 }
 @Override
 protected void succeeded(ArrayList<String> result) {
   if (result != null && result.size() > 0) {
     // Entonces ha habido errores y los mostramos
     JPanel panel = new JPanel();
     BorderLayout layout = new BorderLayout();
     layout.setVgap(10);
     panel.setLayout(layout);
     JList lista = new JList(result.toArray());
     JScrollPane scroll = new JScrollPane(lista);
     panel.add(scroll, BorderLayout.CENTER);
     JLabel label = new JLabel("Se ha producido errores sincronizando los datos con Séneca.");
     panel.add(label, BorderLayout.NORTH);
     JOptionPane.showMessageDialog(
         MaimonidesApp.getApplication().getMainFrame(),
         panel,
         "Errores de sincronización.",
         JOptionPane.ERROR_MESSAGE);
   } else {
     if (!gen.isFicherosGenerados()) {
       JOptionPane.showMessageDialog(
           MaimonidesApp.getApplication().getMainFrame(),
           "No hay faltas que exportar",
           "Exportación de faltas",
           JOptionPane.WARNING_MESSAGE);
     } else {
       if (this.soloFicheros) {
         JOptionPane.showMessageDialog(
             MaimonidesApp.getApplication().getMainFrame(),
             "Ficheros de faltas generados correctamente.\nProceda a realizar el envío manual.",
             "Exportación de faltas",
             JOptionPane.INFORMATION_MESSAGE);
         try {
           Desktop.getDesktop().open(gen.getCarpetaSalida());
         } catch (IOException ex) {
           Logger.getLogger(PanelExportacionSeneca.class.getName()).log(Level.SEVERE, null, ex);
         }
       } else {
         JOptionPane.showMessageDialog(
             MaimonidesApp.getApplication().getMainFrame(),
             "Ficheros de faltas exportados a Séneca correctamente",
             "Exportación de faltas",
             JOptionPane.INFORMATION_MESSAGE);
       }
     }
   }
 }
 @Override
 protected void failed(Throwable t) {
   setMessage("Importación finalizada con errores.");
   JOptionPane.showMessageDialog(
       MaimonidesApp.getApplication().getMainFrame(),
       "No se han podido importar correctamente los datos:\n" + t.getLocalizedMessage(),
       "Error importando datos",
       JOptionPane.ERROR_MESSAGE);
 }
Пример #12
0
  private void generarCabeceraFaltas(
      GregorianCalendar fechaMin, GregorianCalendar fechaMax, Element nCursos) throws DOMException {
    // Ahora generamos la cabecera

    Element datosGenerales = getDocumento().createElement("DATOS_GENERALES");
    // <MODULO>FALTAS DE ASISTENCIA</MODULO>
    datosGenerales.appendChild(crearTag("MODULO", "FALTAS DE ASISTENCIA"));
    // <TIPO_INTERCAMBIO>I</TIPO_INTERCAMBIO>
    datosGenerales.appendChild(crearTag("TIPO_INTERCAMBIO", "I"));
    // <AUTOR>SENECA</AUTOR>
    datosGenerales.appendChild(crearTag("AUTOR", "MAIMONIDES"));
    // <FECHA>17/10/2008 14:11:47</FECHA>
    datosGenerales.appendChild(
        crearTag("FECHA", Fechas.format(new GregorianCalendar(), "dd/MM/yyyy HH:mm:ss")));
    // <C_ANNO>2008</C_ANNO>
    datosGenerales.appendChild(
        crearTag("C_ANNO", MaimonidesApp.getApplication().getAnoEscolar().getAno()));
    // <FECHA_DESDE>06/10/2008</FECHA_DESDE>
    datosGenerales.appendChild(crearTag("FECHA_DESDE", Fechas.format(fechaMin)));
    // <FECHA_HASTA>06/10/2008</FECHA_HASTA>
    datosGenerales.appendChild(crearTag("FECHA_HASTA", Fechas.format(fechaMax)));
    // <CODIGO_CENTRO>18002243</CODIGO_CENTRO>
    datosGenerales.appendChild(
        crearTag(
            "CODIGO_CENTRO",
            MaimonidesApp.getApplication().getConfiguracion().get("codigo_centro", "")));
    // <NOMBRE_CENTRO>I.E.S. Federico García Lorca</NOMBRE_CENTRO>
    datosGenerales.appendChild(
        crearTag(
            "NOMBRE_CENTRO",
            MaimonidesApp.getApplication().getConfiguracion().get("nombre_centro", "")));
    // <LOCALIDAD_CENTRO>Churriana de la Vega (Granada)</LOCALIDAD_CENTRO>
    datosGenerales.appendChild(
        crearTag(
            "LOCALIDAD_CENTRO",
            MaimonidesApp.getApplication().getConfiguracion().get("poblacion_centro", "")
                + " ("
                + MaimonidesApp.getApplication().getConfiguracion().get("provincia_centro", "")
                + ")"));
    raiz.appendChild(datosGenerales);
    raiz.appendChild(nCursos);
    // getDocumento().appendChild(raiz);
  }
Пример #13
0
 @Override
 protected void succeeded(Vector<Profesor> result) {
   if (result != null && result.size() > 0) {
     JOptionPane.showMessageDialog(
         MaimonidesApp.getApplication().getMainFrame(),
         "Algunos profesores no se han podido borrar.",
         "Borrar profesores",
         JOptionPane.WARNING_MESSAGE);
     modelo.addDatos(result);
   }
 }
Пример #14
0
    @Override
    protected Integer doInBackground() {
      setMessage("Procensado usuarios...");
      int cont = 0;
      PreparedStatement st = null;
      ResultSet res = null;
      int asoc = 0;
      try {
        st =
            (PreparedStatement)
                MaimonidesApp.getConexion()
                    .prepareStatement(
                        "SELECT p.cod FROM profesores AS p JOIN usuarios_profesores AS up ON up.profesor_id=p.id AND p.ano=up.ano WHERE p.ano<>? AND up.usuario_id=? ORDER BY p.ano DESC LIMIT 0,1");
        st.setInt(1, MaimonidesApp.getApplication().getAnoEscolar().getId());
        for (Usuario u : modelo.getDatos()) {
          cont++;
          setProgress(cont, 0, modelo.getRowCount());
          setMessage("Verificando " + u + "...");
          if (u.getProfesor() == null) {
            // Vemos la id del profesor del año anterior
            st.setInt(2, u.getId());
            res = st.executeQuery();
            if (res.next()) {
              Profesor p =
                  Profesor.getProfesorPorCodigo(
                      res.getInt(1), MaimonidesApp.getApplication().getAnoEscolar());
              if (p != null) {
                u.setProfesor(p);
                if (u.guardar()) {
                  asoc++;
                }
              }
            }
          }
        }
      } catch (SQLException ex) {
        Logger.getLogger(PanelUsuarios.class.getName()).log(Level.SEVERE, null, ex);
      }

      return asoc;
    }
Пример #15
0
 @Override
 protected void succeeded(Short result) {
   String titulo = "Datos enviados correctamente";
   int tipo = JOptionPane.INFORMATION_MESSAGE;
   if (result < 1) {
     titulo = "Error enviando datos";
     tipo = JOptionPane.ERROR_MESSAGE;
   }
   setMessage(titulo);
   JOptionPane.showMessageDialog(
       MaimonidesApp.getApplication().getMainFrame(), ew.getUltimoMensaje(), titulo, tipo);
 }
Пример #16
0
 EnviarWebTask(org.jdesktop.application.Application app) {
   super(app);
   int op =
       JOptionPane.showConfirmDialog(
           MaimonidesApp.getApplication().getMainFrame(),
           "Se va a enviar el listado de profesores a la web,\nlos profesores que no existan se desactivarán\ny los nuevos profesores se crearán.\n¿Continuar?",
           "Confirmación",
           JOptionPane.OK_CANCEL_OPTION,
           JOptionPane.QUESTION_MESSAGE);
   if (op != JOptionPane.OK_OPTION) {
     cancel(false);
   }
 }
Пример #17
0
 ImportarUsuariosTask(org.jdesktop.application.Application app) {
   super(app);
   int op =
       JOptionPane.showConfirmDialog(
           MaimonidesApp.getMaimonidesView().getFrame(),
           "Esta operación creará un usuario para cada profesor.\n¿Continuar?",
           "Importación de usuarios",
           JOptionPane.OK_CANCEL_OPTION,
           JOptionPane.QUESTION_MESSAGE);
   if (op != JOptionPane.OK_OPTION) {
     cancel(false);
   }
 }
Пример #18
0
 AsociarProfesoresTask(org.jdesktop.application.Application app) {
   super(app);
   int op =
       JOptionPane.showConfirmDialog(
           MaimonidesApp.getMaimonidesView().getFrame(),
           "Se van a asociar los usuarios con los profesores basándose en los datos del año anterior.\n¿Continuar?",
           "Importación de usuarios",
           JOptionPane.OK_CANCEL_OPTION,
           JOptionPane.QUESTION_MESSAGE);
   if (op != JOptionPane.OK_OPTION) {
     cancel(false);
   }
 }
Пример #19
0
 @Override
 protected Vector<Profesor> doInBackground() {
   Vector<Profesor> ret = new Vector<Profesor>();
   if (!Beans.isDesignTime()) {
     try {
       if (Permisos.isUsuarioSoloProfesor() && Permisos.getFiltroProfesor() != null) {
         ret.add(Permisos.getFiltroProfesor());
       } else {
         PreparedStatement st =
             (PreparedStatement)
                 MaimonidesApp.getApplication()
                     .getConector()
                     .getConexion()
                     .prepareStatement(
                         "SELECT * FROM profesores_ WHERE ano=? ORDER BY nombre,apellido1,apellido2");
         st.setInt(1, MaimonidesApp.getApplication().getAnoEscolar().getId());
         ResultSet res = st.executeQuery();
         while (res.next()) {
           Profesor p = new Profesor();
           try {
             p.cargarDesdeResultSet(res);
             ret.add(p);
           } catch (SQLException ex) {
             Logger.getLogger(PanelProfesores.class.getName()).log(Level.SEVERE, null, ex);
           } catch (Exception ex) {
             Logger.getLogger(PanelProfesores.class.getName()).log(Level.SEVERE, null, ex);
           }
         }
         Obj.cerrar(st, res);
       }
     } catch (SQLException ex) {
       Logger.getLogger(PanelProfesores.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
   return ret; // return your result
 }
Пример #20
0
 public Expulsion(int id) throws Exception {
   PreparedStatement st =
       (PreparedStatement)
           MaimonidesApp.getApplication()
               .getConector()
               .getConexion()
               .prepareStatement("SELECT * FROM expulsiones WHERE id=? ");
   st.setInt(1, id);
   ResultSet res = st.executeQuery();
   if (res.next()) {
     cargarDesdeResultSet(res);
   } else {
     throw new InvalidParameterException("No existe ninguna expulsion con ID " + id);
   }
   Obj.cerrar(st, res);
 }
Пример #21
0
  /** Creates new form PanelConfiguracionesSMS */
  public PanelConfiguracionesSMS() {
    initComponents();
    cbServicioSMS.addItemListener(
        new ItemListener() {

          @Override
          public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
              ((CardLayout) panel.getLayout()).show(panel, e.getItem().toString());
            }
          }
        });
    // Ahora cargamos el tipo de servicio
    String tipo = MaimonidesApp.getApplication().getConfiguracion().get("sms.servicio", "mail");
    if (tipo.equals("mail")) {
      cbServicioSMS.setSelectedIndex(0);
    } else if (tipo.equals("smsGestion")) {
      cbServicioSMS.setSelectedIndex(1);
    }
  }
  @Override
  protected Object doInBackground() throws Exception {
    if (fichero == null) {
      // Entonces importamos los datos desde séneca
      setMessage("Descargando fichero de Séneca...");
      cli.addPropertyChangeListener(
          new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
              firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
            }
          });
      fichero = cli.getArchivoGeneradoresDeHorarios();
    }
    boolean ret = false;
    if (fichero.exists()) {
      // TODO Debería poder importarse los datos aunque estos ya existan...
      ImportadorDatosGeneralesSeneca importador =
          new ImportadorDatosGeneralesSeneca(
              MaimonidesApp.getApplication().getAnoEscolar(), fichero, this.tipo);
      importador.addPropertyChangeListener(
          new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
              firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
            }
          });

      ObjetoBDConCod.setSoloInsertar(soloNuevos);
      try {
        ret = importador.importarDatosGeneralesSeneca();
      } catch (Exception e) {
        throw e;
      } finally {
        ObjetoBDConCod.setSoloInsertar(false);
      }
    }
    return ret;
  }
Пример #23
0
 BorrarProfesorTask(org.jdesktop.application.Application app) {
   super(app);
   int[] filas = tabla.getSelectedRows();
   int op =
       JOptionPane.showConfirmDialog(
           MaimonidesApp.getApplication().getMainFrame(),
           "¿Esta seguro de que desea borrar los profesores seleccionados ("
               + filas.length
               + ")?",
           "Borrar",
           JOptionPane.YES_NO_OPTION,
           JOptionPane.QUESTION_MESSAGE);
   if (op == JOptionPane.YES_OPTION) {
     for (int i : filas) {
       int row = tabla.convertRowIndexToModel(i);
       Profesor p = modelo.getElemento(row);
       profs.add(p);
     }
     modelo.quitarDatos(profs);
   }
 }
  protected final void pedirUsuarioClave() {
    if (!GestorUsuarioClaveSeneca.getGestor().pedirUsuarioClave()) {
      cancel(false);
    } else {
      cli =
          new ClienteSeneca(
              GestorUsuarioClaveSeneca.getGestor().getUsuario(),
              GestorUsuarioClaveSeneca.getGestor().getClave());
      cli.setDebugMode(MaimonidesApp.isDebug());
      cli.addPropertyChangeListener(
          new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
              firePropertyChange(evt.getPropertyName(), evt.getOldValue(), evt.getNewValue());
              if ("error".equals(evt.getPropertyName())) {
                gen.getErrores().add(Str.noNulo(evt.getNewValue()));
              }
            }
          });
      gen.setClienteSeneca(cli);
    }
  }
Пример #25
0
 public static Expulsion getUltimaExpulsionPorFechaDeRegreso(Alumno alumno) {
   Expulsion e = null;
   PreparedStatement st = null;
   ResultSet res = null;
   String sql =
       "SELECT ADDDATE(fecha,dias) AS fechaEntrada ,e.* FROM expulsiones AS e WHERE e.alumno_id=? ORDER BY fechaEntrada DESC LIMIT 0,1";
   try {
     st =
         (PreparedStatement)
             MaimonidesApp.getApplication().getConector().getConexion().prepareStatement(sql);
     st.setInt(1, alumno.getId());
     res = st.executeQuery();
     if (res.next()) {
       e = new Expulsion();
       e.cargarDesdeResultSet(res);
     }
   } catch (Exception ex) {
     Logger.getLogger(Expulsion.class.getName()).log(Level.SEVERE, null, ex);
     e = null;
   }
   Obj.cerrar(st, res);
   return e;
 }
Пример #26
0
 public ArrayList<ParteConvivencia> getPartes() {
   if (partes == null) {
     partes = new ArrayList<ParteConvivencia>();
     PreparedStatement st = null;
     ResultSet res = null;
     try {
       st =
           (PreparedStatement)
               MaimonidesApp.getConexion()
                   .prepareStatement("SELECT * FROM conv_partes WHERE expulsion_id=?");
       st.setInt(1, getId());
       res = st.executeQuery();
       while (res.next()) {
         ParteConvivencia parte = new ParteConvivencia();
         parte.cargarDesdeResultSet(res);
         partes.add(parte);
       }
     } catch (Exception ex) {
       Logger.getLogger(Expulsion.class.getName()).log(Level.SEVERE, null, ex);
     }
     Obj.cerrar(st, res);
   }
   return partes;
 }
 // TODO Implementar el envío directo a Séneca
 public File exportarHorariosXMLSeneca() throws IOException {
   File ficheroXml = null;
   // Primero precargamos los profesores, unidades, etc
   firePropertyChange("message", null, "Precargando datos de profesores...");
   Profesor.getProfesores();
   firePropertyChange("message", null, "Precargando datos de unidades...");
   Unidad.getUnidades();
   firePropertyChange("message", null, "Precargando datos de dependencias...");
   Dependencia.getDependencias();
   firePropertyChange("message", null, "Precargando datos de tramos horarios...");
   TramoHorario.getTramosHorarios();
   firePropertyChange("message", null, "Precargando datos de materias...");
   Materia.getMaterias();
   firePropertyChange("message", null, "Precargando datos de actividades...");
   Actividad.getActividades();
   firePropertyChange("message", null, "Precargando datos de unidades...");
   Unidad.getUnidades();
   firePropertyChange("message", null, "Precargando datos de cursos...");
   Curso.getCursos();
   int contadorProfesores = 1;
   int contadorActividad = 1;
   // Ahora cargamos todos los horarios del año escolar
   PreparedStatement st = null;
   ResultSet res = null;
   try {
     firePropertyChange("message", null, "Procesando horarios...");
     st =
         (PreparedStatement)
             MaimonidesApp.getConexion()
                 .prepareStatement("SELECT * FROM horarios_ WHERE ano=? ORDER BY profesor_id ");
     st.setInt(1, MaimonidesApp.getApplication().getAnoEscolar().getId());
     res = st.executeQuery();
     int ultimoProfesor = -1;
     ArrayList<String> bloquesProfesores = new ArrayList<String>();
     ArrayList<String> bloquesActividad = new ArrayList<String>();
     while (res.next()) {
       try {
         int idProfesor = res.getInt("profesor_id");
         int dia = res.getInt("dia");
         int idMateria = res.getInt("materia_id");
         int idActividad = res.getInt("actividad_id");
         int idUnidad = res.getInt("unidad_id");
         int idDependencia = res.getInt("aula_id");
         Dependencia dependencia = null;
         if (idDependencia > 0) {
           try {
             dependencia = Dependencia.getDependencia(idDependencia);
           } catch (Exception ex) {
             Logger.getLogger(ExportadorHorariosSeneca.class.getName())
                 .log(Level.SEVERE, "No existe la dependencia " + idDependencia + ".", ex);
           }
         }
         TramoHorario tramo = TramoHorario.getTramoHorario(res.getInt("tramo_id"));
         Materia materia = null;
         Actividad actividad = Actividad.getActividad(idActividad);
         Unidad unidad = Unidad.getUnidad(idUnidad);
         Curso curso = Curso.getCurso(unidad.getIdCurso());
         if (idMateria > 0) {
           materia = Materia.getMateria(idMateria);
         }
         if (idProfesor != ultimoProfesor) {
           // Si cambiamos de profesor tenemos que crear un nuevo registro
           // si el profesor anterior no era -1
           if (ultimoProfesor != -1) {
             String bloqueProfesor =
                 getBloqueProfesor(contadorProfesores, idProfesor, bloquesActividad);
             if (bloqueProfesor != null) {
               bloquesProfesores.add(bloqueProfesor);
               contadorProfesores++;
             }
             bloquesActividad.clear();
             contadorActividad = 1;
           }
         }
         ultimoProfesor = idProfesor;
         // Añadimos el bloque de actividades
         bloquesActividad.add(
             getXMLBloqueHorario(
                 MaimonidesApp.getApplication().getAnoEscolar(),
                 contadorActividad,
                 dia,
                 tramo,
                 dependencia,
                 curso,
                 unidad,
                 actividad,
                 materia));
         contadorActividad++;
       } catch (Exception e) {
         Logger.getLogger(ExportadorHorariosSeneca.class.getName())
             .log(Level.SEVERE, "Ha habido un error procesando el horario.", e);
       }
     }
     // Añadimos el último profesor
     if (ultimoProfesor != -1) {
       String bloqueProfesor =
           getBloqueProfesor(contadorProfesores, ultimoProfesor, bloquesActividad);
       if (bloqueProfesor != null) {
         bloquesProfesores.add(bloqueProfesor);
       }
     }
     // Ahora generamos el resto del documento
     GregorianCalendar fecha = new GregorianCalendar();
     StringBuilder xml = new StringBuilder();
     xml.append(
         String.format(
             "<SERVICIO modulo=\"HORARIOS\" tipo=\"I\" autor=\"Maimonides %s\" fecha=\"%2$tm/%2$td/%2$tY %tT\">\n",
             Mantenimiento.getAplicationVersion(), fecha, fecha));
     xml.append("<BLOQUE_DATOS>\n");
     xml.append(
         String.format(
             "\t<grupo_datos seq=\"ANNO_ACADEMICO\">\n\t\t<dato nombre_dato=\"C_ANNO\">%d</dato>\n\t</grupo_datos>\n",
             MaimonidesApp.getApplication().getAnoEscolar().getAno()));
     xml.append(
         String.format(
             "\t<grupo_datos seq=\"HORARIOS_REGULARES\" registros=\"%d\">\n",
             bloquesProfesores.size()));
     xml.append(Str.implode(bloquesProfesores, ""));
     xml.append("\t</grupo_datos>\n");
     xml.append("</BLOQUE_DATOS>\n");
     xml.append("</SERVICIO>\n");
     // Ahora guardamos el contenido en el fichero
     ficheroXml = File.createTempFile("horarios_seneca", ".xml");
     Archivo.setContenido(xml.toString(), "ISO-8859-1", ficheroXml, false);
   } catch (SQLException ex) {
     Logger.getLogger(ExportadorHorariosSeneca.class.getName())
         .log(Level.SEVERE, "Error recuperando listado de horarios.", ex);
   }
   Obj.cerrar(st, res);
   return ficheroXml;
 }
Пример #28
0
 public ArrayList<String> exportarFaltas(
     GregorianCalendar fechaDesde, GregorianCalendar fechaHasta, ArrayList<String> cursos) {
   ArrayList<String> err = new ArrayList<String>();
   setFaltasExportadas(false);
   String texto = "Procesando... ";
   if (Fechas.getDiferenciaTiempoEn(fechaDesde, fechaHasta, GregorianCalendar.DATE) == 0) {
     texto += Fechas.format(fechaHasta, "dd/MM");
   } else {
     texto += Fechas.format(fechaDesde, "dd/MM") + " a " + Fechas.format(fechaHasta, "dd/MM");
   }
   PreparedStatement st = null;
   try {
     firePropertyChange("message", null, "Recuperando datos...");
     StringBuilder sbCursos = new StringBuilder();
     boolean primero = true;
     for (String c : cursos) {
       if (primero) {
         primero = false;
       } else {
         sbCursos.append(",");
       }
       sbCursos.append("\"").append(c).append("\"");
     }
     String sql =
         "SELECT p.id as idParte,p.fecha,t.cod AS codTramo,pa.asistencia,a.id AS idAlumno FROM partes_alumnos AS pa "
             + " JOIN partes AS p ON p.id=pa.parte_id "
             + " JOIN alumnos AS a ON a.id=pa.alumno_id "
             + " LEFT JOIN alumnos_problemas_envio AS ap ON a.id=ap.alumno_id "
             + " JOIN horarios AS h ON h.id=pa.horario_id "
             + " LEFT JOIN calendario_escolar AS ce ON ce.ano=p.ano AND p.fecha=ce.dia AND ce.docentes "
             + // TODO Esta linea elimina a caso hecho a los alumnos "MIXTOS" ya que séneca da un
               // error con ellos.
             " JOIN unidades AS u ON a.unidad_id=u.id AND a.curso_id=u.curso_id "
             + " JOIN tramos AS t ON t.id=h.tramo_id "
             + // Sólo hay que recuperar las que sean de actividad doncencia de alumnos con código
               // de faltas y que no están borrados, y que no son festivos
             " WHERE ce.id IS NULL AND (ap.id IS NULL || ap.excluir=0 ) AND h.actividad_id="
             + Actividad.getIdActividadDocencia(MaimonidesApp.getApplication().getAnoEscolar())
             + " AND a.borrado=0 AND a.codFaltas!='' AND p.fecha BETWEEN ? AND ? AND p.curso IN ("
             + sbCursos.toString()
             + ") AND pa.asistencia > "
             + ParteFaltas.FALTA_ASISTENCIA
             + " AND p.ano=? ORDER BY a.curso_id,a.unidad_id,idAlumno,p.fecha,asistencia,t.hora";
     System.out.println(sql);
     PreparedStatement actuParte =
         (PreparedStatement)
             MaimonidesApp.getApplication()
                 .getConector()
                 .getConexion()
                 .prepareStatement(
                     "UPDATE partes SET enviado=1, justificado=1 WHERE fecha BETWEEN ? AND ? AND curso IN ("
                         + sbCursos.toString()
                         + ") AND ano=?  ");
     st =
         (PreparedStatement)
             MaimonidesApp.getApplication().getConector().getConexion().prepareStatement(sql);
     st.setDate(1, new java.sql.Date(fechaDesde.getTime().getTime()));
     st.setDate(2, new java.sql.Date(fechaHasta.getTime().getTime()));
     st.setInt(3, MaimonidesApp.getApplication().getAnoEscolar().getId());
     actuParte.setDate(1, new java.sql.Date(fechaDesde.getTime().getTime()));
     actuParte.setDate(2, new java.sql.Date(fechaHasta.getTime().getTime()));
     actuParte.setInt(3, MaimonidesApp.getApplication().getAnoEscolar().getId());
     ResultSet res = st.executeQuery();
     Curso ultimoCurso = null;
     Unidad ultimaUnidad = null;
     Alumno ultimoAlumno = null;
     Element nCursos = getDocumento().createElement("CURSOS");
     Element nCurso = null;
     Element nUnidades = null;
     Element nUnidad = null;
     Element nAlumnos = null;
     Element nAlumno = null;
     Element nFaltas = null;
     while (res.next() && !isCancelado()) {
       setFaltasExportadas(true);
       GregorianCalendar fecha = Fechas.toGregorianCalendar(res.getDate("fecha"));
       // firePropertyChange("message", null, "Procesando asistencia ...");
       // int idParte = res.getInt("idParte");
       int tramo = res.getInt("codTramo");
       int asistencia = res.getInt("asistencia");
       int idAlumno = res.getInt("idAlumno");
       Alumno a = Alumno.getAlumno(idAlumno);
       Curso c = Curso.getCurso(a.getIdCurso());
       Unidad u = a.getUnidad();
       firePropertyChange("message", null, texto + " " + u + " " + a + "...");
       if (ultimoCurso == null || !ultimoCurso.equals(c)) {
         nCurso = getDocumento().createElement("CURSO");
         nCursos.appendChild(nCurso);
         // Creamos la linea <X_OFERTAMATRIG>2063</X_OFERTAMATRIG>
         nCurso.appendChild(crearTag("X_OFERTAMATRIG", c.getCodigo()));
         // Creamos la linea <D_OFERTAMATRIG>1º de Bachillerato (Humanidades y Ciencias
         // Sociales)</D_OFERTAMATRIG>
         nCurso.appendChild(crearTag("D_OFERTAMATRIG", c.getDescripcion()));
         // Ahora creamos el comienzo de la unidad
         nUnidades = getDocumento().createElement("UNIDADES");
         nCurso.appendChild(nUnidades);
       }
       if (ultimaUnidad == null || !ultimaUnidad.equals(u)) {
         // Creamos una nueva unidad
         nUnidad = getDocumento().createElement("UNIDAD");
         nUnidades.appendChild(nUnidad);
         // Creamos la linea <X_UNIDAD>601648</X_UNIDAD>
         nUnidad.appendChild(crearTag("X_UNIDAD", u.getCodigo()));
         // Creamos la linea <T_NOMBRE>1BTO-A</T_NOMBRE>
         nUnidad.appendChild(crearTag("T_NOMBRE", u.getCursoGrupo()));
         // Ahora creamos el comienzo de la unidad
         nAlumnos = getDocumento().createElement("ALUMNOS");
         nUnidad.appendChild(nAlumnos);
       }
       if (ultimoAlumno == null || !ultimoAlumno.equals(a)) {
         nAlumno = getDocumento().createElement("ALUMNO");
         nAlumno.appendChild(crearTag("X_MATRICULA", a.getCodFaltas()));
         // Y Creamos el inicio para las faltas de asistencia de este alumno
         nFaltas = getDocumento().createElement("FALTAS_ASISTENCIA");
         nAlumno.appendChild(nFaltas);
         nAlumnos.appendChild(nAlumno);
       }
       addFalta(fecha, tramo, asistencia, nFaltas);
       ultimoCurso = c;
       ultimaUnidad = u;
       ultimoAlumno = a;
     }
     if (isFaltasExportadas() && !isCancelado()) {
       firePropertyChange("message", null, "Generando fichero...");
       generarCabeceraFaltas(fechaDesde, fechaHasta, nCursos);
       File f = generarFicheroFaltas(fechaDesde, fechaHasta, cursos);
       if (isEnviarASeneca()) {
         firePropertyChange("message", null, "Enviando fichero a Séneca...");
         String nombre = f.getName().substring(0, f.getName().length() - 4);
         String codigoOperacion = Cripto.md5(nombre + "" + Math.random());
         int ret = enviarFichero(f, codigoOperacion);
         if (ret == GestorEnvioFaltas.RET_OK) {
           firePropertyChange(
               "message", null, "Fichero enviado correctamente. Marcando faltas como enviadas...");
           actuParte.executeUpdate();
           File enviados = new File(f.getParent(), "enviados");
           enviados.mkdirs();
           f.renameTo(new File(enviados, f.getName()));
           firePropertyChange("message", null, "Envío de faltas terminado.");
         } else {
           if (ret == GestorEnvioFaltas.RET_ERROR_PROCESANDO) {
             firePropertyChange(
                 "message", null, "Séneca ha dado errores procesando el fichero enviado.");
             File nuevo =
                 new File(getCarpetaFallidos(), nombre + "-ID" + codigoOperacion + ".xml");
             f.renameTo(nuevo);
             // Creamos el fichero de propiedades del nuevo
             File info = new File(nuevo.getParentFile(), nuevo.getName() + ".info");
             Properties p = new Properties();
             p.setProperty("desde", fechaDesde.getTimeInMillis() + "");
             p.setProperty("hasta", fechaHasta.getTimeInMillis() + "");
             p.setProperty("cursos", Str.implode(cursos, ","));
             p.setProperty("archivo", nuevo.getAbsolutePath());
             p.setProperty("codigo", codigoOperacion);
             p.setProperty("error", getClienteSeneca().getUltimoError());
             FileOutputStream fos = new FileOutputStream(info);
             p.store(fos, "Error enviando fichero de faltas");
             Obj.cerrar(fos);
             err.add(
                 "<html>Séneca ha dado errores procesando el fichero enviado:<br/> "
                     + nombre
                     + ".<br/><br/>");
             if (!getClienteSeneca().getUltimoError().equals("")) {
               err.add(getClienteSeneca().getUltimoError());
             }
           } else {
             firePropertyChange("message", null, "No se ha podido enviar el fichero a Séneca.");
             f.delete();
             err.add("<html>No se ha podido enviar el fichero:<br/> " + nombre + ".<br/><br/>");
             if (!getClienteSeneca().getUltimoError().equals("")) {
               err.add(getClienteSeneca().getUltimoError());
             }
           }
           // Si no se está loggeado cancelamos el proceso
           if (!getClienteSeneca().isLoggeado()) {
             setCancelado(true);
           }
         }
       } else {
         firePropertyChange("message", null, "Marcando faltas como enviadas...");
         actuParte.executeUpdate();
       }
     }
     Obj.cerrar(actuParte, st, res);
   } catch (Exception ex) {
     Logger.getLogger(GeneradorFicherosSeneca.class.getName()).log(Level.SEVERE, null, ex);
   }
   return err;
 }
Пример #29
0
  public static JFrame mostrarImagen(Image imagen) {
    // img.getGraphics().drawRect(0, 0, img.getWidth(null), img.getHeight(null));
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gs = ge.getDefaultScreenDevice();
    GraphicsConfiguration gc = gs.getDefaultConfiguration();
    BufferedImage tmpImg = null;
    if (imagen instanceof BufferedImage) {
      tmpImg = (BufferedImage) imagen;
    } else {
      tmpImg =
          gc.createCompatibleImage(
              imagen.getWidth(null), imagen.getHeight(null), Transparency.OPAQUE);
      Graphics g = tmpImg.createGraphics();
      // Paint the image onto the buffered image
      g.drawImage(imagen, 0, 0, null);
      g.setColor(Color.red);
      g.drawRect(0, 0, tmpImg.getWidth(null), tmpImg.getHeight(null));
      g.dispose();
    }
    final BufferedImage bimage = tmpImg;

    JFrame m = new JFrame();
    JScrollPane scroll = new JScrollPane();
    m.add(scroll, BorderLayout.CENTER);
    JLabel l = new JLabel();
    l.setIcon(new ImageIcon(bimage));
    final JLabel lStatus = new JLabel();
    m.add(lStatus, BorderLayout.SOUTH);

    scroll.getViewport().add(l);
    JButton b = new JButton("Imprimir");
    m.add(b, BorderLayout.NORTH);
    b.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            PrinterJob job = PrinterJob.getPrinterJob();
            job.setPrintable(
                new Printable() {

                  @Override
                  public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
                      throws PrinterException {
                    if (pageIndex > 0) {
                      return NO_SUCH_PAGE;
                    }
                    Graphics2D g2d = (Graphics2D) graphics;
                    g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
                    try {
                      g2d.drawImage(
                          Img.getImagenEscalada(
                              bimage,
                              new Dimension(
                                  (int) pageFormat.getImageableWidth(),
                                  (int) pageFormat.getImageableHeight())),
                          0,
                          0,
                          null);

                    } catch (Exception e) {
                      System.out.println(e.toString());
                    }
                    return PAGE_EXISTS;
                  }
                });
            boolean ok = job.printDialog();
            if (ok) {
              try {
                job.print();
              } catch (PrinterException ex) {
                ex.printStackTrace();
              }
            }
          }
        });
    m.setSize(800, 600);
    if (MaimonidesApp.getApplication() != null) {
      m.setIconImage(MaimonidesApp.getApplication().getMainFrame().getIconImage());
      GUI.centrar(MaimonidesApp.getApplication().getMainFrame(), m);
    }
    m.setVisible(true);
    return m;
  }
  public ImportarDatosBaseSenecaTask(org.jdesktop.application.Application app, int tipo) {
    super(app);
    this.tipo = tipo;
    setUserCanCancel(false);
    String sImp = "los datos generales del año escolar.<br/>";
    if (!ImportadorDatosGeneralesSeneca.isImportar(tipo, ImportadorDatosGeneralesSeneca.TODO)) {
      sImp = ":<br/>";
      if (ImportadorDatosGeneralesSeneca.isImportar(
          tipo, ImportadorDatosGeneralesSeneca.ACTIVIDADES)) {
        sImp += " - Actividades.<br/>";
      }
      if (ImportadorDatosGeneralesSeneca.isImportar(
          tipo, ImportadorDatosGeneralesSeneca.PROFESORES)) {
        sImp += " - Profesores.<br/>";
      }
      if (ImportadorDatosGeneralesSeneca.isImportar(
          tipo, ImportadorDatosGeneralesSeneca.DEPENDENCIAS)) {
        sImp += " - Dependencias.<br/>";
      }
      if (ImportadorDatosGeneralesSeneca.isImportar(
          tipo, ImportadorDatosGeneralesSeneca.MATERIAS)) {
        sImp += " - Materias.<br/>";
      }
      if (ImportadorDatosGeneralesSeneca.isImportar(tipo, ImportadorDatosGeneralesSeneca.TRAMOS)) {
        sImp += " - Tramos horarios.<br/>";
      }
      if (ImportadorDatosGeneralesSeneca.isImportar(
          tipo, ImportadorDatosGeneralesSeneca.UNIDADES)) {
        sImp += " - Unidades.<br/>";
      }
      if (ImportadorDatosGeneralesSeneca.isImportar(tipo, ImportadorDatosGeneralesSeneca.CURSOS)) {
        sImp += " - Cursos.<br/>";
      }
    }
    sImp = "<html><body>Se van a importar " + sImp + "<br/></body></html>";
    String s2 =
        "<html><body><br/>Puede importar estos datos desde un fichero descargado de Séneca o<br/>dejar que Maimónides lo descargue automáticamente.<br/>¿Desde donde quiere importar los datos?</body></html>";
    JLabel l = new JLabel(sImp);
    JLabel l2 = new JLabel(s2);
    JCheckBox cb = new JCheckBox("Sólo importar datos nuevos. No actualizar datos existentes.");
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(l, BorderLayout.NORTH);
    panel.add(cb, BorderLayout.CENTER);
    panel.add(l2, BorderLayout.SOUTH);

    int op =
        JOptionPane.showOptionDialog(
            MaimonidesApp.getApplication().getMainFrame(),
            panel,
            "Importación de datos generales",
            JOptionPane.YES_NO_CANCEL_OPTION,
            JOptionPane.INFORMATION_MESSAGE,
            null,
            new String[] {"Desde Séneca", "Desde fichero", "Cancelar"},
            "Desde Séneca");
    soloNuevos = cb.isSelected();
    if (op == JOptionPane.YES_OPTION) {
      // Tenemos que pedir los datos de acceso a séneca
      if (!GestorUsuarioClaveSeneca.getGestor().pedirUsuarioClave()) {
        cancel(false);
      } else {
        cli =
            new ClienteSeneca(
                GestorUsuarioClaveSeneca.getGestor().getUsuario(),
                GestorUsuarioClaveSeneca.getGestor().getClave());
        cli.setDebugMode(MaimonidesApp.isDebug());
      }
    } else if (op == JOptionPane.NO_OPTION) {
      // Tenemos que pedir el fichero
      JFileChooser f = new JFileChooser(MaimonidesApp.getApplication().getUltimoArchivo());
      f.setFileSelectionMode(JFileChooser.FILES_ONLY);
      f.setFileFilter(
          new FileFilter() {

            @Override
            public boolean accept(File f) {
              return f.isDirectory() || f.getName().toLowerCase().endsWith(".xml");
            }

            @Override
            public String getDescription() {
              return "Archivos XML de Séneca(*.xml)";
            }
          });
      int res = f.showOpenDialog(MaimonidesApp.getMaimonidesView().getFrame());
      if (res != JFileChooser.APPROVE_OPTION) {
        cancel(false);
      } else {
        fichero = f.getSelectedFile();
        MaimonidesApp.getApplication().setUltimoArchivo(fichero);
      }
    } else {
      setMessage("Importación cancelada.");
      cancel(false);
    }
  }