Package com.vgo.movie.domain

Examples of com.vgo.movie.domain.Movie


    jLabelInfoNumeroMedia.setText(Libelle.getLibelle("dernierNumeroMedia", dernierNumMedia.toString()));
  }   

  private void jButtonAjouterActionPerformed(ActionEvent evt) {
    /*Ajout d'un film dans la base de donn�es*/
    Movie tmpMovie = new Movie();
    boolean controlOk=false;

    if(jTextNomFilm.getText().trim().equals("")){
      JOptionPane.showOptionDialog(
          SwingUtilities.getWindowAncestor(this),
          Libelle.getLibelle("erreurNomFilmVide") ,
          Libelle.getLibelle("erreur"),
          JOptionPane.DEFAULT_OPTION,
          JOptionPane.ERROR_MESSAGE,
          null,
          null,
          null)
    }
    else{
      tmpMovie.setNom(jTextNomFilm.getText());
      tmpMovie.setType((String)jComboBoxTypeMedia.getSelectedItem());
      tmpMovie.setLangue((String)jComboBoxLangue.getSelectedItem());
      tmpMovie.setCompression((String)jComboBoxCompression.getSelectedItem());
      tmpMovie.setQualite((String)jComboBoxQualite.getSelectedItem());

      try {
        if(jTextNumeroMedia.getText().trim().equals("")){
          //Dans ce cas on ajoute sur un nouveau m�dia
          tmpMovie.setIdMedia(dernierNumMedia+1);
          controlOk = true;
        }
        else{
          Integer tmpNumMedia = new Integer(jTextNumeroMedia.getText().trim());
          if(tmpNumMedia > dernierNumMedia ){
            JOptionPane.showOptionDialog(
                SwingUtilities.getWindowAncestor(this),
                Libelle.getLibelle("dernierNumeroMedia",dernierNumMedia.toString()),
                Libelle.getLibelle("erreur"),
                JOptionPane.DEFAULT_OPTION,
                JOptionPane.ERROR_MESSAGE,
                null,
                null,
                null);         
          }
          else{
            tmpMovie.setIdMedia(tmpNumMedia);
            controlOk = true;
          }
        }
      } catch (NumberFormatException e) {
        JOptionPane.showOptionDialog(
            SwingUtilities.getWindowAncestor(this),
            Libelle.getLibelle("erreurNumMediaNonEntier"),
            Libelle.getLibelle("erreur"),
            JOptionPane.DEFAULT_OPTION,
            JOptionPane.ERROR_MESSAGE,
            null,
            null,
            null);
      }     
    }



    /*A ce stade le film peut �tre ajout�*/
    if(controlOk){
      try {
        DatabaseDAO.insertMovie(tmpMovie);
        JOptionPane.showOptionDialog(
            SwingUtilities.getWindowAncestor(this),
            Libelle.getLibelle("insertionFilmOk",tmpMovie.getNom()),
            "Insertion r�ussie",
            JOptionPane.DEFAULT_OPTION,
            JOptionPane.INFORMATION_MESSAGE,
            null,
            null,
            null);
      } catch (SQLException e) {
        JOptionPane.showOptionDialog(
            SwingUtilities.getWindowAncestor(this),
            Libelle.getLibelle("erreurInsertionFilms"),
            Libelle.getLibelle("erreur"),
            JOptionPane.DEFAULT_OPTION,
            JOptionPane.ERROR_MESSAGE,
            null,
            null,
            null);
      }
      recupDernierNumMedia();
      jTextNumeroMedia.setText(dernierNumMedia.toString());
      jTextNomFilm.setText("");
      try {
        tmpMovie = (Movie)DatabaseDAO.recupDernierFilm();
        Object[] data = {new Integer(tmpMovie.getId()),
            tmpMovie.getNom(),
            tmpMovie.getType(),
            new Integer(tmpMovie.getIdMedia()),
            tmpMovie.getStatut(),
            tmpMovie.getLangue(),
            tmpMovie.getCompression(),
            tmpMovie.getQualite()};
        localParent.getListFilmModel().addRow(data);
       
      } catch (SQLException e) {
        JOptionPane.showOptionDialog(
            SwingUtilities.getWindowAncestor(this),
View Full Code Here


        localParent.getListFilmModel().fireTableRowsDeleted(i, i);
        localParent.getListFilmModel().removeRow(i);     
      }         

      //On appelle la liste dans la BDD
      Movie tmpMovie = new Movie();
      tmpMovie.setNom('%' + localParent.getJRechercherNom().getText() + '%');
      tmpMovie.setType((String)localParent.getJComboBoxTypeMedia().getSelectedItem());
      try{
        tmpMovie.setIdMedia(new Integer(localParent.getJRechercherNumero().getText()));
      }
      catch (NumberFormatException nex){
        tmpMovie.setIdMedia(0);
      }
     
      tmpMovie.setLangue((String)localParent.getJComboBoxLangue().getSelectedItem());
      tmpMovie.setQualite((String)localParent.getJComboBoxQualite().getSelectedItem());
      tmpMovie.setStatut((String)localParent.getJComboBoxStatut().getSelectedItem());
      tmpMovie.setCompression((String)localParent.getJComboBoxCompression().getSelectedItem());
      List tmpList = DatabaseDAO.selectAllMovies(tmpMovie);

      //On initialize la progress bar     
      localParent.getJProgressBar().setMinimum(0);
      localParent.getJProgressBar().setValue(0);
      localParent.getJProgressBar().setMaximum(tmpList.size());

      //On rempli la table avec les films
      Iterator tmpIterator = tmpList.listIterator();
      int compteur = 0;
      while(tmpIterator.hasNext()){
        tmpMovie = (Movie)tmpIterator.next();
        Object[] data = {new Integer(tmpMovie.getId()),
            tmpMovie.getNom(),
            tmpMovie.getType(),
            new Integer(tmpMovie.getIdMedia()),
            tmpMovie.getStatut(),
            tmpMovie.getLangue(),
            tmpMovie.getCompression(),
            tmpMovie.getQualite()};
        localParent.getListFilmModel().addRow(data);
        compteur++;
        localParent.getJProgressBar().setValue(compteur);
      }       
     
View Full Code Here

      //principe : enlever le "." et "_" dans le nom
      //d�tecter les cat�gories avec ce qui existe en base
      //enlever ce qui est d�tect� du nom du film
      //proposer le reste comme nom de film       
      for (String film : listeFichier) {
        Movie tmpMovie = new Movie();     
        film = film.replaceAll("_", " ");
        film = film.replaceAll("\\.", " ");

        //Cr�ation d'un film avec init du type de m�dia, du num�ro et du statut
        tmpMovie.setType(typeMedia);
        tmpMovie.setIdMedia(dernierNumMedia+1);
        tmpMovie.setStatut("");
        //Puis on initialise � vide les autres
        tmpMovie.setCompression("");
        tmpMovie.setLangue("");
        tmpMovie.setQualite("");
        //Puis on met le nom du film tel qu'il est
        tmpMovie.setNom(film);
        //Maintenant passons � la d�tection de la compression
        tmpMovie = detectionCompression(tmpMovie);
        //Idem pour la langue
        tmpMovie = detectionLangue(tmpMovie);
        //Et finalement la qualit�
        tmpMovie = detectionQualite(tmpMovie);
        //Puis on nettoie le nom du film en enlevant les doubles espaces g�n�r�s
        while (tmpMovie.getNom().indexOf("  ") != -1){
          tmpMovie.setNom(tmpMovie.getNom().replaceAll("  ", " "));
        }

        //Proposition du film dans la fen�tre
        localParent.getJTextNomFilm().setText(tmpMovie.getNom());
        localParent.getJTextFieldNumMedia().setText(new Integer(tmpMovie.getIdMedia()).toString());

        localParent.getJComboBoxTypeMedia().setSelectedItem(tmpMovie.getType());     
        if(!tmpMovie.getCompression().equals("")){
          localParent.getJComboBoxCompression().setSelectedItem(tmpMovie.getCompression());         
        }
        if(!tmpMovie.getLangue().equals("")){
          localParent.getJComboBoxLangue().setSelectedItem(tmpMovie.getLangue());         
        }
        if(!tmpMovie.getQualite().equals("")){
          localParent.getJComboBoxQualite().setSelectedItem(tmpMovie.getQualite());         
        }
        //Puis mise en attente de la validation
        localParent.setValidationEnCours(true);
        localParent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        while(localParent.isValidationEnCours()){
View Full Code Here

  public ListeFilmListener(Main parent) {
    localParent = parent;
  }

  public void tableChanged(TableModelEvent e) {
    Movie tmpMovie = new Movie();
   
    if(e.getType() == TableModelEvent.UPDATE){
      TableModel model = (TableModel)e.getSource();
      int row = e.getFirstRow();   
      tmpMovie.setId((Integer)(model.getValueAt(row, 0)));
      tmpMovie.setNom((String)(model.getValueAt(row, 1)));
      tmpMovie.setType((String)(model.getValueAt(row, 2)));
      tmpMovie.setIdMedia((Integer)model.getValueAt(row, 3));
      tmpMovie.setStatut((String)(model.getValueAt(row, 4)));
      tmpMovie.setLangue((String)(model.getValueAt(row, 5)));
      tmpMovie.setCompression((String)(model.getValueAt(row, 6)));
      tmpMovie.setQualite((String)(model.getValueAt(row, 7)));     
     
      try {
        DatabaseDAO.updateMovie(tmpMovie);
        localParent.getJLabelInformation().setText(Libelle.getLibelle("miseAJourOk"));
      } catch (SQLException ex) {
        JOptionPane.showOptionDialog(
            SwingUtilities.getWindowAncestor(localParent),
            Libelle.getLibelle("erreurMiseAJourFilm",tmpMovie.getNom()),
            Libelle.getLibelle("erreur"),
            JOptionPane.DEFAULT_OPTION,
            JOptionPane.ERROR_MESSAGE,
            null,
            null,
View Full Code Here

  }

  private void jButtonValiderActionPerformed(ActionEvent evt) {
    nbMovieInserted++;
    //Insertion du film en base et dans la liste
    Movie tmpMovie = new Movie();

    if(jTextNomFilm.getText().trim().equals("")){
      JOptionPane.showOptionDialog(
          SwingUtilities.getWindowAncestor(this),
          Libelle.getLibelle("erreurNomFilmVide") ,
          Libelle.getLibelle("erreur"),
          JOptionPane.DEFAULT_OPTION,
          JOptionPane.ERROR_MESSAGE,
          null,
          null,
          null)
    }
    else{
      tmpMovie.setNom(jTextNomFilm.getText());
      tmpMovie.setType((String)jComboBoxTypeMedia.getSelectedItem());
      tmpMovie.setLangue((String)jComboBoxLangue.getSelectedItem());
      tmpMovie.setCompression((String)jComboBoxCompression.getSelectedItem());
      tmpMovie.setQualite((String)jComboBoxQualite.getSelectedItem());
      tmpMovie.setIdMedia(new Integer(jTextFieldNumMedia.getText().trim()));   
    }
    /*A ce stade le film peut �tre ajout�*/
    try {
      DatabaseDAO.insertMovie(tmpMovie);
    } catch (SQLException e) {
      JOptionPane.showOptionDialog(
          SwingUtilities.getWindowAncestor(this),
          Libelle.getLibelle("erreurInsertionFilms"),
          Libelle.getLibelle("erreur"),
          JOptionPane.DEFAULT_OPTION,
          JOptionPane.ERROR_MESSAGE,
          null,
          null,
          null);
    }
    try {
      tmpMovie = (Movie)DatabaseDAO.recupDernierFilm();
      Object[] data = {new Integer(tmpMovie.getId()),
          tmpMovie.getNom(),
          tmpMovie.getType(),
          new Integer(tmpMovie.getIdMedia()),
          tmpMovie.getStatut(),
          tmpMovie.getLangue(),
          tmpMovie.getCompression(),
          tmpMovie.getQualite()};
      localParent.getListFilmModel().addRow(data);

    } catch (SQLException e) {
      JOptionPane.showOptionDialog(
          SwingUtilities.getWindowAncestor(this),
View Full Code Here

  }

  private void jListGeneriqueKeyReleased(KeyEvent evt) {
    if(evt.getKeyCode() == 127 ){
      Generique tmpBean = new Generique();
      Movie tmpBeanMovie = new Movie();
      if(!((String)jListElements.getSelectedValue()).trim().toLowerCase().equals("nouveau ...")){
        if(jListElements.getLastVisibleIndex() > 1){
          try {
            tmpBean.setCode((String)jListElements.getSelectedValue());

            if(localType.equals("typeMedia")){
              tmpBeanMovie.setType(tmpBean.getCode());     
              List tmpList = DatabaseDAO.verifierTypeMedia(tmpBeanMovie);
              if(tmpList != null && tmpList.size() > 0){
                fille = new RemplacementGenerique(this,localType,tmpList,tmpBeanMovie, this);
                fille.setVisible(true)
                fille.setAlwaysOnTop(true);
              }
              else{
                DatabaseDAO.deleteTypeMedia(tmpBean)
                this.finSuppression();
              }
            }

            if(localType.equals("compression")){
              tmpBeanMovie.setCompression(tmpBean.getCode());     
              List tmpList = DatabaseDAO.verifierCompression(tmpBeanMovie);
              if(tmpList != null && tmpList.size() > 0){
                fille = new RemplacementGenerique(this,localType,tmpList,tmpBeanMovie, this);
                fille.setVisible(true);
                fille.setAlwaysOnTop(true);
              }
              else{
                DatabaseDAO.deleteCompression(tmpBean)
                this.finSuppression();
              }
            }   

            if(localType.equals("langue")){
              tmpBeanMovie.setLangue(tmpBean.getCode());     
              List tmpList = DatabaseDAO.verifierLangue(tmpBeanMovie);
              if(tmpList != null && tmpList.size() > 0){
                fille = new RemplacementGenerique(this,localType,tmpList,tmpBeanMovie, this);
                fille.setVisible(true);
                fille.setAlwaysOnTop(true);
              }
              else{
                DatabaseDAO.deleteLangue(tmpBean)
                this.finSuppression();
              }
            }         

            if(localType.equals("qualite")){
              tmpBeanMovie.setQualite(tmpBean.getCode());     
              List tmpList = DatabaseDAO.verifierQualite(tmpBeanMovie);
              if(tmpList != null && tmpList.size() > 0){
                fille = new RemplacementGenerique(this,localType,tmpList,tmpBeanMovie, this);
                fille.setVisible(true)
                fille.setAlwaysOnTop(true);
View Full Code Here

      int[] selection = getTableListeFilms().getSelectedRows();
      String tmpNom = new String();
      Integer tmpId = new Integer(0);
      int compteurSuppression = 0;
      Movie tmpMovie = null;

      for(int i = 0; i<selection.length; i++){
        tmpNom = (String)getTableListeFilms().getValueAt(selection[i] - compteurSuppression, getTableListeFilms().getColumn(Libelle.getLibelle("titreColonneNom")).getModelIndex());
        tmpId = (Integer)getTableListeFilms().getValueAt(selection[i] - compteurSuppression, getTableListeFilms().getColumn(Libelle.getLibelle("titreColonneIdentifiant")).getModelIndex());
        //attention on essaye de supprimer
        Object[] options = {Libelle.getLibelle("oui"),Libelle.getLibelle("non")};
        int answer = JOptionPane.showOptionDialog(
            SwingUtilities.getWindowAncestor(this),
            Libelle.getLibelle("confirmationSuppressionFilm", tmpNom),
            Libelle.getLibelle("titreSuppressionFilm"),
            JOptionPane.YES_NO_OPTION,
            JOptionPane.WARNING_MESSAGE,
            null,
            options,
            options[1]);
        if (answer == 0) {
          tmpMovie = new Movie();
          tmpMovie.setId(tmpId.intValue());
          try {
            DatabaseDAO.deleteMovie(tmpMovie);
            getListFilmModel().removeRow(getTableListeFilms().convertRowIndexToModel(selection[i] - compteurSuppression));
            compteurSuppression++;
View Full Code Here

TOP

Related Classes of com.vgo.movie.domain.Movie

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.