Package net.sf.nfp.mini.data

Examples of net.sf.nfp.mini.data.Observation


      observationsRMS = RecordStore.openRecordStore("observations", true);
    return observationsRMS;
  }

  public Observation find(int id) throws RecordStoreException, IOException {
    return (Observation) super.find(id, new Observation());
  }
View Full Code Here


  private NavigationCommand noCommand = null;
  private Alert view;
 
  public void load(Object parameter) throws Exception {
    Object[] params = (Object[]) parameter;
    Observation existing = (Observation) params[0];   
    Navigation onYes = (Navigation) params[1];
    Navigation onNo = (Navigation) params[2];
 
    view.setString("${overwrite.existing}\n"+existing);
    view.setTimeout(Alert.FOREVER);
View Full Code Here

    view.addCommand(new ActionCommand("D:sample data", Command.SCREEN, 101) {
      public Navigation execute(Displayable d) throws Exception {
        Calendar date = Calendar.getInstance();
        Random random = new Random();
        controler.progressListner.setMaxValue(30);
        Observation o = null;
        Period period = new Period(new Date());
        controler.getPeriodDAO().setObservationIds(period, new Vector());
        for(int i=1; i < 5; ++i) {
          date.set(Calendar.DAY_OF_MONTH, i);
          o = new Observation(date.getTime(),
              Observation.NO_TEMPERATURE,
              MucusRegistry.instance().find(1),
              true, random.nextInt() % 5 == 0, "");
          LogicDAO.addObservationToPeriod(o, new Period[]{period}, controler);
          controler.progressListner.setValue(i);
        }
        for (int i = 5; i < 30; ++i) {
          date.set(Calendar.DAY_OF_MONTH, i);
          o = new Observation(date.getTime(),
              3620 + random.nextInt() % 60,
              MucusRegistry.instance().find(i % 3 + 1),
              false, random.nextInt() % 10 == 0, "");
          LogicDAO.addObservationToPeriod(o, new Period[]{period}, controler);
          controler.progressListner.setValue(i);
View Full Code Here

    int prevX = 0;
    int prevY = 0;
    boolean drawLine = false;
    boolean lastIsBleeding = true;
    for (int day = 0; day < observations.size(); day++) {
      Observation observation = (Observation) observations.elementAt(day);
      if(observation == null) {
        if(lastIsBleeding)
          drawInterval(g, new Interval(day, day+1), 0xff6060, true);
        continue;
      }
      if(observation.isBleeding()) {
        drawInterval(g, new Interval(day, day+1), 0x800000, true);
        if(day == selectedDay)
          drawInterval(g, new Interval(day, day+1), 0xff0000, true);
        continue;
      }else lastIsBleeding = false;
      if(!observation.hasTemperature())
        continue;
      int x = tx.get(day) + offset;
      int y = ty.get(observation.getTemperature());
      g.setColor(Color.BLACK);
      if (drawLine)
        g.drawLine(prevX + DOT_RADIUS, prevY, x - DOT_RADIUS, y);
      if (day == selectedDay) {
        g.setColor(Color.BLACK);
        drawDot(g, x, y, DOT_RADIUS + 2);
      }
      setMucusColor(g, observation);
      drawDot(g, x, y);
      g.setColor(Color.BLACK);
      fillDot(g, x, y);
      if(observation.isDisturbed()) {
        //draw a red cross
        g.setColor(DISTURBED_CROSS_COLOR);
        int r = DOT_RADIUS+2;
        g.drawLine(x - r, y - r, x + r, y + r);
        g.drawLine(x - r, y + r, x + r, y - r);
View Full Code Here

    g.drawLine(0, height-1, getWidth(), height-1);
    if (observations ==null || observations.isEmpty()) {
      return;
    } else {
      try {
        Observation observation = (Observation) observations.elementAt(selectedDay);
        if(observation == null)
          return;
        if(observation.isBleeding())
          g.setColor(Color.RED);
        else
          setMucusColor(g, observation);
        g.fillRect(0, height, getWidth(), detailsHeight);
        g.setColor(Color.BLACK);
View Full Code Here

    this.view = (GraphView) v;

    selectCommand = new ActionCommand("${select}", Command.SCREEN, 1) {
      public Navigation execute(Displayable d) throws Exception {
        GraphView view = (GraphView) d;
        Observation observation = view.getSelectedObservation();
        return new Navigation("input", period, observation);
      }
    };
    view.addCommand(selectCommand);
    view.addCommand(new ActionCommand("${enter.new}", Command.SCREEN, 2) {
      public Navigation execute(Displayable d) throws Exception {
        return new Navigation("input", period, new Observation());
      }
    });
    view.addCommand(new ActionCommand("${history}", Command.SCREEN, 5) {
      public Navigation execute(Displayable d) throws Exception {
        return new Navigation("history", period);
      }
    });
    view.addCommand(new ActionCommand("${delete}", Command.SCREEN, 3){
      public Navigation execute(Displayable d) throws Exception {
        Observation observation = view.getSelectedObservation();
        if(observation != null) {
          LogicDAO.removeObservation(controler, observation, period);
          return new Navigation("graph", period, observation);
        }else return null;
      }
View Full Code Here

    Vector observations = new Vector(days);
    observations.setSize(days + 1);
    controler.progressListner.setMaxValue(ids.size());
    for (int i1 = 0; i1 < ids.size(); ++i1) {
      int id = ((Integer) ids.elementAt(i1)).intValue();
      Observation o1 = observationDAO.find(id);
      int day = Utils.getDaysBetween(period.getStart(), o1.getDate());
      observations.setElementAt(o1, day);
      controler.progressListner.setValue(i1);
    }
    Log.log("observations: " + observations);

    int selectedDay = 0;   
    Observation observation = (Observation) params[1];
    if(observation != null) {
      for(int i=0;i<observations.size();++i) {
        Observation o = (Observation) observations.elementAt(i);
        if(o == null)
          continue;
        if(observation.getId() == o.getId()) {
          selectedDay = i;
          break;
        }
      }
    }
View Full Code Here

      }
    });
    view.addCommand(new ActionCommand("${save}", Command.BACK, 1) {
      public Navigation execute(Displayable d) throws Exception {
        InputView form = (InputView) d;
        Observation observation = form.getObservation();
        Observation existing = getObservationAt(observation.getDate());
        if (existing != null) {
          return new Navigation("confirm-overwrite", existing,
              new Navigation("save-observation", period, observation),
              new Navigation("graph", period, existing));
        }
View Full Code Here

  public void load(Object parameter) throws Exception {
    System.out.println("InputModel.load(" + parameter + ")");
    if (parameter == null) {
      period = controler.getPeriodDAO().getCurrent();
      view.setObservation(new Observation());
      view.refreshMucusList();
    } else {
      Object[] params = (Object[]) parameter;
      period = (Period) params[0];
      view.setObservation((Observation) params[1]);
View Full Code Here

      return null;
    Vector ids = periodDAO.getObservationIds(period);
    controler.progressListner.setMaxValue(ids.size());
    for (int i = 0; i < ids.size(); ++i) {
      int id = ((Integer) ids.elementAt(i)).intValue();
      Observation o = observationDAO.find(id);
      if (Utils.equals(date, o.getDate()))
        return o;
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of net.sf.nfp.mini.data.Observation

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.