Package editor

Source Code of editor.EditorCliente

package editor;

import java.awt.Component;
import java.awt.event.ActionEvent;
import javax.swing.JOptionPane;
import javax.swing.JTable;

import controllers.ControllerFactory;
import controllers.HalconController;

import vista.AbmCliente;
import vista.ModificarCliente;
import vista.MostrarCliente;

import base.Cliente;


  public class EditorCliente extends Editor {

      /**
     *
     */
    private HalconController halconController = ControllerFactory.GetHalconController();
   
    private static final long serialVersionUID = 1L;
     @SuppressWarnings("unchecked")
    private AbmCliente abmCliente;
   
     
    @SuppressWarnings("unchecked")
    public EditorCliente(AbmCliente abm, int m, int e) {
      super(m,e);
          this.abmCliente = abm;
      }

      public void actionPerformed(ActionEvent e) {
       
        int id = Integer.parseInt((String) abmCliente.tabla.getValueAt(fila, 0));
          Cliente cliente = halconController.GetClienteById(id);
                  
          if (columna==mod){
           
            ModificarCliente m = new ModificarCliente(this.abmCliente, cliente);
            abmCliente.removeAll();
            abmCliente.add(m);
           
          }
          else
            if(columna==eli){
              int option=JOptionPane.showConfirmDialog(null, "�Seguro que desea eliminar al cliente?");
                  if (option==JOptionPane.YES_OPTION)
                    halconController.DeleteClienteByClass(cliente);
            }
            else
              MostrarCliente m = new MostrarCliente(this.abmCliente, cliente);
              abmCliente.removeAll();
              abmCliente.add(m);
              }
         
          abmCliente.repaint();
          fireEditingStopped();
          abmCliente.cargarTabla();
      }

       //Implement the one method defined by TableCellEditor.
      public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
      return  super.getTableCellEditorComponent(table, value, isSelected, row, column);     
      }
  }

TOP

Related Classes of editor.EditorCliente

TOP
Copyright © 2018 www.massapi.com. 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.