Package GUI.touchscreen

Source Code of GUI.touchscreen.VentanaAdministradorTouchScreen$AccionMenu

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package GUI.touchscreen;

import GUI.*;
import Administracion.Administrador;
import Pedidos.Platillo;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JPopupMenu;

/**
*
* @author Administrador
*/
public class VentanaAdministradorTouchScreen extends javax.swing.JFrame {
//TODO permitirle gestionar todos los platillos
    //TODO permitirle gestionar todas las mesas
    //TODO permitirle cambiar de mesa a clientes
    //TODO permitirle gestionar los clientes ?
    //TODO poder consultar módulo de informes
    //TODO permitirle consultar comandas pagadas: tipo de pago, mesero, mesa, fecha
    //TODO permitirle consultar el desempeño de los camareros: mesas atendidas, dinero recaudado
    //TODO permitirle agregar o quitar reservaciones
    //TODO permitirle consultar las ventas por cada platillo
    //TODO consultar mejores clientes,
    Administracion.Administrador administrador = new Administrador();
    JPopupMenu menuContextualPlatillos = new JPopupMenu();
    JPopupMenu menuContextualMeseros = new JPopupMenu();

    /**
     * Creates new form ventanaAdministrador
     */
    public VentanaAdministradorTouchScreen() {
        initComponents();
//        listaMeseros.setListData(administrador.getMeserosEmpleados().toArray());//TODO cambiar al to array que modifica un arreglo por referencia
        menuContextualMeseros.add(new AccionMenu("cuatro"));
        menuContextualMeseros.add(new AccionMenu("cinco"));
        menuContextualMeseros.add(new AccionMenu("seis"));
       
        menuContextualPlatillos.add(new AccionMenu("uno"));
        menuContextualPlatillos.add(new AccionMenu("dos"));
        menuContextualPlatillos.add(new AccionMenu("tres"));
    }

    /**
     * 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() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        listaPlatillos = new javax.swing.JList();
        jScrollPane1 = new javax.swing.JScrollPane();
        listaMeseros = new javax.swing.JList();
        btnAgregarPlatillos = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        btnAgregarMeseros = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        lblFondo = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel1.setForeground(javax.swing.UIManager.getDefaults().getColor("Button.background"));
        jLabel1.setText("Platillos");
        getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 20, -1, -1));

        jLabel2.setForeground(javax.swing.UIManager.getDefaults().getColor("Button.background"));
        jLabel2.setText("Meseros");
        getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 20, -1, -1));

        jScrollPane2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jScrollPane2MouseClicked(evt);
            }
        });

        listaPlatillos.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                listaPlatillosMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(listaPlatillos);

        getContentPane().add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 50, -1, -1));

        listaMeseros.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                listaMeserosMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(listaMeseros);

        getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 50, 150, -1));

        btnAgregarPlatillos.setText("+");
        btnAgregarPlatillos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAgregarPlatillosActionPerformed(evt);
            }
        });
        getContentPane().add(btnAgregarPlatillos, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 190, -1, -1));

        jButton2.setText("-");
        getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 190, -1, -1));

        btnAgregarMeseros.setText("+");
        btnAgregarMeseros.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAgregarMeserosActionPerformed(evt);
            }
        });
        getContentPane().add(btnAgregarMeseros, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 190, -1, -1));

        jButton4.setText("-");
        getContentPane().add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 190, -1, -1));

        lblFondo.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
        lblFondo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/GUI/res/moon.jpg"))); // NOI18N
        lblFondo.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
        lblFondo.setOpaque(true);
        getContentPane().add(lblFondo, new org.netbeans.lib.awtextra.AbsoluteConstraints(-10, 0, -1, -1));

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

    private void btnAgregarMeserosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarMeserosActionPerformed
// TODO agregar meseros
    }//GEN-LAST:event_btnAgregarMeserosActionPerformed

    private void btnAgregarPlatillosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarPlatillosActionPerformed
        Platillo platillo = new Platillo();
       
        administrador.AgregarNuevoPlatillo(platillo);
    }//GEN-LAST:event_btnAgregarPlatillosActionPerformed

    private void listaPlatillosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listaPlatillosMouseClicked
        if (evt.getButton() >= 2) {//click secundario o medio
            //menu contextual
            menuContextualPlatillos.show(evt.getComponent(),
                    evt.getX(), evt.getY());

        }
    }//GEN-LAST:event_listaPlatillosMouseClicked

    private void jScrollPane2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jScrollPane2MouseClicked
        if (evt.getButton() >= 2) {//click secundario o medio
            //menu contextual
            menuContextualPlatillos.show(evt.getComponent(),
                    evt.getX(), evt.getY());
            //aqui
        }
    }//GEN-LAST:event_jScrollPane2MouseClicked

    private void listaMeserosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listaMeserosMouseClicked
       if (evt.getButton() >= 2) {//click secundario o medio
            //menu contextual
            menuContextualMeseros.show(evt.getComponent(),
                    evt.getX(), evt.getY());
            //aqui
        }
    }//GEN-LAST:event_listaMeserosMouseClicked

    /**
     * @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(VentanaAdministradorTouchScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(VentanaAdministradorTouchScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(VentanaAdministradorTouchScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(VentanaAdministradorTouchScreen.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new VentanaAdministradorTouchScreen().setVisible(true);
            }
        });
    }

    class AccionMenu extends AbstractAction {

        private String textoOpcion;

        /**
         * Se le pasa el nombre que se quiere que se muestre
         *
         * @param textoOpcion
         */
        public AccionMenu(String textoOpcion) {
            this.textoOpcion = textoOpcion;
            this.putValue(Action.NAME, textoOpcion);
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            System.out.println("Pulsado " + textoOpcion);
        }
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAgregarMeseros;
    private javax.swing.JButton btnAgregarPlatillos;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton4;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel lblFondo;
    private javax.swing.JList listaMeseros;
    private javax.swing.JList listaPlatillos;
    // End of variables declaration//GEN-END:variables
}
TOP

Related Classes of GUI.touchscreen.VentanaAdministradorTouchScreen$AccionMenu

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.