Package net.sf.cannagrower.data

Examples of net.sf.cannagrower.data.Event


    Vector<Advice>  advices=new Vector<Advice>();
    boolean      ecTooHigh=false;
    boolean      phTooHigh=false;
   
    for(Container container:plantation.getEvents()){
      Event event=null;
     
      try{event=(Event)container.getData();}
      catch(ClassNotFoundException e){Messages.showException(e);}
      catch(java.io.IOException e){Messages.showException(e);}
     
      if(event instanceof EnvironmentMediumState){
        double ec=Double.valueOf(event.getProperties().getProperty(Messages.eventMediumEc));
        double ph=Double.valueOf(event.getProperties().getProperty(Messages.eventMediumPh));
       
        if(ec>=ecMax){ecTooHigh=true;}
        if(ph>=phMax){phTooHigh=true;}
       
        if(ecTooHigh && phTooHigh){break;}
View Full Code Here


 
  private void eventRemove(){
    if (!jListEvents.isSelectionEmpty()) {
      try {
        for (Object eventObject : jListEvents.getSelectedValues()) {
          Event event= (Event) eventObject;
          plantation.getEvents().remove(event);
        }
      } catch (ArrayIndexOutOfBoundsException e) {
      }
      eventShow();
View Full Code Here

    if(getJListEvents().getModel().getSize()>0){
      getJListEvents().setSelectedIndex(0);
    }
  }
  public void eventShow(){
    Event event=null;
   
    // Retrieve selected event
    if (jListEvents.getSelectedIndex() >= 0
        && jListEvents.getSelectedIndex() < jListEvents
            .getModel().getSize()) {
      EventsListModel listModel=(EventsListModel)jListEvents.getModel();
      event=listModel.getDataAt(jListEvents.getSelectedIndex());
    }   
   
    if (jPanelEventsDetailsViewer != null) {
      // Checking if selected event is already active
      if(event!=null && jPanelEventsDetailsViewer.getEvent() != null){
        if(event==jPanelEventsDetailsViewer.getEvent()){return;}
      }
     
      // Cleaning active event
      jPanelEventsDetailsViewer.setVisible(false);
      jPanelEventsDetails.remove(jPanelEventsDetailsViewer);
      jPanelEventsDetailsViewer = null;
    }
   
    // Loading selected event
    if (event!=null){
      jPanelEventsDetailsViewer = event.getViewer();
      jPanelEventsDetailsViewer.setEvent(event);
      jPanelEventsDetails.add(jPanelEventsDetailsViewer, BorderLayout.CENTER);
      jPanelEventsDetails.updateUI();
    }
  }
View Full Code Here

    return events.get(index);
  }

  public Event getDataAt(int index){
    Container   container=events.get(index);
    Event    event=null;
   
    try{
      event=(Event)container.getData();
    }catch(ClassNotFoundException e){
      Messages.showException(e);
View Full Code Here

    XYSeriesCollection   collection = new XYSeriesCollection();
    XYSeries       ec = new XYSeries("EC");
    XYSeries       ph = new XYSeries("PH");
   
    for(Container container:plantation.getEvents()){
      Event event=null;
     
      try{event=(Event)container.getData();}
      catch(ClassNotFoundException e){Messages.showException(e);}
      catch(java.io.IOException e){Messages.showException(e);}
     
      if(event.getClass().equals(EnvironmentMediumState.class)){
        int   x;
        float   y;
        long   day;
       
        day=(event.getDate().getTime()-plantation.getStarted().getTime());
        day+=(((1000*60)*60)*24);
        day=day/(((1000*60)*60)*24);
       
        x=Integer.parseInt(Long.toHexString(day));
       
        y=Float.parseFloat(event.getProperties().getProperty(Messages.eventMediumEc));
        if(y>0){ec.add(x,y);}
       
        y=Float.parseFloat(event.getProperties().getProperty(Messages.eventMediumPh));
        if(y>0){ph.add(x,y);}
      }
    }
   
    collection.addSeries(ph);
 
View Full Code Here

          .addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(
                java.awt.event.ActionEvent e) {
              JMenuItem jMenuItem = (JMenuItem) e.getSource();
              try {
                Event event=(Event) Class.forName(jMenuItem.getName()).newInstance();
                plantationViewer.plantation.getEvents().store(event);
                plantationViewer.getJListEvents().setSelectedValue(event, true);
              } catch (Exception ex) {
                Messages.showException(ex);
              }
View Full Code Here

TOP

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

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.