コード例 #1
0
  /**
   * Méthode de construction du contenu de la cellule "Situation initiale"
   *
   * @param fiche fiche concernée
   * @return contenu de la cellule
   */
  static String construitLibelleSituationInitiale(Fiche fiche) {
    if (fiche == null) {
      return null;
    }

    if (StringUtils.isBlank(fiche.getSituationInitialeTitre())) {
      return "pas de détails";
    }

    StringBuilder situInitiale = new StringBuilder();
    situInitiale.append(StringUtils.trimToEmpty(fiche.getSituationInitialeTitre()));

    // #31572 : on suffixe le titre de "..." quand la situation initiale (libellé "long") est
    // renseignée pour indiquer à l'utilisateur que plus de détails se trouvent sur la fiche MC
    if (StringUtils.isNotBlank(fiche.getSituationInitiale())) {
      while (!situInitiale.toString().endsWith("...")) {
        situInitiale.append(".");
      }
    }

    return situInitiale.toString();
  }
コード例 #2
0
  private PdfPTable buildExpose(Fiche fiche) {
    PdfPCell cell;
    PdfPTable table = new PdfPTable(new float[] {1, 0.5f, 4.5f});
    table.setWidthPercentage(100);

    cell = new PdfPCell(new Phrase("2_ Exposé des faits ", FONT_NORMAL));
    cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell.setColspan(3);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("GDH Appel: ", FONT_NORMAL));
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell.setBorder(0);
    table.addCell(cell);

    Date gdhAppelDate = fiche.getGdhAppel();

    String pattern = "dd/MM/yyyy HH:mm";
    SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);

    String gdhAppel = dateFormat.format(gdhAppelDate);

    cell = new PdfPCell(new Phrase(gdhAppel, FONT_NORMAL));
    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell.setColspan(2);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("GDH Arrivée: ", FONT_NORMAL));
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell.setBorder(0);
    table.addCell(cell);

    Date gdhArriveeDate = fiche.getGdhArrivee();
    String gdhArrivee = "";
    if (gdhArriveeDate != null) gdhArrivee = dateFormat.format(gdhArriveeDate);

    cell = new PdfPCell(new Phrase(gdhArrivee, FONT_NORMAL));
    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell.setColspan(2);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("Lieu: ", FONT_NORMAL));
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell.setBorder(0);
    table.addCell(cell);

    String numeroRue = fiche.getAdresse().getNumeroVoie();

    cell = new PdfPCell(new Phrase(numeroRue, FONT_NORMAL));
    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    table.addCell(cell);

    String libelleRue = fiche.getAdresse().getNomVoie().getLibelle();

    cell = new PdfPCell(new Phrase(libelleRue, FONT_NORMAL));
    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("Précisions: ", FONT_NORMAL));
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell.setBorder(0);
    table.addCell(cell);

    String lieuPredefini = "";
    if (fiche.getLieuPredefini() != null)
      lieuPredefini = fiche.getLieuPredefini().getLibelleLong().concat(" ");
    String adresseComplement = "";
    if (fiche.getComplementAdresse() != null) adresseComplement = fiche.getComplementAdresse();
    cell = new PdfPCell(new Phrase(lieuPredefini.concat(adresseComplement), FONT_NORMAL));
    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell.setColspan(2);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("spacer", FONT_SPACER));
    cell.setBorder(0);
    cell.setColspan(3);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("Titre: ", FONT_NORMAL));
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell.setBorder(0);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase(fiche.getSituationInitialeTitre(), FONT_NORMAL));
    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell.setColspan(2);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("spacer", FONT_SPACER));
    cell.setBorder(0);
    cell.setColspan(3);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("Situation initiale: ", FONT_NORMAL));
    cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    cell.setBorder(0);
    table.addCell(cell);

    String situationInitiale = fiche.getSituationInitiale();

    cell = new PdfPCell(new Paragraph(situationInitiale, FONT_NORMAL));
    cell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    cell.setColspan(2);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("spacer", FONT_SPACER));
    cell.setBorder(0);
    cell.setColspan(3);
    table.addCell(cell);

    table.setSpacingBefore(5);
    table.setSpacingAfter(5);

    return table;
  }