Exemplo n.º 1
0
 @Override
 public void load() {
   desktop.setWaitCursor();
   clear();
   Vector<ScheduleRangeObject> v = null;
   try {
     v =
         memberService.findFollowUp(
             personFile.getId(), new DateRange(dates.getStartFr(), dates.getEndFr()));
   } catch (SQLException ex) {
     GemLogger.logException(ex);
   }
   int min = 0;
   if (v != null) {
     for (int i = 0; i < v.size(); i++) {
       ScheduleRangeObject r = v.elementAt(i);
       Hour hd = r.getStart();
       Hour hf = r.getEnd();
       min += hd.getLength(hf);
       tableModel.addItem(r);
     }
     totalTime.setText(Hour.format(min));
   }
   loaded = true;
   desktop.setDefaultCursor();
 }
Exemplo n.º 2
0
  private void print() {
    desktop.setWaitCursor();
    hideCatchingRooms();
    printDlg.setVisible(true);
    try {
      List<Module> modules =
          memberService.findModuleOrders(personFile.getId(), dates.getStart(), dates.getEnd());
      StringBuilder sb = new StringBuilder(personFile.getContact().getFirstnameName());

      if (modules != null && !modules.isEmpty()) {
        sb.append(" : ");
        sb.append(modules.get(0).getTitle());
        if (modules.size() > 1) {
          sb.append("..."); // do not display next modules
        }
      }

      MessageFormat header = new MessageFormat(sb.toString());
      MessageFormat footer = new MessageFormat("Page {0}");
      PrintRequestAttributeSet prs = new HashPrintRequestAttributeSet();
      prs.add(MediaSizeName.ISO_A4);
      prs.add(Sides.TWO_SIDED_LONG_EDGE);
      prs.add(OrientationRequested.PORTRAIT);
      prs.add(
          new JobName(
              BundleUtil.getLabel("Follow.up.label") + "-" + personFile.getId(),
              Locale.getDefault()));
      // 210 x 297 mm | 8.3 x 11.7 in 1 inch = 25.4 mm

      MediaPrintableArea printableArea =
          new MediaPrintableArea(10f, 10f, 190f, 277f, MediaPrintableArea.MM);
      prs.add(printableArea);
      printTable.print(JTable.PrintMode.FIT_WIDTH, header, footer, true, prs, true);
    } catch (PrinterException ex) {
      GemLogger.logException(ex);
    } finally {
      printDlg.setVisible(false);
      desktop.setDefaultCursor();
    }
  }