@Override
  public Individual[] run(
      StopCondition cond,
      FitnessFunction fitness,
      SelectionAlgorithm selector,
      GenerationAlgorithm generator,
      ReplaceAlgorithm replacer,
      int lambda) {

    SelectionAlgorithm sel[] = Factory.createAllSelectionAlgorithm();

    return run(cond, fitness, sel, generator, replacer, lambda);
  }
Example #2
0
 public Section(String titre, String texte) {
   this.titre = titre;
   this.texte = texte;
   objetsRecuperables = Factory.newGestionObjets();
   enchainements = Factory.newGestionEnchainements();
 }
Example #3
0
/** @author Super-Afg */
public class JDAfficheSante extends javax.swing.JDialog {

  /** Creates new form JDListVeterinaire */
  public JDAfficheSante(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();
    refreshModel();
  }

  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    jPanel2 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTable1 = new javax.swing.JTable();
    btnquitter = new javax.swing.JButton();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Alert vaccination");

    jLabel1.setFont(new java.awt.Font("Times New Roman", 0, 36)); // NOI18N
    jLabel1.setText("La liste des interventions à faire dans les 14 jours");

    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(
        jPanel2Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel2Layout
                    .createSequentialGroup()
                    .addGap(174, 174, 174)
                    .addComponent(jLabel1)
                    .addContainerGap(207, Short.MAX_VALUE)));
    jPanel2Layout.setVerticalGroup(
        jPanel2Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanel2Layout
                    .createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel1)
                    .addGap(22, 22, 22)));

    jTable1.setModel(myTableAnimal);
    jTable1.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(java.awt.event.MouseEvent evt) {
            jTable1MouseClicked(evt);
          }
        });
    jScrollPane1.setViewportView(jTable1);

    btnquitter.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/resource/quitter.png"))); // NOI18N
    btnquitter.setText("Quitter");
    btnquitter.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnquitterActionPerformed(evt);
          }
        });

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(
                                jPanel2,
                                javax.swing.GroupLayout.Alignment.TRAILING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addGroup(
                                javax.swing.GroupLayout.Alignment.TRAILING,
                                layout
                                    .createSequentialGroup()
                                    .addGap(0, 0, Short.MAX_VALUE)
                                    .addComponent(btnquitter)))
                    .addContainerGap()));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        jPanel2,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addComponent(
                        jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 448, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(btnquitter)));

    pack();
  } // </editor-fold>//GEN-END:initComponents

  private void btnquitterActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnquitterActionPerformed
    new JFPrincipale().setVisible(true);
    this.dispose();
  } // GEN-LAST:event_btnquitterActionPerformed

  private void jTable1MouseClicked(
      java.awt.event.MouseEvent evt) { // GEN-FIRST:event_jTable1MouseClicked
    if (jTable1.getSelectedRow() != -1) {
      if (evt.getClickCount() == 2) {
        myAnimal = myTableAnimal.getMyList(jTable1.getSelectedRow());
        if (myAnimal != null) {
          this.dispose();
        }
      }
    }
  } // GEN-LAST:event_jTable1MouseClicked

  /** @param args the command line arguments */
  public static void main(String args[]) {
    /* Set the Nimbus look and feel */
    // <editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
     * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
     */
    try {
      for (javax.swing.UIManager.LookAndFeelInfo info :
          javax.swing.UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
          javax.swing.UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (ClassNotFoundException ex) {
      java.util.logging.Logger.getLogger(JDAfficheSante.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
      java.util.logging.Logger.getLogger(JDAfficheSante.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
      java.util.logging.Logger.getLogger(JDAfficheSante.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(JDAfficheSante.class.getName())
          .log(java.util.logging.Level.SEVERE, null, ex);
    }
    // </editor-fold>

    /* Create and display the dialog */
    java.awt.EventQueue.invokeLater(
        new Runnable() {
          public void run() {
            JDAfficheSante dialog = new JDAfficheSante(new javax.swing.JFrame(), true);
            dialog.addWindowListener(
                new java.awt.event.WindowAdapter() {
                  @Override
                  public void windowClosing(java.awt.event.WindowEvent e) {
                    System.exit(0);
                  }
                });
            dialog.setVisible(true);
          }
        });
  }

  // Variables declaration - do not modify//GEN-BEGIN:variables
  private javax.swing.JButton btnquitter;
  private javax.swing.JLabel jLabel1;
  private javax.swing.JPanel jPanel2;
  private static javax.swing.JScrollPane jScrollPane1;
  private javax.swing.JTable jTable1;
  // End of variables declaration//GEN-END:variables
  private void refreshModel() {
    myTableAnimal.setMyList(daoAnimal.selectRappelVaccin());
    // OrganiseMaTable();
    resizeColumnWidth();
  }

  private void resizeColumnWidth() {
    final TableColumnModel columnModel = jTable1.getColumnModel();
    for (int column = 0; column < jTable1.getColumnCount(); column++) {
      int width = 50; // Min width
      for (int row = 0; row < jTable1.getRowCount(); row++) {
        TableCellRenderer renderer = jTable1.getCellRenderer(row, column);
        Component comp = jTable1.prepareRenderer(renderer, row, column);
        width = Math.max(comp.getPreferredSize().width, width);
      }
      columnModel.getColumn(column).setPreferredWidth(width);
    }
    CenterText();
  }

  private void CenterText() {
    DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
    centerRenderer.setHorizontalAlignment(JLabel.CENTER);
    jTable1.setDefaultRenderer(String.class, centerRenderer);
  }

  protected Animal myAnimal;
  private daoAnimal daoAnimal = Factory.getdaoAnimal();
  private TableModelRappelVaccin myTableAnimal =
      new TableModelRappelVaccin(daoAnimal.selectRappelVaccin());
  private Connexion daocon = factory.Factory.getDAOConnexion();
}