Package editor

Source Code of editor.EditorServicio

package editor;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.table.TableCellEditor;

import controllers.ControllerFactory;
import controllers.HalconController;
import vista.AbmServicio;
import vista.ModificarServicio;
import vista.MostrarServicio;

import base.Servicio;

  @SuppressWarnings("serial")
  public class EditorServicio extends Editor implements TableCellEditor, ActionListener {

   
    private HalconController halconController = ControllerFactory.GetHalconController();
           
      @SuppressWarnings("unchecked")
    private AbmServicio a;
   

      @SuppressWarnings("unchecked")
    public EditorServicio(AbmServicio abm,int m, int e) {
          super(m,e);
          this.a=abm;
         
      }

      public void actionPerformed(ActionEvent e) {
       
        int id = Integer.parseInt((String) a.table.getValueAt(fila, 0));
          Servicio servicio = halconController.GetServicioById(id);
         
          if (columna == mod){
            ModificarServicio m = new ModificarServicio(this.a, servicio);
            a.removeAll();
            a.add(m);
           
           
           }
          else
            if(columna == eli){
              int option=JOptionPane.showConfirmDialog(null, "�Seguro que desea eliminar el servicio?");
                 if (option==JOptionPane.YES_OPTION)
                   halconController.DeleteServicioByClass(servicio);
            }
            else
         
              MostrarServicio m = new MostrarServicio(this.a, servicio);
              a.removeAll();
              a.add(m);
             
          }
          a.repaint();
          fireEditingStopped();
          a.cargarTabla();
         
      }

    
        
      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.EditorServicio

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.