Пример #1
0
 /** @param evt */
 private void nextButtonActionPerformed(java.awt.event.ActionEvent evt) {
   ArrayList<Day> days = new ArrayList<Day>();
   if (this.sundayCheck.isSelected()) {
     ArrayList<Object> sun = new ArrayList<Object>();
     List<Object> jobs = Arrays.asList(this.models[0].toArray());
     sun.addAll(jobs);
     days.add(new Day(dfs.getWeekdays()[1], sun));
   }
   if (this.mondayCheck.isSelected()) {
     ArrayList<Object> mon = new ArrayList<Object>();
     List<Object> jobs = Arrays.asList(this.models[1].toArray());
     mon.addAll(jobs);
     days.add(new Day(dfs.getWeekdays()[2], mon));
   }
   if (this.tuesdayCheck.isSelected()) {
     ArrayList<Object> tue = new ArrayList<Object>();
     List<Object> jobs = Arrays.asList(this.models[2].toArray());
     tue.addAll(jobs);
     days.add(new Day(dfs.getWeekdays()[3], tue));
   }
   if (this.wednesdayCheck.isSelected()) {
     ArrayList<Object> wed = new ArrayList<Object>();
     List<Object> jobs = Arrays.asList(this.models[3].toArray());
     wed.addAll(jobs);
     days.add(new Day(dfs.getWeekdays()[4], wed));
   }
   if (this.thursdayCheck.isSelected()) {
     ArrayList<Object> thu = new ArrayList<Object>();
     List<Object> jobs = Arrays.asList(this.models[4].toArray());
     thu.addAll(jobs);
     days.add(new Day(dfs.getWeekdays()[5], thu));
   }
   if (this.fridayCheck.isSelected()) {
     ArrayList<Object> fri = new ArrayList<Object>();
     List<Object> jobs = Arrays.asList(this.models[5].toArray());
     fri.addAll(jobs);
     days.add(new Day(dfs.getWeekdays()[6], fri));
   }
   if (this.saturdayCheck.isSelected()) {
     ArrayList<Object> sat = new ArrayList<Object>();
     List<Object> jobs = Arrays.asList(this.models[6].toArray());
     sat.addAll(jobs);
     days.add(new Day(dfs.getWeekdays()[7], sat));
   }
   if (days.size() > 0) {
     boolean hasJobs = true;
     int i = 0;
     while (hasJobs && i < days.size()) {
       if (days.get(i).getJobs().size() == 0) {
         hasJobs = false;
       }
       i++;
     }
     if (hasJobs) {
       Main.setDays(days);
       Main.wSet = new WorkerSetup(Main.getLocale());
       Main.toggleWorkerSetup();
       Main.config = this;
       Main.toggleConfig();
     } else {
       JOptionPane.showMessageDialog(this, "You must have at least one job each day.");
     }
   } else {
     JOptionPane.showMessageDialog(this, "You have not added any days.");
   }
 }