Package practica1

Examples of practica1.Practica1$EscuchadorVentana


     * @param int tamanioPoblacion
     */
    public void setTamanioPoblacion(int tamanioPoblacion) {
        this.tamanioPoblacion = tamanioPoblacion;
       
        fireModeloPoblacionPropertyChange(new
                        PoblacionPropertyEvent(this,
                        CHANGE_TAMANIO_POBLACION));
    }
View Full Code Here


     * @param int temperatura
     */
    public void setTemperatura(int temperatura) {
        this.temperatura = temperatura;
       
        fireModeloPoblacionPropertyChange(new
                        PoblacionPropertyEvent(this,
                        CHANGE_TEMPERATURA));
    }
View Full Code Here

     * @param String escalaTemperatura
     */
    public void setEscalaTemperatura(String escalaTemperatura) {
        this.escalaTemperatura = escalaTemperatura;
       
        fireModeloPoblacionPropertyChange(new
                        PoblacionPropertyEvent(this,
                        CHANGE_ESCALA_TEMPERATURA));
    }
View Full Code Here

     * @param String luminosidad
     */
    public void setLuminosidad(String luminosidad) {
        this.luminosidad = luminosidad;
       
        fireModeloPoblacionPropertyChange(new
                        PoblacionPropertyEvent(this,
                        CHANGE_LUMINOSIDAD));
    }
View Full Code Here

                modeloGraficaChange();
            }
           
        });
       
        fireModeloPoblacionPropertyChange(new
                        PoblacionPropertyEvent(this,
                        CHANGE_MODELO_GRAFICA));
    }
View Full Code Here

            public void tableChanged(TableModelEvent e) {
                modeloPoblacionChange();
            }
         });
       
        fireModeloPoblacionPropertyChange(new
                        PoblacionPropertyEvent(this,
                        CHANGE_MODELO_POBLACION_GRAFICA));
    }
View Full Code Here

            public void removedComentario(ComentarioEvent ce) {
                modeloComentarioChange();
            }           
        });
       
        fireModeloPoblacionPropertyChange(new
                        PoblacionPropertyEvent(this,
                        CHANGE_MODELO_COMENTARIOS));
    }
View Full Code Here

     * @param nombrePoblacion Nombre de la población
     * @param experimentoPadre Experimento lógico que lo contiene
     */
    public LogicPoblacion(String nombrePoblacion, LogicExperimento experimentoPadre) {
        super(nombrePoblacion);
        super.addPropertyChangeListener(new PoblacionPropertyListener() {

            @Override
            public void propertyChange(PoblacionPropertyEvent propertyChange) {
                firePoblacionChange();
            }
View Full Code Here

     * Cuando sucede la acción nos encargamos de imprimir el experimento principal
     * @param e ActionEvent Evento producido
     */
    @Override
    public void actionPerformed(ActionEvent e) {
        LogicExperimento exp = Controller.getInstance().
                getExperimentoPrincipal();
       
        if(exp != null) {
            try {
                ImprimirExperimento.imprimir(exp);
View Full Code Here

       
        //Construimos el DOM con las preferencias
        DocumentBuilderFactory dbFactory;
        DocumentBuilder docBuilder;
       
        LogicExperimento experimento = null;
       
        try
        {
            dbFactory = DocumentBuilderFactory.newInstance();
            docBuilder = dbFactory.newDocumentBuilder();
           
            if(fichExperimento.exists()) {
                xmlDoc  = docBuilder.parse(fichExperimento);
                elementoCabecera = xmlDoc.getDocumentElement();
            } else {
                Practica1.log.error("Abrir, no existe el experimento");
                throw new ExperimentoInvalidoException(
                        Language.getI().getP("NO_EXISTE_EXPERIMENTO"));
            }
           
            //Buscamos las propiedades del experimento
            NodeList lstPropiedades = elementoCabecera.
                    getElementsByTagName("propiedades-experimento");
           
           
            boolean propiedadesCorrecto = false;
            if(lstPropiedades.getLength() == 1) {
                Node nodePropiedades = lstPropiedades.item(0);
               
                //Obtenemos las propiedades del experimento
                NodeList lstValores = nodePropiedades.getChildNodes();
               
                //Recorremos las propiedades
                for(int i=0; i<lstValores.getLength(); i++) {
                    Node nodoPropExp = lstValores.item(i);
                    if(nodoPropExp.getNodeType() == Node.ELEMENT_NODE) {
                      
                        String nProp = nodoPropExp.getNodeName();

                        //Comprobamos en orden que se cumplen las propiedades esperadas
                        switch(i) {
                            case 1: //Nombre experimento
                                if(nProp.equals("nombre-experimento")) {
                                    nombreExperimento = nodoPropExp.
                                            getTextContent();
                                } else {
                                    Practica1.log.error("Abrir, nombre experimento inválido");
                                    throw new ExperimentoInvalidoException(
                                        Language.getI().getP("FICHERO_INVALIDO"));
                                }
                                break;
                            case 3:
                                if(nProp.equals("tipo-bacteria")) {
                                    tipoBacteria = nodoPropExp.
                                            getTextContent();
                                } else {
                                    Practica1.log.error("Abrir, tipo bacteria inválido");
                                    throw new ExperimentoInvalidoException(
                                        Language.getI().getP("FICHERO_INVALIDO"));
                                }
                                break;
                            case 5:
                                if(nProp.equals("nombre-investigador")) {
                                    nombreInvestigador = nodoPropExp.
                                            getTextContent();
                                } else {
                                    Practica1.log.error("Abrir, nombre investigador inválido");
                                    throw new ExperimentoInvalidoException(
                                        Language.getI().getP("FICHERO_INVALIDO"));
                                }
                                break;
                            case 7:
                                if(nProp.equals("proyecto-investigacion")) {
                                    proyectoInvestigacion = nodoPropExp.
                                            getTextContent();
                                   
                                    propiedadesCorrecto = true;
                                } else {
                                    Practica1.log.error("Abrir, proyecto investigación inválido");
                                    throw new ExperimentoInvalidoException(
                                        Language.getI().getP("FICHERO_INVALIDO"));
                                }
                                break;
                        }
                    }
                }
            } else {
                Practica1.log.error("Abrir, fichero inválido");
                throw new ExperimentoInvalidoException(
                        Language.getI().getP("FICHERO_INVALIDO"));
            }
           
            if(!propiedadesCorrecto) {
                throw new ExperimentoInvalidoException(
                        Language.getI().getP("FICHERO_INVALIDO"));
            }
           
            //Creamos el modelo del experimento
            experimento = new LogicExperimento(fichExperimento,
                    nombreExperimento, tipoBacteria, nombreInvestigador,
                    proyectoInvestigacion);
           
            //Buscamos las poblaciones del experimento
            NodeList lstPoblaciones = elementoCabecera.
                    getElementsByTagName("poblacion");
           
            //Recorremos las poblaciones y las analizamos
            for(int i=0; i<lstPoblaciones.getLength(); i++) {
                if(lstPoblaciones.item(i).getNodeType() == Node.ELEMENT_NODE) {
                    cargarPoblacion(experimento, lstPoblaciones.item(i));
                }
            }
        }
        catch (Exception ex)
        {
            Practica1.log.error(Language.getI().getP("ERROR"), ex);
            throw new ExperimentoInvalidoException(ex);
        }

        xmlDoc = null;
        elementoCabecera= null;
        experimento.setModified(false);
        return experimento;

    }
View Full Code Here

TOP

Related Classes of practica1.Practica1$EscuchadorVentana

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.