/* 
* Copyright 2016 Agencia Estatal de Administración Tibutaria
*
* Licencia con arreglo a la EUPL, Versión 1.1 o –en cuanto
* sean aprobadas por la Comisión Europea– versiones
* posteriores de la EUPL (la «Licencia»);
* Solo podrá usarse esta obra si se respeta la Licencia.
* Puede obtenerse una copia de la Licencia en:
*  
* https://joinup.ec.europa.eu/software/page/eupl
*  
* Salvo cuando lo exija la legislación aplicable o se acuerde
* por escrito, el programa distribuido con arreglo a la
* Licencia se distribuye «TAL CUAL», SIN GARANTÍAS NI CONDICIONES
* DE NINGÚN TIPO, ni expresasni implícitas.
*
* Véase la Licencia en el idioma concreto que rige los permisos y 
* limitaciones que establece la Licencia.
*/ 

package gestor;

import gestor.utiles.*;
import java.awt.*;

public final class DlgConfirmarCita extends javax.swing.JDialog {
    
    boolean emitirTicket = false;
    public javax.swing.Timer timerCierraAviso;
    PanelTactil padre;

    public DlgConfirmarCita(PanelTactil padre) {
        this.padre = padre;
        initComponents();
        setLocationRelativeTo(padre);
        preparaTimerAviso();
        setNif("");
        setNombre("");
        setHora("");
        setCitas("");
        setEstado("");
        setMultipleTexto1("");
        setMultiple("");
        jLabel8.setText(Global.trad.valor("PulseAceptarSiCorrectos"));
        jLabel8.setVisible(false);
        BotonSi.setText(Global.trad.valor("Aceptar"));
        BotonNo.setText(Global.trad.valor("Cancelar"));
        timerCierraAviso.start();
        if(!Configuracion.instanciaUnica().cursorVisible) {
            setCursor(gestor.utiles.Global.mainForm.cursorTransparente);
        }
    }
    
    public void setNif(String texto) {
        jLabel1.setText(texto) ;
    }
    
    public void setNombre(String texto) {
        jLabel2.setText(texto) ;
    }
    
    public void setNombre(String texto, boolean Rojo) {
        jLabel2.setText(texto) ;
        if(Rojo) jLabel2.setForeground(Color.RED);
    }
    
    public void setHora(String texto) {
        jLabel3.setText(texto) ;
    }
    
    public void setCitas(String texto) {
        jLabel4.setText(texto) ;
    }
    
    public void setCitas(String texto, boolean Rojo) {
        jLabel4.setText(texto) ;
        if(Rojo) jLabel4.setForeground(Color.RED);
    }
    
    public void setEstado(String texto) {
        jLabel5.setText(texto) ;
        
    }
    public void setEstado(String texto,boolean Rojo) {
        jLabel5.setText(texto) ;
        if(Rojo) jLabel5.setForeground(Color.RED);
    }
    
    public void setMultiple(String texto) {
        jLabel6.setText(texto) ;
    }
    
    public void setMultipleTexto1(String texto) {
        jLabel7.setText(texto) ;
    }
    
    public void setAceptarVisible(boolean S) {
        jLabel8.setVisible(S) ;
    }
    
    public void setBotonNo(boolean S){
        BotonNo.setVisible(S);
        remove(BotonNo);
        Dimension di = new Dimension();
        di.setSize(150,50);
        BotonSi.setMinimumSize(di);
        BotonSi.setPreferredSize(di);
        invalidate();
    }
    
    void soloAceptar() {
        this.BotonNo.setVisible(false);
    }
    
    void cerrarCon(boolean valor) {
        emitirTicket = valor;
        timerCierraAviso.stop();
        setVisible(false);
    }
    
    void preparaTimerAviso() {
        timerCierraAviso = new javax.swing.Timer(Configuracion.instanciaUnica().segundosCierreVentanas  * 1000, new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cerrarCon(false);
            }
        });
    }
    
    /** 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.
     */
   // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
   private void initComponents() {

      jPanel3 = new javax.swing.JPanel();
      jPanel1 = new MiPanel();
      jLabel1 = new gestor.utiles.SmoothLabel();
      jLabel2 = new gestor.utiles.SmoothLabel();
      jLabel3 = new gestor.utiles.SmoothLabel();
      jLabel4 = new gestor.utiles.SmoothLabel();
      jLabel5 = new gestor.utiles.SmoothLabel();
      jLabel6 = new gestor.utiles.SmoothLabel();
      jLabel7 = new gestor.utiles.SmoothLabel();
      jPanel2 = new javax.swing.JPanel();
      BotonNo = new gestor.utiles.MiBoton();
      BotonSi = new gestor.utiles.MiBoton();
      jLabel8 = new gestor.utiles.SmoothLabel();

      setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
      setModal(true);
      setResizable(false);
      setUndecorated(true);

      jPanel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(200, 200, 200), 4));
      jPanel3.setLayout(new java.awt.BorderLayout());

      jLabel1.setFont(new java.awt.Font("MS Sans Serif", 3, 20));
      jLabel1.setText("L1");

      jLabel2.setFont(new java.awt.Font("MS Sans Serif", 3, 20));
      jLabel2.setText("L2");
      jLabel2.setMaximumSize(new java.awt.Dimension(83, 190));

      jLabel3.setFont(new java.awt.Font("MS Sans Serif", 3, 20));
      jLabel3.setText("l3");

      jLabel4.setFont(new java.awt.Font("MS Sans Serif", 3, 20));
      jLabel4.setText("l4");

      jLabel5.setFont(new java.awt.Font("MS Sans Serif", 3, 20));
      jLabel5.setText("L5");
      jLabel5.setVerticalAlignment(javax.swing.SwingConstants.TOP);

      jLabel6.setFont(new java.awt.Font("Courier New", 3, 20));
      jLabel6.setText("L6");
      jLabel6.setAutoscrolls(true);

      jLabel7.setFont(new java.awt.Font("MS Sans Serif", 3, 20));
      jLabel7.setForeground(new java.awt.Color(51, 51, 255));
      jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
      jLabel7.setText("L7");

      org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
      jPanel1.setLayout(jPanel1Layout);
      jPanel1Layout.setHorizontalGroup(
         jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
         .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
            .add(43, 43, 43)
            .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
               .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel6, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 618, Short.MAX_VALUE)
               .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 618, Short.MAX_VALUE)
               .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 618, Short.MAX_VALUE)
               .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 618, Short.MAX_VALUE)
               .add(jPanel1Layout.createSequentialGroup()
                  .add(jLabel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 310, Short.MAX_VALUE)
                  .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                  .add(jLabel5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 302, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
               .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup()
                  .add(jLabel7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 514, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                  .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 104, Short.MAX_VALUE)))
            .addContainerGap())
      );
      jPanel1Layout.setVerticalGroup(
         jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
         .add(jPanel1Layout.createSequentialGroup()
            .add(44, 44, 44)
            .add(jLabel1)
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
            .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
            .add(jLabel3)
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
            .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
               .add(jLabel5)
               .add(jLabel4))
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
            .add(jLabel7)
            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
            .add(jLabel6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 108, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
            .addContainerGap(23, Short.MAX_VALUE))
      );

      jPanel3.add(jPanel1, java.awt.BorderLayout.CENTER);

      BotonNo.setFont(new java.awt.Font("MS Sans Serif", 3, 24));
      BotonNo.setForeground(new java.awt.Color(255, 51, 51));
      BotonNo.setText("Cancelar");
      BotonNo.setFocusable(false);
      BotonNo.addActionListener(new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent evt) {
            PulsadoBotonNo(evt);
         }
      });

      BotonSi.setFont(new java.awt.Font("MS Sans Serif", 3, 24)); // NOI18N
      BotonSi.setForeground(new java.awt.Color(255, 51, 51));
      BotonSi.setText("Aceptar");
      BotonSi.setFocusable(false);
      BotonSi.setMaximumSize(new java.awt.Dimension(340, 81));
      BotonSi.setMinimumSize(new java.awt.Dimension(120, 41));
      BotonSi.setPreferredSize(new java.awt.Dimension(135, 41));
      BotonSi.addActionListener(new java.awt.event.ActionListener() {
         public void actionPerformed(java.awt.event.ActionEvent evt) {
            PulsadoAceptar(evt);
         }
      });

      jLabel8.setFont(new java.awt.Font("MS Sans Serif", 0, 24));
      jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
      jLabel8.setText("Pulse Aceptar si los datos son correctos.  ");

      org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
      jPanel2.setLayout(jPanel2Layout);
      jPanel2Layout.setHorizontalGroup(
         jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
         .add(jPanel2Layout.createSequentialGroup()
            .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
               .add(jPanel2Layout.createSequentialGroup()
                  .addContainerGap()
                  .add(jLabel8, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 641, Short.MAX_VALUE))
               .add(jPanel2Layout.createSequentialGroup()
                  .add(41, 41, 41)
                  .add(BotonSi, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 250, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                  .add(69, 69, 69)
                  .add(BotonNo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 250, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
            .addContainerGap())
      );
      jPanel2Layout.setVerticalGroup(
         jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
         .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup()
            .addContainerGap()
            .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER)
               .add(BotonSi, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
               .add(BotonNo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 41, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
            .add(11, 11, 11)
            .add(jLabel8)
            .addContainerGap())
      );

      jPanel3.add(jPanel2, java.awt.BorderLayout.SOUTH);

      getContentPane().add(jPanel3, java.awt.BorderLayout.CENTER);

      pack();
   }// </editor-fold>//GEN-END:initComponents
    
    private void PulsadoBotonNo(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PulsadoBotonNo
        cerrarCon(false);
    }//GEN-LAST:event_PulsadoBotonNo
    
    private void PulsadoAceptar(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PulsadoAceptar
        cerrarCon(true);
    }//GEN-LAST:event_PulsadoAceptar
    
   // Variables declaration - do not modify//GEN-BEGIN:variables
   javax.swing.JButton BotonNo;
   javax.swing.JButton BotonSi;
   javax.swing.JLabel jLabel1;
   javax.swing.JLabel jLabel2;
   javax.swing.JLabel jLabel3;
   javax.swing.JLabel jLabel4;
   javax.swing.JLabel jLabel5;
   javax.swing.JLabel jLabel6;
   javax.swing.JLabel jLabel7;
   javax.swing.JLabel jLabel8;
   javax.swing.JPanel jPanel1;
   javax.swing.JPanel jPanel2;
   javax.swing.JPanel jPanel3;
   // End of variables declaration//GEN-END:variables
    
}
