Package net.geco.model

Examples of net.geco.model.Course


    return processData(data, target.getEcard(), detectCourse(data), Status.DUP);
  }

  @Override
  public String requestMergeUnknownRunner(RunnerRaceData data, String ecard) {
    Course course = detectCourse(data);
    Runner r = detectArchiveRunner(data, ecard, course);
    if( r!=null ){
      // TODO: rethink this part with SIReaderHandler. We return null because detectArchiveRunner
      // already handled the case and announced CardRead (autoprinting).
      // Returning the e-card would led SIReaderHandler to announce an unknown card.
View Full Code Here


      }
    };
    ActionListener removeAction = new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        Course course = getSelectedData();
        if( course!=null ) {
          try {
            geco.stageControl().removeCourse(course);
          } catch (Exception e1) {
            JOptionPane.showMessageDialog(frame,
              Messages.uiGet("StagePanel.CourseNoDeletionWarning") + e1.getMessage(), //$NON-NLS-1$
              Messages.uiGet("StagePanel.ActionCancelledTitle"), //$NON-NLS-1$
              JOptionPane.WARNING_MESSAGE);
          }
        }
      }
    };
    ActionListener editAction = new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        Course course = getSelectedData();
        if( course!=null ) {
          new CourseControlDialog(frame, course);
        }
      }
    };
    ActionListener importAction = new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        JFileChooser chooser = new JFileChooser();
        chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        chooser.setSelectedFile(new File(geco.getCurrentStagePath()));
        chooser.setFileFilter(new FileFilter() {
          @Override
          public String getDescription() {
            return Messages.uiGet("StagePanel.XMLFilesLabel"); //$NON-NLS-1$
          }
          @Override
          public boolean accept(File f) {
            return f.getName().endsWith(".xml"); //$NON-NLS-1$
          }
        });
        int answer = chooser.showDialog(frame, Messages.uiGet("StagePanel.CourseImportXMLLabel")); //$NON-NLS-1$
        if( answer==JFileChooser.APPROVE_OPTION ) {
          String file = chooser.getSelectedFile().getAbsolutePath();
          try {
            Vector<Course> courses = CourseSaxImporter.importFromXml(file, geco.stageControl().factory());
            for (Course course : courses) {
              geco.stageControl().addCourse(course)
            }
          } catch (Exception e1) {
            e1.printStackTrace();
            JOptionPane.showMessageDialog(frame,
                e1.getMessage(),
                Messages.uiGet("StagePanel.XMLLoadError"), //$NON-NLS-1$
                JOptionPane.ERROR_MESSAGE);
          }
        }
      }
    };
    ActionListener refreshAction = new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        Course course = getSelectedData();
        if( course!=null ) {
          geco.runnerControl().recheckRunnersFromCourse(course);
        }
      }
    };
View Full Code Here

 
  public SplitTime[] buildAllNormalSplits(Result result, ResultConfig config, Map<RunnerRaceData, SplitTime[]> allSplits) {
    SplitTime[] bestSplits = null;
    boolean sameCourse = true; // default for CourseResult and MixedResult
    if( ! result.isEmpty() ){
      Course course = result.anyRunner().getCourse();
      if( config.resultType==ResultType.CategoryResult ){
        // check that all runners in category share the same course
        for (RunnerRaceData runnerData : result.getRankedRunners()) {
          sameCourse &= runnerData.getCourse()==course;
        }
        for (RunnerRaceData runnerData : result.getNRRunners()) {
          sameCourse &= runnerData.getCourse()==course;
        }
      }
      if( ! sameCourse ) {
        geco().log(Messages.getString("ResultBuilder.NoBestSplitForCategoryWarning") + result.getIdentifier()); //$NON-NLS-1$
      } else { // initialize bestSplits
        bestSplits = new SplitTime[course.nbControls() + 1];
        for (int i = 0; i < bestSplits.length; i++) {
          bestSplits[i] = new SplitTime("", null, TimeManager.NO_TIME_l, TimeManager.NO_TIME_l); //$NON-NLS-1$
        }
      }
    }
View Full Code Here

    course.setCodes(codez);
    codes = new Vector<Integer>();
  }

  private void registerCourses() {
    Course c = null;
    if( variations.size()==1 ) {
      c = variations.values().iterator().next();
      c.setName(namePrefix);
      courses.add(c);
    } else {
      for (String id : variations.keySet()) {
        c = variations.get(id);
        c.setName(namePrefix + " " + id); //$NON-NLS-1$
        courses.add(c);
      }
    }
    variations.clear();
  }
View Full Code Here

 
  public void updateRunnerData(RunnerRaceData raceData) {
    nameL.setText(raceData.getRunner().getName());
//    clubL.setText(raceData.getRunner().getClub().getName());
//    categoryL.setText(raceData.getRunner().getCategory().getName());
    Course course = raceData.getCourse();
    courseL.setText(course.getName());
   
    RunnerResult result = raceData.getResult();
//    racetimeL.setText(result.formatRacetime());
    updateStatusLabel(result.getStatus());
//    penaltiesL.setText(result.formatTimePenalty());
    updateMps(result.getNbMPs(), course.nbControls());
   
    punchP.refreshPunches(raceData);
  }
View Full Code Here

    return false;
  }
 
  public boolean validateCourse(RunnerRaceData runnerData, String newCourse) {
    Runner runner = runnerData.getRunner();
    Course oldCourse = runner.getCourse();
    if( !oldCourse.getName().equals(newCourse) ) {
      runner.setCourse(registry().findCourse(newCourse));
      registry().updateRunnerCourse(oldCourse, runner);
      announcer().announceCourseChange(runner, oldCourse);
      geco().log(Messages.getString("RunnerControl.CourseChangeMessage") //$NON-NLS-1$
            + runner.idString() + Messages.getString("RunnerControl.FromMessage") //$NON-NLS-1$
            + oldCourse.getName() + Messages.getString("RunnerControl.ToMessage") //$NON-NLS-1$
            + newCourse);
      // Proceed by checking the new status
      if( runnerData.statusIsRecheckable() ) {
        Status oldStatus = runnerData.getResult().getStatus();
        geco().checker().check(runnerData);
View Full Code Here

  }


  private Course randomCourse() {
    List<String> courses = registry().getCourseNames();
    Course course = registry().findCourse(courses.get(random.nextInt(courses.size())));
    return course;
  }
View Full Code Here

      runner.setClub(registry.noClub());
      System.err.println("Unknown club " + record[4] + " for runner " + runner.idString()); //$NON-NLS-1$ //$NON-NLS-2$
    } else {
      runner.setClub(club);
    }
    Course course = registry.findCourse(record[5]);
    if( course == null ) {
      runner.setCourse(registry.anyCourse());
      System.err.println("Unknown course " + record[5] + " for runner " + runner.idString()); //$NON-NLS-1$ //$NON-NLS-2$
    } else {
      runner.setCourse(course);
View Full Code Here

    super(factory, reader, writer, registry);
  }

  @Override
  public Course importTData(String[] record) {   
    Course course = this.factory.createCourse();
    course.setName(record[0]);
    Float meterLength = new Float(record[1]) * 1000;
    course.setLength(meterLength.intValue());
    course.setClimb(new Integer(record[2]));
    int nbCodes;
    if( record.length<=12 ) {
      nbCodes = 0;
    } else {
      nbCodes = record.length - 12;
    }
    int[] codes = new int[nbCodes];
    for (int i = 0; i < codes.length; i++) {
      codes[i] = new Integer(record[i + 12]);
    };
    course.setCodes(codes);
    return course;
  }
View Full Code Here

      public void actionPerformed(ActionEvent e) {
        // always assert we use a unique e-card (in particular if creating a new runner
        // when one exists with the same e-card)
        String uniqueEcardNumber = runnerControl().deriveUniqueEcard(ecard);
        String selectedCoursename = getSelectedCoursename();
        Course course = selectedCoursename.equals(Messages.uiGet("MergeRunnerDialog.UnknownCourseItem")) ? //$NON-NLS-1$
          registry().anyCourse() :
          registry().findCourse(selectedCoursename);
        try {
          // Create from scratch a brand new runner
          Runner newRunner = runnerControl().buildAnonymousRunner(uniqueEcardNumber, course);
View Full Code Here

TOP

Related Classes of net.geco.model.Course

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.