Examples of MainContainer


Examples of jade.core.MainContainer

   
    private void handleAddTool(VerticalCommand cmd) {
      Object[] params = cmd.getParams();
      AID tool = (AID)params[0];
     
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        impl.toolAdded(tool);
      }
      else {
        // Do nothing for now, but could also route the command to the main slice, thus enabling e.g. AMS replication
      }
    }
View Full Code Here

Examples of jade.core.MainContainer

   
    private void handleRemoveTool(VerticalCommand cmd) {
      Object[] params = cmd.getParams();
      AID tool = (AID)params[0];
     
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        impl.toolRemoved(tool);
      }
      else {
        // Do nothing for now, but could also route the command to the main slice, thus enabling e.g. AMS replication
      }
    }
View Full Code Here

Examples of jade.core.MainContainer

     
      myContainer.releaseLocalAgent(agentID);
    }
   
    private void bornAgent(AID name, ContainerID cid, JADEPrincipal principal, Credentials credentials) throws NameClashException, NotFoundException {
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        // Retrieve the ownership from the credentials
        String ownership = "NONE";
        if (credentials != null) {
          JADEPrincipal ownerPr = credentials.getOwner();
          if (ownerPr != null) {
            ownership = ownerPr.getName();
          }
        }
        try {
          // If the name is already in the GADT, throws NameClashException
          impl.bornAgent(name, cid, principal, ownership, false);
        }
        catch(NameClashException nce) {
          //#CUSTOMJ2SE_EXCLUDE_BEGIN
          try {
            ContainerID oldCid = impl.getContainerID(name);
            if (oldCid != null) {
              Node n = impl.getContainerNode(oldCid).getNode();
             
              // Perform a non-blocking ping to check...
              n.ping(false);
             
              // Ping succeeded: rethrow the NameClashException
              throw nce;
            }
            else {
              // The old agent is registered with the AMS, but does not live in the platform --> cannot check if it still exists
              throw nce;
            }
          }
          catch(NameClashException nce2) {
            // This is the re-thrown NameClashException --> let it through
            throw nce2;
          }
          catch(Exception e) {
            // Either the old agent disappeared in the meanwhile or the Ping failed: forcibly replace the old agent...
            impl.bornAgent(name, cid, principal, ownership, true);
          }
          //#CUSTOMJ2SE_EXCLUDE_END
          /*#CUSTOMJ2SE_INCLUDE_BEGIN
           try {
           //System.out.println("Replacing old agent "+name.getName());
View Full Code Here

Examples of jade.core.MainContainer

     }
     }
     #CUSTOMJ2SE_INCLUDE_END*/
   
    private void deadAgent(AID name) throws NotFoundException {
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        impl.deadAgent(name, false);
        /*#CUSTOMJ2SE_INCLUDE_BEGIN
         notifyDead(name);
         #CUSTOMJ2SE_INCLUDE_END*/
      }
    }
 
View Full Code Here

Examples of jade.core.MainContainer

         #CUSTOMJ2SE_INCLUDE_END*/
      }
    }
   
    private void suspendedAgent(AID name) throws NotFoundException {
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        impl.suspendedAgent(name);
      }
    }
View Full Code Here

Examples of jade.core.MainContainer

        impl.suspendedAgent(name);
      }
    }
   
    private void resumedAgent(AID name) throws NotFoundException {
      MainContainer impl = myContainer.getMain();
      if(impl != null) {
        impl.resumedAgent(name);
      }
    }
View Full Code Here

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