Package net.sf.cannagrower.data

Examples of net.sf.cannagrower.data.Hardware


   */
  private void hardwareRemove() {
    if (!jListHardwares.isSelectionEmpty()) {
      try {
        for (Object object: jListHardwares.getSelectedValues()) {
          Hardware hardware=(Hardware)object;
          culture.getHardwares().unstore(hardware);
        }
      }
      catch(ArrayIndexOutOfBoundsException e) {}
      catch(IOException e){Messages.showException(e);}
View Full Code Here


   * This method show the hardware selected in the list
   *
   * @return void
   */
  public void hardwareShow() {
    Hardware   hardware=null;
   
    // Retrieve selected element
    if (jListHardwares.getSelectedIndex() >= 0
        && jListHardwares.getSelectedIndex() < jListHardwares
            .getModel().getSize()){
View Full Code Here

        Container container=cultureViewer.culture.getHardwares().get(index);
        object = container.getData();
      } else {
        int rank = 0;
        for (Container container : cultureViewer.culture.getHardwares()) {
          Hardware hardware;
          hardware=(Hardware)container.getData();
          if(hardware!=null){
            if (rank == index) {
              object = hardware;
            }
            if (hardware.isInstalled()) {
              rank++;
            }
          }
        }
      }
View Full Code Here

      size = cultureViewer.culture.getHardwares().size();
    } else {
      if(cultureViewer==null)return 0;
      if(cultureViewer.culture==null)return 0;
      for (Container container : cultureViewer.culture.getHardwares()) {
        Hardware hardware;
        try{
          hardware=(Hardware)container.getData();
        }catch(IOException e){
          hardware=null;
          Messages.showException(e);
        }catch(ClassNotFoundException e){
          hardware=null;
          Messages.showException(e);
        }
        if(hardware!=null){
          if (hardware.isInstalled()) {size++;}
        }
      }
    }
    return size;
  }
View Full Code Here

    Vector<Class<?>>   hardwaresType         = Hardware.getHardwares();
    Vector<Class<?>>     hardwaresInstalled    = new Vector<Class<?>>();
   
    // Searching all unique hardware installed
    for (Container ghost: cultureViewer.culture.getHardwares()) {
      Hardware hardware;
      try{
        hardware=(Hardware)ghost.getData();
      }catch(IOException e){
        Messages.showException(e);
        hardware=null;
      }catch(ClassNotFoundException e){
        Messages.showException(e);
        hardware=null;
      }
      if(hardware!=null){
        if (hardware.isInstalled()) {
          if (hardware.isUnique()) {
            hardwaresInstalled.add(hardware.getClass());
          }
        }
      }
    }

    for (Class<?> hardwareType : hardwaresType) {
      // Checking if hardware type unique and installed.
      if (!hardwaresInstalled.contains(hardwareType)) {
        // Adding jMenu
        JMenuItem jMenuItem = new JMenuItem();
        jMenuItem.setText(Messages.getMessage(Hardware.class
            .getSimpleName().toLowerCase()
            + "." + hardwareType.getSimpleName().toLowerCase()));
        jMenuItem.setIcon(Hardware.getIcon(hardwareType));
        jMenuItem.setName(hardwareType.getName());
        jMenuItem
            .addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(
                  java.awt.event.ActionEvent e) {
                JMenuItem jMenuItem = (JMenuItem) e.getSource();
                try {
                  Hardware hardware=(Hardware) Class.forName(jMenuItem.getName()).newInstance();
                  cultureViewer.culture.getHardwares().store(hardware);
                  cultureViewer.getJListHardwares().setSelectedValue(hardware, true);
                } catch (Exception ex) {
                  Messages.showException(ex);
                }
View Full Code Here

TOP

Related Classes of net.sf.cannagrower.data.Hardware

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.