Package org.indrasoftwarelabs.containers

Examples of org.indrasoftwarelabs.containers.MainContainer


   
    //Create and set up the window.
        frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        frame.setSize(700, 800);
       
        final MainContainer main = new MainContainer(frame, prop);
        frame.setContentPane(main.getMyContainer());
       
        // VENTANA
        frame.addWindowListener(
           
            new WindowListener(){

          public void windowActivated(WindowEvent arg0) {
          }

          public void windowClosed(WindowEvent arg0) {
          }

          public void windowClosing(WindowEvent arg0) {
           
            int value = JOptionPane.showConfirmDialog(frame,"�Quieres salir de la aplicacion?","SALIR",JOptionPane.OK_OPTION, JOptionPane.QUESTION_MESSAGE);
                 
                  if(value == JOptionPane.OK_OPTION ){
                    //MainForm.closeConexion(con);
                    System.out.println("Conexion de BBDD cerrada");
                    LogForDay.writeToLog("Aplicacion cerrada" , QCS.logPath, LogForDay.ERROR);
                System.exit(0);
                  }
           
          }

          public void windowDeactivated(WindowEvent arg0) {
          }

          public void windowDeiconified(WindowEvent arg0) {
          }

          public void windowIconified(WindowEvent arg0) {
          }

          public void windowOpened(WindowEvent arg0) {
          }
             
            }
           
        );
       
    /********************************************************************
        // MENU FILE
        /********************************************************************/
       
        // App icon
        //ImageIcon iconExit    =  null;
        ImageIcon iconNew    =  null;
        ImageIcon iconEdit    =  null;
        ImageIcon iconSearch  =  null;
        ImageIcon iconDelete  =  null;
        ImageIcon iconOrganize  =  null;
       
        ImageIcon iconSettings  =  null;
        ImageIcon iconLog    =  null;
       
        ImageIcon iconAbout    =  null;
       
    Image img;
   
    try {
      img = ImageIO.read(new File("res/icons/Info-icon.png"));
      iconAbout = new ImageIcon(img);
    } catch (IOException err) {
      LogForDay.writeToLog("No se encuentra la ruta res/icons/Info-icon.png " + err.getLocalizedMessage(), QCS.logPath, LogForDay.ERROR);
    }
   
    try {
      img = ImageIO.read(new File("res/icon.png"));
      frame.setIconImage(img);
    } catch (IOException err) {
      LogForDay.writeToLog("No se encuentra la ruta res/icons/icon.png " + err.getLocalizedMessage(), QCS.logPath, LogForDay.ERROR);
    }
   
    try {
      img = ImageIO.read(new File("res/icons/Add-icon.png"));
      iconNew = new ImageIcon(img);
    } catch (IOException err) {
      LogForDay.writeToLog("No se encuentra la ruta res/icons/Add-icon.png " + err.getLocalizedMessage(), QCS.logPath, LogForDay.ERROR);
    }
   
    try {
      img = ImageIO.read(new File("res/icons/Edit-icon.png"));
      iconEdit = new ImageIcon(img);
    } catch (IOException err) {
      LogForDay.writeToLog("No se encuentra la ruta res/icons/Edit-icon.png " + err.getLocalizedMessage(), QCS.logPath, LogForDay.ERROR);
    }
   
    try {
      img = ImageIO.read(new File("res/icons/Search-icon.png"));
      iconSearch = new ImageIcon(img);
    } catch (IOException err) {
      LogForDay.writeToLog("No se encuentra la ruta res/icons/Search-icon.png " + err.getLocalizedMessage(), QCS.logPath, LogForDay.ERROR);
    }
   
    try {
      img = ImageIO.read(new File("res/icons/Delete-icon.png"));
      iconDelete = new ImageIcon(img);
    } catch (IOException err) {
      LogForDay.writeToLog("No se encuentra la ruta res/icons/Delete-icon.png " + err.getLocalizedMessage(), QCS.logPath, LogForDay.ERROR);
    }
   
    try {
      img = ImageIO.read(new File("res/icons/Refresh-icon.png"));
      iconOrganize = new ImageIcon(img);
    } catch (IOException err) {
      LogForDay.writeToLog("No se encuentra la ruta res/icons/Refresh-icon.png " + err.getLocalizedMessage(), QCS.logPath, LogForDay.ERROR);
    }
   
    try {
      img = ImageIO.read(new File("res/icons/Tools-icon.png"));
      iconSettings = new ImageIcon(img);
    } catch (IOException err) {
      LogForDay.writeToLog("No se encuentra la ruta res/icons/Tools-icon.png " + err.getLocalizedMessage(), QCS.logPath, LogForDay.ERROR);
    }
   
    try {
      img = ImageIO.read(new File("res/icons/Folder-icon.png"));
      iconLog = new ImageIcon(img);
    } catch (IOException err) {
      LogForDay.writeToLog("No se encuentra la ruta res/icons/Folder-icon.png " + err.getLocalizedMessage(), QCS.logPath, LogForDay.ERROR);
    }
   
    JMenuBar menubar = null;
    JMenuItem eMenuItem = null;
    JMenu file = null;
   
    menubar = new JMenuBar();
   
    file = new JMenu("View");
   
    eMenuItem = new JMenuItem("NEW", iconNew);
    eMenuItem.setEnabled(true);
   
    eMenuItem.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
           
            /**
               * TODO
               * Un cuadro de dialogo con la opcion de agregar un nuevo:
               *
               * - MODULO
               * - METODO
               * - SENTENCIA
               *
               */
             
              SeleccionarDialog customDialog = new SeleccionarDialog(SeleccionarDialog.NEW_PARAMETER, null, frame, prop, main.getMyContainer());
         
              customDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
         
          customDialog.setLocationRelativeTo(frame);
          customDialog.setResizable(false);
          customDialog.setVisible(true);
           
          }
        });
   
    //file.add(eMenuItem);
   
    eMenuItem = new JMenuItem("EDIT", iconEdit);
    eMenuItem.setEnabled(true);
   
    eMenuItem.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
           
            // Si no hay una query seleccionada, sacar un mensaje de dialogo advirtiendo del uso correcto
            String valor = (String)main.listSen.getSelectedValue();
           
            if(valor == null){
              String msg = "Por favor, selecciona una sentencia de la lista inferior";
                JOptionPane.showConfirmDialog(frame,msg,"Atencion",JOptionPane.CLOSED_OPTION, JOptionPane.WARNING_MESSAGE);
                 
            }else{
             
//              EditDialog customDialog = new EditDialog(valor, frame, con);
//              customDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
//             
//              customDialog.setLocationRelativeTo(frame);
//              customDialog.setVisible(true);
//              customDialog.setResizable(false);
             
              /**
                   * TODO
                   * Un cuadro de dialogo con la opcion del objeto que se desee editar:
                   *
                   * - MODULO
                   * - METODO
                   * - SENTENCIA
                   *
                   */
                 
                  SeleccionarDialog customDialog = new SeleccionarDialog(SeleccionarDialog.EDIT_PARAMETER, valor, frame, prop, main.getMyContainer());
              customDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
             
              customDialog.setLocationRelativeTo(frame);
              customDialog.setResizable(false);
              customDialog.setVisible(true);
             
            }
           
          }
        });
   
    //file.add(eMenuItem);
   
//    eMenuItem = new JMenuItem("Test", iconEdit);
//    eMenuItem.setEnabled(true);
//   
//    eMenuItem.addActionListener(new ActionListener() {
//          public void actionPerformed(ActionEvent event) {
//           
//            OptionsTest test = new OptionsTest(con);
//            ksetContentPane(test.getContainer());
//            frame.setVisible(true);
//           
//          }
//        });
//   
//    file.add(eMenuItem);
   
    eMenuItem = new JMenuItem("DELETE", iconDelete);
    eMenuItem.setEnabled(false);
    //file.add(eMenuItem);
   
    eMenuItem = new JMenuItem("SEARCH", iconSearch);
    eMenuItem.setEnabled(true);
   
    eMenuItem.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent event) {
           
            SearchContainer mainSearch = new SearchContainer(frame, prop, main.getMyContainer());
            frame.setContentPane(mainSearch.getMyContainer());
            frame.setVisible(true);
           
          }
        });
View Full Code Here

TOP

Related Classes of org.indrasoftwarelabs.containers.MainContainer

Copyright © 2018 www.massapicom. 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.